aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/rtc/interface.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 38d1dc74b2c..636a2ec2181 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -762,6 +762,14 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer)
762 return 0; 762 return 0;
763} 763}
764 764
765static void rtc_alarm_disable(struct rtc_device *rtc)
766{
767 if (!rtc->ops || !rtc->ops->alarm_irq_enable)
768 return;
769
770 rtc->ops->alarm_irq_enable(rtc->dev.parent, false);
771}
772
765/** 773/**
766 * rtc_timer_remove - Removes a rtc_timer from the rtc_device timerqueue 774 * rtc_timer_remove - Removes a rtc_timer from the rtc_device timerqueue
767 * @rtc rtc device 775 * @rtc rtc device
@@ -783,8 +791,10 @@ static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer)
783 struct rtc_wkalrm alarm; 791 struct rtc_wkalrm alarm;
784 int err; 792 int err;
785 next = timerqueue_getnext(&rtc->timerqueue); 793 next = timerqueue_getnext(&rtc->timerqueue);
786 if (!next) 794 if (!next) {
795 rtc_alarm_disable(rtc);
787 return; 796 return;
797 }
788 alarm.time = rtc_ktime_to_tm(next->expires); 798 alarm.time = rtc_ktime_to_tm(next->expires);
789 alarm.enabled = 1; 799 alarm.enabled = 1;
790 err = __rtc_set_alarm(rtc, &alarm); 800 err = __rtc_set_alarm(rtc, &alarm);
@@ -846,7 +856,8 @@ again:
846 err = __rtc_set_alarm(rtc, &alarm); 856 err = __rtc_set_alarm(rtc, &alarm);
847 if (err == -ETIME) 857 if (err == -ETIME)
848 goto again; 858 goto again;
849 } 859 } else
860 rtc_alarm_disable(rtc);
850 861
851 mutex_unlock(&rtc->ops_lock); 862 mutex_unlock(&rtc->ops_lock);
852} 863}