aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/alarmtimer.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/time/alarmtimer.c')
-rw-r--r--kernel/time/alarmtimer.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index 9265014cb4db..2d966244ea60 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -494,7 +494,7 @@ static int update_rmtp(ktime_t exp, enum alarmtimer_type type,
494 */ 494 */
495static long __sched alarm_timer_nsleep_restart(struct restart_block *restart) 495static long __sched alarm_timer_nsleep_restart(struct restart_block *restart)
496{ 496{
497 enum alarmtimer_type type = restart->nanosleep.index; 497 enum alarmtimer_type type = restart->nanosleep.clockid;
498 ktime_t exp; 498 ktime_t exp;
499 struct timespec __user *rmtp; 499 struct timespec __user *rmtp;
500 struct alarm alarm; 500 struct alarm alarm;
@@ -573,7 +573,7 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
573 573
574 restart = &current_thread_info()->restart_block; 574 restart = &current_thread_info()->restart_block;
575 restart->fn = alarm_timer_nsleep_restart; 575 restart->fn = alarm_timer_nsleep_restart;
576 restart->nanosleep.index = type; 576 restart->nanosleep.clockid = type;
577 restart->nanosleep.expires = exp.tv64; 577 restart->nanosleep.expires = exp.tv64;
578 restart->nanosleep.rmtp = rmtp; 578 restart->nanosleep.rmtp = rmtp;
579 ret = -ERESTART_RESTARTBLOCK; 579 ret = -ERESTART_RESTARTBLOCK;
@@ -669,12 +669,20 @@ static int __init has_wakealarm(struct device *dev, void *name_ptr)
669 */ 669 */
670static int __init alarmtimer_init_late(void) 670static int __init alarmtimer_init_late(void)
671{ 671{
672 struct device *dev;
672 char *str; 673 char *str;
673 674
674 /* Find an rtc device and init the rtc_timer */ 675 /* Find an rtc device and init the rtc_timer */
675 class_find_device(rtc_class, NULL, &str, has_wakealarm); 676 dev = class_find_device(rtc_class, NULL, &str, has_wakealarm);
676 if (str) 677 /* If we have a device then str is valid. See has_wakealarm() */
678 if (dev) {
677 rtcdev = rtc_class_open(str); 679 rtcdev = rtc_class_open(str);
680 /*
681 * Drop the reference we got in class_find_device,
682 * rtc_open takes its own.
683 */
684 put_device(dev);
685 }
678 if (!rtcdev) { 686 if (!rtcdev) {
679 printk(KERN_WARNING "No RTC device found, ALARM timers will" 687 printk(KERN_WARNING "No RTC device found, ALARM timers will"
680 " not wake from suspend"); 688 " not wake from suspend");