aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-02-07 03:49:14 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-02-07 03:49:14 -0500
commit3593cab5d62c4c7abced1076710f9bc2d8847433 (patch)
treedd5dc21961f6b4aef6900b0c2eb63ce7c70aecd5 /drivers/media/common
parent538f9630afbbe429ecbcdcf92536200293a8e4b3 (diff)
V4L/DVB (3318b): sem2mutex: drivers/media/, #2
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/common')
-rw-r--r--drivers/media/common/saa7146_core.c6
-rw-r--r--drivers/media/common/saa7146_fops.c18
-rw-r--r--drivers/media/common/saa7146_i2c.c4
-rw-r--r--drivers/media/common/saa7146_vbi.c2
-rw-r--r--drivers/media/common/saa7146_video.c30
5 files changed, 30 insertions, 30 deletions
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c
index 04c1938b9c91..ee16c042ef6e 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -21,7 +21,7 @@
21#include <media/saa7146.h> 21#include <media/saa7146.h>
22 22
23LIST_HEAD(saa7146_devices); 23LIST_HEAD(saa7146_devices);
24DECLARE_MUTEX(saa7146_devices_lock); 24DEFINE_MUTEX(saa7146_devices_lock);
25 25
26static int saa7146_num; 26static int saa7146_num;
27 27
@@ -402,11 +402,11 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
402 402
403 pci_set_drvdata(pci, dev); 403 pci_set_drvdata(pci, dev);
404 404
405 init_MUTEX(&dev->lock); 405 mutex_init(&dev->lock);
406 spin_lock_init(&dev->int_slock); 406 spin_lock_init(&dev->int_slock);
407 spin_lock_init(&dev->slock); 407 spin_lock_init(&dev->slock);
408 408
409 init_MUTEX(&dev->i2c_lock); 409 mutex_init(&dev->i2c_lock);
410 410
411 dev->module = THIS_MODULE; 411 dev->module = THIS_MODULE;
412 init_waitqueue_head(&dev->i2c_wq); 412 init_waitqueue_head(&dev->i2c_wq);
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index f8cf73ed49ad..dc7fb20f47b5 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -17,18 +17,18 @@ int saa7146_res_get(struct saa7146_fh *fh, unsigned int bit)
17 } 17 }
18 18
19 /* is it free? */ 19 /* is it free? */
20 down(&dev->lock); 20 mutex_lock(&dev->lock);
21 if (vv->resources & bit) { 21 if (vv->resources & bit) {
22 DEB_D(("locked! vv->resources:0x%02x, we want:0x%02x\n",vv->resources,bit)); 22 DEB_D(("locked! vv->resources:0x%02x, we want:0x%02x\n",vv->resources,bit));
23 /* no, someone else uses it */ 23 /* no, someone else uses it */
24 up(&dev->lock); 24 mutex_unlock(&dev->lock);
25 return 0; 25 return 0;
26 } 26 }
27 /* it's free, grab it */ 27 /* it's free, grab it */
28 fh->resources |= bit; 28 fh->resources |= bit;
29 vv->resources |= bit; 29 vv->resources |= bit;
30 DEB_D(("res: get 0x%02x, cur:0x%02x\n",bit,vv->resources)); 30 DEB_D(("res: get 0x%02x, cur:0x%02x\n",bit,vv->resources));
31 up(&dev->lock); 31 mutex_unlock(&dev->lock);
32 return 1; 32 return 1;
33} 33}
34 34
@@ -40,11 +40,11 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits)
40 if ((fh->resources & bits) != bits) 40 if ((fh->resources & bits) != bits)
41 BUG(); 41 BUG();
42 42
43 down(&dev->lock); 43 mutex_lock(&dev->lock);
44 fh->resources &= ~bits; 44 fh->resources &= ~bits;
45 vv->resources &= ~bits; 45 vv->resources &= ~bits;
46 DEB_D(("res: put 0x%02x, cur:0x%02x\n",bits,vv->resources)); 46 DEB_D(("res: put 0x%02x, cur:0x%02x\n",bits,vv->resources));
47 up(&dev->lock); 47 mutex_unlock(&dev->lock);
48} 48}
49 49
50 50
@@ -204,7 +204,7 @@ static int fops_open(struct inode *inode, struct file *file)
204 204
205 DEB_EE(("inode:%p, file:%p, minor:%d\n",inode,file,minor)); 205 DEB_EE(("inode:%p, file:%p, minor:%d\n",inode,file,minor));
206 206
207 if (down_interruptible(&saa7146_devices_lock)) 207 if (mutex_lock_interruptible(&saa7146_devices_lock))
208 return -ERESTARTSYS; 208 return -ERESTARTSYS;
209 209
210 list_for_each(list,&saa7146_devices) { 210 list_for_each(list,&saa7146_devices) {
@@ -276,7 +276,7 @@ out:
276 kfree(fh); 276 kfree(fh);
277 file->private_data = NULL; 277 file->private_data = NULL;
278 } 278 }
279 up(&saa7146_devices_lock); 279 mutex_unlock(&saa7146_devices_lock);
280 return result; 280 return result;
281} 281}
282 282
@@ -287,7 +287,7 @@ static int fops_release(struct inode *inode, struct file *file)
287 287
288 DEB_EE(("inode:%p, file:%p\n",inode,file)); 288 DEB_EE(("inode:%p, file:%p\n",inode,file));
289 289
290 if (down_interruptible(&saa7146_devices_lock)) 290 if (mutex_lock_interruptible(&saa7146_devices_lock))
291 return -ERESTARTSYS; 291 return -ERESTARTSYS;
292 292
293 if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { 293 if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
@@ -303,7 +303,7 @@ static int fops_release(struct inode *inode, struct file *file)
303 file->private_data = NULL; 303 file->private_data = NULL;
304 kfree(fh); 304 kfree(fh);
305 305
306 up(&saa7146_devices_lock); 306 mutex_unlock(&saa7146_devices_lock);
307 307
308 return 0; 308 return 0;
309} 309}
diff --git a/drivers/media/common/saa7146_i2c.c b/drivers/media/common/saa7146_i2c.c
index 8aabdd8fb3c5..d9953f7a8b6b 100644
--- a/drivers/media/common/saa7146_i2c.c
+++ b/drivers/media/common/saa7146_i2c.c
@@ -279,7 +279,7 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *msgs, in
279 int address_err = 0; 279 int address_err = 0;
280 int short_delay = 0; 280 int short_delay = 0;
281 281
282 if (down_interruptible (&dev->i2c_lock)) 282 if (mutex_lock_interruptible(&dev->i2c_lock))
283 return -ERESTARTSYS; 283 return -ERESTARTSYS;
284 284
285 for(i=0;i<num;i++) { 285 for(i=0;i<num;i++) {
@@ -366,7 +366,7 @@ out:
366 } 366 }
367 } 367 }
368 368
369 up(&dev->i2c_lock); 369 mutex_unlock(&dev->i2c_lock);
370 return err; 370 return err;
371} 371}
372 372
diff --git a/drivers/media/common/saa7146_vbi.c b/drivers/media/common/saa7146_vbi.c
index 468d3c959075..500bd3f05e16 100644
--- a/drivers/media/common/saa7146_vbi.c
+++ b/drivers/media/common/saa7146_vbi.c
@@ -410,7 +410,7 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
410 V4L2_FIELD_SEQ_TB, // FIXME: does this really work? 410 V4L2_FIELD_SEQ_TB, // FIXME: does this really work?
411 sizeof(struct saa7146_buf), 411 sizeof(struct saa7146_buf),
412 file); 412 file);
413 init_MUTEX(&fh->vbi_q.lock); 413 mutex_init(&fh->vbi_q.lock);
414 414
415 init_timer(&fh->vbi_read_timeout); 415 init_timer(&fh->vbi_read_timeout);
416 fh->vbi_read_timeout.function = vbi_read_timeout; 416 fh->vbi_read_timeout.function = vbi_read_timeout;
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index 7ebac7949df3..6b42713d97f4 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -378,20 +378,20 @@ static int s_fmt(struct saa7146_fh *fh, struct v4l2_format *f)
378 err = try_win(dev,&f->fmt.win); 378 err = try_win(dev,&f->fmt.win);
379 if (0 != err) 379 if (0 != err)
380 return err; 380 return err;
381 down(&dev->lock); 381 mutex_lock(&dev->lock);
382 fh->ov.win = f->fmt.win; 382 fh->ov.win = f->fmt.win;
383 fh->ov.nclips = f->fmt.win.clipcount; 383 fh->ov.nclips = f->fmt.win.clipcount;
384 if (fh->ov.nclips > 16) 384 if (fh->ov.nclips > 16)
385 fh->ov.nclips = 16; 385 fh->ov.nclips = 16;
386 if (copy_from_user(fh->ov.clips,f->fmt.win.clips,sizeof(struct v4l2_clip)*fh->ov.nclips)) { 386 if (copy_from_user(fh->ov.clips,f->fmt.win.clips,sizeof(struct v4l2_clip)*fh->ov.nclips)) {
387 up(&dev->lock); 387 mutex_unlock(&dev->lock);
388 return -EFAULT; 388 return -EFAULT;
389 } 389 }
390 390
391 /* fh->ov.fh is used to indicate that we have valid overlay informations, too */ 391 /* fh->ov.fh is used to indicate that we have valid overlay informations, too */
392 fh->ov.fh = fh; 392 fh->ov.fh = fh;
393 393
394 up(&dev->lock); 394 mutex_unlock(&dev->lock);
395 395
396 /* check if our current overlay is active */ 396 /* check if our current overlay is active */
397 if (IS_OVERLAY_ACTIVE(fh) != 0) { 397 if (IS_OVERLAY_ACTIVE(fh) != 0) {
@@ -516,7 +516,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c)
516 return -EINVAL; 516 return -EINVAL;
517 } 517 }
518 518
519 down(&dev->lock); 519 mutex_lock(&dev->lock);
520 520
521 switch (ctrl->type) { 521 switch (ctrl->type) {
522 case V4L2_CTRL_TYPE_BOOLEAN: 522 case V4L2_CTRL_TYPE_BOOLEAN:
@@ -560,7 +560,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c)
560 /* fixme: we can support changing VFLIP and HFLIP here... */ 560 /* fixme: we can support changing VFLIP and HFLIP here... */
561 if (IS_CAPTURE_ACTIVE(fh) != 0) { 561 if (IS_CAPTURE_ACTIVE(fh) != 0) {
562 DEB_D(("V4L2_CID_HFLIP while active capture.\n")); 562 DEB_D(("V4L2_CID_HFLIP while active capture.\n"));
563 up(&dev->lock); 563 mutex_unlock(&dev->lock);
564 return -EINVAL; 564 return -EINVAL;
565 } 565 }
566 vv->hflip = c->value; 566 vv->hflip = c->value;
@@ -568,7 +568,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c)
568 case V4L2_CID_VFLIP: 568 case V4L2_CID_VFLIP:
569 if (IS_CAPTURE_ACTIVE(fh) != 0) { 569 if (IS_CAPTURE_ACTIVE(fh) != 0) {
570 DEB_D(("V4L2_CID_VFLIP while active capture.\n")); 570 DEB_D(("V4L2_CID_VFLIP while active capture.\n"));
571 up(&dev->lock); 571 mutex_unlock(&dev->lock);
572 return -EINVAL; 572 return -EINVAL;
573 } 573 }
574 vv->vflip = c->value; 574 vv->vflip = c->value;
@@ -577,7 +577,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c)
577 return -EINVAL; 577 return -EINVAL;
578 } 578 }
579 } 579 }
580 up(&dev->lock); 580 mutex_unlock(&dev->lock);
581 581
582 if (IS_OVERLAY_ACTIVE(fh) != 0) { 582 if (IS_OVERLAY_ACTIVE(fh) != 0) {
583 saa7146_stop_preview(fh); 583 saa7146_stop_preview(fh);
@@ -939,7 +939,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
939 } 939 }
940 } 940 }
941 941
942 down(&dev->lock); 942 mutex_lock(&dev->lock);
943 943
944 /* ok, accept it */ 944 /* ok, accept it */
945 vv->ov_fb = *fb; 945 vv->ov_fb = *fb;
@@ -948,7 +948,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
948 vv->ov_fb.fmt.bytesperline = 948 vv->ov_fb.fmt.bytesperline =
949 vv->ov_fb.fmt.width*fmt->depth/8; 949 vv->ov_fb.fmt.width*fmt->depth/8;
950 950
951 up(&dev->lock); 951 mutex_unlock(&dev->lock);
952 952
953 return 0; 953 return 0;
954 } 954 }
@@ -1086,7 +1086,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
1086 } 1086 }
1087 } 1087 }
1088 1088
1089 down(&dev->lock); 1089 mutex_lock(&dev->lock);
1090 1090
1091 for(i = 0; i < dev->ext_vv_data->num_stds; i++) 1091 for(i = 0; i < dev->ext_vv_data->num_stds; i++)
1092 if (*id & dev->ext_vv_data->stds[i].id) 1092 if (*id & dev->ext_vv_data->stds[i].id)
@@ -1098,7 +1098,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
1098 found = 1; 1098 found = 1;
1099 } 1099 }
1100 1100
1101 up(&dev->lock); 1101 mutex_unlock(&dev->lock);
1102 1102
1103 if (vv->ov_suspend != NULL) { 1103 if (vv->ov_suspend != NULL) {
1104 saa7146_start_preview(vv->ov_suspend); 1104 saa7146_start_preview(vv->ov_suspend);
@@ -1201,11 +1201,11 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
1201 DEB_D(("VIDIOCGMBUF \n")); 1201 DEB_D(("VIDIOCGMBUF \n"));
1202 1202
1203 q = &fh->video_q; 1203 q = &fh->video_q;
1204 down(&q->lock); 1204 mutex_lock(&q->lock);
1205 err = videobuf_mmap_setup(q,gbuffers,gbufsize, 1205 err = videobuf_mmap_setup(q,gbuffers,gbufsize,
1206 V4L2_MEMORY_MMAP); 1206 V4L2_MEMORY_MMAP);
1207 if (err < 0) { 1207 if (err < 0) {
1208 up(&q->lock); 1208 mutex_unlock(&q->lock);
1209 return err; 1209 return err;
1210 } 1210 }
1211 memset(mbuf,0,sizeof(*mbuf)); 1211 memset(mbuf,0,sizeof(*mbuf));
@@ -1213,7 +1213,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
1213 mbuf->size = gbuffers * gbufsize; 1213 mbuf->size = gbuffers * gbufsize;
1214 for (i = 0; i < gbuffers; i++) 1214 for (i = 0; i < gbuffers; i++)
1215 mbuf->offsets[i] = i * gbufsize; 1215 mbuf->offsets[i] = i * gbufsize;
1216 up(&q->lock); 1216 mutex_unlock(&q->lock);
1217 return 0; 1217 return 0;
1218 } 1218 }
1219 default: 1219 default:
@@ -1414,7 +1414,7 @@ static int video_open(struct saa7146_dev *dev, struct file *file)
1414 sizeof(struct saa7146_buf), 1414 sizeof(struct saa7146_buf),
1415 file); 1415 file);
1416 1416
1417 init_MUTEX(&fh->video_q.lock); 1417 mutex_init(&fh->video_q.lock);
1418 1418
1419 return 0; 1419 return 0;
1420} 1420}