aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/class.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/class.c')
-rw-r--r--drivers/rtc/class.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index 4dfdf019fccc..be5a6b73e601 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -48,9 +48,7 @@ static int rtc_suspend(struct device *dev, pm_message_t mesg)
48 struct rtc_time tm; 48 struct rtc_time tm;
49 struct timespec ts = current_kernel_time(); 49 struct timespec ts = current_kernel_time();
50 50
51 if (strncmp(rtc->dev.bus_id, 51 if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0)
52 CONFIG_RTC_HCTOSYS_DEVICE,
53 BUS_ID_SIZE) != 0)
54 return 0; 52 return 0;
55 53
56 rtc_read_time(rtc, &tm); 54 rtc_read_time(rtc, &tm);
@@ -71,20 +69,18 @@ static int rtc_resume(struct device *dev)
71 time_t newtime; 69 time_t newtime;
72 struct timespec time; 70 struct timespec time;
73 71
74 if (strncmp(rtc->dev.bus_id, 72 if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0)
75 CONFIG_RTC_HCTOSYS_DEVICE,
76 BUS_ID_SIZE) != 0)
77 return 0; 73 return 0;
78 74
79 rtc_read_time(rtc, &tm); 75 rtc_read_time(rtc, &tm);
80 if (rtc_valid_tm(&tm) != 0) { 76 if (rtc_valid_tm(&tm) != 0) {
81 pr_debug("%s: bogus resume time\n", rtc->dev.bus_id); 77 pr_debug("%s: bogus resume time\n", dev_name(&rtc->dev));
82 return 0; 78 return 0;
83 } 79 }
84 rtc_tm_to_time(&tm, &newtime); 80 rtc_tm_to_time(&tm, &newtime);
85 if (newtime <= oldtime) { 81 if (newtime <= oldtime) {
86 if (newtime < oldtime) 82 if (newtime < oldtime)
87 pr_debug("%s: time travel!\n", rtc->dev.bus_id); 83 pr_debug("%s: time travel!\n", dev_name(&rtc->dev));
88 return 0; 84 return 0;
89 } 85 }
90 86
@@ -156,7 +152,7 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
156 init_waitqueue_head(&rtc->irq_queue); 152 init_waitqueue_head(&rtc->irq_queue);
157 153
158 strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); 154 strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE);
159 snprintf(rtc->dev.bus_id, BUS_ID_SIZE, "rtc%d", id); 155 dev_set_name(&rtc->dev, "rtc%d", id);
160 156
161 rtc_dev_prepare(rtc); 157 rtc_dev_prepare(rtc);
162 158
@@ -169,7 +165,7 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
169 rtc_proc_add_device(rtc); 165 rtc_proc_add_device(rtc);
170 166
171 dev_info(dev, "rtc core: registered %s as %s\n", 167 dev_info(dev, "rtc core: registered %s as %s\n",
172 rtc->name, rtc->dev.bus_id); 168 rtc->name, dev_name(&rtc->dev));
173 169
174 return rtc; 170 return rtc;
175 171