aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2009-11-27 11:57:30 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-15 21:17:56 -0500
commitf0813b4c9f7ffbeaddcba1c08a1812f7ff30e1b7 (patch)
tree6bee13e029a382236f5e54402e054b271350c0fe
parent957b4aa9f786cf04585a690a2e4c3dc867ce80e9 (diff)
V4L/DVB (13553): v4l: Use the video_is_registered function in device drivers
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>
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c6
-rw-r--r--drivers/media/video/cx231xx/cx231xx-video.c6
-rw-r--r--drivers/media/video/cx23885/cx23885-417.c2
-rw-r--r--drivers/media/video/cx23885/cx23885-video.c2
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c2
-rw-r--r--drivers/media/video/cx88/cx88-video.c6
-rw-r--r--drivers/media/video/davinci/vpfe_capture.c2
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c6
-rw-r--r--drivers/media/video/omap24xxcam.c2
-rw-r--r--drivers/media/video/ov511.c2
-rw-r--r--drivers/media/video/s2255drv.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c6
-rw-r--r--drivers/media/video/stradis.c2
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c6
-rw-r--r--drivers/staging/cx25821/cx25821-video.c4
15 files changed, 28 insertions, 28 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index d57618319896..a2336915ca70 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -4208,21 +4208,21 @@ static struct video_device *vdev_init(struct bttv *btv,
4208static void bttv_unregister_video(struct bttv *btv) 4208static void bttv_unregister_video(struct bttv *btv)
4209{ 4209{
4210 if (btv->video_dev) { 4210 if (btv->video_dev) {
4211 if (-1 != btv->video_dev->minor) 4211 if (video_is_registered(btv->video_dev))
4212 video_unregister_device(btv->video_dev); 4212 video_unregister_device(btv->video_dev);
4213 else 4213 else
4214 video_device_release(btv->video_dev); 4214 video_device_release(btv->video_dev);
4215 btv->video_dev = NULL; 4215 btv->video_dev = NULL;
4216 } 4216 }
4217 if (btv->vbi_dev) { 4217 if (btv->vbi_dev) {
4218 if (-1 != btv->vbi_dev->minor) 4218 if (video_is_registered(btv->vbi_dev))
4219 video_unregister_device(btv->vbi_dev); 4219 video_unregister_device(btv->vbi_dev);
4220 else 4220 else
4221 video_device_release(btv->vbi_dev); 4221 video_device_release(btv->vbi_dev);
4222 btv->vbi_dev = NULL; 4222 btv->vbi_dev = NULL;
4223 } 4223 }
4224 if (btv->radio_dev) { 4224 if (btv->radio_dev) {
4225 if (-1 != btv->radio_dev->minor) 4225 if (video_is_registered(btv->radio_dev))
4226 video_unregister_device(btv->radio_dev); 4226 video_unregister_device(btv->radio_dev);
4227 else 4227 else
4228 video_device_release(btv->radio_dev); 4228 video_device_release(btv->radio_dev);
diff --git a/drivers/media/video/cx231xx/cx231xx-video.c b/drivers/media/video/cx231xx/cx231xx-video.c
index 1c7f84e203e6..71e152dc2791 100644
--- a/drivers/media/video/cx231xx/cx231xx-video.c
+++ b/drivers/media/video/cx231xx/cx231xx-video.c
@@ -2020,7 +2020,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev)
2020 /*FIXME: I2C IR should be disconnected */ 2020 /*FIXME: I2C IR should be disconnected */
2021 2021
2022 if (dev->radio_dev) { 2022 if (dev->radio_dev) {
2023 if (-1 != dev->radio_dev->minor) 2023 if (video_is_registered(dev->radio_dev))
2024 video_unregister_device(dev->radio_dev); 2024 video_unregister_device(dev->radio_dev);
2025 else 2025 else
2026 video_device_release(dev->radio_dev); 2026 video_device_release(dev->radio_dev);
@@ -2029,7 +2029,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev)
2029 if (dev->vbi_dev) { 2029 if (dev->vbi_dev) {
2030 cx231xx_info("V4L2 device %s deregistered\n", 2030 cx231xx_info("V4L2 device %s deregistered\n",
2031 video_device_node_name(dev->vbi_dev)); 2031 video_device_node_name(dev->vbi_dev));
2032 if (-1 != dev->vbi_dev->minor) 2032 if (video_is_registered(dev->vbi_dev))
2033 video_unregister_device(dev->vbi_dev); 2033 video_unregister_device(dev->vbi_dev);
2034 else 2034 else
2035 video_device_release(dev->vbi_dev); 2035 video_device_release(dev->vbi_dev);
@@ -2038,7 +2038,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev)
2038 if (dev->vdev) { 2038 if (dev->vdev) {
2039 cx231xx_info("V4L2 device %s deregistered\n", 2039 cx231xx_info("V4L2 device %s deregistered\n",
2040 video_device_node_name(dev->vdev)); 2040 video_device_node_name(dev->vdev));
2041 if (-1 != dev->vdev->minor) 2041 if (video_is_registered(dev->vdev))
2042 video_unregister_device(dev->vdev); 2042 video_unregister_device(dev->vdev);
2043 else 2043 else
2044 video_device_release(dev->vdev); 2044 video_device_release(dev->vdev);
diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c
index 8084e13dd103..a7bfe7c3a447 100644
--- a/drivers/media/video/cx23885/cx23885-417.c
+++ b/drivers/media/video/cx23885/cx23885-417.c
@@ -1746,7 +1746,7 @@ void cx23885_417_unregister(struct cx23885_dev *dev)
1746 dprintk(1, "%s()\n", __func__); 1746 dprintk(1, "%s()\n", __func__);
1747 1747
1748 if (dev->v4l_device) { 1748 if (dev->v4l_device) {
1749 if (-1 != dev->v4l_device->minor) 1749 if (video_is_registered(dev->v4l_device))
1750 video_unregister_device(dev->v4l_device); 1750 video_unregister_device(dev->v4l_device);
1751 else 1751 else
1752 video_device_release(dev->v4l_device); 1752 video_device_release(dev->v4l_device);
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c
index 5570383fa332..fd98121361f4 100644
--- a/drivers/media/video/cx23885/cx23885-video.c
+++ b/drivers/media/video/cx23885/cx23885-video.c
@@ -1461,7 +1461,7 @@ void cx23885_video_unregister(struct cx23885_dev *dev)
1461 cx_clear(PCI_INT_MSK, 1); 1461 cx_clear(PCI_INT_MSK, 1);
1462 1462
1463 if (dev->video_dev) { 1463 if (dev->video_dev) {
1464 if (-1 != dev->video_dev->minor) 1464 if (video_is_registered(dev->video_dev))
1465 video_unregister_device(dev->video_dev); 1465 video_unregister_device(dev->video_dev);
1466 else 1466 else
1467 video_device_release(dev->video_dev); 1467 video_device_release(dev->video_dev);
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index 9f02715b4e15..5186f87b4ece 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1276,7 +1276,7 @@ static int cx8802_blackbird_advise_release(struct cx8802_driver *drv)
1276static void blackbird_unregister_video(struct cx8802_dev *dev) 1276static void blackbird_unregister_video(struct cx8802_dev *dev)
1277{ 1277{
1278 if (dev->mpeg_dev) { 1278 if (dev->mpeg_dev) {
1279 if (-1 != dev->mpeg_dev->minor) 1279 if (video_is_registered(dev->mpeg_dev))
1280 video_unregister_device(dev->mpeg_dev); 1280 video_unregister_device(dev->mpeg_dev);
1281 else 1281 else
1282 video_device_release(dev->mpeg_dev); 1282 video_device_release(dev->mpeg_dev);
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 55063a76a43a..0259ac6d8147 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -1778,21 +1778,21 @@ static struct video_device cx8800_radio_template = {
1778static void cx8800_unregister_video(struct cx8800_dev *dev) 1778static void cx8800_unregister_video(struct cx8800_dev *dev)
1779{ 1779{
1780 if (dev->radio_dev) { 1780 if (dev->radio_dev) {
1781 if (-1 != dev->radio_dev->minor) 1781 if (video_is_registered(dev->radio_dev))
1782 video_unregister_device(dev->radio_dev); 1782 video_unregister_device(dev->radio_dev);
1783 else 1783 else
1784 video_device_release(dev->radio_dev); 1784 video_device_release(dev->radio_dev);
1785 dev->radio_dev = NULL; 1785 dev->radio_dev = NULL;
1786 } 1786 }
1787 if (dev->vbi_dev) { 1787 if (dev->vbi_dev) {
1788 if (-1 != dev->vbi_dev->minor) 1788 if (video_is_registered(dev->vbi_dev))
1789 video_unregister_device(dev->vbi_dev); 1789 video_unregister_device(dev->vbi_dev);
1790 else 1790 else
1791 video_device_release(dev->vbi_dev); 1791 video_device_release(dev->vbi_dev);
1792 dev->vbi_dev = NULL; 1792 dev->vbi_dev = NULL;
1793 } 1793 }
1794 if (dev->video_dev) { 1794 if (dev->video_dev) {
1795 if (-1 != dev->video_dev->minor) 1795 if (video_is_registered(dev->video_dev))
1796 video_unregister_device(dev->video_dev); 1796 video_unregister_device(dev->video_dev);
1797 else 1797 else
1798 video_device_release(dev->video_dev); 1798 video_device_release(dev->video_dev);
diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c
index c3916a42668e..1e8579438ef5 100644
--- a/drivers/media/video/davinci/vpfe_capture.c
+++ b/drivers/media/video/davinci/vpfe_capture.c
@@ -2071,7 +2071,7 @@ probe_out_video_unregister:
2071probe_out_v4l2_unregister: 2071probe_out_v4l2_unregister:
2072 v4l2_device_unregister(&vpfe_dev->v4l2_dev); 2072 v4l2_device_unregister(&vpfe_dev->v4l2_dev);
2073probe_out_video_release: 2073probe_out_video_release:
2074 if (vpfe_dev->video_dev->minor == -1) 2074 if (!video_is_registered(vpfe_dev->video_dev))
2075 video_device_release(vpfe_dev->video_dev); 2075 video_device_release(vpfe_dev->video_dev);
2076probe_out_release_irq: 2076probe_out_release_irq:
2077 free_irq(vpfe_dev->ccdc_irq0, vpfe_dev); 2077 free_irq(vpfe_dev->ccdc_irq0, vpfe_dev);
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 5cc4fff04cdb..9a8ff32cb31b 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -2160,7 +2160,7 @@ void em28xx_release_analog_resources(struct em28xx *dev)
2160 /*FIXME: I2C IR should be disconnected */ 2160 /*FIXME: I2C IR should be disconnected */
2161 2161
2162 if (dev->radio_dev) { 2162 if (dev->radio_dev) {
2163 if (-1 != dev->radio_dev->minor) 2163 if (video_is_registered(dev->radio_dev))
2164 video_unregister_device(dev->radio_dev); 2164 video_unregister_device(dev->radio_dev);
2165 else 2165 else
2166 video_device_release(dev->radio_dev); 2166 video_device_release(dev->radio_dev);
@@ -2169,7 +2169,7 @@ void em28xx_release_analog_resources(struct em28xx *dev)
2169 if (dev->vbi_dev) { 2169 if (dev->vbi_dev) {
2170 em28xx_info("V4L2 device %s deregistered\n", 2170 em28xx_info("V4L2 device %s deregistered\n",
2171 video_device_node_name(dev->vbi_dev)); 2171 video_device_node_name(dev->vbi_dev));
2172 if (-1 != dev->vbi_dev->minor) 2172 if (video_is_registered(dev->vbi_dev))
2173 video_unregister_device(dev->vbi_dev); 2173 video_unregister_device(dev->vbi_dev);
2174 else 2174 else
2175 video_device_release(dev->vbi_dev); 2175 video_device_release(dev->vbi_dev);
@@ -2178,7 +2178,7 @@ void em28xx_release_analog_resources(struct em28xx *dev)
2178 if (dev->vdev) { 2178 if (dev->vdev) {
2179 em28xx_info("V4L2 device %s deregistered\n", 2179 em28xx_info("V4L2 device %s deregistered\n",
2180 video_device_node_name(dev->vdev)); 2180 video_device_node_name(dev->vdev));
2181 if (-1 != dev->vdev->minor) 2181 if (video_is_registered(dev->vdev))
2182 video_unregister_device(dev->vdev); 2182 video_unregister_device(dev->vdev);
2183 else 2183 else
2184 video_device_release(dev->vdev); 2184 video_device_release(dev->vdev);
diff --git a/drivers/media/video/omap24xxcam.c b/drivers/media/video/omap24xxcam.c
index e2f137b0daeb..34eb96594333 100644
--- a/drivers/media/video/omap24xxcam.c
+++ b/drivers/media/video/omap24xxcam.c
@@ -1696,7 +1696,7 @@ static void omap24xxcam_device_unregister(struct v4l2_int_device *s)
1696 omap24xxcam_sensor_exit(cam); 1696 omap24xxcam_sensor_exit(cam);
1697 1697
1698 if (cam->vfd) { 1698 if (cam->vfd) {
1699 if (cam->vfd->minor == -1) { 1699 if (!video_is_registered(cam->vfd)) {
1700 /* 1700 /*
1701 * The device was never registered, so release the 1701 * The device was never registered, so release the
1702 * video_device struct directly. 1702 * video_device struct directly.
diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c
index 0bc2cf573c76..b636160fd510 100644
--- a/drivers/media/video/ov511.c
+++ b/drivers/media/video/ov511.c
@@ -5884,7 +5884,7 @@ ov51x_probe(struct usb_interface *intf, const struct usb_device_id *id)
5884 5884
5885error: 5885error:
5886 if (ov->vdev) { 5886 if (ov->vdev) {
5887 if (-1 == ov->vdev->minor) 5887 if (!video_is_registered(ov->vdev))
5888 video_device_release(ov->vdev); 5888 video_device_release(ov->vdev);
5889 else 5889 else
5890 video_unregister_device(ov->vdev); 5890 video_unregister_device(ov->vdev);
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index 41765f3c7c28..4201abcf8f63 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -1880,7 +1880,7 @@ static void s2255_exit_v4l(struct s2255_dev *dev)
1880 1880
1881 int i; 1881 int i;
1882 for (i = 0; i < MAX_CHANNELS; i++) { 1882 for (i = 0; i < MAX_CHANNELS; i++) {
1883 if (-1 != dev->vdev[i]->minor) { 1883 if (video_is_registered(dev->vdev[i])) {
1884 video_unregister_device(dev->vdev[i]); 1884 video_unregister_device(dev->vdev[i]);
1885 printk(KERN_INFO "s2255 unregistered\n"); 1885 printk(KERN_INFO "s2255 unregistered\n");
1886 } else { 1886 } else {
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index c07f07277810..b910df94ed72 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -803,21 +803,21 @@ static struct video_device *vdev_init(struct saa7134_dev *dev,
803static void saa7134_unregister_video(struct saa7134_dev *dev) 803static void saa7134_unregister_video(struct saa7134_dev *dev)
804{ 804{
805 if (dev->video_dev) { 805 if (dev->video_dev) {
806 if (-1 != dev->video_dev->minor) 806 if (video_is_registered(dev->video_dev))
807 video_unregister_device(dev->video_dev); 807 video_unregister_device(dev->video_dev);
808 else 808 else
809 video_device_release(dev->video_dev); 809 video_device_release(dev->video_dev);
810 dev->video_dev = NULL; 810 dev->video_dev = NULL;
811 } 811 }
812 if (dev->vbi_dev) { 812 if (dev->vbi_dev) {
813 if (-1 != dev->vbi_dev->minor) 813 if (video_is_registered(dev->vbi_dev))
814 video_unregister_device(dev->vbi_dev); 814 video_unregister_device(dev->vbi_dev);
815 else 815 else
816 video_device_release(dev->vbi_dev); 816 video_device_release(dev->vbi_dev);
817 dev->vbi_dev = NULL; 817 dev->vbi_dev = NULL;
818 } 818 }
819 if (dev->radio_dev) { 819 if (dev->radio_dev) {
820 if (-1 != dev->radio_dev->minor) 820 if (video_is_registered(dev->radio_dev))
821 video_unregister_device(dev->radio_dev); 821 video_unregister_device(dev->radio_dev);
822 else 822 else
823 video_device_release(dev->radio_dev); 823 video_device_release(dev->radio_dev);
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c
index eaada39c76fd..c8909056215c 100644
--- a/drivers/media/video/stradis.c
+++ b/drivers/media/video/stradis.c
@@ -2134,7 +2134,7 @@ static void stradis_release_saa(struct pci_dev *pdev)
2134 free_irq(saa->irq, saa); 2134 free_irq(saa->irq, saa);
2135 if (saa->saa7146_mem) 2135 if (saa->saa7146_mem)
2136 iounmap(saa->saa7146_mem); 2136 iounmap(saa->saa7146_mem);
2137 if (saa->video_dev.minor != -1) 2137 if (video_is_registered(&saa->video_dev))
2138 video_unregister_device(&saa->video_dev); 2138 video_unregister_device(&saa->video_dev);
2139} 2139}
2140 2140
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c
index 639c3396ae77..e89b855fd282 100644
--- a/drivers/media/video/usbvision/usbvision-video.c
+++ b/drivers/media/video/usbvision/usbvision-video.c
@@ -1418,7 +1418,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
1418 if (usbvision->vbi) { 1418 if (usbvision->vbi) {
1419 PDEBUG(DBG_PROBE, "unregister %s [v4l2]", 1419 PDEBUG(DBG_PROBE, "unregister %s [v4l2]",
1420 video_device_node_name(usbvision->vbi)); 1420 video_device_node_name(usbvision->vbi));
1421 if (usbvision->vbi->minor != -1) { 1421 if (video_is_registered(usbvision->vbi)) {
1422 video_unregister_device(usbvision->vbi); 1422 video_unregister_device(usbvision->vbi);
1423 } else { 1423 } else {
1424 video_device_release(usbvision->vbi); 1424 video_device_release(usbvision->vbi);
@@ -1430,7 +1430,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
1430 if (usbvision->rdev) { 1430 if (usbvision->rdev) {
1431 PDEBUG(DBG_PROBE, "unregister %s [v4l2]", 1431 PDEBUG(DBG_PROBE, "unregister %s [v4l2]",
1432 video_device_node_name(usbvision->rdev)); 1432 video_device_node_name(usbvision->rdev));
1433 if (usbvision->rdev->minor != -1) { 1433 if (video_is_registered(usbvision->rdev)) {
1434 video_unregister_device(usbvision->rdev); 1434 video_unregister_device(usbvision->rdev);
1435 } else { 1435 } else {
1436 video_device_release(usbvision->rdev); 1436 video_device_release(usbvision->rdev);
@@ -1442,7 +1442,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
1442 if (usbvision->vdev) { 1442 if (usbvision->vdev) {
1443 PDEBUG(DBG_PROBE, "unregister %s [v4l2]", 1443 PDEBUG(DBG_PROBE, "unregister %s [v4l2]",
1444 video_device_node_name(usbvision->vdev)); 1444 video_device_node_name(usbvision->vdev));
1445 if (usbvision->vdev->minor != -1) { 1445 if (video_is_registered(usbvision->vdev)) {
1446 video_unregister_device(usbvision->vdev); 1446 video_unregister_device(usbvision->vdev);
1447 } else { 1447 } else {
1448 video_device_release(usbvision->vdev); 1448 video_device_release(usbvision->vdev);
diff --git a/drivers/staging/cx25821/cx25821-video.c b/drivers/staging/cx25821/cx25821-video.c
index 8834bc80a5ab..156e332ce002 100644
--- a/drivers/staging/cx25821/cx25821-video.c
+++ b/drivers/staging/cx25821/cx25821-video.c
@@ -424,7 +424,7 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status)
424void cx25821_videoioctl_unregister(struct cx25821_dev *dev) 424void cx25821_videoioctl_unregister(struct cx25821_dev *dev)
425{ 425{
426 if (dev->ioctl_dev) { 426 if (dev->ioctl_dev) {
427 if (dev->ioctl_dev->minor != -1) 427 if (video_is_registered(dev->ioctl_dev))
428 video_unregister_device(dev->ioctl_dev); 428 video_unregister_device(dev->ioctl_dev);
429 else 429 else
430 video_device_release(dev->ioctl_dev); 430 video_device_release(dev->ioctl_dev);
@@ -438,7 +438,7 @@ void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num)
438 cx_clear(PCI_INT_MSK, 1); 438 cx_clear(PCI_INT_MSK, 1);
439 439
440 if (dev->video_dev[chan_num]) { 440 if (dev->video_dev[chan_num]) {
441 if (-1 != dev->video_dev[chan_num]->minor) 441 if (video_is_registered(dev->video_dev[chan_num]))
442 video_unregister_device(dev->video_dev[chan_num]); 442 video_unregister_device(dev->video_dev[chan_num]);
443 else 443 else
444 video_device_release(dev->video_dev[chan_num]); 444 video_device_release(dev->video_dev[chan_num]);