diff options
author | David Brownell <david-b@pacbell.net> | 2007-05-08 03:33:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:18 -0400 |
commit | cb3a58d2acc042f62cde932add8e1f9ed508368d (patch) | |
tree | a14e0afa950d7b6dd6b6bbd536ef0b128f5078e6 /drivers | |
parent | 61a7c36acb3da406d64c0da6288eab1c414a65ea (diff) |
rtc: update to class device removal patches
Fix a goof in the revised classdev support for RTCs: make sure the /dev
node info is ready before the device is registered, not after. Otherwise
the /sys/class/rtc/rtcN/dev attribute won't be created and then udev won't
have the information it needs to create the /dev/rtcN node.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: 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')
-rw-r--r-- | drivers/rtc/class.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-core.h | 5 | ||||
-rw-r--r-- | drivers/rtc/rtc-dev.c | 5 |
3 files changed, 11 insertions, 1 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 587d251be454..8b3cd31d6a61 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
@@ -156,6 +156,8 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev, | |||
156 | strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); | 156 | strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); |
157 | snprintf(rtc->dev.bus_id, BUS_ID_SIZE, "rtc%d", id); | 157 | snprintf(rtc->dev.bus_id, BUS_ID_SIZE, "rtc%d", id); |
158 | 158 | ||
159 | rtc_dev_prepare(rtc); | ||
160 | |||
159 | err = device_register(&rtc->dev); | 161 | err = device_register(&rtc->dev); |
160 | if (err) | 162 | if (err) |
161 | goto exit_kfree; | 163 | goto exit_kfree; |
diff --git a/drivers/rtc/rtc-core.h b/drivers/rtc/rtc-core.h index d81a278fcded..5f9df7430a22 100644 --- a/drivers/rtc/rtc-core.h +++ b/drivers/rtc/rtc-core.h | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | extern void __init rtc_dev_init(void); | 3 | extern void __init rtc_dev_init(void); |
4 | extern void __exit rtc_dev_exit(void); | 4 | extern void __exit rtc_dev_exit(void); |
5 | extern void rtc_dev_prepare(struct rtc_device *rtc); | ||
5 | extern void rtc_dev_add_device(struct rtc_device *rtc); | 6 | extern void rtc_dev_add_device(struct rtc_device *rtc); |
6 | extern void rtc_dev_del_device(struct rtc_device *rtc); | 7 | extern void rtc_dev_del_device(struct rtc_device *rtc); |
7 | 8 | ||
@@ -15,6 +16,10 @@ static inline void rtc_dev_exit(void) | |||
15 | { | 16 | { |
16 | } | 17 | } |
17 | 18 | ||
19 | static inline void rtc_dev_prepare(struct rtc_device *rtc) | ||
20 | { | ||
21 | } | ||
22 | |||
18 | static inline void rtc_dev_add_device(struct rtc_device *rtc) | 23 | static inline void rtc_dev_add_device(struct rtc_device *rtc) |
19 | { | 24 | { |
20 | } | 25 | } |
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 2c13433089a0..671b14ec28bb 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
@@ -396,7 +396,7 @@ static const struct file_operations rtc_dev_fops = { | |||
396 | 396 | ||
397 | /* insertion/removal hooks */ | 397 | /* insertion/removal hooks */ |
398 | 398 | ||
399 | void rtc_dev_add_device(struct rtc_device *rtc) | 399 | void rtc_dev_prepare(struct rtc_device *rtc) |
400 | { | 400 | { |
401 | if (!rtc_devt) | 401 | if (!rtc_devt) |
402 | return; | 402 | return; |
@@ -418,7 +418,10 @@ void rtc_dev_add_device(struct rtc_device *rtc) | |||
418 | 418 | ||
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 | ||
423 | void rtc_dev_add_device(struct rtc_device *rtc) | ||
424 | { | ||
422 | if (cdev_add(&rtc->char_dev, rtc->dev.devt, 1)) | 425 | if (cdev_add(&rtc->char_dev, rtc->dev.devt, 1)) |
423 | printk(KERN_WARNING "%s: failed to add char device %d:%d\n", | 426 | printk(KERN_WARNING "%s: failed to add char device %d:%d\n", |
424 | rtc->name, MAJOR(rtc_devt), rtc->id); | 427 | rtc->name, MAJOR(rtc_devt), rtc->id); |