Re: [PATCH 1/2] reboot: allow to override reboot type if quirks are found

From: Petr Mladek
Date: Tue Dec 01 2020 - 05:47:38 EST


On Mon 2020-11-30 18:37:16, Matteo Croce wrote:
> From: Matteo Croce <mcroce@xxxxxxxxxxxxx>
>
> On some machines a quirk can force a specific reboot type.
> Quirks are found during a DMI scan, the list of machines which need
> special reboot handling is defined in reboot_dmi_table.
>
> The kernel command line reboot= option overrides this via a global
> variable `reboot_default`, so that the reboot type requested in
> the command line is really performed.
>
> This was not true when setting the reboot type via the new sysfs
> interface. Fix this by setting reboot_default upon the first change,
> like reboot_setup() does for the command line.

Strictly speaking this is not necessary. The quirks are proceed
in core_initcall() while the sysfs interface is created in
late_initcall(). By other words, the quirks are uses before
the default can be modified by the sysfs interface.

On the other hand, it does not harm. Better be on the safe
side for eventual future changes.

Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>

Best Regards,
Petr