[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZvFrWDF6Pn9zOb23@finisterre.sirena.org.uk>
Date: Mon, 23 Sep 2024 15:21:28 +0200
From: Mark Brown <broonie@...nel.org>
To: Jerome Brunet <jbrunet@...libre.com>
Cc: Liam Girdwood <lgirdwood@...il.com>, Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
Jonathan Corbet <corbet@....net>, linux-kernel@...r.kernel.org,
linux-hwmon@...r.kernel.org, linux-doc@...r.kernel.org
Subject: Re: [PATCH 4/5] hwmon: (pmbus/core) improve handling of write
protected regulators
On Fri, Sep 20, 2024 at 06:47:05PM +0200, Jerome Brunet wrote:
> +int pmbus_regulator_init_cb(struct regulator_dev *rdev,
> + struct regulator_config *config)
> +{
> + struct pmbus_data *data = config->driver_data;
> + struct regulation_constraints *constraints = rdev->constraints;
> +
> + if (data->flags & PMBUS_OP_PROTECTED)
> + constraints->valid_ops_mask &= ~REGULATOR_CHANGE_STATUS;
> +
> + if (data->flags & PMBUS_VOUT_PROTECTED)
> + constraints->valid_ops_mask &= ~REGULATOR_CHANGE_VOLTAGE;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_NS_GPL(pmbus_regulator_init_cb, PMBUS);
I'm fairly comfortable with this from a regulator point of view, modulo
the suggestion I posted in the other message about registering separate
ops. The fact that there's three combinations of ops is annoying but
doesn't feel too bad, though I didn't actually write it out so perhaps
it looks horrible. In general removing permissions is safe, and without
separate steps to remove write protect (which I see in your patch 5) the
writes wouldn't actually work anyway.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists