Commit da497e30 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB: cx88: Remove BKL

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 8979e9d4
...@@ -1057,7 +1057,7 @@ static int mpeg_open(struct file *file) ...@@ -1057,7 +1057,7 @@ static int mpeg_open(struct file *file)
dprintk( 1, "%s\n", __func__); dprintk( 1, "%s\n", __func__);
lock_kernel(); mutex_lock(&dev->core->lock);
/* Make sure we can acquire the hardware */ /* Make sure we can acquire the hardware */
drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD); drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD);
...@@ -1065,7 +1065,7 @@ static int mpeg_open(struct file *file) ...@@ -1065,7 +1065,7 @@ static int mpeg_open(struct file *file)
err = drv->request_acquire(drv); err = drv->request_acquire(drv);
if(err != 0) { if(err != 0) {
dprintk(1,"%s: Unable to acquire hardware, %d\n", __func__, err); dprintk(1,"%s: Unable to acquire hardware, %d\n", __func__, err);
unlock_kernel(); mutex_unlock(&dev->core->lock);;
return err; return err;
} }
} }
...@@ -1073,7 +1073,7 @@ static int mpeg_open(struct file *file) ...@@ -1073,7 +1073,7 @@ static int mpeg_open(struct file *file)
if (!atomic_read(&dev->core->mpeg_users) && blackbird_initialize_codec(dev) < 0) { if (!atomic_read(&dev->core->mpeg_users) && blackbird_initialize_codec(dev) < 0) {
if (drv) if (drv)
drv->request_release(drv); drv->request_release(drv);
unlock_kernel(); mutex_unlock(&dev->core->lock);
return -EINVAL; return -EINVAL;
} }
dprintk(1, "open dev=%s\n", video_device_node_name(vdev)); dprintk(1, "open dev=%s\n", video_device_node_name(vdev));
...@@ -1083,7 +1083,7 @@ static int mpeg_open(struct file *file) ...@@ -1083,7 +1083,7 @@ static int mpeg_open(struct file *file)
if (NULL == fh) { if (NULL == fh) {
if (drv) if (drv)
drv->request_release(drv); drv->request_release(drv);
unlock_kernel(); mutex_unlock(&dev->core->lock);
return -ENOMEM; return -ENOMEM;
} }
file->private_data = fh; file->private_data = fh;
...@@ -1099,10 +1099,9 @@ static int mpeg_open(struct file *file) ...@@ -1099,10 +1099,9 @@ static int mpeg_open(struct file *file)
/* FIXME: locking against other video device */ /* FIXME: locking against other video device */
cx88_set_scale(dev->core, dev->width, dev->height, cx88_set_scale(dev->core, dev->width, dev->height,
fh->mpegq.field); fh->mpegq.field);
unlock_kernel();
atomic_inc(&dev->core->mpeg_users); atomic_inc(&dev->core->mpeg_users);
mutex_unlock(&dev->core->lock);
return 0; return 0;
} }
...@@ -1120,8 +1119,11 @@ static int mpeg_release(struct file *file) ...@@ -1120,8 +1119,11 @@ static int mpeg_release(struct file *file)
videobuf_stop(&fh->mpegq); videobuf_stop(&fh->mpegq);
videobuf_mmap_free(&fh->mpegq); videobuf_mmap_free(&fh->mpegq);
mutex_lock(&dev->core->lock);
file->private_data = NULL; file->private_data = NULL;
kfree(fh); kfree(fh);
mutex_unlock(&dev->core->lock);
/* Make sure we release the hardware */ /* Make sure we release the hardware */
drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD); drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD);
......
...@@ -769,19 +769,14 @@ static int video_open(struct file *file) ...@@ -769,19 +769,14 @@ static int video_open(struct file *file)
break; break;
} }
lock_kernel();
core = dev->core;
dprintk(1, "open dev=%s radio=%d type=%s\n", dprintk(1, "open dev=%s radio=%d type=%s\n",
video_device_node_name(vdev), radio, v4l2_type_names[type]); video_device_node_name(vdev), radio, v4l2_type_names[type]);
/* allocate + initialize per filehandle data */ /* allocate + initialize per filehandle data */
fh = kzalloc(sizeof(*fh),GFP_KERNEL); fh = kzalloc(sizeof(*fh),GFP_KERNEL);
if (NULL == fh) { if (unlikely(!fh))
unlock_kernel();
return -ENOMEM; return -ENOMEM;
}
file->private_data = fh; file->private_data = fh;
fh->dev = dev; fh->dev = dev;
fh->radio = radio; fh->radio = radio;
...@@ -790,6 +785,9 @@ static int video_open(struct file *file) ...@@ -790,6 +785,9 @@ static int video_open(struct file *file)
fh->height = 240; fh->height = 240;
fh->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24); fh->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24);
mutex_lock(&core->lock);
core = dev->core;
videobuf_queue_sg_init(&fh->vidq, &cx8800_video_qops, videobuf_queue_sg_init(&fh->vidq, &cx8800_video_qops,
&dev->pci->dev, &dev->slock, &dev->pci->dev, &dev->slock,
V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_BUF_TYPE_VIDEO_CAPTURE,
...@@ -826,9 +824,9 @@ static int video_open(struct file *file) ...@@ -826,9 +824,9 @@ static int video_open(struct file *file)
} }
call_all(core, tuner, s_radio); call_all(core, tuner, s_radio);
} }
unlock_kernel();
atomic_inc(&core->users); atomic_inc(&core->users);
mutex_unlock(&core->lock);
return 0; return 0;
} }
...@@ -920,10 +918,11 @@ static int video_release(struct file *file) ...@@ -920,10 +918,11 @@ static int video_release(struct file *file)
videobuf_mmap_free(&fh->vidq); videobuf_mmap_free(&fh->vidq);
videobuf_mmap_free(&fh->vbiq); videobuf_mmap_free(&fh->vbiq);
mutex_lock(&dev->core->lock);
file->private_data = NULL; file->private_data = NULL;
kfree(fh); kfree(fh);
mutex_lock(&dev->core->lock);
if(atomic_dec_and_test(&dev->core->users)) if(atomic_dec_and_test(&dev->core->users))
call_all(dev->core, core, s_power, 0); call_all(dev->core, core, s_power, 0);
mutex_unlock(&dev->core->lock); mutex_unlock(&dev->core->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment