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

From: Sohil Mehta
Date: Fri Oct 18 2024 - 15:03:06 EST


On 10/16/2024 5:30 AM, Qiuxu Zhuo wrote:

> @@ -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