[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <64c3f6c3-10b5-44c6-a1cd-c796b770c904@roeck-us.net>
Date: Mon, 23 Sep 2024 09:44:11 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Mark Brown <broonie@...nel.org>, Jerome Brunet <jbrunet@...libre.com>
Cc: Liam Girdwood <lgirdwood@...il.com>, Jean Delvare <jdelvare@...e.com>,
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 9/23/24 06:21, Mark Brown wrote:
> 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.
I still consider the callback to be unnecessary, but I don't really have time
to implement a better solution myself. If you accept the regulator patches,
I'll have another look at the series as-is.
Guenter
Powered by blists - more mailing lists