summaryrefslogtreecommitdiff
path: root/drivers/media/pci/cx25821/cx25821-video.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-04-13 07:07:40 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-16 18:02:02 -0300
commita8f35ce3d6f5b776463f03403e0319c2415401f7 (patch)
tree0b089c96d8e4bd306edd495a0e5a697fd7a907a0 /drivers/media/pci/cx25821/cx25821-video.c
parentbfef0d35e57c08dff295e3203d30f9ca4077415a (diff)
[media] cx25821: remove unnecessary global devlist
This device list is not necessary. The kernel already has all that information, so just use that instead. Also remove a bogus refcount and some dead 'private_free' code in the alsa driver. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/pci/cx25821/cx25821-video.c')
-rw-r--r--drivers/media/pci/cx25821/cx25821-video.c38
1 files changed, 10 insertions, 28 deletions
diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c
index c418e0d38c24..a9aa09651cab 100644
--- a/drivers/media/pci/cx25821/cx25821-video.c
+++ b/drivers/media/pci/cx25821/cx25821-video.c
@@ -654,45 +654,28 @@ static struct videobuf_queue_ops cx25821_video_qops = {
static int video_open(struct file *file)
{
struct video_device *vdev = video_devdata(file);
- struct cx25821_dev *h, *dev = video_drvdata(file);
+ struct cx25821_dev *dev = video_drvdata(file);
struct cx25821_fh *fh;
- struct list_head *list;
- int minor = video_devdata(file)->minor;
enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
u32 pix_format;
- int ch_id = 0;
- int i;
+ int ch_id;
dprintk(1, "open dev=%s type=%s\n", video_device_node_name(vdev),
v4l2_type_names[type]);
+ for (ch_id = 0; ch_id < MAX_VID_CHANNEL_NUM - 1; ch_id++)
+ if (dev->channels[ch_id].video_dev == vdev)
+ break;
+
+ /* Can't happen */
+ if (ch_id >= MAX_VID_CHANNEL_NUM - 1)
+ return -ENODEV;
+
/* allocate + initialize per filehandle data */
fh = kzalloc(sizeof(*fh), GFP_KERNEL);
if (NULL == fh)
return -ENOMEM;
- mutex_lock(&cx25821_devlist_mutex);
-
- list_for_each(list, &cx25821_devlist)
- {
- h = list_entry(list, struct cx25821_dev, devlist);
-
- for (i = 0; i < MAX_VID_CHANNEL_NUM - 1; i++) {
- if (h->channels[i].video_dev &&
- h->channels[i].video_dev->minor == minor) {
- dev = h;
- ch_id = i;
- type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- }
- }
- }
-
- if (NULL == dev) {
- mutex_unlock(&cx25821_devlist_mutex);
- kfree(fh);
- return -ENODEV;
- }
-
file->private_data = fh;
fh->dev = dev;
fh->type = type;
@@ -719,7 +702,6 @@ static int video_open(struct file *file)
fh, NULL);
dprintk(1, "post videobuf_queue_init()\n");
- mutex_unlock(&cx25821_devlist_mutex);
return 0;
}