Re: [PATCH] gpio: core: Do not call get_direction in atomic context for sleeping gpio
From: Linus Walleij
Date: Mon May 30 2016 - 11:17:10 EST
On Tue, May 24, 2016 at 3:18 PM, Laxman Dewangan <ldewangan@xxxxxxxxxx> wrote:
> When adding the gpiochip, the GPIO HW drivers' callback get_direction()
> get called in atomic context. Some of the GPIO HW drivers can sleep when
> accessing the register and hence it can create the sleeping call in
> atomic context.
>
> Call get_direction() in non-atomic context from gpiochip_add() if GPIO
> HW driver is having sleepable callback i.e. chip->can_sleep = 1.
>
> Signed-off-by: Laxman Dewangan <ldewangan@xxxxxxxxxx>
>
> ---
> This is found when implementing the get_direction() of max77620 on 20160520
> linux-next.
I chose to send a new patch just moving the lock release before the
direction check. I just sent it with you as Reported-by.
Yours,
Linus Walleij