Merge branch 'omap-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6.git] / drivers / rtc / class.c
index 8b3cd31..be5a6b7 100644 (file)
@@ -46,10 +46,9 @@ static int rtc_suspend(struct device *dev, pm_message_t mesg)
 {
        struct rtc_device       *rtc = to_rtc_device(dev);
        struct rtc_time         tm;
+       struct timespec         ts = current_kernel_time();
 
-       if (strncmp(rtc->dev.bus_id,
-                               CONFIG_RTC_HCTOSYS_DEVICE,
-                               BUS_ID_SIZE) != 0)
+       if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0)
                return 0;
 
        rtc_read_time(rtc, &tm);
@@ -57,8 +56,8 @@ static int rtc_suspend(struct device *dev, pm_message_t mesg)
 
        /* RTC precision is 1 second; adjust delta for avg 1/2 sec err */
        set_normalized_timespec(&delta,
-                               xtime.tv_sec - oldtime,
-                               xtime.tv_nsec - (NSEC_PER_SEC >> 1));
+                               ts.tv_sec - oldtime,
+                               ts.tv_nsec - (NSEC_PER_SEC >> 1));
 
        return 0;
 }
@@ -70,20 +69,18 @@ static int rtc_resume(struct device *dev)
        time_t                  newtime;
        struct timespec         time;
 
-       if (strncmp(rtc->dev.bus_id,
-                               CONFIG_RTC_HCTOSYS_DEVICE,
-                               BUS_ID_SIZE) != 0)
+       if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0)
                return 0;
 
        rtc_read_time(rtc, &tm);
        if (rtc_valid_tm(&tm) != 0) {
-               pr_debug("%s:  bogus resume time\n", rtc->dev.bus_id);
+               pr_debug("%s:  bogus resume time\n", dev_name(&rtc->dev));
                return 0;
        }
        rtc_tm_to_time(&tm, &newtime);
        if (newtime <= oldtime) {
                if (newtime < oldtime)
-                       pr_debug("%s:  time travel!\n", rtc->dev.bus_id);
+                       pr_debug("%s:  time travel!\n", dev_name(&rtc->dev));
                return 0;
        }
 
@@ -152,9 +149,10 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
        mutex_init(&rtc->ops_lock);
        spin_lock_init(&rtc->irq_lock);
        spin_lock_init(&rtc->irq_task_lock);
+       init_waitqueue_head(&rtc->irq_queue);
 
        strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE);
-       snprintf(rtc->dev.bus_id, BUS_ID_SIZE, "rtc%d", id);
+       dev_set_name(&rtc->dev, "rtc%d", id);
 
        rtc_dev_prepare(rtc);
 
@@ -167,7 +165,7 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
        rtc_proc_add_device(rtc);
 
        dev_info(dev, "rtc core: registered %s as %s\n",
-                       rtc->name, rtc->dev.bus_id);
+                       rtc->name, dev_name(&rtc->dev));
 
        return rtc;