intel_mid_powerbtn: Remove misuse of IRQF_NO_SUSPEND flag
authorSudeep Holla <sudeep.holla@arm.com>
Mon, 21 Sep 2015 15:47:01 +0000 (16:47 +0100)
committerDarren Hart <dvhart@linux.intel.com>
Sat, 3 Oct 2015 16:40:30 +0000 (09:40 -0700)
The IRQF_NO_SUSPEND flag is used to identify the interrupts that should
be left enabled so as to allow them to work as expected during the
suspend-resume cycle, but doesn't guarantee that it will wake the system
from a suspended state, enable_irq_wake is recommended to be used for
the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags and uses newly
introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

Cc: Darren Hart <dvhart@infradead.org>
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
drivers/platform/x86/intel_mid_powerbtn.c

index 22606d6..1fc0de8 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/platform_device.h>
 #include <linux/input.h>
 #include <linux/mfd/intel_msic.h>
+#include <linux/pm_wakeirq.h>
 
 #define DRIVER_NAME "msic_power_btn"
 
@@ -76,14 +77,17 @@ static int mfld_pb_probe(struct platform_device *pdev)
 
        input_set_capability(input, EV_KEY, KEY_POWER);
 
-       error = request_threaded_irq(irq, NULL, mfld_pb_isr, IRQF_NO_SUSPEND,
-                       DRIVER_NAME, input);
+       error = request_threaded_irq(irq, NULL, mfld_pb_isr, 0,
+                                    DRIVER_NAME, input);
        if (error) {
                dev_err(&pdev->dev, "Unable to request irq %d for mfld power"
                                "button\n", irq);
                goto err_free_input;
        }
 
+       device_init_wakeup(&pdev->dev, true);
+       dev_pm_set_wake_irq(&pdev->dev, irq);
+
        error = input_register_device(input);
        if (error) {
                dev_err(&pdev->dev, "Unable to register input dev, error "
@@ -124,6 +128,8 @@ static int mfld_pb_remove(struct platform_device *pdev)
        struct input_dev *input = platform_get_drvdata(pdev);
        int irq = platform_get_irq(pdev, 0);
 
+       dev_pm_clear_wake_irq(&pdev->dev);
+       device_init_wakeup(&pdev->dev, false);
        free_irq(irq, input);
        input_unregister_device(input);