Skip to content

Commit f501ed5

Browse files
Vladimir Zapolskiytorvalds
authored andcommitted
rtc: s3c: balance state changes of wakeup flag
This change resolves a problem about unbalanced calls of enable_irq_wakeup() and disable_irq_wakeup() for alarm interrupt. Bug reproduction: root@eb600:~# echo 0 > /sys/class/rtc/rtc0/wakealarm WARNING: at kernel/irq/manage.c:361 set_irq_wake+0x7c/0xe4() Unbalanced IRQ 46 wake disable Modules linked in: [<c0025708>] (unwind_backtrace+0x0/0xd8) from [<c003358c>] (warn_slowpath_common+0x44/0x5c) [<c003358c>] (warn_slowpath_common+0x44/0x5c) from [<c00335dc>] (warn_slowpath_fmt+0x24/0x30) [<c00335dc>] (warn_slowpath_fmt+0x24/0x30) from [<c0058c20>] (set_irq_wake+0x7c/0xe4) [<c0058c20>] (set_irq_wake+0x7c/0xe4) from [<c01b5e80>] (s3c_rtc_setalarm+0xa8/0xb8) [<c01b5e80>] (s3c_rtc_setalarm+0xa8/0xb8) from [<c01b47a0>] (rtc_set_alarm+0x60/0x74) [<c01b47a0>] (rtc_set_alarm+0x60/0x74) from [<c01b5a98>] (rtc_sysfs_set_wakealarm+0xc8/0xd8) [<c01b5a98>] (rtc_sysfs_set_wakealarm+0xc8/0xd8) from [<c01891ec>] (dev_attr_store+0x20/0x24) [<c01891ec>] (dev_attr_store+0x20/0x24) from [<c00be934>] (sysfs_write_file+0x104/0x13c) [<c00be934>] (sysfs_write_file+0x104/0x13c) from [<c0080e7c>] (vfs_write+0xb0/0x158) [<c0080e7c>] (vfs_write+0xb0/0x158) from [<c0080fcc>] (sys_write+0x3c/0x68) [<c0080fcc>] (sys_write+0x3c/0x68) from [<c0020ec0>] (ret_fast_syscall+0x0/0x28) Signed-off-by: Vladimir Zapolskiy <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Ben Dooks <[email protected]> Cc: Atul Dahiya <[email protected]> Cc: Taekgyun Ko <[email protected]> Cc: Kukjin Kim <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 2aeadc3 commit f501ed5

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/rtc/rtc-s3c.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,6 @@ static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
310310

311311
s3c_rtc_setaie(alrm->enabled);
312312

313-
if (alrm->enabled)
314-
enable_irq_wake(s3c_rtc_alarmno);
315-
else
316-
disable_irq_wake(s3c_rtc_alarmno);
317-
318313
return 0;
319314
}
320315

@@ -587,6 +582,10 @@ static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state)
587582
ticnt_en_save &= S3C64XX_RTCCON_TICEN;
588583
}
589584
s3c_rtc_enable(pdev, 0);
585+
586+
if (device_may_wakeup(&pdev->dev))
587+
enable_irq_wake(s3c_rtc_alarmno);
588+
590589
return 0;
591590
}
592591

@@ -600,6 +599,10 @@ static int s3c_rtc_resume(struct platform_device *pdev)
600599
tmp = readb(s3c_rtc_base + S3C2410_RTCCON);
601600
writeb(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON);
602601
}
602+
603+
if (device_may_wakeup(&pdev->dev))
604+
disable_irq_wake(s3c_rtc_alarmno);
605+
603606
return 0;
604607
}
605608
#else

0 commit comments

Comments
 (0)