[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <9eea0291-f225-466a-ba01-df3210bd8ead@www.fastmail.com>
Date: Thu, 10 Sep 2020 11:42:34 +0930
From: "Andrew Jeffery" <andrew@...id.au>
To: "Guenter Roeck" <linux@...ck-us.net>, linux-hwmon@...r.kernel.org
Cc: "Jean Delvare" <jdelvare@...e.com>, openbmc@...ts.ozlabs.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hwmon: (pmbus) Expose PEC debugfs attribute
On Thu, 10 Sep 2020, at 01:01, Guenter Roeck wrote:
> On 9/9/20 6:24 AM, Andrew Jeffery wrote:
> > Enable runtime debug control of whether the PEC byte is exchanged with
> > the PMBus device.
> >
> > Some manufacturers have asked for the PEC to be disabled as part of
> > debugging driver communication issues with devices.
> >
> > Signed-off-by: Andrew Jeffery <andrew@...id.au>
> > ---
> > drivers/hwmon/pmbus/pmbus_core.c | 39 ++++++++++++++++++++++++++++++++
> > 1 file changed, 39 insertions(+)
> >
> > diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> > index 44535add3a4a..51c8502b35e9 100644
> > --- a/drivers/hwmon/pmbus/pmbus_core.c
> > +++ b/drivers/hwmon/pmbus/pmbus_core.c
> > @@ -2346,6 +2346,42 @@ static int pmbus_debugfs_get_status(void *data, u64 *val)
> > DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_status, pmbus_debugfs_get_status,
> > NULL, "0x%04llx\n");
> >
> > +static int pmbus_debugfs_get_pec(void *data, u64 *val)
> > +{
> > + struct i2c_client *client = data;
> > +
> > + *val = !!(client->flags & I2C_CLIENT_PEC);
> > +
> > + return 0;
> > +}
> > +
> > +static int pmbus_debugfs_set_pec(void *data, u64 val)
> > +{
> > + int rc;
> > + struct i2c_client *client = data;
> > +
> > + if (!val) {
> > + client->flags &= ~I2C_CLIENT_PEC;
> > + return 0;
> > + }
> > +
> > + if (val != 1)
> > + return -EINVAL;
> > +
> > + rc = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
> > + if (rc < 0)
> > + return rc;
> > +
> > + if (!(rc & PB_CAPABILITY_ERROR_CHECK))
> > + return -ENOTSUPP;
>
> WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP
>
> > +
> > + client->flags |= I2C_CLIENT_PEC;
> > +
> > + return 0;
> > +}
> > +DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_pec, pmbus_debugfs_get_pec,
> > + pmbus_debugfs_set_pec, "0x%1llu\n");
>
> ERROR: Prefixing 0x with decimal output is defective
>
> (since the displayed value is a boolean, it is also quite useless).
Indeed. I overlooked running checkpatch, sorry for the noise.
I've sent v2 which checkpatch claims to be clean.
Andrew
Powered by blists - more mailing lists