Skip to content

Commit f63f475

Browse files
torvaldsgregkh
authored andcommitted
Revert "rtc: Disable the alarm in the hardware"
commit 157e8bf upstream. This reverts commit c0afabd. It causes failures on Toshiba laptops - instead of disabling the alarm, it actually seems to enable it on the affected laptops, resulting in (for example) the laptop powering on automatically five minutes after shutdown. There's a patch for it that appears to work for at least some people, but it's too late to play around with this, so revert for now and try again in the next merge window. See for example http://bugs.debian.org/652869 Reported-and-bisected-by: Andreas Friedrich <afrie@gmx.net> (Toshiba Tecra) Reported-by: Antonio-M. Corbi Bellot <antonio.corbi@ua.es> (Toshiba Portege R500) Reported-by: Marco Santos <marco.santos@waynext.com> (Toshiba Portege Z830) Reported-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr> (Toshiba Portege R830) Cc: Jonathan Nieder <jrnieder@gmail.com> Requested-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 12ed227 commit f63f475

1 file changed

Lines changed: 10 additions & 34 deletions

File tree

‎drivers/rtc/interface.c‎

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -318,20 +318,6 @@ int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
318318
}
319319
EXPORT_SYMBOL_GPL(rtc_read_alarm);
320320

321-
static int ___rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
322-
{
323-
int err;
324-
325-
if (!rtc->ops)
326-
err = -ENODEV;
327-
else if (!rtc->ops->set_alarm)
328-
err = -EINVAL;
329-
else
330-
err = rtc->ops->set_alarm(rtc->dev.parent, alarm);
331-
332-
return err;
333-
}
334-
335321
static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
336322
{
337323
struct rtc_time tm;
@@ -355,7 +341,14 @@ static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
355341
* over right here, before we set the alarm.
356342
*/
357343

358-
return ___rtc_set_alarm(rtc, alarm);
344+
if (!rtc->ops)
345+
err = -ENODEV;
346+
else if (!rtc->ops->set_alarm)
347+
err = -EINVAL;
348+
else
349+
err = rtc->ops->set_alarm(rtc->dev.parent, alarm);
350+
351+
return err;
359352
}
360353

361354
int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
@@ -769,20 +762,6 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer)
769762
return 0;
770763
}
771764

772-
static void rtc_alarm_disable(struct rtc_device *rtc)
773-
{
774-
struct rtc_wkalrm alarm;
775-
struct rtc_time tm;
776-
777-
__rtc_read_time(rtc, &tm);
778-
779-
alarm.time = rtc_ktime_to_tm(ktime_add(rtc_tm_to_ktime(tm),
780-
ktime_set(300, 0)));
781-
alarm.enabled = 0;
782-
783-
___rtc_set_alarm(rtc, &alarm);
784-
}
785-
786765
/**
787766
* rtc_timer_remove - Removes a rtc_timer from the rtc_device timerqueue
788767
* @rtc rtc device
@@ -804,10 +783,8 @@ static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer)
804783
struct rtc_wkalrm alarm;
805784
int err;
806785
next = timerqueue_getnext(&rtc->timerqueue);
807-
if (!next) {
808-
rtc_alarm_disable(rtc);
786+
if (!next)
809787
return;
810-
}
811788
alarm.time = rtc_ktime_to_tm(next->expires);
812789
alarm.enabled = 1;
813790
err = __rtc_set_alarm(rtc, &alarm);
@@ -869,8 +846,7 @@ void rtc_timer_do_work(struct work_struct *work)
869846
err = __rtc_set_alarm(rtc, &alarm);
870847
if (err == -ETIME)
871848
goto again;
872-
} else
873-
rtc_alarm_disable(rtc);
849+
}
874850

875851
mutex_unlock(&rtc->ops_lock);
876852
}

0 commit comments

Comments
 (0)