Re: [PATCH v1 3/3] regulator: fixed: forward under-voltage events
From: Mark Brown
Date: Tue Oct 10 2023 - 08:19:49 EST
On Tue, Oct 10, 2023 at 10:59:06AM +0200, Oleksij Rempel wrote:
> Add handler to forward under-voltage events.
> On systems for more or less complicated regulator chains we need to
> forward under-voltage events to actual driver which need to react on
> them.
It isn't clear to me why this would be implemented in one specific
driver, nor why this would be done unconditionally. Could you provide
some information on the problem you're trying to solve here? This feels
like something that should be a core feature.
> +static int reg_fixed_regulator_notifier(struct notifier_block *nb,
> + unsigned long event, void *data)
> +{
> + struct fixed_voltage_data *priv =
> + container_of(nb, struct fixed_voltage_data, nb);
> + struct regulator_dev *rdev = priv->dev;
> +
> + if (event != REGULATOR_EVENT_UNDER_VOLTAGE_WARN &&
> + event != REGULATOR_EVENT_UNDER_VOLTAGE)
> + return NOTIFY_OK;
> +
> + regulator_notifier_call_chain(rdev, event, NULL);
This would be better written as a switch statement for extensibility,
and it's not clear why the filtering?
Attachment:
signature.asc
Description: PGP signature