aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-10-09 16:05:14 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-21 09:35:25 -0400
commitdc961136b982c4260b6701d9c619bf7a4a7ac6ed (patch)
treef79d280b6c094c9e5944ff4a5beb9dc3a84f14b1 /drivers
parentefba4bc12c7e81b8ece677eed5b8c8bc754802dc (diff)
[media] tm6000: don't use BKL at the driver
Instead, use core lock handling. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/tm6000/tm6000-cards.c3
-rw-r--r--drivers/staging/tm6000/tm6000-core.c2
-rw-r--r--drivers/staging/tm6000/tm6000-video.c21
3 files changed, 7 insertions, 19 deletions
diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c
index 9d091c34991b..4106ae009f9d 100644
--- a/drivers/staging/tm6000/tm6000-cards.c
+++ b/drivers/staging/tm6000/tm6000-cards.c
@@ -909,8 +909,6 @@ static void tm6000_usb_disconnect(struct usb_interface *interface)
909 909
910 printk(KERN_INFO "tm6000: disconnecting %s\n", dev->name); 910 printk(KERN_INFO "tm6000: disconnecting %s\n", dev->name);
911 911
912 mutex_lock(&dev->lock);
913
914 tm6000_ir_fini(dev); 912 tm6000_ir_fini(dev);
915 913
916 if (dev->gpio.power_led) { 914 if (dev->gpio.power_led) {
@@ -945,7 +943,6 @@ static void tm6000_usb_disconnect(struct usb_interface *interface)
945 tm6000_close_extension(dev); 943 tm6000_close_extension(dev);
946 tm6000_remove_from_devlist(dev); 944 tm6000_remove_from_devlist(dev);
947 945
948 mutex_unlock(&dev->lock);
949 kfree(dev); 946 kfree(dev);
950} 947}
951 948
diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c
index 0912639369d9..af41bbe2d236 100644
--- a/drivers/staging/tm6000/tm6000-core.c
+++ b/drivers/staging/tm6000/tm6000-core.c
@@ -313,10 +313,8 @@ int tm6000_init_analog_mode(struct tm6000_core *dev)
313 * beginning, we needed to add this hack. The better would be to 313 * beginning, we needed to add this hack. The better would be to
314 * discover some way to make tm6000 to wake up without this hack. 314 * discover some way to make tm6000 to wake up without this hack.
315 */ 315 */
316 mutex_lock(&dev->lock);
317 f.frequency = dev->freq; 316 f.frequency = dev->freq;
318 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f); 317 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f);
319 mutex_unlock(&dev->lock);
320 318
321 msleep(100); 319 msleep(100);
322 tm6000_set_standard(dev, &dev->norm); 320 tm6000_set_standard(dev, &dev->norm);
diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c
index 84ab49d1618c..4a5fe6670fb4 100644
--- a/drivers/staging/tm6000/tm6000-video.c
+++ b/drivers/staging/tm6000/tm6000-video.c
@@ -791,16 +791,11 @@ static struct videobuf_queue_ops tm6000_video_qops = {
791static int res_get(struct tm6000_core *dev, struct tm6000_fh *fh) 791static int res_get(struct tm6000_core *dev, struct tm6000_fh *fh)
792{ 792{
793 /* is it free? */ 793 /* is it free? */
794 mutex_lock(&dev->lock); 794 if (dev->resources)
795 if (dev->resources) {
796 /* no, someone else uses it */
797 mutex_unlock(&dev->lock);
798 return 0; 795 return 0;
799 }
800 /* it's free, grab it */ 796 /* it's free, grab it */
801 dev->resources =1; 797 dev->resources =1;
802 dprintk(dev, V4L2_DEBUG_RES_LOCK, "res: get\n"); 798 dprintk(dev, V4L2_DEBUG_RES_LOCK, "res: get\n");
803 mutex_unlock(&dev->lock);
804 return 1; 799 return 1;
805} 800}
806 801
@@ -811,10 +806,8 @@ static int res_locked(struct tm6000_core *dev)
811 806
812static void res_free(struct tm6000_core *dev, struct tm6000_fh *fh) 807static void res_free(struct tm6000_core *dev, struct tm6000_fh *fh)
813{ 808{
814 mutex_lock(&dev->lock);
815 dev->resources = 0; 809 dev->resources = 0;
816 dprintk(dev, V4L2_DEBUG_RES_LOCK, "res: put\n"); 810 dprintk(dev, V4L2_DEBUG_RES_LOCK, "res: put\n");
817 mutex_unlock(&dev->lock);
818} 811}
819 812
820/* ------------------------------------------------------------------ 813/* ------------------------------------------------------------------
@@ -1229,10 +1222,8 @@ static int vidioc_s_frequency (struct file *file, void *priv,
1229 if (unlikely(f->tuner != 0)) 1222 if (unlikely(f->tuner != 0))
1230 return -EINVAL; 1223 return -EINVAL;
1231 1224
1232// mutex_lock(&dev->lock);
1233 dev->freq = f->frequency; 1225 dev->freq = f->frequency;
1234 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f); 1226 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f);
1235// mutex_unlock(&dev->lock);
1236 1227
1237 return 0; 1228 return 0;
1238} 1229}
@@ -1308,7 +1299,7 @@ static int tm6000_open(struct file *file)
1308 NULL, &dev->slock, 1299 NULL, &dev->slock,
1309 fh->type, 1300 fh->type,
1310 V4L2_FIELD_INTERLACED, 1301 V4L2_FIELD_INTERLACED,
1311 sizeof(struct tm6000_buffer), fh, NULL); 1302 sizeof(struct tm6000_buffer), fh, &dev->lock);
1312 1303
1313 return 0; 1304 return 0;
1314} 1305}
@@ -1389,7 +1380,7 @@ static struct v4l2_file_operations tm6000_fops = {
1389 .owner = THIS_MODULE, 1380 .owner = THIS_MODULE,
1390 .open = tm6000_open, 1381 .open = tm6000_open,
1391 .release = tm6000_release, 1382 .release = tm6000_release,
1392 .ioctl = video_ioctl2, /* V4L2 ioctl handler */ 1383 .unlocked_ioctl = video_ioctl2, /* V4L2 ioctl handler */
1393 .read = tm6000_read, 1384 .read = tm6000_read,
1394 .poll = tm6000_poll, 1385 .poll = tm6000_poll,
1395 .mmap = tm6000_mmap, 1386 .mmap = tm6000_mmap,
@@ -1451,8 +1442,10 @@ int tm6000_v4l2_register(struct tm6000_core *dev)
1451 INIT_LIST_HEAD(&dev->vidq.active); 1442 INIT_LIST_HEAD(&dev->vidq.active);
1452 INIT_LIST_HEAD(&dev->vidq.queued); 1443 INIT_LIST_HEAD(&dev->vidq.queued);
1453 1444
1454 memcpy (dev->vfd, &tm6000_template, sizeof(*(dev->vfd))); 1445 memcpy(dev->vfd, &tm6000_template, sizeof(*(dev->vfd)));
1455 dev->vfd->debug=tm6000_debug; 1446 dev->vfd->debug = tm6000_debug;
1447 dev->vfd->lock = &dev->lock;
1448
1456 vfd->v4l2_dev = &dev->v4l2_dev; 1449 vfd->v4l2_dev = &dev->v4l2_dev;
1457 video_set_drvdata(vfd, dev); 1450 video_set_drvdata(vfd, dev);
1458 1451