Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Revert "rtc: Disable the alarm in the hardware"

This reverts commit c0afabd3d553c521e003779c127143ffde55a16f.

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>
Cc: stable@kernel.org # for the versions that applied this
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+10 -34
+10 -34
drivers/rtc/interface.c
··· 323 323 } 324 324 EXPORT_SYMBOL_GPL(rtc_read_alarm); 325 325 326 - static int ___rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) 327 - { 328 - int err; 329 - 330 - if (!rtc->ops) 331 - err = -ENODEV; 332 - else if (!rtc->ops->set_alarm) 333 - err = -EINVAL; 334 - else 335 - err = rtc->ops->set_alarm(rtc->dev.parent, alarm); 336 - 337 - return err; 338 - } 339 - 340 326 static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) 341 327 { 342 328 struct rtc_time tm; ··· 346 360 * over right here, before we set the alarm. 347 361 */ 348 362 349 - return ___rtc_set_alarm(rtc, alarm); 363 + if (!rtc->ops) 364 + err = -ENODEV; 365 + else if (!rtc->ops->set_alarm) 366 + err = -EINVAL; 367 + else 368 + err = rtc->ops->set_alarm(rtc->dev.parent, alarm); 369 + 370 + return err; 350 371 } 351 372 352 373 int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) ··· 769 776 return 0; 770 777 } 771 778 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 - 786 779 /** 787 780 * rtc_timer_remove - Removes a rtc_timer from the rtc_device timerqueue 788 781 * @rtc rtc device ··· 790 811 struct rtc_wkalrm alarm; 791 812 int err; 792 813 next = timerqueue_getnext(&rtc->timerqueue); 793 - if (!next) { 794 - rtc_alarm_disable(rtc); 814 + if (!next) 795 815 return; 796 - } 797 816 alarm.time = rtc_ktime_to_tm(next->expires); 798 817 alarm.enabled = 1; 799 818 err = __rtc_set_alarm(rtc, &alarm); ··· 853 876 err = __rtc_set_alarm(rtc, &alarm); 854 877 if (err == -ETIME) 855 878 goto again; 856 - } else 857 - rtc_alarm_disable(rtc); 879 + } 858 880 859 881 mutex_unlock(&rtc->ops_lock); 860 882 }