Commit 52cd4e5c authored by Ben Dooks's avatar Ben Dooks Committed by Linus Torvalds

drivers/rtc/rtc-s3c.c: fixup wake support for rtc

The driver is not balancing set_irq and disable_irq_wake() calls, so
ensure that it keeps track of whether the wake is enabled.

The fixes the following error on S3C6410 devices:

  WARNING: at kernel/irq/manage.c:382 set_irq_wake+0x84/0xec()
  Unbalanced IRQ 92 wake disable
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9f381a61
...@@ -46,6 +46,7 @@ static struct clk *rtc_clk; ...@@ -46,6 +46,7 @@ static struct clk *rtc_clk;
static void __iomem *s3c_rtc_base; static void __iomem *s3c_rtc_base;
static int s3c_rtc_alarmno = NO_IRQ; static int s3c_rtc_alarmno = NO_IRQ;
static int s3c_rtc_tickno = NO_IRQ; static int s3c_rtc_tickno = NO_IRQ;
static bool wake_en;
static enum s3c_cpu_type s3c_rtc_cpu_type; static enum s3c_cpu_type s3c_rtc_cpu_type;
static DEFINE_SPINLOCK(s3c_rtc_pie_lock); static DEFINE_SPINLOCK(s3c_rtc_pie_lock);
...@@ -562,8 +563,12 @@ static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -562,8 +563,12 @@ static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state)
} }
s3c_rtc_enable(pdev, 0); s3c_rtc_enable(pdev, 0);
if (device_may_wakeup(&pdev->dev)) if (device_may_wakeup(&pdev->dev) && !wake_en) {
enable_irq_wake(s3c_rtc_alarmno); if (enable_irq_wake(s3c_rtc_alarmno) == 0)
wake_en = true;
else
dev_err(&pdev->dev, "enable_irq_wake failed\n");
}
return 0; return 0;
} }
...@@ -579,8 +584,10 @@ static int s3c_rtc_resume(struct platform_device *pdev) ...@@ -579,8 +584,10 @@ static int s3c_rtc_resume(struct platform_device *pdev)
writew(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); writew(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON);
} }
if (device_may_wakeup(&pdev->dev)) if (device_may_wakeup(&pdev->dev) && wake_en) {
disable_irq_wake(s3c_rtc_alarmno); disable_irq_wake(s3c_rtc_alarmno);
wake_en = false;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment