[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1jpln62jtj.fsf@starbuckisacylon.baylibre.com>
Date: Fri, 08 Nov 2024 09:47:36 +0100
From: Jerome Brunet <jbrunet@...libre.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Jean Delvare <jdelvare@...e.com>, Jonathan Corbet <corbet@....net>,
Patrick Rudolph <patrick.rudolph@...ements.com>, Naresh Solanki
<naresh.solanki@...ements.com>, Rob Herring <robh@...nel.org>, Krzysztof
Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
Delphine CC Chiu <Delphine_CC_Chiu@...ynn.com>,
linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, devicetree@...r.kernel.org,
linux-i2c@...r.kernel.org, Vaishnav Achath <vaishnav.a@...com>
Subject: Re: [PATCH v4 7/7] hwmon: (pmbus/tps25990): add initial support
On Wed 06 Nov 2024 at 10:59, Guenter Roeck <linux@...ck-us.net> 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
Powered by blists - more mailing lists