Re: [PATCH v2 1/3] hwmon: (pmbus) Add driver for Delta DPS-920AB PSU
From: Guenter Roeck
Date: Fri Jun 04 2021 - 08:39:52 EST
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