Re: [PATCH 5/8] usb: ohci-da8xx: add vbus and overcurrent gpios

From: Sekhar Nori
Date: Fri Feb 08 2019 - 06:30:02 EST


Hi Bartosz,

On 05/02/19 3:55 PM, Bartosz Golaszewski wrote:
> +static irqreturn_t ohci_da8xx_oc_handler(int irq, void *data)
> +{
> + struct da8xx_ohci_hcd *da8xx_ohci = data;
> +
> + if (gpiod_get_value_cansleep(da8xx_ohci->oc_gpio))
> + gpiod_set_value_cansleep(da8xx_ohci->vbus_gpio, 0);
> +
> + return IRQ_HANDLED;
> +}

Its pretty strange to see gpiod_get_value_cansleep() being called from
irq context, although I agree right now it uses SoC GPIOs so it should
actually never sleep.

Isn't it better to use gpiod_get_value() instead so you get a warning on
incorrect usage?

Thanks,
Sekhar