[PATCH v2 06/11] i2c: nomadik: support short xfer timeouts using waitqueue & hrtimer
Théo Lebrun
theo.lebrun at bootlin.com
Mon Mar 4 02:14:53 PST 2024
Hello,
On Mon Mar 4, 2024 at 10:18 AM CET, Wolfram Sang wrote:
> On Thu, Feb 29, 2024 at 07:10:54PM +0100, Théo Lebrun wrote:
> > Replace the completion by a waitqueue for synchronization from IRQ
> > handler to task. For short timeouts, use hrtimers, else use timers.
> > Usecase: avoid blocking the I2C bus for too long when an issue occurs.
> >
> > The threshold picked is one jiffy: if timeout is below that, use
> > hrtimers. This threshold is NOT configurable.
> >
> > Implement behavior but do NOT change fetching of timeout. This means the
> > timeout is unchanged (200ms) and the hrtimer case will never trigger.
> >
> > A waitqueue is used because it supports both desired timeout approaches.
> > See wait_event_timeout() and wait_event_hrtimeout(). An atomic boolean
> > serves as synchronization condition.
> >
> > Reviewed-by: Linus Walleij <linus.walleij at linaro.org>
> > Signed-off-by: Théo Lebrun <theo.lebrun at bootlin.com>
>
> Largely:
>
> Reviewed-by: Wolfram Sang <wsa+renesas at sang-engineering.com>
Thanks for the reviews Wolfram.
> Nit:
>
> > - int timeout;
> > + int timeout_usecs;
>
> I think 'unsigned' makes a lot of sense here. Maybe u32 even?
Yes unsigned would make sense. unsigned int or u32, I wouldn't know
which to pick.
Regards,
--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
More information about the linux-arm-kernel
mailing list