[i2c] [PATCH] Add a new-style driver for most I2C EEPROMs
Wolfram Sang
w.sang at pengutronix.de
Fri Apr 18 10:59:53 CEST 2008
David Brownell wrote:
> That was obviously tested only at HZ=100 or with quick-ish
> EEPROMs!
Ah, okay. I was aware that msleep(1) waits not less than 10ms with
HZ=100. I simply wondered, how to reach the timeout value for bigger
HZ-values.
> That loop should (a) run at least a few times, maybe three;
> and (b) not exit before the timeout passes.
...or (c) return successfully as soon as possible. This is why you used
msleep(1) and not something like msleep(AT24_EE_TIMEOUT / 2). I got it :)
> timeout = ... ;
> retries = 0;
> while (retries++ < 3 || time_before(jiffies, timeout)) {
> ... try write, quit loop on success ...
> msleep(1);
> }
This looks good, will include it!
Wolfram
--
Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
More information about the i2c
mailing list