V4L/DVB (13553): v4l: Use the video_is_registered function in device drivers
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 27 Nov 2009 16:57:30 +0000 (13:57 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 16 Dec 2009 02:17:56 +0000 (00:17 -0200)
Fix all device drivers to use the video_is_registered function instead
of checking video_device::minor.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
15 files changed:
drivers/media/video/bt8xx/bttv-driver.c
drivers/media/video/cx231xx/cx231xx-video.c
drivers/media/video/cx23885/cx23885-417.c
drivers/media/video/cx23885/cx23885-video.c
drivers/media/video/cx88/cx88-blackbird.c
drivers/media/video/cx88/cx88-video.c
drivers/media/video/davinci/vpfe_capture.c
drivers/media/video/em28xx/em28xx-video.c
drivers/media/video/omap24xxcam.c
drivers/media/video/ov511.c
drivers/media/video/s2255drv.c
drivers/media/video/saa7134/saa7134-core.c
drivers/media/video/stradis.c
drivers/media/video/usbvision/usbvision-video.c
drivers/staging/cx25821/cx25821-video.c

index d57618319896e6284304aed26e5146431e8d8bda..a2336915ca70903f13995e02cd9c42c0f1799c79 100644 (file)
@@ -4208,21 +4208,21 @@ static struct video_device *vdev_init(struct bttv *btv,
 static void bttv_unregister_video(struct bttv *btv)
 {
        if (btv->video_dev) {
-               if (-1 != btv->video_dev->minor)
+               if (video_is_registered(btv->video_dev))
                        video_unregister_device(btv->video_dev);
                else
                        video_device_release(btv->video_dev);
                btv->video_dev = NULL;
        }
        if (btv->vbi_dev) {
-               if (-1 != btv->vbi_dev->minor)
+               if (video_is_registered(btv->vbi_dev))
                        video_unregister_device(btv->vbi_dev);
                else
                        video_device_release(btv->vbi_dev);
                btv->vbi_dev = NULL;
        }
        if (btv->radio_dev) {
-               if (-1 != btv->radio_dev->minor)
+               if (video_is_registered(btv->radio_dev))
                        video_unregister_device(btv->radio_dev);
                else
                        video_device_release(btv->radio_dev);
index 1c7f84e203e692cb0e0a144d8d52bfd4e2bd94d4..71e152dc2791e07fb51daed2a9e0990c92549dab 100644 (file)
@@ -2020,7 +2020,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev)
        /*FIXME: I2C IR should be disconnected */
 
        if (dev->radio_dev) {
-               if (-1 != dev->radio_dev->minor)
+               if (video_is_registered(dev->radio_dev))
                        video_unregister_device(dev->radio_dev);
                else
                        video_device_release(dev->radio_dev);
@@ -2029,7 +2029,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev)
        if (dev->vbi_dev) {
                cx231xx_info("V4L2 device %s deregistered\n",
                             video_device_node_name(dev->vbi_dev));
-               if (-1 != dev->vbi_dev->minor)
+               if (video_is_registered(dev->vbi_dev))
                        video_unregister_device(dev->vbi_dev);
                else
                        video_device_release(dev->vbi_dev);
@@ -2038,7 +2038,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev)
        if (dev->vdev) {
                cx231xx_info("V4L2 device %s deregistered\n",
                             video_device_node_name(dev->vdev));
-               if (-1 != dev->vdev->minor)
+               if (video_is_registered(dev->vdev))
                        video_unregister_device(dev->vdev);
                else
                        video_device_release(dev->vdev);
index 8084e13dd103bdd6026b43b2f5b74acc0fb6e006..a7bfe7c3a447c5cda2fcd5a3f30dd0d0c50e9051 100644 (file)
@@ -1746,7 +1746,7 @@ void cx23885_417_unregister(struct cx23885_dev *dev)
        dprintk(1, "%s()\n", __func__);
 
        if (dev->v4l_device) {
-               if (-1 != dev->v4l_device->minor)
+               if (video_is_registered(dev->v4l_device))
                        video_unregister_device(dev->v4l_device);
                else
                        video_device_release(dev->v4l_device);
index 5570383fa332fba54f6252ef892eb1ab79c0c50f..fd98121361f431c7c5f4b451af1019fb5187f27b 100644 (file)
@@ -1461,7 +1461,7 @@ void cx23885_video_unregister(struct cx23885_dev *dev)
        cx_clear(PCI_INT_MSK, 1);
 
        if (dev->video_dev) {
-               if (-1 != dev->video_dev->minor)
+               if (video_is_registered(dev->video_dev))
                        video_unregister_device(dev->video_dev);
                else
                        video_device_release(dev->video_dev);
index 9f02715b4e153858d5a2b3eebc69c329da79547b..5186f87b4ece7a3cb29332e92ec972ad1e4477d0 100644 (file)
@@ -1276,7 +1276,7 @@ static int cx8802_blackbird_advise_release(struct cx8802_driver *drv)
 static void blackbird_unregister_video(struct cx8802_dev *dev)
 {
        if (dev->mpeg_dev) {
-               if (-1 != dev->mpeg_dev->minor)
+               if (video_is_registered(dev->mpeg_dev))
                        video_unregister_device(dev->mpeg_dev);
                else
                        video_device_release(dev->mpeg_dev);
index 55063a76a43a7d07fff6f4aa5b1ede0c75181188..0259ac6d8147a53b9865f2dc691b3b6521828d27 100644 (file)
@@ -1778,21 +1778,21 @@ static struct video_device cx8800_radio_template = {
 static void cx8800_unregister_video(struct cx8800_dev *dev)
 {
        if (dev->radio_dev) {
-               if (-1 != dev->radio_dev->minor)
+               if (video_is_registered(dev->radio_dev))
                        video_unregister_device(dev->radio_dev);
                else
                        video_device_release(dev->radio_dev);
                dev->radio_dev = NULL;
        }
        if (dev->vbi_dev) {
-               if (-1 != dev->vbi_dev->minor)
+               if (video_is_registered(dev->vbi_dev))
                        video_unregister_device(dev->vbi_dev);
                else
                        video_device_release(dev->vbi_dev);
                dev->vbi_dev = NULL;
        }
        if (dev->video_dev) {
-               if (-1 != dev->video_dev->minor)
+               if (video_is_registered(dev->video_dev))
                        video_unregister_device(dev->video_dev);
                else
                        video_device_release(dev->video_dev);
index c3916a42668e8b136e69c00244f505d75e042ee7..1e8579438ef58fe7b35b51bc7d8e47df9b3f55a7 100644 (file)
@@ -2071,7 +2071,7 @@ probe_out_video_unregister:
 probe_out_v4l2_unregister:
        v4l2_device_unregister(&vpfe_dev->v4l2_dev);
 probe_out_video_release:
-       if (vpfe_dev->video_dev->minor == -1)
+       if (!video_is_registered(vpfe_dev->video_dev))
                video_device_release(vpfe_dev->video_dev);
 probe_out_release_irq:
        free_irq(vpfe_dev->ccdc_irq0, vpfe_dev);
index 5cc4fff04cdbf1b8e37f104251f2c1ca0d87a453..9a8ff32cb31b4da61f88d02b1960b37b756880bf 100644 (file)
@@ -2160,7 +2160,7 @@ void em28xx_release_analog_resources(struct em28xx *dev)
        /*FIXME: I2C IR should be disconnected */
 
        if (dev->radio_dev) {
-               if (-1 != dev->radio_dev->minor)
+               if (video_is_registered(dev->radio_dev))
                        video_unregister_device(dev->radio_dev);
                else
                        video_device_release(dev->radio_dev);
@@ -2169,7 +2169,7 @@ void em28xx_release_analog_resources(struct em28xx *dev)
        if (dev->vbi_dev) {
                em28xx_info("V4L2 device %s deregistered\n",
                            video_device_node_name(dev->vbi_dev));
-               if (-1 != dev->vbi_dev->minor)
+               if (video_is_registered(dev->vbi_dev))
                        video_unregister_device(dev->vbi_dev);
                else
                        video_device_release(dev->vbi_dev);
@@ -2178,7 +2178,7 @@ void em28xx_release_analog_resources(struct em28xx *dev)
        if (dev->vdev) {
                em28xx_info("V4L2 device %s deregistered\n",
                            video_device_node_name(dev->vdev));
-               if (-1 != dev->vdev->minor)
+               if (video_is_registered(dev->vdev))
                        video_unregister_device(dev->vdev);
                else
                        video_device_release(dev->vdev);
index e2f137b0daeb8cc51c8c56f36a9c7fddf49e75a5..34eb96594333cbb544df4f236bd9d65b5aabb765 100644 (file)
@@ -1696,7 +1696,7 @@ static void omap24xxcam_device_unregister(struct v4l2_int_device *s)
        omap24xxcam_sensor_exit(cam);
 
        if (cam->vfd) {
-               if (cam->vfd->minor == -1) {
+               if (!video_is_registered(cam->vfd)) {
                        /*
                         * The device was never registered, so release the
                         * video_device struct directly.
index 0bc2cf573c764a0aedde5e0353d43cbc8c75176f..b636160fd51035fe46be6202a9746a1b00d75b92 100644 (file)
@@ -5884,7 +5884,7 @@ ov51x_probe(struct usb_interface *intf, const struct usb_device_id *id)
 
 error:
        if (ov->vdev) {
-               if (-1 == ov->vdev->minor)
+               if (!video_is_registered(ov->vdev))
                        video_device_release(ov->vdev);
                else
                        video_unregister_device(ov->vdev);
index 41765f3c7c28cc71e5c3106c1035c39e9453fe54..4201abcf8f6395823cd2cc312ec6980f4e791936 100644 (file)
@@ -1880,7 +1880,7 @@ static void s2255_exit_v4l(struct s2255_dev *dev)
 
        int i;
        for (i = 0; i < MAX_CHANNELS; i++) {
-               if (-1 != dev->vdev[i]->minor) {
+               if (video_is_registered(dev->vdev[i])) {
                        video_unregister_device(dev->vdev[i]);
                        printk(KERN_INFO "s2255 unregistered\n");
                } else {
index c07f072778105b1322ed0ddbbf22799beadb04ab..b910df94ed72ef8ab4bed3c5fa0c2dcd6e8c7aee 100644 (file)
@@ -803,21 +803,21 @@ static struct video_device *vdev_init(struct saa7134_dev *dev,
 static void saa7134_unregister_video(struct saa7134_dev *dev)
 {
        if (dev->video_dev) {
-               if (-1 != dev->video_dev->minor)
+               if (video_is_registered(dev->video_dev))
                        video_unregister_device(dev->video_dev);
                else
                        video_device_release(dev->video_dev);
                dev->video_dev = NULL;
        }
        if (dev->vbi_dev) {
-               if (-1 != dev->vbi_dev->minor)
+               if (video_is_registered(dev->vbi_dev))
                        video_unregister_device(dev->vbi_dev);
                else
                        video_device_release(dev->vbi_dev);
                dev->vbi_dev = NULL;
        }
        if (dev->radio_dev) {
-               if (-1 != dev->radio_dev->minor)
+               if (video_is_registered(dev->radio_dev))
                        video_unregister_device(dev->radio_dev);
                else
                        video_device_release(dev->radio_dev);
index eaada39c76fdfcf5d2273bd3c31af6dca0350da1..c8909056215c95f5db2ab993a42b525f3fd11b61 100644 (file)
@@ -2134,7 +2134,7 @@ static void stradis_release_saa(struct pci_dev *pdev)
        free_irq(saa->irq, saa);
        if (saa->saa7146_mem)
                iounmap(saa->saa7146_mem);
-       if (saa->video_dev.minor != -1)
+       if (video_is_registered(&saa->video_dev))
                video_unregister_device(&saa->video_dev);
 }
 
index 639c3396ae7713e7e7dfebf749f17b3ff30fba8e..e89b855fd282671d7fe71cdec874cae86bf5324c 100644 (file)
@@ -1418,7 +1418,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
        if (usbvision->vbi) {
                PDEBUG(DBG_PROBE, "unregister %s [v4l2]",
                       video_device_node_name(usbvision->vbi));
-               if (usbvision->vbi->minor != -1) {
+               if (video_is_registered(usbvision->vbi)) {
                        video_unregister_device(usbvision->vbi);
                } else {
                        video_device_release(usbvision->vbi);
@@ -1430,7 +1430,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
        if (usbvision->rdev) {
                PDEBUG(DBG_PROBE, "unregister %s [v4l2]",
                       video_device_node_name(usbvision->rdev));
-               if (usbvision->rdev->minor != -1) {
+               if (video_is_registered(usbvision->rdev)) {
                        video_unregister_device(usbvision->rdev);
                } else {
                        video_device_release(usbvision->rdev);
@@ -1442,7 +1442,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
        if (usbvision->vdev) {
                PDEBUG(DBG_PROBE, "unregister %s [v4l2]",
                       video_device_node_name(usbvision->vdev));
-               if (usbvision->vdev->minor != -1) {
+               if (video_is_registered(usbvision->vdev)) {
                        video_unregister_device(usbvision->vdev);
                } else {
                        video_device_release(usbvision->vdev);
index 8834bc80a5ab575c4a54efbea1cf10fbdaddb09d..156e332ce002ebe041f3b4f10ae2c2b17de97e70 100644 (file)
@@ -424,7 +424,7 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status)
 void cx25821_videoioctl_unregister(struct cx25821_dev *dev)
 {
        if (dev->ioctl_dev) {
-               if (dev->ioctl_dev->minor != -1)
+               if (video_is_registered(dev->ioctl_dev))
                        video_unregister_device(dev->ioctl_dev);
                else
                        video_device_release(dev->ioctl_dev);
@@ -438,7 +438,7 @@ void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num)
        cx_clear(PCI_INT_MSK, 1);
 
        if (dev->video_dev[chan_num]) {
-               if (-1 != dev->video_dev[chan_num]->minor)
+               if (video_is_registered(dev->video_dev[chan_num]))
                        video_unregister_device(dev->video_dev[chan_num]);
                else
                        video_device_release(dev->video_dev[chan_num]);