[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMpxmJWniibfkoQCFgpwH8D23t8V1+3g=NBY2tmNZsGN=6Ufvg@mail.gmail.com>
Date: Sat, 16 Jul 2016 21:25:08 +0200
From: Bartosz Golaszewski <bgolaszewski@...libre.com>
To: Wolfram Sang <wsa@...-dreams.de>
Cc: linux-i2c <linux-i2c@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Andrew Lunn <andrew@...n.ch>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Maxime Ripard <maxime.ripard@...e-electrons.com>,
GregKH <greg@...ah.com>
Subject: Re: [RESEND PATCH 05/14] eeprom: at24: hide the read/write loop
behind a macro
2016-07-16 6:56 GMT+02:00 Wolfram Sang <wsa@...-dreams.de>:
>
>> > >> +#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)
>
> What about:
>
> #define loop_until_timeout(tout, op_time) \
> for (tout = jiffies + msecs_to_jiffies(write_timeout), op_time = 0; \
> op_time ? time_before(op_time, tout) : true; \
> usleep_range(1000, 1500), op_time = jiffies)
>
> ? Would probably need an explanation in a comment, though.
>
Hi Wolfram,
thanks for the suggestion, it looks good. I'm not at home right now
and don't have access to any device with which I could test it. I'll
try to send the patch tomorrow evening or Monday morning.
Best regards,
Bartosz Golaszewski
Powered by blists - more mailing lists