lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 11 Sep 2014 17:32:40 -0700
From:	Bryan Wu <cooloney@...il.com>
To:	Lothar Waßmann <LW@...o-electronics.de>
Cc:	Linux LED Subsystem <linux-leds@...r.kernel.org>,
	lkml <linux-kernel@...r.kernel.org>,
	Richard Purdie <rpurdie@...ys.net>
Subject: Re: [PATCH 2/2] leds: trigger: gpio: make ledtrig-gpio useable with
 GPIO drivers requiring threaded irqs

On Tue, Sep 9, 2014 at 12:40 AM, Lothar Waßmann <LW@...o-electronics.de> 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@...O-electronics.de>
> ---
>  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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ