aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx23885/cx23885-417.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx23885/cx23885-417.c')
-rw-r--r--drivers/media/video/cx23885/cx23885-417.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c
index a7bfe7c3a447..272c60a993b5 100644
--- a/drivers/media/video/cx23885/cx23885-417.c
+++ b/drivers/media/video/cx23885/cx23885-417.c
@@ -1568,28 +1568,11 @@ static int vidioc_queryctrl(struct file *file, void *priv,
1568 1568
1569static int mpeg_open(struct file *file) 1569static int mpeg_open(struct file *file)
1570{ 1570{
1571 int minor = video_devdata(file)->minor; 1571 struct cx23885_dev *dev = video_drvdata(file);
1572 struct cx23885_dev *h, *dev = NULL;
1573 struct list_head *list;
1574 struct cx23885_fh *fh; 1572 struct cx23885_fh *fh;
1575 1573
1576 dprintk(2, "%s()\n", __func__); 1574 dprintk(2, "%s()\n", __func__);
1577 1575
1578 lock_kernel();
1579 list_for_each(list, &cx23885_devlist) {
1580 h = list_entry(list, struct cx23885_dev, devlist);
1581 if (h->v4l_device &&
1582 h->v4l_device->minor == minor) {
1583 dev = h;
1584 break;
1585 }
1586 }
1587
1588 if (dev == NULL) {
1589 unlock_kernel();
1590 return -ENODEV;
1591 }
1592
1593 /* allocate + initialize per filehandle data */ 1576 /* allocate + initialize per filehandle data */
1594 fh = kzalloc(sizeof(*fh), GFP_KERNEL); 1577 fh = kzalloc(sizeof(*fh), GFP_KERNEL);
1595 if (NULL == fh) { 1578 if (NULL == fh) {
@@ -1597,6 +1580,8 @@ static int mpeg_open(struct file *file)
1597 return -ENOMEM; 1580 return -ENOMEM;
1598 } 1581 }
1599 1582
1583 lock_kernel();
1584
1600 file->private_data = fh; 1585 file->private_data = fh;
1601 fh->dev = dev; 1586 fh->dev = dev;
1602 1587
@@ -1803,6 +1788,7 @@ int cx23885_417_register(struct cx23885_dev *dev)
1803 /* Allocate and initialize V4L video device */ 1788 /* Allocate and initialize V4L video device */
1804 dev->v4l_device = cx23885_video_dev_alloc(tsport, 1789 dev->v4l_device = cx23885_video_dev_alloc(tsport,
1805 dev->pci, &cx23885_mpeg_template, "mpeg"); 1790 dev->pci, &cx23885_mpeg_template, "mpeg");
1791 video_set_drvdata(dev->v4l_device, dev);
1806 err = video_register_device(dev->v4l_device, 1792 err = video_register_device(dev->v4l_device,
1807 VFL_TYPE_GRABBER, -1); 1793 VFL_TYPE_GRABBER, -1);
1808 if (err < 0) { 1794 if (err < 0) {