On Tue, Dec 18, 2018 at 07:24:52AM +0100, Sergio Paracuellos wrote:
> > +static int ksz9477_i2c_read_reg(struct i2c_client *i2c, u32 reg, u8 *val,
> > +                               unsigned int len)
> > +{
> > +       struct i2c_msg msg[2];
> > +       int ret = 0;
> > +
> > +       val[0] = (u8)(reg >> 8);
> > +       val[1] = (u8)reg;
> > +
> > +       msg[0].addr = i2c->addr;
> > +       msg[0].flags = 0;
> > +       msg[0].len = 2;
> > +       msg[0].buf = val;
> > +
> > +       msg[1].addr = i2c->addr;
> > +       msg[1].flags = I2C_M_RD;
> > +       msg[1].len = len;
> > +       msg[1].buf = &val[2];
> > +
> > +       if (i2c_transfer(i2c->adapter, msg, 2) != 2)
> > +               ret = -ENODEV;
> 
> Should this be -EREMOTEIO instead?

It should actually be whatever error code i2c_transfer returns.

> > +static int ksz9477_i2c_write_reg(struct i2c_client *i2c, u32 reg, u8 *val,
> > +                                unsigned int len)
> > +{
> > +       struct i2c_msg msg;
> > +       int ret = 0;
> > +
> > +       val[0] = (u8)(reg >> 8);
> > +       val[1] = (u8)reg;
> > +
> > +       msg.addr = i2c->addr;
> > +       msg.flags = 0;
> > +       msg.len = 2 + len;
> > +       msg.buf = val;
> > +
> > +       if (i2c_transfer(i2c->adapter, &msg, 1) != 1)
> > +               ret = -ENODEV;
> 
> 
> Should this be -EREMOTEIO instead?

And the same here.

> > +MODULE_AUTHOR("Woojung Huh <woojung....@microchip.com>");
> > +MODULE_DESCRIPTION("Microchip KSZ9477 Series Switch I2C access Driver");
> > +MODULE_LICENSE("GPL");
> > diff --git a/drivers/net/dsa/microchip/ksz_i2c.h 
> > b/drivers/net/dsa/microchip/ksz_i2c.h
> > new file mode 100644
> > index 0000000..b9af0a8
> > --- /dev/null
> > +++ b/drivers/net/dsa/microchip/ksz_i2c.h
> > @@ -0,0 +1,69 @@
> > +/* SPDX-License-Identifier: GPL-2.0

This is i think inconsistent. MODULE_LICENSE("GPL") means GPL 2 and at
your choice, future versions. Your SPDX is for v2 only.

     Andrew

Reply via email to