Re: [PATCH] eeprom: at24: Fix unexpected timeout under high load

From: Andy Shevchenko
Date: Tue Aug 14 2018 - 09:28:38 EST


On Mon, Aug 6, 2018 at 2:39 PM, Jonas Mark (BT-FIR/ENG1)
<Mark.Jonas@xxxxxxxxxxxx> wrote:

> tout = jiffies + msecs_to_jiffies(at24_write_timeout);
> do {
> read_time = jiffies;
>
> ret = regmap_bulk_read(regmap, offset, buf, count);
> dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n",
> count, offset, ret, jiffies);
> if (!ret)
> return count;
>
> usleep_range(1000, 1500);
> } while (!time_before(tout, read_time))
>
> The advantage of this code is that the usleep_range() is unconditional.

> The disadvantage of the new proposal is that in case of a timeout one
> more unnecessary sleep is made. Is that acceptable?

Yes.

> An alternative would be to duplicate the regmap_bulk_read() and the
> debugging code outside the loop.

> Is this preferable?

No.

--
With Best Regards,
Andy Shevchenko