power: gpio-charger: balance enable/disable_irq_wake calls
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Thu, 15 Jan 2015 02:00:37 +0000 (05:00 +0300)
committerSebastian Reichel <sre@kernel.org>
Tue, 20 Jan 2015 12:58:31 +0000 (13:58 +0100)
enable_irq_wakeup returns 0 in case it correctly enabled the IRQ to
generate the wakeup event (and thus resume should call disable_irq_wake).
Currently gpio-charger driver has this logic inverted. Correct that thus
correcting enable/disable_irq_wake() calls balance.

Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
drivers/power/gpio-charger.c

index aef74bdf7ab31690ebb1d286df3a593e24d18788..b7424c8501f106d8c6e460c14ca5f946602ad088 100644 (file)
@@ -229,7 +229,7 @@ static int gpio_charger_suspend(struct device *dev)
 
        if (device_may_wakeup(dev))
                gpio_charger->wakeup_enabled =
-                       enable_irq_wake(gpio_charger->irq);
+                       !enable_irq_wake(gpio_charger->irq);
 
        return 0;
 }
@@ -239,7 +239,7 @@ static int gpio_charger_resume(struct device *dev)
        struct platform_device *pdev = to_platform_device(dev);
        struct gpio_charger *gpio_charger = platform_get_drvdata(pdev);
 
-       if (gpio_charger->wakeup_enabled)
+       if (device_may_wakeup(dev) && gpio_charger->wakeup_enabled)
                disable_irq_wake(gpio_charger->irq);
        power_supply_changed(&gpio_charger->charger);