[media] hdpvr: register the video node at the end of probe
authorHans Verkuil <hans.verkuil@cisco.com>
Tue, 19 Mar 2013 12:34:58 +0000 (09:34 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 14 Apr 2013 22:58:59 +0000 (19:58 -0300)
Video nodes can be used at once after registration, so make sure the full
initialization is done before registering them.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/usb/hdpvr/hdpvr-core.c

index 73195fe..248835b 100644 (file)
@@ -386,12 +386,6 @@ static int hdpvr_probe(struct usb_interface *interface,
        }
        mutex_unlock(&dev->io_mutex);
 
-       if (hdpvr_register_videodev(dev, &interface->dev,
-                                   video_nr[atomic_inc_return(&dev_nr)])) {
-               v4l2_err(&dev->v4l2_dev, "registering videodev failed\n");
-               goto error;
-       }
-
 #if IS_ENABLED(CONFIG_I2C)
        retval = hdpvr_register_i2c_adapter(dev);
        if (retval < 0) {
@@ -414,6 +408,13 @@ static int hdpvr_probe(struct usb_interface *interface,
        }
 #endif
 
+       retval = hdpvr_register_videodev(dev, &interface->dev,
+                                   video_nr[atomic_inc_return(&dev_nr)]);
+       if (retval < 0) {
+               v4l2_err(&dev->v4l2_dev, "registering videodev failed\n");
+               goto error;
+       }
+
        /* let the user know what node this device is now attached to */
        v4l2_info(&dev->v4l2_dev, "device now attached to %s\n",
                  video_device_node_name(dev->video_dev));