kernel: gpio-button-hotplug: update to use threaded irq's

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>

SVN-Revision: 48696
This commit is contained in:
John Crispin 2016-02-12 08:29:11 +00:00
parent 376e3ade79
commit 69517e88be

View File

@ -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 *button = &pdata->buttons[i];
struct gpio_keys_button_data *bdata = &bdev->data[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) if (!button->irq)
button->irq = gpio_to_irq(button->gpio); button->irq = gpio_to_irq(button->gpio);
if (button->irq < 0) { if (button->irq < 0) {
dev_err(&pdev->dev, "failed to get irq for gpio:%d\n", button->gpio); dev_err(&pdev->dev, "failed to get irq for gpio:%d\n", button->gpio);
continue; continue;
} }
ret = devm_request_irq(&pdev->dev, button->irq, button_handle_irq,
ret = devm_request_threaded_irq(&pdev->dev, button->irq, NULL, button_handle_irq,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
dev_name(&pdev->dev), bdata); dev_name(&pdev->dev), bdata);
if (ret) if (ret < 0)
dev_err(&pdev->dev, "failed to request irq:%d for gpio:%d\n", button->irq, button->gpio); dev_err(&pdev->dev, "failed to request irq:%d for gpio:%d\n", button->irq, button->gpio);
else else
dev_dbg(&pdev->dev, "gpio:%d has irq:%d\n", button->gpio, button->irq); dev_dbg(&pdev->dev, "gpio:%d has irq:%d\n", button->gpio, button->irq);