Hello,
On 20.01.25 08:10, Tzung-Bi Shih wrote:
On Mon, Jan 13, 2025 at 05:25:26PM +0100, Ahmad Fatoum wrote:
quoted
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@pengutronix.de>
With a minor question,
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Thanks for your review.
quoted
@@ -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.
My thinking was that having poweroff in the else branch underlines that
it's the default, i.e. either reboot was explicitly asked for or we fall
back to the poweroff default.
I see that this is subjective. I can change it for v3 if that's preferred.
Cheers,
Ahmad
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |