Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1444254
| From | Wolfram Sang <wsa@the-dreams.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RESEND PATCH 05/14] eeprom: at24: hide the read/write loop behind a macro |
| Date | 2016-07-15 14:30 +0200 |
| Message-ID | <rVapH-6QL-9@gated-at.bofh.it> (permalink) |
| References | <rGYoq-2vy-7@gated-at.bofh.it> <rGYoq-2vy-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
> +/* > + * Both reads and writes fail if the previous write didn't complete yet. This > + * macro loops a few times waiting at least long enough for one entire page > + * write to work. > + * > + * It takes two parameters: a variable in which the future timeout in jiffies > + * will be stored and a temporary variable holding the time of the last > + * iteration of processing the request. Both should be unsigned integers > + * holding at least 32 bits. > + */ > +#define loop_until_timeout(tout, op_time) \ > + for (tout = jiffies + msecs_to_jiffies(write_timeout), \ > + op_time = jiffies; \ > + time_before(op_time, tout); \ > + usleep_range(1000, 1500), op_time = jiffies) There is one subtle change coming with this change: the do-while loop is guaranteed to run at least once while the for-loop doesn't.
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [RESEND PATCH 05/14] eeprom: at24: hide the read/write loop behind a macro Wolfram Sang <wsa@the-dreams.de> - 2016-07-15 14:30 +0200
Re: [RESEND PATCH 05/14] eeprom: at24: hide the read/write loop behind a macro Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-07-15 15:00 +0200
Re: [RESEND PATCH 05/14] eeprom: at24: hide the read/write loop behind a macro Wolfram Sang <wsa@the-dreams.de> - 2016-07-15 17:10 +0200
Re: [RESEND PATCH 05/14] eeprom: at24: hide the read/write loop behind a macro Wolfram Sang <wsa@the-dreams.de> - 2016-07-16 07:00 +0200
Re: [RESEND PATCH 05/14] eeprom: at24: hide the read/write loop behind a macro Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-07-16 21:30 +0200
Re: [RESEND PATCH 05/14] eeprom: at24: hide the read/write loop behind a macro Wolfram Sang <wsa@the-dreams.de> - 2016-07-17 20:10 +0200
csiph-web