[PATCH v2 01/12] reboot: replace __hw_protection_shutdown bool action parameter with an enum

Tzung-Bi Shih tzungbi at kernel.org
Mon Jan 20 07:10:28 UTC 2025


On Mon, Jan 13, 2025 at 05:25:26PM +0100, Ahmad Fatoum wrote:
> Currently __hw_protection_shutdown() either reboots or shuts down the
> system according to its shutdown argument.
> 
> To make the logic easier to follow, both inside __hw_protection_shutdown
> and at caller sites, lets replace the bool parameter with an enum.
> 
> This will be extra useful, when in a later commit, a third action is
> added to the enumeration.
> 
> No functional change.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>

With a minor question,
Reviewed-by: Tzung-Bi Shih <tzungbi at kernel.org>

> @@ -1009,10 +1007,10 @@ void __hw_protection_shutdown(const char *reason, int ms_until_forced, bool shut
>  	 * orderly_poweroff failure
>  	 */
>  	hw_failure_emergency_poweroff(ms_until_forced);
> -	if (shutdown)
> -		orderly_poweroff(true);
> -	else
> +	if (action == HWPROT_ACT_REBOOT)
>  		orderly_reboot();
> +	else
> +		orderly_poweroff(true);

It probably doesn't really matter.  Does it intend to change the branch
order?  As s/shutdown/action == HWPROT_ACT_SHUTDOWN/ should be more
intuitive for the hunk to me.



More information about the Linux-security-module-archive mailing list