From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH RFC net-next] net: dsa: microchip: add KSZ9477 I2C driver Date: Tue, 18 Dec 2018 11:01:32 +0100 Message-ID: <20181218100132.GE8334@lunn.ch> References: <1545097200-26493-1-git-send-email-Tristram.Ha@microchip.com> <1545097200-26493-2-git-send-email-Tristram.Ha@microchip.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Tristram.Ha@microchip.com, Florian Fainelli , Pavel Machek , Marek Vasut , Dan Carpenter , vivien.didelot@savoirfairelinux.com, UNGLinuxDriver@microchip.com, netdev@vger.kernel.org To: Sergio Paracuellos Return-path: Received: from vps0.lunn.ch ([185.16.172.187]:51432 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbeLRKBr (ORCPT ); Tue, 18 Dec 2018 05:01:47 -0500 Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: 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 "); > > +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