summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-at32ap700x.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-06-16 11:27:18 +0200
committerIngo Molnar <mingo@elte.hu>2008-06-16 11:27:18 +0200
commit33ee375b2ea5dd11581a57d67bedd0ca39b19a5e (patch)
tree411d3a04936e281e54680ad082f98d985561bce5 /drivers/rtc/rtc-at32ap700x.c
parent6703f6d10dcd3316e03641a5ecaa6c8a04374d98 (diff)
parent066519068ad2fbe98c7f45552b1f592903a9c8c8 (diff)
Merge branch 'linus' into x86/garttip-x86-gart-2008-06-16_09.27_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