aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx231xx
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2009-12-10 08:44:04 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-15 21:17:56 -0500
commit63b0d5ad20365edf8baf96cdbb8e7faf62501286 (patch)
tree9a12041cab48051834ee67d0de358443464e5d94 /drivers/media/video/cx231xx
parentf0813b4c9f7ffbeaddcba1c08a1812f7ff30e1b7 (diff)
V4L/DVB (13554a): v4l: Use the video_drvdata function in drivers
Fix all device drivers to use the video_drvdata function instead of maintaining a local list of minor to private data mappings. Call video_set_drvdata to register the driver private pointer when not already done. Where applicable, the local list of mappings is completely removed when it becomes unused. [mchehab.redhat.com: removed tm6000 changes as tm6000 is not ready yet for submission even on staging] Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx231xx')
-rw-r--r--drivers/media/video/cx231xx/cx231xx-core.c26
-rw-r--r--drivers/media/video/cx231xx/cx231xx-video.c18
-rw-r--r--drivers/media/video/cx231xx/cx231xx.h2
3 files changed, 14 insertions, 32 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-core.c b/drivers/media/video/cx231xx/cx231xx-core.c
index 0d333e679f70..4a60dfbc347d 100644
--- a/drivers/media/video/cx231xx/cx231xx-core.c
+++ b/drivers/media/video/cx231xx/cx231xx-core.c
@@ -66,32 +66,6 @@ MODULE_PARM_DESC(alt, "alternate setting to use for video endpoint");
66static LIST_HEAD(cx231xx_devlist); 66static LIST_HEAD(cx231xx_devlist);
67static DEFINE_MUTEX(cx231xx_devlist_mutex); 67static DEFINE_MUTEX(cx231xx_devlist_mutex);
68 68
69struct cx231xx *cx231xx_get_device(int minor,
70 enum v4l2_buf_type *fh_type, int *has_radio)
71{
72 struct cx231xx *h, *dev = NULL;
73
74 *fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
75 *has_radio = 0;
76
77 mutex_lock(&cx231xx_devlist_mutex);
78 list_for_each_entry(h, &cx231xx_devlist, devlist) {
79 if (h->vdev->minor == minor)
80 dev = h;
81 if (h->vbi_dev->minor == minor) {
82 dev = h;
83 *fh_type = V4L2_BUF_TYPE_VBI_CAPTURE;
84 }
85 if (h->radio_dev && h->radio_dev->minor == minor) {
86 dev = h;
87 *has_radio = 1;
88 }
89 }
90 mutex_unlock(&cx231xx_devlist_mutex);
91
92 return dev;
93}
94
95/* 69/*
96 * cx231xx_realease_resources() 70 * cx231xx_realease_resources()
97 * unregisters the v4l2,i2c and usb devices 71 * unregisters the v4l2,i2c and usb devices
diff --git a/drivers/media/video/cx231xx/cx231xx-video.c b/drivers/media/video/cx231xx/cx231xx-video.c
index 71e152dc2791..3fc7a6fe8554 100644
--- a/drivers/media/video/cx231xx/cx231xx-video.c
+++ b/drivers/media/video/cx231xx/cx231xx-video.c
@@ -1918,13 +1918,22 @@ static int cx231xx_v4l2_open(struct file *filp)
1918{ 1918{
1919 int minor = video_devdata(filp)->minor; 1919 int minor = video_devdata(filp)->minor;
1920 int errCode = 0, radio = 0; 1920 int errCode = 0, radio = 0;
1921 struct cx231xx *dev = NULL; 1921 struct video_device *vdev = video_devdata(filp);
1922 struct cx231xx *dev = video_drvdata(filp);
1922 struct cx231xx_fh *fh; 1923 struct cx231xx_fh *fh;
1923 enum v4l2_buf_type fh_type = 0; 1924 enum v4l2_buf_type fh_type = 0;
1924 1925
1925 dev = cx231xx_get_device(minor, &fh_type, &radio); 1926 switch (vdev->vfl_type) {
1926 if (NULL == dev) 1927 case VFL_TYPE_GRABBER:
1927 return -ENODEV; 1928 fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1929 break;
1930 case VFL_TYPE_VBI:
1931 fh_type = V4L2_BUF_TYPE_VBI_CAPTURE;
1932 break;
1933 case VFL_TYPE_RADIO:
1934 radio = 1;
1935 break;
1936 }
1928 1937
1929 mutex_lock(&dev->lock); 1938 mutex_lock(&dev->lock);
1930 1939
@@ -2326,6 +2335,7 @@ static struct video_device *cx231xx_vdev_init(struct cx231xx *dev,
2326 2335
2327 snprintf(vfd->name, sizeof(vfd->name), "%s %s", dev->name, type_name); 2336 snprintf(vfd->name, sizeof(vfd->name), "%s %s", dev->name, type_name);
2328 2337
2338 video_set_drvdata(vfd, dev);
2329 return vfd; 2339 return vfd;
2330} 2340}
2331 2341
diff --git a/drivers/media/video/cx231xx/cx231xx.h b/drivers/media/video/cx231xx/cx231xx.h
index 64e2ddd3c401..17d4d1a800ce 100644
--- a/drivers/media/video/cx231xx/cx231xx.h
+++ b/drivers/media/video/cx231xx/cx231xx.h
@@ -689,8 +689,6 @@ void cx231xx_release_analog_resources(struct cx231xx *dev);
689int cx231xx_register_analog_devices(struct cx231xx *dev); 689int cx231xx_register_analog_devices(struct cx231xx *dev);
690void cx231xx_remove_from_devlist(struct cx231xx *dev); 690void cx231xx_remove_from_devlist(struct cx231xx *dev);
691void cx231xx_add_into_devlist(struct cx231xx *dev); 691void cx231xx_add_into_devlist(struct cx231xx *dev);
692struct cx231xx *cx231xx_get_device(int minor,
693 enum v4l2_buf_type *fh_type, int *has_radio);
694void cx231xx_init_extension(struct cx231xx *dev); 692void cx231xx_init_extension(struct cx231xx *dev);
695void cx231xx_close_extension(struct cx231xx *dev); 693void cx231xx_close_extension(struct cx231xx *dev);
696 694