aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/interface.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-05-08 03:33:40 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:18 -0400
commitcd9662094edf4173e87f0452e57e4eacc228f8ff (patch)
tree819d487aad05c7e61531bd25e3e7a0d4c08c6616 /drivers/rtc/interface.c
parent7d9f99eccc8f94ace31030a2a7ff73cf5f8c12a0 (diff)
rtc: remove rest of class_device
Finish converting the RTC framework so it no longer uses class_device. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-By: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/interface.c')
-rw-r--r--drivers/rtc/interface.c34
1 files changed, 17 insertions, 17 deletions
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
168struct rtc_device *rtc_class_open(char *name) 168struct 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);
195void rtc_class_close(struct rtc_device *rtc) 195void 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}
200EXPORT_SYMBOL_GPL(rtc_class_close); 200EXPORT_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 }