提交 157e8bf8 编写于 作者: L Linus Torvalds

Revert "rtc: Disable the alarm in the hardware"

This reverts commit c0afabd3.

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: NJohn Stultz <john.stultz@linaro.org>
Cc: stable@kernel.org  # for the versions that applied this
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 f9fab10b
...@@ -323,20 +323,6 @@ int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) ...@@ -323,20 +323,6 @@ int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
} }
EXPORT_SYMBOL_GPL(rtc_read_alarm); EXPORT_SYMBOL_GPL(rtc_read_alarm);
static int ___rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
{
int err;
if (!rtc->ops)
err = -ENODEV;
else if (!rtc->ops->set_alarm)
err = -EINVAL;
else
err = rtc->ops->set_alarm(rtc->dev.parent, alarm);
return err;
}
static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
{ {
struct rtc_time tm; struct rtc_time tm;
...@@ -360,7 +346,14 @@ static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) ...@@ -360,7 +346,14 @@ static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
* over right here, before we set the alarm. * over right here, before we set the alarm.
*/ */
return ___rtc_set_alarm(rtc, alarm); if (!rtc->ops)
err = -ENODEV;
else if (!rtc->ops->set_alarm)
err = -EINVAL;
else
err = rtc->ops->set_alarm(rtc->dev.parent, alarm);
return err;
} }
int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
...@@ -776,20 +769,6 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer) ...@@ -776,20 +769,6 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer)
return 0; return 0;
} }
static void rtc_alarm_disable(struct rtc_device *rtc)
{
struct rtc_wkalrm alarm;
struct rtc_time tm;
__rtc_read_time(rtc, &tm);
alarm.time = rtc_ktime_to_tm(ktime_add(rtc_tm_to_ktime(tm),
ktime_set(300, 0)));
alarm.enabled = 0;
___rtc_set_alarm(rtc, &alarm);
}
/** /**
* rtc_timer_remove - Removes a rtc_timer from the rtc_device timerqueue * rtc_timer_remove - Removes a rtc_timer from the rtc_device timerqueue
* @rtc rtc device * @rtc rtc device
...@@ -811,10 +790,8 @@ static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer) ...@@ -811,10 +790,8 @@ static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer)
struct rtc_wkalrm alarm; struct rtc_wkalrm alarm;
int err; int err;
next = timerqueue_getnext(&rtc->timerqueue); next = timerqueue_getnext(&rtc->timerqueue);
if (!next) { if (!next)
rtc_alarm_disable(rtc);
return; return;
}
alarm.time = rtc_ktime_to_tm(next->expires); alarm.time = rtc_ktime_to_tm(next->expires);
alarm.enabled = 1; alarm.enabled = 1;
err = __rtc_set_alarm(rtc, &alarm); err = __rtc_set_alarm(rtc, &alarm);
...@@ -876,8 +853,7 @@ void rtc_timer_do_work(struct work_struct *work) ...@@ -876,8 +853,7 @@ void rtc_timer_do_work(struct work_struct *work)
err = __rtc_set_alarm(rtc, &alarm); err = __rtc_set_alarm(rtc, &alarm);
if (err == -ETIME) if (err == -ETIME)
goto again; goto again;
} else }
rtc_alarm_disable(rtc);
mutex_unlock(&rtc->ops_lock); mutex_unlock(&rtc->ops_lock);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册