Re: [PATCH v3 01/22] i2c: tegra: Make tegra_i2c_flush_fifos() usable in atomic transfer

From: Dmitry Osipenko
Date: Thu Sep 03 2020 - 10:26:12 EST


03.09.2020 14:02, Andy Shevchenko пишет:
> On Thu, Sep 3, 2020 at 3:53 AM Dmitry Osipenko <digetx@xxxxxxxxx> wrote:
>>
>> The tegra_i2c_flush_fifos() shouldn't sleep in atomic transfer and jiffies
>> are not updating if interrupts are disabled. Hence let's use proper delay
>> functions and use ktime API in order not to hang atomic transfer. Note
>> that this patch doesn't fix any known problem because normally FIFO is
>> flushed at the time of starting a new transfer.
>
>> + /*
>> + * ktime_get() may take up to couple milliseconds in a worst case
>> + * and normally FIFOs are flushed, hence let's check the state before
>> + * proceeding to polling.
>> + */
>
> Everything, including above can be done by using macros from iopoll.h. Why not?

Perhaps indeed it should be possible to use the common macros, at least
I can't recall why I chose not to use them. Maybe because it appeared to
me that the current variant is a bit nicer than:

if (atomic)
read_poll_atomic()
else
read_poll()


I'll consider to use the common iopoll macros in v4, thanks!