aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/saa7146_fops.c
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/common/saa7146_fops.c
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/common/saa7146_fops.c')
-rw-r--r--drivers/media/common/saa7146_fops.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index f279a6440415..2d9fc2435f2b 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -195,42 +195,24 @@ void saa7146_buffer_timeout(unsigned long data)
195static int fops_open(struct file *file) 195static int fops_open(struct file *file)
196{ 196{
197 unsigned int minor = video_devdata(file)->minor; 197 unsigned int minor = video_devdata(file)->minor;
198 struct saa7146_dev *h = NULL, *dev = NULL; 198 struct video_device *vdev = video_devdata(file);
199 struct list_head *list; 199 struct saa7146_dev *dev = video_drvdata(file);
200 struct saa7146_fh *fh = NULL; 200 struct saa7146_fh *fh = NULL;
201 int result = 0; 201 int result = 0;
202 202
203 enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 203 enum v4l2_buf_type type;
204 204
205 DEB_EE(("file:%p, minor:%d\n", file, minor)); 205 DEB_EE(("file:%p, minor:%d\n", file, minor));
206 206
207 if (mutex_lock_interruptible(&saa7146_devices_lock)) 207 if (mutex_lock_interruptible(&saa7146_devices_lock))
208 return -ERESTARTSYS; 208 return -ERESTARTSYS;
209 209
210 list_for_each(list,&saa7146_devices) {
211 h = list_entry(list, struct saa7146_dev, item);
212 if( NULL == h->vv_data ) {
213 DEB_D(("device %p has not registered video devices.\n",h));
214 continue;
215 }
216 DEB_D(("trying: %p @ major %d,%d\n",h,h->vv_data->video_minor,h->vv_data->vbi_minor));
217
218 if (h->vv_data->video_minor == minor) {
219 dev = h;
220 }
221 if (h->vv_data->vbi_minor == minor) {
222 type = V4L2_BUF_TYPE_VBI_CAPTURE;
223 dev = h;
224 }
225 }
226 if (NULL == dev) {
227 DEB_S(("no such video device.\n"));
228 result = -ENODEV;
229 goto out;
230 }
231
232 DEB_D(("using: %p\n",dev)); 210 DEB_D(("using: %p\n",dev));
233 211
212 type = vdev->vfl_type == VFL_TYPE_GRABBER
213 ? V4L2_BUF_TYPE_VIDEO_CAPTURE
214 : V4L2_BUF_TYPE_VBI_CAPTURE;
215
234 /* check if an extension is registered */ 216 /* check if an extension is registered */
235 if( NULL == dev->ext ) { 217 if( NULL == dev->ext ) {
236 DEB_S(("no extension registered for this device.\n")); 218 DEB_S(("no extension registered for this device.\n"));