[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190725182029.GK21952@lunn.ch>
Date: Thu, 25 Jul 2019 20:20:29 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Sergej Benilov <sergej.benilov@...glemail.com>
Cc: venza@...wnhat.org, netdev@...r.kernel.org
Subject: Re: [PATCH] sis900: add support for ethtool --eeprom-dump
On Thu, Jul 25, 2019 at 06:41:41PM +0200, Sergej Benilov wrote:
> On Thu, 25 Jul 2019 at 18:25, Andrew Lunn <andrew@...n.ch> wrote:
> >
> > > +static int sis900_read_eeprom(struct net_device *net_dev, u8 *buf)
> > > +{
> > > + struct sis900_private *sis_priv = netdev_priv(net_dev);
> > > + void __iomem *ioaddr = sis_priv->ioaddr;
> > > + int wait, ret = -EAGAIN;
> > > + u16 signature;
> > > + u16 *ebuf = (u16 *)buf;
> > > + int i;
> > > +
> > > + if (sis_priv->chipset_rev == SIS96x_900_REV) {
> > > + sw32(mear, EEREQ);
> > > + for (wait = 0; wait < 2000; wait++) {
> > > + if (sr32(mear) & EEGNT) {
> > > + /* read 16 bits, and index by 16 bits */
> > > + for (i = 0; i < sis_priv->eeprom_size / 2; i++)
> > > + ebuf[i] = (u16)read_eeprom(ioaddr, i);
> > > + ret = 0;
> > > + break;
> > > + }
> > > + udelay(1);
> > > + }
> > > + sw32(mear, EEDONE);
> >
> > The indentation looks all messed up here.
>
> This has passed ./scripts/checkpatch.pl, as you had suggested for the
> previous patch.
checkpatch just checks for things like tabs vs space.
I would expect the indentation to be more like:
if (sis_priv->chipset_rev == SIS96x_900_REV) {
sw32(mear, EEREQ);
for (wait = 0; wait < 2000; wait++) {
if (sr32(mear) & EEGNT) {
/* read 16 bits, and index by 16 bits */
for (i = 0; i < sis_priv->eeprom_size / 2; i++)
ebuf[i] = (u16)read_eeprom(ioaddr, i);
ret = 0;
break;
}
udelay(1);
}
sw32(mear, EEDONE);
} else {
signature = (u16)read_eeprom(ioaddr, EEPROMSignature);
if (signature != 0xffff && signature != 0x0000) {
/* read 16 bits, and index by 16 bits */
for (i = 0; i < sis_priv->eeprom_size / 2; i++)
ebuf[i] = (u16)read_eeprom(ioaddr, i);
ret = 0;
}
}
return ret;
> > Why do you not put the data directly into data and avoid this memory
> > allocation, and memcpy?
>
> Because EEPROM data from 'eeprom->offset' offset and of 'eeprom->len'
> length only is expected to be returned in 'data'.
O.K.
Andrew
Powered by blists - more mailing lists