diff options
author | David Brownell <david-b@pacbell.net> | 2007-05-08 03:33:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:18 -0400 |
commit | ab6a2d70d18edc7a716ef3127b9e13382faec98c (patch) | |
tree | 6de624dfcbd0181e54e21f1730d2a52ae9822c47 /drivers/rtc/rtc-dev.c | |
parent | 5726fb2012f0d96153113ddb7f988a0daea587ce (diff) |
rtc: rtc interfaces don't use class_device
This patch removes class_device from the programming interface that the RTC
framework exposes to the rest of the kernel. Now an rtc_device is passed,
which is more type-safe and streamlines all the relevant code.
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/rtc-dev.c')
-rw-r--r-- | drivers/rtc/rtc-dev.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 3fa6138523b5..623cb8d06b02 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
@@ -32,7 +32,7 @@ static int rtc_dev_open(struct inode *inode, struct file *file) | |||
32 | if (!(mutex_trylock(&rtc->char_lock))) | 32 | if (!(mutex_trylock(&rtc->char_lock))) |
33 | return -EBUSY; | 33 | return -EBUSY; |
34 | 34 | ||
35 | file->private_data = &rtc->class_dev; | 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->class_dev.dev) : 0; |
38 | if (err == 0) { | 38 | if (err == 0) { |
@@ -61,7 +61,7 @@ static void rtc_uie_task(struct work_struct *work) | |||
61 | int num = 0; | 61 | int num = 0; |
62 | int err; | 62 | int err; |
63 | 63 | ||
64 | err = rtc_read_time(&rtc->class_dev, &tm); | 64 | err = rtc_read_time(rtc, &tm); |
65 | 65 | ||
66 | local_irq_disable(); | 66 | local_irq_disable(); |
67 | spin_lock(&rtc->irq_lock); | 67 | spin_lock(&rtc->irq_lock); |
@@ -79,7 +79,7 @@ static void rtc_uie_task(struct work_struct *work) | |||
79 | } | 79 | } |
80 | spin_unlock(&rtc->irq_lock); | 80 | spin_unlock(&rtc->irq_lock); |
81 | if (num) | 81 | if (num) |
82 | rtc_update_irq(&rtc->class_dev, num, RTC_UF | RTC_IRQF); | 82 | rtc_update_irq(rtc, num, RTC_UF | RTC_IRQF); |
83 | local_irq_enable(); | 83 | local_irq_enable(); |
84 | } | 84 | } |
85 | static void rtc_uie_timer(unsigned long data) | 85 | static void rtc_uie_timer(unsigned long data) |
@@ -121,7 +121,7 @@ static int set_uie(struct rtc_device *rtc) | |||
121 | struct rtc_time tm; | 121 | struct rtc_time tm; |
122 | int err; | 122 | int err; |
123 | 123 | ||
124 | err = rtc_read_time(&rtc->class_dev, &tm); | 124 | err = rtc_read_time(rtc, &tm); |
125 | if (err) | 125 | if (err) |
126 | return err; | 126 | return err; |
127 | spin_lock_irq(&rtc->irq_lock); | 127 | spin_lock_irq(&rtc->irq_lock); |
@@ -210,8 +210,7 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, | |||
210 | unsigned int cmd, unsigned long arg) | 210 | unsigned int cmd, unsigned long arg) |
211 | { | 211 | { |
212 | int err = 0; | 212 | int err = 0; |
213 | struct class_device *class_dev = file->private_data; | 213 | struct rtc_device *rtc = file->private_data; |
214 | struct rtc_device *rtc = to_rtc_device(class_dev); | ||
215 | const struct rtc_class_ops *ops = rtc->ops; | 214 | const struct rtc_class_ops *ops = rtc->ops; |
216 | struct rtc_time tm; | 215 | struct rtc_time tm; |
217 | struct rtc_wkalrm alarm; | 216 | struct rtc_wkalrm alarm; |
@@ -252,7 +251,7 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, | |||
252 | 251 | ||
253 | /* try the driver's ioctl interface */ | 252 | /* try the driver's ioctl interface */ |
254 | if (ops->ioctl) { | 253 | if (ops->ioctl) { |
255 | err = ops->ioctl(class_dev->dev, cmd, arg); | 254 | err = ops->ioctl(rtc->class_dev.dev, cmd, arg); |
256 | if (err != -ENOIOCTLCMD) | 255 | if (err != -ENOIOCTLCMD) |
257 | return err; | 256 | return err; |
258 | } | 257 | } |
@@ -264,7 +263,7 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, | |||
264 | 263 | ||
265 | switch (cmd) { | 264 | switch (cmd) { |
266 | case RTC_ALM_READ: | 265 | case RTC_ALM_READ: |
267 | err = rtc_read_alarm(class_dev, &alarm); | 266 | err = rtc_read_alarm(rtc, &alarm); |
268 | if (err < 0) | 267 | if (err < 0) |
269 | return err; | 268 | return err; |
270 | 269 | ||
@@ -284,11 +283,11 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, | |||
284 | alarm.time.tm_wday = -1; | 283 | alarm.time.tm_wday = -1; |
285 | alarm.time.tm_yday = -1; | 284 | alarm.time.tm_yday = -1; |
286 | alarm.time.tm_isdst = -1; | 285 | alarm.time.tm_isdst = -1; |
287 | err = rtc_set_alarm(class_dev, &alarm); | 286 | err = rtc_set_alarm(rtc, &alarm); |
288 | break; | 287 | break; |
289 | 288 | ||
290 | case RTC_RD_TIME: | 289 | case RTC_RD_TIME: |
291 | err = rtc_read_time(class_dev, &tm); | 290 | err = rtc_read_time(rtc, &tm); |
292 | if (err < 0) | 291 | if (err < 0) |
293 | return err; | 292 | return err; |
294 | 293 | ||
@@ -300,7 +299,7 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, | |||
300 | if (copy_from_user(&tm, uarg, sizeof(tm))) | 299 | if (copy_from_user(&tm, uarg, sizeof(tm))) |
301 | return -EFAULT; | 300 | return -EFAULT; |
302 | 301 | ||
303 | err = rtc_set_time(class_dev, &tm); | 302 | err = rtc_set_time(rtc, &tm); |
304 | break; | 303 | break; |
305 | 304 | ||
306 | case RTC_IRQP_READ: | 305 | case RTC_IRQP_READ: |
@@ -310,7 +309,7 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, | |||
310 | 309 | ||
311 | case RTC_IRQP_SET: | 310 | case RTC_IRQP_SET: |
312 | if (ops->irq_set_freq) | 311 | if (ops->irq_set_freq) |
313 | err = rtc_irq_set_freq(class_dev, rtc->irq_task, arg); | 312 | err = rtc_irq_set_freq(rtc, rtc->irq_task, arg); |
314 | break; | 313 | break; |
315 | 314 | ||
316 | #if 0 | 315 | #if 0 |
@@ -336,11 +335,11 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, | |||
336 | if (copy_from_user(&alarm, uarg, sizeof(alarm))) | 335 | if (copy_from_user(&alarm, uarg, sizeof(alarm))) |
337 | return -EFAULT; | 336 | return -EFAULT; |
338 | 337 | ||
339 | err = rtc_set_alarm(class_dev, &alarm); | 338 | err = rtc_set_alarm(rtc, &alarm); |
340 | break; | 339 | break; |
341 | 340 | ||
342 | case RTC_WKALM_RD: | 341 | case RTC_WKALM_RD: |
343 | err = rtc_read_alarm(class_dev, &alarm); | 342 | err = rtc_read_alarm(rtc, &alarm); |
344 | if (err < 0) | 343 | if (err < 0) |
345 | return err; | 344 | return err; |
346 | 345 | ||