aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorSimon Arlott <simon@fire.lp0.eu>2007-05-06 19:56:14 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-05-22 15:00:14 -0400
commit4abdcf933f647763592db6bef001d1fae61a5527 (patch)
treee5dc6075802215d51f2c1703d474948471bd19dd /drivers/media/dvb
parenta6d7613226c4e159b12fbaad707ddadf47b38ccf (diff)
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 <simon@fire.lp0.eu> Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c15
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 e23d8a0ea1d3..a9fa3337dd81 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,
200{ 200{
201 struct dvb_device *dvbdev; 201 struct dvb_device *dvbdev;
202 struct file_operations *dvbdevfops; 202 struct file_operations *dvbdevfops;
203 203 struct class_device *clsdev;
204 int id; 204 int id;
205 205
206 mutex_lock(&dvbdev_register_lock); 206 mutex_lock(&dvbdev_register_lock);
@@ -242,8 +242,15 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
242 242
243 mutex_unlock(&dvbdev_register_lock); 243 mutex_unlock(&dvbdev_register_lock);
244 244
245 class_device_create(dvb_class, NULL, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), 245 clsdev = class_device_create(dvb_class, NULL, MKDEV(DVB_MAJOR,
246 adap->device, "dvb%d.%s%d", adap->num, dnames[type], id); 246 nums2minor(adap->num, type, id)),
247 adap->device, "dvb%d.%s%d", adap->num,
248 dnames[type], id);
249 if (IS_ERR(clsdev)) {
250 printk(KERN_ERR "%s: failed to create device dvb%d.%s%d (%ld)\n",
251 __FUNCTION__, adap->num, dnames[type], id, PTR_ERR(clsdev));
252 return PTR_ERR(clsdev);
253 }
247 254
248 dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n", 255 dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n",
249 adap->num, dnames[type], id, nums2minor(adap->num, type, id), 256 adap->num, dnames[type], id, nums2minor(adap->num, type, id),
@@ -431,7 +438,7 @@ static void __exit exit_dvbdev(void)
431 unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS); 438 unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS);
432} 439}
433 440
434module_init(init_dvbdev); 441subsys_initcall(init_dvbdev);
435module_exit(exit_dvbdev); 442module_exit(exit_dvbdev);
436 443
437MODULE_DESCRIPTION("DVB Core Driver"); 444MODULE_DESCRIPTION("DVB Core Driver");