diff options
-rw-r--r-- | drivers/rtc/class.c | 22 | ||||
-rw-r--r-- | drivers/rtc/hctosys.c | 6 | ||||
-rw-r--r-- | drivers/rtc/interface.c | 34 | ||||
-rw-r--r-- | drivers/rtc/rtc-cmos.c | 12 | ||||
-rw-r--r-- | drivers/rtc/rtc-dev.c | 14 | ||||
-rw-r--r-- | drivers/rtc/rtc-omap.c | 8 | ||||
-rw-r--r-- | drivers/rtc/rtc-proc.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-sysfs.c | 38 | ||||
-rw-r--r-- | include/linux/rtc.h | 4 |
9 files changed, 74 insertions, 66 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 9230001bd591..d58d74cf570e 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
@@ -23,9 +23,9 @@ static DEFINE_IDR(rtc_idr); | |||
23 | static DEFINE_MUTEX(idr_lock); | 23 | static DEFINE_MUTEX(idr_lock); |
24 | struct class *rtc_class; | 24 | struct class *rtc_class; |
25 | 25 | ||
26 | static void rtc_device_release(struct class_device *class_dev) | 26 | static void rtc_device_release(struct device *dev) |
27 | { | 27 | { |
28 | struct rtc_device *rtc = to_rtc_device(class_dev); | 28 | struct rtc_device *rtc = to_rtc_device(dev); |
29 | mutex_lock(&idr_lock); | 29 | mutex_lock(&idr_lock); |
30 | idr_remove(&rtc_idr, rtc->id); | 30 | idr_remove(&rtc_idr, rtc->id); |
31 | mutex_unlock(&idr_lock); | 31 | mutex_unlock(&idr_lock); |
@@ -73,18 +73,18 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev, | |||
73 | rtc->ops = ops; | 73 | rtc->ops = ops; |
74 | rtc->owner = owner; | 74 | rtc->owner = owner; |
75 | rtc->max_user_freq = 64; | 75 | rtc->max_user_freq = 64; |
76 | rtc->class_dev.dev = dev; | 76 | rtc->dev.parent = dev; |
77 | rtc->class_dev.class = rtc_class; | 77 | rtc->dev.class = rtc_class; |
78 | rtc->class_dev.release = rtc_device_release; | 78 | rtc->dev.release = rtc_device_release; |
79 | 79 | ||
80 | mutex_init(&rtc->ops_lock); | 80 | mutex_init(&rtc->ops_lock); |
81 | spin_lock_init(&rtc->irq_lock); | 81 | spin_lock_init(&rtc->irq_lock); |
82 | spin_lock_init(&rtc->irq_task_lock); | 82 | spin_lock_init(&rtc->irq_task_lock); |
83 | 83 | ||
84 | strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); | 84 | strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); |
85 | snprintf(rtc->class_dev.class_id, BUS_ID_SIZE, "rtc%d", id); | 85 | snprintf(rtc->dev.bus_id, BUS_ID_SIZE, "rtc%d", id); |
86 | 86 | ||
87 | err = class_device_register(&rtc->class_dev); | 87 | err = device_register(&rtc->dev); |
88 | if (err) | 88 | if (err) |
89 | goto exit_kfree; | 89 | goto exit_kfree; |
90 | 90 | ||
@@ -93,7 +93,7 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev, | |||
93 | rtc_proc_add_device(rtc); | 93 | rtc_proc_add_device(rtc); |
94 | 94 | ||
95 | dev_info(dev, "rtc core: registered %s as %s\n", | 95 | dev_info(dev, "rtc core: registered %s as %s\n", |
96 | rtc->name, rtc->class_dev.class_id); | 96 | rtc->name, rtc->dev.bus_id); |
97 | 97 | ||
98 | return rtc; | 98 | return rtc; |
99 | 99 | ||
@@ -120,7 +120,7 @@ EXPORT_SYMBOL_GPL(rtc_device_register); | |||
120 | */ | 120 | */ |
121 | void rtc_device_unregister(struct rtc_device *rtc) | 121 | void rtc_device_unregister(struct rtc_device *rtc) |
122 | { | 122 | { |
123 | if (class_device_get(&rtc->class_dev) != NULL) { | 123 | if (get_device(&rtc->dev) != NULL) { |
124 | mutex_lock(&rtc->ops_lock); | 124 | mutex_lock(&rtc->ops_lock); |
125 | /* remove innards of this RTC, then disable it, before | 125 | /* remove innards of this RTC, then disable it, before |
126 | * letting any rtc_class_open() users access it again | 126 | * letting any rtc_class_open() users access it again |
@@ -128,10 +128,10 @@ void rtc_device_unregister(struct rtc_device *rtc) | |||
128 | rtc_sysfs_del_device(rtc); | 128 | rtc_sysfs_del_device(rtc); |
129 | rtc_dev_del_device(rtc); | 129 | rtc_dev_del_device(rtc); |
130 | rtc_proc_del_device(rtc); | 130 | rtc_proc_del_device(rtc); |
131 | class_device_unregister(&rtc->class_dev); | 131 | device_unregister(&rtc->dev); |
132 | rtc->ops = NULL; | 132 | rtc->ops = NULL; |
133 | mutex_unlock(&rtc->ops_lock); | 133 | mutex_unlock(&rtc->ops_lock); |
134 | class_device_put(&rtc->class_dev); | 134 | put_device(&rtc->dev); |
135 | } | 135 | } |
136 | } | 136 | } |
137 | EXPORT_SYMBOL_GPL(rtc_device_unregister); | 137 | EXPORT_SYMBOL_GPL(rtc_device_unregister); |
diff --git a/drivers/rtc/hctosys.c b/drivers/rtc/hctosys.c index f48a8aed5b0f..178527252c6a 100644 --- a/drivers/rtc/hctosys.c +++ b/drivers/rtc/hctosys.c | |||
@@ -46,7 +46,7 @@ static int __init rtc_hctosys(void) | |||
46 | 46 | ||
47 | do_settimeofday(&tv); | 47 | do_settimeofday(&tv); |
48 | 48 | ||
49 | dev_info(rtc->class_dev.dev, | 49 | dev_info(rtc->dev.parent, |
50 | "setting the system clock to " | 50 | "setting the system clock to " |
51 | "%d-%02d-%02d %02d:%02d:%02d (%u)\n", | 51 | "%d-%02d-%02d %02d:%02d:%02d (%u)\n", |
52 | tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, | 52 | tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, |
@@ -54,11 +54,11 @@ static int __init rtc_hctosys(void) | |||
54 | (unsigned int) tv.tv_sec); | 54 | (unsigned int) tv.tv_sec); |
55 | } | 55 | } |
56 | else | 56 | else |
57 | dev_err(rtc->class_dev.dev, | 57 | dev_err(rtc->dev.parent, |
58 | "hctosys: invalid date/time\n"); | 58 | "hctosys: invalid date/time\n"); |
59 | } | 59 | } |
60 | else | 60 | else |
61 | dev_err(rtc->class_dev.dev, | 61 | dev_err(rtc->dev.parent, |
62 | "hctosys: unable to read the hardware clock\n"); | 62 | "hctosys: unable to read the hardware clock\n"); |
63 | 63 | ||
64 | rtc_class_close(rtc); | 64 | rtc_class_close(rtc); |
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index d9d326ff6253..b5cc5f82436d 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -27,7 +27,7 @@ int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm) | |||
27 | err = -EINVAL; | 27 | err = -EINVAL; |
28 | else { | 28 | else { |
29 | memset(tm, 0, sizeof(struct rtc_time)); | 29 | memset(tm, 0, sizeof(struct rtc_time)); |
30 | err = rtc->ops->read_time(rtc->class_dev.dev, tm); | 30 | err = rtc->ops->read_time(rtc->dev.parent, tm); |
31 | } | 31 | } |
32 | 32 | ||
33 | mutex_unlock(&rtc->ops_lock); | 33 | mutex_unlock(&rtc->ops_lock); |
@@ -52,7 +52,7 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm) | |||
52 | else if (!rtc->ops->set_time) | 52 | else if (!rtc->ops->set_time) |
53 | err = -EINVAL; | 53 | err = -EINVAL; |
54 | else | 54 | else |
55 | err = rtc->ops->set_time(rtc->class_dev.dev, tm); | 55 | err = rtc->ops->set_time(rtc->dev.parent, tm); |
56 | 56 | ||
57 | mutex_unlock(&rtc->ops_lock); | 57 | mutex_unlock(&rtc->ops_lock); |
58 | return err; | 58 | return err; |
@@ -70,11 +70,11 @@ int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs) | |||
70 | if (!rtc->ops) | 70 | if (!rtc->ops) |
71 | err = -ENODEV; | 71 | err = -ENODEV; |
72 | else if (rtc->ops->set_mmss) | 72 | else if (rtc->ops->set_mmss) |
73 | err = rtc->ops->set_mmss(rtc->class_dev.dev, secs); | 73 | err = rtc->ops->set_mmss(rtc->dev.parent, secs); |
74 | else if (rtc->ops->read_time && rtc->ops->set_time) { | 74 | else if (rtc->ops->read_time && rtc->ops->set_time) { |
75 | struct rtc_time new, old; | 75 | struct rtc_time new, old; |
76 | 76 | ||
77 | err = rtc->ops->read_time(rtc->class_dev.dev, &old); | 77 | err = rtc->ops->read_time(rtc->dev.parent, &old); |
78 | if (err == 0) { | 78 | if (err == 0) { |
79 | rtc_time_to_tm(secs, &new); | 79 | rtc_time_to_tm(secs, &new); |
80 | 80 | ||
@@ -86,7 +86,7 @@ int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs) | |||
86 | */ | 86 | */ |
87 | if (!((old.tm_hour == 23 && old.tm_min == 59) || | 87 | if (!((old.tm_hour == 23 && old.tm_min == 59) || |
88 | (new.tm_hour == 23 && new.tm_min == 59))) | 88 | (new.tm_hour == 23 && new.tm_min == 59))) |
89 | err = rtc->ops->set_time(rtc->class_dev.dev, | 89 | err = rtc->ops->set_time(rtc->dev.parent, |
90 | &new); | 90 | &new); |
91 | } | 91 | } |
92 | } | 92 | } |
@@ -113,7 +113,7 @@ int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | |||
113 | err = -EINVAL; | 113 | err = -EINVAL; |
114 | else { | 114 | else { |
115 | memset(alarm, 0, sizeof(struct rtc_wkalrm)); | 115 | memset(alarm, 0, sizeof(struct rtc_wkalrm)); |
116 | err = rtc->ops->read_alarm(rtc->class_dev.dev, alarm); | 116 | err = rtc->ops->read_alarm(rtc->dev.parent, alarm); |
117 | } | 117 | } |
118 | 118 | ||
119 | mutex_unlock(&rtc->ops_lock); | 119 | mutex_unlock(&rtc->ops_lock); |
@@ -134,7 +134,7 @@ int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | |||
134 | else if (!rtc->ops->set_alarm) | 134 | else if (!rtc->ops->set_alarm) |
135 | err = -EINVAL; | 135 | err = -EINVAL; |
136 | else | 136 | else |
137 | err = rtc->ops->set_alarm(rtc->class_dev.dev, alarm); | 137 | err = rtc->ops->set_alarm(rtc->dev.parent, alarm); |
138 | 138 | ||
139 | mutex_unlock(&rtc->ops_lock); | 139 | mutex_unlock(&rtc->ops_lock); |
140 | return err; | 140 | return err; |
@@ -167,22 +167,22 @@ EXPORT_SYMBOL_GPL(rtc_update_irq); | |||
167 | 167 | ||
168 | struct rtc_device *rtc_class_open(char *name) | 168 | struct rtc_device *rtc_class_open(char *name) |
169 | { | 169 | { |
170 | struct class_device *class_dev_tmp; | 170 | struct device *dev; |
171 | struct rtc_device *rtc = NULL; | 171 | struct rtc_device *rtc = NULL; |
172 | 172 | ||
173 | down(&rtc_class->sem); | 173 | down(&rtc_class->sem); |
174 | list_for_each_entry(class_dev_tmp, &rtc_class->children, node) { | 174 | list_for_each_entry(dev, &rtc_class->devices, node) { |
175 | if (strncmp(class_dev_tmp->class_id, name, BUS_ID_SIZE) == 0) { | 175 | if (strncmp(dev->bus_id, name, BUS_ID_SIZE) == 0) { |
176 | class_dev_tmp = class_device_get(class_dev_tmp); | 176 | dev = get_device(dev); |
177 | if (class_dev_tmp) | 177 | if (dev) |
178 | rtc = to_rtc_device(class_dev_tmp); | 178 | rtc = to_rtc_device(dev); |
179 | break; | 179 | break; |
180 | } | 180 | } |
181 | } | 181 | } |
182 | 182 | ||
183 | if (rtc) { | 183 | if (rtc) { |
184 | if (!try_module_get(rtc->owner)) { | 184 | if (!try_module_get(rtc->owner)) { |
185 | class_device_put(class_dev_tmp); | 185 | put_device(dev); |
186 | rtc = NULL; | 186 | rtc = NULL; |
187 | } | 187 | } |
188 | } | 188 | } |
@@ -195,7 +195,7 @@ EXPORT_SYMBOL_GPL(rtc_class_open); | |||
195 | void rtc_class_close(struct rtc_device *rtc) | 195 | void rtc_class_close(struct rtc_device *rtc) |
196 | { | 196 | { |
197 | module_put(rtc->owner); | 197 | module_put(rtc->owner); |
198 | class_device_put(&rtc->class_dev); | 198 | put_device(&rtc->dev); |
199 | } | 199 | } |
200 | EXPORT_SYMBOL_GPL(rtc_class_close); | 200 | EXPORT_SYMBOL_GPL(rtc_class_close); |
201 | 201 | ||
@@ -241,7 +241,7 @@ int rtc_irq_set_state(struct rtc_device *rtc, struct rtc_task *task, int enabled | |||
241 | spin_unlock_irqrestore(&rtc->irq_task_lock, flags); | 241 | spin_unlock_irqrestore(&rtc->irq_task_lock, flags); |
242 | 242 | ||
243 | if (err == 0) | 243 | if (err == 0) |
244 | err = rtc->ops->irq_set_state(rtc->class_dev.dev, enabled); | 244 | err = rtc->ops->irq_set_state(rtc->dev.parent, enabled); |
245 | 245 | ||
246 | return err; | 246 | return err; |
247 | } | 247 | } |
@@ -261,7 +261,7 @@ int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq) | |||
261 | spin_unlock_irqrestore(&rtc->irq_task_lock, flags); | 261 | spin_unlock_irqrestore(&rtc->irq_task_lock, flags); |
262 | 262 | ||
263 | if (err == 0) { | 263 | if (err == 0) { |
264 | err = rtc->ops->irq_set_freq(rtc->class_dev.dev, freq); | 264 | err = rtc->ops->irq_set_freq(rtc->dev.parent, freq); |
265 | if (err == 0) | 265 | if (err == 0) |
266 | rtc->irq_freq = freq; | 266 | rtc->irq_freq = freq; |
267 | } | 267 | } |
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 4b586ebb5814..4e8c373f78e3 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
@@ -434,7 +434,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq) | |||
434 | goto cleanup0; | 434 | goto cleanup0; |
435 | } | 435 | } |
436 | } | 436 | } |
437 | rename_region(ports, cmos_rtc.rtc->class_dev.class_id); | 437 | rename_region(ports, cmos_rtc.rtc->dev.bus_id); |
438 | 438 | ||
439 | spin_lock_irq(&rtc_lock); | 439 | spin_lock_irq(&rtc_lock); |
440 | 440 | ||
@@ -470,7 +470,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq) | |||
470 | 470 | ||
471 | if (is_valid_irq(rtc_irq)) | 471 | if (is_valid_irq(rtc_irq)) |
472 | retval = request_irq(rtc_irq, cmos_interrupt, IRQF_DISABLED, | 472 | retval = request_irq(rtc_irq, cmos_interrupt, IRQF_DISABLED, |
473 | cmos_rtc.rtc->class_dev.class_id, | 473 | cmos_rtc.rtc->dev.bus_id, |
474 | cmos_rtc.rtc); | 474 | cmos_rtc.rtc); |
475 | if (retval < 0) { | 475 | if (retval < 0) { |
476 | dev_dbg(dev, "IRQ %d is already in use\n", rtc_irq); | 476 | dev_dbg(dev, "IRQ %d is already in use\n", rtc_irq); |
@@ -483,7 +483,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq) | |||
483 | */ | 483 | */ |
484 | 484 | ||
485 | pr_info("%s: alarms up to one %s%s\n", | 485 | pr_info("%s: alarms up to one %s%s\n", |
486 | cmos_rtc.rtc->class_dev.class_id, | 486 | cmos_rtc.rtc->dev.bus_id, |
487 | is_valid_irq(rtc_irq) | 487 | is_valid_irq(rtc_irq) |
488 | ? (cmos_rtc.mon_alrm | 488 | ? (cmos_rtc.mon_alrm |
489 | ? "year" | 489 | ? "year" |
@@ -525,7 +525,7 @@ static void __exit cmos_do_remove(struct device *dev) | |||
525 | rename_region(cmos->iomem, NULL); | 525 | rename_region(cmos->iomem, NULL); |
526 | 526 | ||
527 | if (is_valid_irq(cmos->irq)) | 527 | if (is_valid_irq(cmos->irq)) |
528 | free_irq(cmos->irq, &cmos_rtc.rtc->class_dev); | 528 | free_irq(cmos->irq, cmos_rtc.rtc); |
529 | 529 | ||
530 | rtc_device_unregister(cmos_rtc.rtc); | 530 | rtc_device_unregister(cmos_rtc.rtc); |
531 | 531 | ||
@@ -564,7 +564,7 @@ static int cmos_suspend(struct device *dev, pm_message_t mesg) | |||
564 | */ | 564 | */ |
565 | 565 | ||
566 | pr_debug("%s: suspend%s, ctrl %02x\n", | 566 | pr_debug("%s: suspend%s, ctrl %02x\n", |
567 | cmos_rtc.rtc->class_dev.class_id, | 567 | cmos_rtc.rtc->dev.bus_id, |
568 | (tmp & RTC_AIE) ? ", alarm may wake" : "", | 568 | (tmp & RTC_AIE) ? ", alarm may wake" : "", |
569 | tmp); | 569 | tmp); |
570 | 570 | ||
@@ -595,7 +595,7 @@ static int cmos_resume(struct device *dev) | |||
595 | } | 595 | } |
596 | 596 | ||
597 | pr_debug("%s: resume, ctrl %02x\n", | 597 | pr_debug("%s: resume, ctrl %02x\n", |
598 | cmos_rtc.rtc->class_dev.class_id, | 598 | cmos_rtc.rtc->dev.bus_id, |
599 | cmos->suspend_ctrl); | 599 | cmos->suspend_ctrl); |
600 | 600 | ||
601 | 601 | ||
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 623cb8d06b02..2c13433089a0 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
@@ -34,7 +34,7 @@ static int rtc_dev_open(struct inode *inode, struct file *file) | |||
34 | 34 | ||
35 | file->private_data = rtc; | 35 | file->private_data = rtc; |
36 | 36 | ||
37 | err = ops->open ? ops->open(rtc->class_dev.dev) : 0; | 37 | err = ops->open ? ops->open(rtc->dev.parent) : 0; |
38 | if (err == 0) { | 38 | if (err == 0) { |
39 | spin_lock_irq(&rtc->irq_lock); | 39 | spin_lock_irq(&rtc->irq_lock); |
40 | rtc->irq_data = 0; | 40 | rtc->irq_data = 0; |
@@ -180,7 +180,7 @@ rtc_dev_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
180 | if (ret == 0) { | 180 | if (ret == 0) { |
181 | /* Check for any data updates */ | 181 | /* Check for any data updates */ |
182 | if (rtc->ops->read_callback) | 182 | if (rtc->ops->read_callback) |
183 | data = rtc->ops->read_callback(rtc->class_dev.dev, | 183 | data = rtc->ops->read_callback(rtc->dev.parent, |
184 | data); | 184 | data); |
185 | 185 | ||
186 | if (sizeof(int) != sizeof(long) && | 186 | if (sizeof(int) != sizeof(long) && |
@@ -251,7 +251,7 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, | |||
251 | 251 | ||
252 | /* try the driver's ioctl interface */ | 252 | /* try the driver's ioctl interface */ |
253 | if (ops->ioctl) { | 253 | if (ops->ioctl) { |
254 | err = ops->ioctl(rtc->class_dev.dev, cmd, arg); | 254 | err = ops->ioctl(rtc->dev.parent, cmd, arg); |
255 | if (err != -ENOIOCTLCMD) | 255 | if (err != -ENOIOCTLCMD) |
256 | return err; | 256 | return err; |
257 | } | 257 | } |
@@ -371,7 +371,7 @@ static int rtc_dev_release(struct inode *inode, struct file *file) | |||
371 | clear_uie(rtc); | 371 | clear_uie(rtc); |
372 | #endif | 372 | #endif |
373 | if (rtc->ops->release) | 373 | if (rtc->ops->release) |
374 | rtc->ops->release(rtc->class_dev.dev); | 374 | rtc->ops->release(rtc->dev.parent); |
375 | 375 | ||
376 | mutex_unlock(&rtc->char_lock); | 376 | mutex_unlock(&rtc->char_lock); |
377 | return 0; | 377 | return 0; |
@@ -406,7 +406,7 @@ void rtc_dev_add_device(struct rtc_device *rtc) | |||
406 | return; | 406 | return; |
407 | } | 407 | } |
408 | 408 | ||
409 | rtc->class_dev.devt = MKDEV(MAJOR(rtc_devt), rtc->id); | 409 | rtc->dev.devt = MKDEV(MAJOR(rtc_devt), rtc->id); |
410 | 410 | ||
411 | mutex_init(&rtc->char_lock); | 411 | mutex_init(&rtc->char_lock); |
412 | spin_lock_init(&rtc->irq_lock); | 412 | spin_lock_init(&rtc->irq_lock); |
@@ -419,7 +419,7 @@ void rtc_dev_add_device(struct rtc_device *rtc) | |||
419 | cdev_init(&rtc->char_dev, &rtc_dev_fops); | 419 | cdev_init(&rtc->char_dev, &rtc_dev_fops); |
420 | rtc->char_dev.owner = rtc->owner; | 420 | rtc->char_dev.owner = rtc->owner; |
421 | 421 | ||
422 | if (cdev_add(&rtc->char_dev, rtc->class_dev.devt, 1)) | 422 | if (cdev_add(&rtc->char_dev, rtc->dev.devt, 1)) |
423 | printk(KERN_WARNING "%s: failed to add char device %d:%d\n", | 423 | printk(KERN_WARNING "%s: failed to add char device %d:%d\n", |
424 | rtc->name, MAJOR(rtc_devt), rtc->id); | 424 | rtc->name, MAJOR(rtc_devt), rtc->id); |
425 | else | 425 | else |
@@ -429,7 +429,7 @@ void rtc_dev_add_device(struct rtc_device *rtc) | |||
429 | 429 | ||
430 | void rtc_dev_del_device(struct rtc_device *rtc) | 430 | void rtc_dev_del_device(struct rtc_device *rtc) |
431 | { | 431 | { |
432 | if (rtc->class_dev.devt) | 432 | if (rtc->dev.devt) |
433 | cdev_del(&rtc->char_dev); | 433 | cdev_del(&rtc->char_dev); |
434 | } | 434 | } |
435 | 435 | ||
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 4ca3a5182cdb..ded35fd13ba0 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c | |||
@@ -399,7 +399,7 @@ static int __devinit omap_rtc_probe(struct platform_device *pdev) | |||
399 | goto fail; | 399 | goto fail; |
400 | } | 400 | } |
401 | platform_set_drvdata(pdev, rtc); | 401 | platform_set_drvdata(pdev, rtc); |
402 | class_set_devdata(&rtc->class_dev, mem); | 402 | dev_set_devdata(&rtc->dev, mem); |
403 | 403 | ||
404 | /* clear pending irqs, and set 1/second periodic, | 404 | /* clear pending irqs, and set 1/second periodic, |
405 | * which we'll use instead of update irqs | 405 | * which we'll use instead of update irqs |
@@ -418,13 +418,13 @@ static int __devinit omap_rtc_probe(struct platform_device *pdev) | |||
418 | 418 | ||
419 | /* handle periodic and alarm irqs */ | 419 | /* handle periodic and alarm irqs */ |
420 | if (request_irq(omap_rtc_timer, rtc_irq, IRQF_DISABLED, | 420 | if (request_irq(omap_rtc_timer, rtc_irq, IRQF_DISABLED, |
421 | rtc->class_dev.class_id, &rtc->class_dev)) { | 421 | rtc->dev.bus_id, rtc)) { |
422 | pr_debug("%s: RTC timer interrupt IRQ%d already claimed\n", | 422 | pr_debug("%s: RTC timer interrupt IRQ%d already claimed\n", |
423 | pdev->name, omap_rtc_timer); | 423 | pdev->name, omap_rtc_timer); |
424 | goto fail0; | 424 | goto fail0; |
425 | } | 425 | } |
426 | if (request_irq(omap_rtc_alarm, rtc_irq, IRQF_DISABLED, | 426 | if (request_irq(omap_rtc_alarm, rtc_irq, IRQF_DISABLED, |
427 | rtc->class_dev.class_id, &rtc->class_dev)) { | 427 | rtc->dev.bus_id, rtc)) { |
428 | pr_debug("%s: RTC alarm interrupt IRQ%d already claimed\n", | 428 | pr_debug("%s: RTC alarm interrupt IRQ%d already claimed\n", |
429 | pdev->name, omap_rtc_alarm); | 429 | pdev->name, omap_rtc_alarm); |
430 | goto fail1; | 430 | goto fail1; |
@@ -481,7 +481,7 @@ static int __devexit omap_rtc_remove(struct platform_device *pdev) | |||
481 | free_irq(omap_rtc_timer, rtc); | 481 | free_irq(omap_rtc_timer, rtc); |
482 | free_irq(omap_rtc_alarm, rtc); | 482 | free_irq(omap_rtc_alarm, rtc); |
483 | 483 | ||
484 | release_resource(class_get_devdata(&rtc->class_dev)); | 484 | release_resource(dev_get_devdata(&rtc->dev)); |
485 | rtc_device_unregister(rtc); | 485 | rtc_device_unregister(rtc); |
486 | return 0; | 486 | return 0; |
487 | } | 487 | } |
diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c index 3d7f4547c7d4..8d300e6d0d9e 100644 --- a/drivers/rtc/rtc-proc.c +++ b/drivers/rtc/rtc-proc.c | |||
@@ -74,7 +74,7 @@ static int rtc_proc_show(struct seq_file *seq, void *offset) | |||
74 | seq_printf(seq, "24hr\t\t: yes\n"); | 74 | seq_printf(seq, "24hr\t\t: yes\n"); |
75 | 75 | ||
76 | if (ops->proc) | 76 | if (ops->proc) |
77 | ops->proc(rtc->class_dev.dev, seq); | 77 | ops->proc(rtc->dev.parent, seq); |
78 | 78 | ||
79 | return 0; | 79 | return 0; |
80 | } | 80 | } |
diff --git a/drivers/rtc/rtc-sysfs.c b/drivers/rtc/rtc-sysfs.c index 1c2fa0cc9cbb..69df94b44841 100644 --- a/drivers/rtc/rtc-sysfs.c +++ b/drivers/rtc/rtc-sysfs.c | |||
@@ -17,12 +17,16 @@ | |||
17 | 17 | ||
18 | /* device attributes */ | 18 | /* device attributes */ |
19 | 19 | ||
20 | static ssize_t rtc_sysfs_show_name(struct class_device *dev, char *buf) | 20 | static ssize_t |
21 | rtc_sysfs_show_name(struct device *dev, struct device_attribute *attr, | ||
22 | char *buf) | ||
21 | { | 23 | { |
22 | return sprintf(buf, "%s\n", to_rtc_device(dev)->name); | 24 | return sprintf(buf, "%s\n", to_rtc_device(dev)->name); |
23 | } | 25 | } |
24 | 26 | ||
25 | static ssize_t rtc_sysfs_show_date(struct class_device *dev, char *buf) | 27 | static ssize_t |
28 | rtc_sysfs_show_date(struct device *dev, struct device_attribute *attr, | ||
29 | char *buf) | ||
26 | { | 30 | { |
27 | ssize_t retval; | 31 | ssize_t retval; |
28 | struct rtc_time tm; | 32 | struct rtc_time tm; |
@@ -36,7 +40,9 @@ static ssize_t rtc_sysfs_show_date(struct class_device *dev, char *buf) | |||
36 | return retval; | 40 | return retval; |
37 | } | 41 | } |
38 | 42 | ||
39 | static ssize_t rtc_sysfs_show_time(struct class_device *dev, char *buf) | 43 | static ssize_t |
44 | rtc_sysfs_show_time(struct device *dev, struct device_attribute *attr, | ||
45 | char *buf) | ||
40 | { | 46 | { |
41 | ssize_t retval; | 47 | ssize_t retval; |
42 | struct rtc_time tm; | 48 | struct rtc_time tm; |
@@ -50,7 +56,9 @@ static ssize_t rtc_sysfs_show_time(struct class_device *dev, char *buf) | |||
50 | return retval; | 56 | return retval; |
51 | } | 57 | } |
52 | 58 | ||
53 | static ssize_t rtc_sysfs_show_since_epoch(struct class_device *dev, char *buf) | 59 | static ssize_t |
60 | rtc_sysfs_show_since_epoch(struct device *dev, struct device_attribute *attr, | ||
61 | char *buf) | ||
54 | { | 62 | { |
55 | ssize_t retval; | 63 | ssize_t retval; |
56 | struct rtc_time tm; | 64 | struct rtc_time tm; |
@@ -65,7 +73,7 @@ static ssize_t rtc_sysfs_show_since_epoch(struct class_device *dev, char *buf) | |||
65 | return retval; | 73 | return retval; |
66 | } | 74 | } |
67 | 75 | ||
68 | static struct class_device_attribute rtc_attrs[] = { | 76 | static struct device_attribute rtc_attrs[] = { |
69 | __ATTR(name, S_IRUGO, rtc_sysfs_show_name, NULL), | 77 | __ATTR(name, S_IRUGO, rtc_sysfs_show_name, NULL), |
70 | __ATTR(date, S_IRUGO, rtc_sysfs_show_date, NULL), | 78 | __ATTR(date, S_IRUGO, rtc_sysfs_show_date, NULL), |
71 | __ATTR(time, S_IRUGO, rtc_sysfs_show_time, NULL), | 79 | __ATTR(time, S_IRUGO, rtc_sysfs_show_time, NULL), |
@@ -74,7 +82,8 @@ static struct class_device_attribute rtc_attrs[] = { | |||
74 | }; | 82 | }; |
75 | 83 | ||
76 | static ssize_t | 84 | static ssize_t |
77 | rtc_sysfs_show_wakealarm(struct class_device *dev, char *buf) | 85 | rtc_sysfs_show_wakealarm(struct device *dev, struct device_attribute *attr, |
86 | char *buf) | ||
78 | { | 87 | { |
79 | ssize_t retval; | 88 | ssize_t retval; |
80 | unsigned long alarm; | 89 | unsigned long alarm; |
@@ -98,7 +107,8 @@ rtc_sysfs_show_wakealarm(struct class_device *dev, char *buf) | |||
98 | } | 107 | } |
99 | 108 | ||
100 | static ssize_t | 109 | static ssize_t |
101 | rtc_sysfs_set_wakealarm(struct class_device *dev, const char *buf, size_t n) | 110 | rtc_sysfs_set_wakealarm(struct device *dev, struct device_attribute *attr, |
111 | const char *buf, size_t n) | ||
102 | { | 112 | { |
103 | ssize_t retval; | 113 | ssize_t retval; |
104 | unsigned long now, alarm; | 114 | unsigned long now, alarm; |
@@ -139,7 +149,7 @@ rtc_sysfs_set_wakealarm(struct class_device *dev, const char *buf, size_t n) | |||
139 | retval = rtc_set_alarm(rtc, &alm); | 149 | retval = rtc_set_alarm(rtc, &alm); |
140 | return (retval < 0) ? retval : n; | 150 | return (retval < 0) ? retval : n; |
141 | } | 151 | } |
142 | static const CLASS_DEVICE_ATTR(wakealarm, S_IRUGO | S_IWUSR, | 152 | static DEVICE_ATTR(wakealarm, S_IRUGO | S_IWUSR, |
143 | rtc_sysfs_show_wakealarm, rtc_sysfs_set_wakealarm); | 153 | rtc_sysfs_show_wakealarm, rtc_sysfs_set_wakealarm); |
144 | 154 | ||
145 | 155 | ||
@@ -150,7 +160,7 @@ static const CLASS_DEVICE_ATTR(wakealarm, S_IRUGO | S_IWUSR, | |||
150 | */ | 160 | */ |
151 | static inline int rtc_does_wakealarm(struct rtc_device *rtc) | 161 | static inline int rtc_does_wakealarm(struct rtc_device *rtc) |
152 | { | 162 | { |
153 | if (!device_can_wakeup(rtc->class_dev.dev)) | 163 | if (!device_can_wakeup(rtc->dev.parent)) |
154 | return 0; | 164 | return 0; |
155 | return rtc->ops->set_alarm != NULL; | 165 | return rtc->ops->set_alarm != NULL; |
156 | } | 166 | } |
@@ -164,10 +174,9 @@ void rtc_sysfs_add_device(struct rtc_device *rtc) | |||
164 | if (!rtc_does_wakealarm(rtc)) | 174 | if (!rtc_does_wakealarm(rtc)) |
165 | return; | 175 | return; |
166 | 176 | ||
167 | err = class_device_create_file(&rtc->class_dev, | 177 | err = device_create_file(&rtc->dev, &dev_attr_wakealarm); |
168 | &class_device_attr_wakealarm); | ||
169 | if (err) | 178 | if (err) |
170 | dev_err(rtc->class_dev.dev, "failed to create " | 179 | dev_err(rtc->dev.parent, "failed to create " |
171 | "alarm attribute, %d", | 180 | "alarm attribute, %d", |
172 | err); | 181 | err); |
173 | } | 182 | } |
@@ -176,11 +185,10 @@ void rtc_sysfs_del_device(struct rtc_device *rtc) | |||
176 | { | 185 | { |
177 | /* REVISIT did we add it successfully? */ | 186 | /* REVISIT did we add it successfully? */ |
178 | if (rtc_does_wakealarm(rtc)) | 187 | if (rtc_does_wakealarm(rtc)) |
179 | class_device_remove_file(&rtc->class_dev, | 188 | device_remove_file(&rtc->dev, &dev_attr_wakealarm); |
180 | &class_device_attr_wakealarm); | ||
181 | } | 189 | } |
182 | 190 | ||
183 | void __init rtc_sysfs_init(struct class *rtc_class) | 191 | void __init rtc_sysfs_init(struct class *rtc_class) |
184 | { | 192 | { |
185 | rtc_class->class_dev_attrs = rtc_attrs; | 193 | rtc_class->dev_attrs = rtc_attrs; |
186 | } | 194 | } |
diff --git a/include/linux/rtc.h b/include/linux/rtc.h index 73ccd8fcc0c7..07ecd4ca8ca7 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h | |||
@@ -136,7 +136,7 @@ struct rtc_task; | |||
136 | 136 | ||
137 | struct rtc_device | 137 | struct rtc_device |
138 | { | 138 | { |
139 | struct class_device class_dev; | 139 | struct device dev; |
140 | struct module *owner; | 140 | struct module *owner; |
141 | 141 | ||
142 | int id; | 142 | int id; |
@@ -168,7 +168,7 @@ struct rtc_device | |||
168 | unsigned int uie_timer_active:1; | 168 | unsigned int uie_timer_active:1; |
169 | #endif | 169 | #endif |
170 | }; | 170 | }; |
171 | #define to_rtc_device(d) container_of(d, struct rtc_device, class_dev) | 171 | #define to_rtc_device(d) container_of(d, struct rtc_device, dev) |
172 | 172 | ||
173 | extern struct rtc_device *rtc_device_register(const char *name, | 173 | extern struct rtc_device *rtc_device_register(const char *name, |
174 | struct device *dev, | 174 | struct device *dev, |