Re: [PATCH v9 2/7] reboot: hw_protection_trigger: use standardized numeric shutdown/reboot reasons instead of strings

From: Sebastian Reichel
Date: Thu May 01 2025 - 16:55:20 EST


Hi,

On Tue, Apr 22, 2025 at 10:57:12AM +0200, Oleksij Rempel wrote:
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 90629a756693..84448a4c7fd4 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -5263,26 +5263,23 @@ EXPORT_SYMBOL_GPL(regulator_bulk_free);
> static void regulator_handle_critical(struct regulator_dev *rdev,
> unsigned long event)
> {
> - const char *reason = NULL;
> + enum psc_reason pscr;

enum psc_reason pscr = PSCR_UNKNOWN;

(or add a default clause to the switch)

> if (!rdev->constraints->system_critical)
> return;
>
> switch (event) {
> case REGULATOR_EVENT_UNDER_VOLTAGE:
> - reason = "System critical regulator: voltage drop detected";
> + pscr = PSCR_UNDER_VOLTAGE;
> break;
> case REGULATOR_EVENT_OVER_CURRENT:
> - reason = "System critical regulator: over-current detected";
> + pscr = PSCR_OVER_CURRENT;
> break;
> case REGULATOR_EVENT_FAIL:
> - reason = "System critical regulator: unknown error";
> + pscr = PSCR_REGULATOR_FAILURE;
> }
>
> - if (!reason)
> - return;
> -
> - hw_protection_trigger(reason,
> + hw_protection_trigger(pscr,
> rdev->constraints->uv_less_critical_window_ms);
> }

Greetings,

-- Sebastian

Attachment: signature.asc
Description: PGP signature