]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
rtc: update to class device removal patches
authorDavid Brownell <david-b@pacbell.net>
Tue, 8 May 2007 07:33:46 +0000 (00:33 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 8 May 2007 18:15:18 +0000 (11:15 -0700)
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>
drivers/rtc/class.c
drivers/rtc/rtc-core.h
drivers/rtc/rtc-dev.c

index 587d251be454ad6c10a40f1ae20a3ff51eb681d5..8b3cd31d6a61898ae892539e84d7d3b8ebca6d39 100644 (file)
@@ -156,6 +156,8 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
        strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE);
        snprintf(rtc->dev.bus_id, BUS_ID_SIZE, "rtc%d", id);
 
+       rtc_dev_prepare(rtc);
+
        err = device_register(&rtc->dev);
        if (err)
                goto exit_kfree;
index d81a278fcded4c7bcd29ced3b2993efe33f94048..5f9df7430a22728a7a1ce7941ef9f5898c476b70 100644 (file)
@@ -2,6 +2,7 @@
 
 extern void __init rtc_dev_init(void);
 extern void __exit rtc_dev_exit(void);
+extern void rtc_dev_prepare(struct rtc_device *rtc);
 extern void rtc_dev_add_device(struct rtc_device *rtc);
 extern void rtc_dev_del_device(struct rtc_device *rtc);
 
@@ -15,6 +16,10 @@ static inline void rtc_dev_exit(void)
 {
 }
 
+static inline void rtc_dev_prepare(struct rtc_device *rtc)
+{
+}
+
 static inline void rtc_dev_add_device(struct rtc_device *rtc)
 {
 }
index 2c13433089a0c63b95e270b23cc8ebd88f6351d2..671b14ec28bb32473b2c9a8f34b69b0b11a83d7f 100644 (file)
@@ -396,7 +396,7 @@ static const struct file_operations rtc_dev_fops = {
 
 /* insertion/removal hooks */
 
-void rtc_dev_add_device(struct rtc_device *rtc)
+void rtc_dev_prepare(struct rtc_device *rtc)
 {
        if (!rtc_devt)
                return;
@@ -418,7 +418,10 @@ void rtc_dev_add_device(struct rtc_device *rtc)
 
        cdev_init(&rtc->char_dev, &rtc_dev_fops);
        rtc->char_dev.owner = rtc->owner;
+}
 
+void rtc_dev_add_device(struct rtc_device *rtc)
+{
        if (cdev_add(&rtc->char_dev, rtc->dev.devt, 1))
                printk(KERN_WARNING "%s: failed to add char device %d:%d\n",
                        rtc->name, MAJOR(rtc_devt), rtc->id);