Re: [PATCH 2/2] i2c: piix4: Use usleep_range()

From: Joe Perches
Date: Mon Feb 12 2018 - 16:35:34 EST


On Mon, 2018-02-12 at 12:59 -0800, Guenter Roeck wrote:
> On Mon, Feb 12, 2018 at 11:53:36AM +0100, Jean Delvare wrote:
> > On Sat, 30 Dec 2017 08:50:58 -0800, Guenter Roeck wrote:
> > > The piix4 i2c driver is extremely slow. Replacing msleep()
> > > with usleep_range() increases its speed substantially.
[]
> > > diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
[]
> > > @@ -467,13 +467,13 @@ static int piix4_transaction(struct i2c_adapter *piix4_adapter)
> > >
> > > /* We will always wait for a fraction of a second! (See PIIX4 docs errata) */
> > > if (srvrworks_csb5_delay) /* Extra delay for SERVERWORKS_CSB5 */
> > > - msleep(2);
> > > + usleep_range(2000, 2000);

usleep_range without a range isn't particularly useful.
Perhaps a 100 uSec range would allow better scheduling.

usleep_range(2000, 2100);