Re: [PATCH v4 7/7] hwmon: (pmbus/tps25990): add initial support
From: Jerome Brunet
Date: Fri Nov 08 2024 - 03:47:52 EST
On Wed 06 Nov 2024 at 10:59, Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
>> +
>> +static int tps25990_mfr_write_protect_set(struct i2c_client *client,
>> + u8 protect)
>> +{
>> + /*
>> + * The chip has a single protection mode, set it regardless of
>> + * the specific protection requested
>> + */
>> + return pmbus_write_byte_data(client, -1, TPS25990_MFR_WRITE_PROTECT,
>> + protect ? 0x0 : 0xa2);
>
> After some thought, I think it would be better to reject all protect values
> other than 0 (no write protection) and PB_WP_ALL because that is what the chip
> supports. Something like
Since operation would not be allowed, it's maps the closest indeed.
>
> if (protect & ~PB_WP_ALL)
> return -ENXIO; // or -EINVAL ? Not really sure.
The command is supported but the argument would not be, so -EINVAL seems
appropriate to me.
>
> Thanks,
> Guenter
--
Jerome