On Tue, Sep 9, 2014 at 12:40 AM, Lothar Waßmann <LW@xxxxxxxxxxxxxxxxxxx> wrote: > When trying to use the LED GPIO trigger with e.g. the PCA953x GPIO > driver, request_irq() fails with -EINVAL, because the GPIO driver > requires a nested interrupt handler. > > Use request_any_context_irq() to be able to use any GPIO driver as LED > trigger. > Hmmm, what about use request_thread_irq() and put the gpio_trig_work() in as the thread_func. Felipe, can you take a look at this? Also in the first patch: Actually in gpio_trig_irq(), it said: /* just schedule_work since gpio_get_value can sleep */ schedule_work(&gpio_data->work); Then that means we need to call gpio_get_value_can_sleep() in the gpio_trig_work() instead of gpio_get_value(), right? Thanks, -Bryan > Signed-off-by: Lothar Waßmann <LW@xxxxxxxxxxxxxxxxxxx> > --- > drivers/leds/trigger/ledtrig-gpio.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/leds/trigger/ledtrig-gpio.c b/drivers/leds/trigger/ledtrig-gpio.c > index c86c418..b4168a7 100644 > --- a/drivers/leds/trigger/ledtrig-gpio.c > +++ b/drivers/leds/trigger/ledtrig-gpio.c > @@ -161,10 +161,10 @@ static ssize_t gpio_trig_gpio_store(struct device *dev, > return n; > } > > - ret = request_irq(gpio_to_irq(gpio), gpio_trig_irq, > + ret = request_any_context_irq(gpio_to_irq(gpio), gpio_trig_irq, > IRQF_SHARED | IRQF_TRIGGER_RISING > | IRQF_TRIGGER_FALLING, "ledtrig-gpio", led); > - if (ret) { > + if (ret < 0) { > dev_err(dev, "request_irq failed with error %d\n", ret); > } else { > if (gpio_data->gpio != 0) > @@ -172,7 +172,7 @@ static ssize_t gpio_trig_gpio_store(struct device *dev, > gpio_data->gpio = gpio; > } > > - return ret ? ret : n; > + return ret < 0 ? ret : n; > } > static DEVICE_ATTR(gpio, 0644, gpio_trig_gpio_show, gpio_trig_gpio_store); > > -- > 1.7.10.4 > -- To unsubscribe from this list: send the line "unsubscribe linux-leds" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html