lkml.org 
[lkml]   [2018]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 3/3] i2c:ocores: add polling interface
Date
>>>>> "Federico" == Federico Vaga <federico.vaga@cern.ch> writes:

Hi,

>> >> Where does this 10 come from?
>> >
>> > It's true, it's just a random number. It can be zero as well, and we ask
>> > the system to just sleep for that amount of time.
>> >
>> > (1) usleep_range(sleep_min, sleep_min);
>>
>> Or just usleep(sleep_min);

> This does not exist as far as I know; the alternative is an active wait with
> udelay. But then, it is not that different from just start polling TIP or BUSY
> flags.

Ahh yes.

> I think that something like this could be better

> (2) usleep_range(sleep_min, sleep_min * XXX);

> But.
> Since it is better to make this patch ready for xfer_irqless, then I will
> definitively go for udelay(). The reason is that, xfer_irqless may run in
> atomic context where we can't sleep at all.

Great! BTW I noticed that your sleep_min calculation looked odd:

int sleep_min = (8/i2c->bus_clock_khz) * 1000; /* us for 8bits

bus_clock_khz almost certainly will be bigger than 8 (E.G. likely
100KHz), so the above set sleep_min to 0. Please move the * 1000 before
the division.

--
Bye, Peter Korsgaard

\
 
 \ /
  Last update: 2018-10-29 14:05    [W:0.105 / U:4.856 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site