diff mbox

[OpenWrt-Devel] kernel: gpio-button-hotplug: update to use threaded irq's

Message ID 1453847605-31300-1-git-send-email-psidhu@gateworks.com
State Accepted
Headers show

Commit Message

Pushpal Sidhu Jan. 26, 2016, 10:33 p.m. UTC
Many gpio controllers 'cansleep' due to the fact that they are behind busses
e.g. i2c etc.

Using threaded irq's allows for 'sleep-able' gpio's to be used.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 .../kernel/gpio-button-hotplug/src/gpio-button-hotplug.c    | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Comments

Pushpal Sidhu Feb. 9, 2016, 8:01 p.m. UTC | #1
Felix,

Not sure what happened, but I was notified via patchwork that this
patch was 'Accepted': https://patchwork.ozlabs.org/patch/573522/

However, I don't see it applied to any OpenWrt tree that I can find:
 * https://dev.openwrt.org/log/trunk/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
 * http://git.openwrt.org/?p=openwrt.git;a=history;f=package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c

What's going on?

- Pushpal

On Tue, Jan 26, 2016 at 2:33 PM, Pushpal Sidhu <psidhu@gateworks.com> wrote:
> Many gpio controllers 'cansleep' due to the fact that they are behind busses
> e.g. i2c etc.
>
> Using threaded irq's allows for 'sleep-able' gpio's to be used.
>
> Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
>  .../kernel/gpio-button-hotplug/src/gpio-button-hotplug.c    | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
> index 029a388..6d1a197 100644
> --- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
> +++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
> @@ -555,20 +555,17 @@ static int gpio_keys_probe(struct platform_device *pdev)
>                 struct gpio_keys_button *button = &pdata->buttons[i];
>                 struct gpio_keys_button_data *bdata = &bdev->data[i];
>
> -               if (bdata->can_sleep) {
> -                       dev_err(&pdev->dev, "skipping gpio:%d, it can sleep\n", button->gpio);
> -                       continue;
> -               }
>                 if (!button->irq)
>                         button->irq = gpio_to_irq(button->gpio);
>                 if (button->irq < 0) {
>                         dev_err(&pdev->dev, "failed to get irq for gpio:%d\n", button->gpio);
>                         continue;
>                 }
> -               ret = devm_request_irq(&pdev->dev, button->irq, button_handle_irq,
> -                                       IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
> -                                       dev_name(&pdev->dev), bdata);
> -               if (ret)
> +
> +               ret = devm_request_threaded_irq(&pdev->dev, button->irq, NULL, button_handle_irq,
> +                                               IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
> +                                               dev_name(&pdev->dev), bdata);
> +               if (ret < 0)
>                         dev_err(&pdev->dev, "failed to request irq:%d for gpio:%d\n", button->irq, button->gpio);
>                 else
>                         dev_dbg(&pdev->dev, "gpio:%d has irq:%d\n", button->gpio, button->irq);
> --
> 2.7.0
>
diff mbox

Patch

diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
index 029a388..6d1a197 100644
--- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
+++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
@@ -555,20 +555,17 @@  static int gpio_keys_probe(struct platform_device *pdev)
 		struct gpio_keys_button *button = &pdata->buttons[i];
 		struct gpio_keys_button_data *bdata = &bdev->data[i];
 
-		if (bdata->can_sleep) {
-			dev_err(&pdev->dev, "skipping gpio:%d, it can sleep\n", button->gpio);
-			continue;
-		}
 		if (!button->irq)
 			button->irq = gpio_to_irq(button->gpio);
 		if (button->irq < 0) {
 			dev_err(&pdev->dev, "failed to get irq for gpio:%d\n", button->gpio);
 			continue;
 		}
-		ret = devm_request_irq(&pdev->dev, button->irq, button_handle_irq,
-					IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
-					dev_name(&pdev->dev), bdata);
-		if (ret)
+
+		ret = devm_request_threaded_irq(&pdev->dev, button->irq, NULL, button_handle_irq,
+						IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+						dev_name(&pdev->dev), bdata);
+		if (ret < 0)
 			dev_err(&pdev->dev, "failed to request irq:%d for gpio:%d\n", button->irq, button->gpio);
 		else
 			dev_dbg(&pdev->dev, "gpio:%d has irq:%d\n", button->gpio, button->irq);