summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-at32ap700x.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-06-16 11:17:19 +0200
committerIngo Molnar <mingo@elte.hu>2008-06-16 11:17:19 +0200
commited9e4996d9a123b7550e63713d563f524fa9d9f0 (patch)
treea9be05d357b407aac80118b86f25d21a5dbdfc88 /drivers/rtc/rtc-at32ap700x.c
parent4d2df795f0c3eb91f97a666f47716121a2f166ed (diff)
parent066519068ad2fbe98c7f45552b1f592903a9c8c8 (diff)
Merge branch 'linus' into tracing/sysproftip-tracing-sysprof-2008-06-16_09.17_Mon
Diffstat (limited to 'drivers/rtc/rtc-at32ap700x.c')
-rw-r--r--drivers/rtc/rtc-at32ap700x.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c
index 42244f14b41c..2ef8cdfda4a7 100644
--- a/drivers/rtc/rtc-at32ap700x.c
+++ b/drivers/rtc/rtc-at32ap700x.c
@@ -94,8 +94,11 @@ static int at32_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
{
struct rtc_at32ap700x *rtc = dev_get_drvdata(dev);
+ spin_lock_irq(&rtc->lock);
rtc_time_to_tm(rtc->alarm_time, &alrm->time);
- alrm->pending = rtc_readl(rtc, IMR) & RTC_BIT(IMR_TOPI) ? 1 : 0;
+ alrm->enabled = rtc_readl(rtc, IMR) & RTC_BIT(IMR_TOPI) ? 1 : 0;
+ alrm->pending = rtc_readl(rtc, ISR) & RTC_BIT(ISR_TOPI) ? 1 : 0;
+ spin_unlock_irq(&rtc->lock);
return 0;
}
@@ -119,7 +122,7 @@ static int at32_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
spin_lock_irq(&rtc->lock);
rtc->alarm_time = alarm_unix_time;
rtc_writel(rtc, TOP, rtc->alarm_time);
- if (alrm->pending)
+ if (alrm->enabled)
rtc_writel(rtc, CTRL, rtc_readl(rtc, CTRL)
| RTC_BIT(CTRL_TOPEN));
else