Re: [RESEND PATCH 05/14] eeprom: at24: hide the read/write loop behind a macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2016-07-16 6:56 GMT+02:00 Wolfram Sang <wsa@xxxxxxxxxxxxx>:
>
>> > >> +#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
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux