summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorRobert Jarzmik <robert.jarzmik@free.fr>2008-08-11 22:22:27 +0200
committerAnton Vorontsov <cbouatmailru@gmail.com>2008-09-01 02:10:06 +0400
commite82374fd1a804e197fc2a54c3930e70c5d300abc (patch)
treedaceef0ed1c611e38b016ba400890873c65cce26 /drivers/power
parentbef69ea0dcce574a425feb0a5aa4c63dd108b9a6 (diff)
downloadlinux-exynos-e82374fd1a804e197fc2a54c3930e70c5d300abc.tar.gz
linux-exynos-e82374fd1a804e197fc2a54c3930e70c5d300abc.tar.bz2
linux-exynos-e82374fd1a804e197fc2a54c3930e70c5d300abc.zip
pda_power: Check and handle return value of set_irq_wake
The recent change in commit 2db873211ba47ef704c301f9ecf4a33413a0b649 forces the calls enable_irq_wake() and disable_irq_wake() to be balanced. But if in pda_power_suspend() the call to enable_irq_wake() fails (because attached gpio cannot wake up the CPU), the corresponding disable_irq_wake will WARN(). Fix it by storing success/failure of enable_irq_wake(). Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/pda_power.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
index 0471ec743ab9..d30bb766fcef 100644
--- a/drivers/power/pda_power.c
+++ b/drivers/power/pda_power.c
@@ -334,13 +334,16 @@ static int pda_power_remove(struct platform_device *pdev)
}
#ifdef CONFIG_PM
+static int ac_wakeup_enabled;
+static int usb_wakeup_enabled;
+
static int pda_power_suspend(struct platform_device *pdev, pm_message_t state)
{
if (device_may_wakeup(&pdev->dev)) {
if (ac_irq)
- enable_irq_wake(ac_irq->start);
+ ac_wakeup_enabled = !enable_irq_wake(ac_irq->start);
if (usb_irq)
- enable_irq_wake(usb_irq->start);
+ usb_wakeup_enabled = !enable_irq_wake(usb_irq->start);
}
return 0;
@@ -349,9 +352,9 @@ static int pda_power_suspend(struct platform_device *pdev, pm_message_t state)
static int pda_power_resume(struct platform_device *pdev)
{
if (device_may_wakeup(&pdev->dev)) {
- if (usb_irq)
+ if (usb_irq && usb_wakeup_enabled)
disable_irq_wake(usb_irq->start);
- if (ac_irq)
+ if (ac_irq && ac_wakeup_enabled)
disable_irq_wake(ac_irq->start);
}