Re: [PATCH v2 12/12] reboot: retire hw_protection_reboot and hw_protection_shutdown helpers

From: Tzung-Bi Shih
Date: Mon Jan 20 2025 - 02:13:31 EST


On Mon, Jan 13, 2025 at 05:25:37PM +0100, Ahmad Fatoum wrote:
> The hw_protection_reboot and hw_protection_shutdown functions mix
> mechanism with policy: They let the driver requesting an emergency
> action for hardware protection also decide how to deal with it.
>
> This is inadequate in the general case as a driver reporting e.g. an
> imminent power failure can't know whether a shutdown or a reboot would
> be more appropriate for a given hardware platform.
>
> With the addition of the hw_protection parameter, it's now possible to
> configure at runtime the default emergency action and drivers are
> expected to use hw_protection_trigger to have this parameter dictate
> policy.
>
> As no current users of either hw_protection_shutdown or
> hw_protection_shutdown helpers remain, remove them, as not to tempt
> driver authors to call them.
>
> Existing users now either defer to hw_protection_trigger or call
> __hw_protection_trigger with a suitable argument directly when
> they have inside knowledge on whether a reboot or shutdown would
> be more appropriate.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>

Reviewed-by: Tzung-Bi Shih <tzungbi@xxxxxxxxxx>