Skip to content

Commit

Permalink
pda_power: Check and handle return value of set_irq_wake
Browse files Browse the repository at this point in the history
The recent change in commit 2db8732
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>
  • Loading branch information
Robert Jarzmik authored and Anton Vorontsov committed Aug 31, 2008
1 parent bef69ea commit e82374f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/power/pda_power.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down

0 comments on commit e82374f

Please sign in to comment.