Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4abdcf933f647763592db6bef001d1fae61a5527
Commit:     4abdcf933f647763592db6bef001d1fae61a5527
Parent:     a6d7613226c4e159b12fbaad707ddadf47b38ccf
Author:     Simon Arlott <[EMAIL PROTECTED]>
AuthorDate: Sun May 6 20:56:14 2007 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Tue May 22 16:00:14 2007 -0300

    V4L/DVB (5630): Dvb-core: Handle failures to create devices
    
    dvb-core is not started early enough when device drivers that use dvb are
    compiled in so dvb_register_device fails (silently) since dvb_class is
    NULL, this runs dvb_init using subsys_initcall instead of module_init.
    
    dvb_register_device will now check the return value of class_device_create.
    
    Signed-off-by: Simon Arlott <[EMAIL PROTECTED]>
    Signed-off-by: Trent Piepho <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/dvb/dvb-core/dvbdev.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/media/dvb/dvb-core/dvbdev.c 
b/drivers/media/dvb/dvb-core/dvbdev.c
index e23d8a0..a9fa333 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -200,7 +200,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct 
dvb_device **pdvbdev,
 {
        struct dvb_device *dvbdev;
        struct file_operations *dvbdevfops;
-
+       struct class_device *clsdev;
        int id;
 
        mutex_lock(&dvbdev_register_lock);
@@ -242,8 +242,15 @@ int dvb_register_device(struct dvb_adapter *adap, struct 
dvb_device **pdvbdev,
 
        mutex_unlock(&dvbdev_register_lock);
 
-       class_device_create(dvb_class, NULL, MKDEV(DVB_MAJOR, 
nums2minor(adap->num, type, id)),
-                           adap->device, "dvb%d.%s%d", adap->num, 
dnames[type], id);
+       clsdev = class_device_create(dvb_class, NULL, MKDEV(DVB_MAJOR,
+                                    nums2minor(adap->num, type, id)),
+                                    adap->device, "dvb%d.%s%d", adap->num,
+                                    dnames[type], id);
+       if (IS_ERR(clsdev)) {
+               printk(KERN_ERR "%s: failed to create device dvb%d.%s%d 
(%ld)\n",
+                      __FUNCTION__, adap->num, dnames[type], id, 
PTR_ERR(clsdev));
+               return PTR_ERR(clsdev);
+       }
 
        dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n",
                adap->num, dnames[type], id, nums2minor(adap->num, type, id),
@@ -431,7 +438,7 @@ static void __exit exit_dvbdev(void)
        unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS);
 }
 
-module_init(init_dvbdev);
+subsys_initcall(init_dvbdev);
 module_exit(exit_dvbdev);
 
 MODULE_DESCRIPTION("DVB Core Driver");
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to