[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210604123829.GA3939356@roeck-us.net>
Date: Fri, 4 Jun 2021 05:38:29 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Robert Marko <robert.marko@...tura.hr>
Cc: robh+dt@...nel.org, jdelvare@...e.com, corbet@....net,
linux-hwmon@...r.kernel.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, trivial@...nel.org,
Jonathan.Cameron@...wei.com, alexandre.belloni@...tlin.com,
sst@...zta.fm, krzk@...nel.org, alexandru.ardelean@...log.com,
devicetree@...r.kernel.org, Luka Perkov <luka.perkov@...tura.hr>,
jmp@...phyte.org, Paul Menzel <pmenzel@...gen.mpg.de>,
Donald Buczek <buczek@...gen.mpg.de>
Subject: Re: [PATCH v2 1/3] hwmon: (pmbus) Add driver for Delta DPS-920AB PSU
On Fri, Jun 04, 2021 at 02:16:02PM +0200, Robert Marko wrote:
[ ... ]
> >
> > > +}
> > > +
> > > +static int dps920ab_write_word_data(struct i2c_client *client, int page, int reg,
> > > + u16 word)
> > > +{
> > > + int ret;
> > > +
> > > + /*
> > > + * This masks commands which are not supported.
> > > + * PSU only has one R/W register and that is
> > > + * for the fan.
> > > + */
> > > + switch (reg) {
> > > + case PMBUS_FAN_COMMAND_1:
> > > + break;
> > > + default:
> > > + ret = -ENODATA;
> > > + }
> > > +
> >
> > Does this work ? It is the wrong error message for a failed write;
> > it should probably return -EACCES.
>
> It appears to work fine, I was looking at other drivers, and all of them
> use -ENODATA for unsupported word registers.
No. They return -ENODATA to tell the PMBus core to use standard PMBus
access functions, ie to handle the access in the core. Please see
_pmbus_write_word_data().
Guenter
Powered by blists - more mailing lists