RE: [PATCH v2 03/10] x86/mce: Make several functions return bool

From: Zhuo, Qiuxu
Date: Fri Oct 18 2024 - 23:00:28 EST


> From: Mehta, Sohil <sohil.mehta@xxxxxxxxx>
> [...]
> > @@ -1748,7 +1748,7 @@ static void mce_timer_delete_all(void)
> > * Can be called from interrupt context, but not from machine check/NMI
> > * context.
> > */
> > -int mce_notify_irq(void)
> > +bool mce_notify_irq(void)
> > {
> > /* Not more than two messages every minute */
> > static DEFINE_RATELIMIT_STATE(ratelimit, 60*HZ, 2); @@ -1759,9
> > +1759,9 @@ int mce_notify_irq(void)
> > if (__ratelimit(&ratelimit))
> > pr_info(HW_ERR "Machine check events logged\n");
> >
> > - return 1;
> > + return true;
> > }
> > - return 0;
> > + return false;
> > }
> > EXPORT_SYMBOL_GPL(mce_notify_irq);
> >
>
> I am slightly confused by the function name mce_notify_irq() and the boolean
> meaning. Would it better to rename this function to mce_notify_user()? As
> the comment suggests on top, it purpose doesn't seem to be irq related but
> to mainly notify the user.
> Also, the boolean would probably make more sense then:
> True -> Notified the user
> False -> Did not notify the user

Agree. mce_notify_user() better reflects what it does.
If nobody else objects to it, I'll update the function name in the next version.

Thanks!
-Qiuxu