aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/cx25821/cx25821-video0.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2009-12-10 11:44:04 -0200
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-16 00:17:56 -0200
commit63b0d5ad20365edf8baf96cdbb8e7faf62501286 (patch)
tree9a12041cab48051834ee67d0de358443464e5d94 /drivers/staging/cx25821/cx25821-video0.c
parentV4L/DVB (13553): v4l: Use the video_is_registered function in device drivers (diff)
downloadlinux-dev-63b0d5ad20365edf8baf96cdbb8e7faf62501286.tar.xz
linux-dev-63b0d5ad20365edf8baf96cdbb8e7faf62501286.zip
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/staging/cx25821/cx25821-video0.c')
-rw-r--r--drivers/staging/cx25821/cx25821-video0.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/drivers/staging/cx25821/cx25821-video0.c b/drivers/staging/cx25821/cx25821-video0.c
index 950fac1d7003..eb0fe8175517 100644
--- a/drivers/staging/cx25821/cx25821-video0.c
+++ b/drivers/staging/cx25821/cx25821-video0.c
@@ -95,36 +95,19 @@ static struct videobuf_queue_ops cx25821_video_qops = {
static int video_open(struct file *file)
{
int minor = video_devdata(file)->minor;
- struct cx25821_dev *h, *dev = NULL;
+ struct cx25821_dev *dev = video_drvdata(file);
struct cx25821_fh *fh;
- struct list_head *list;
- enum v4l2_buf_type type = 0;
+ enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
u32 pix_format;
- lock_kernel();
- list_for_each(list, &cx25821_devlist) {
- h = list_entry(list, struct cx25821_dev, devlist);
-
- if (h->video_dev[SRAM_CH00]
- && h->video_dev[SRAM_CH00]->minor == minor) {
- dev = h;
- type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- }
- }
-
- if (NULL == dev) {
- unlock_kernel();
- return -ENODEV;
- }
-
printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
/* allocate + initialize per filehandle data */
fh = kzalloc(sizeof(*fh), GFP_KERNEL);
- if (NULL == fh) {
- unlock_kernel();
+ if (NULL == fh)
return -ENOMEM;
- }
+
+ lock_kernel();
file->private_data = fh;
fh->dev = dev;