aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/saa7146_fops.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/common/saa7146_fops.c')
-rw-r--r--drivers/media/common/saa7146_fops.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index f8cf73ed49ad..3870fa948cc0 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
@@ -37,14 +37,13 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits)
37 struct saa7146_dev *dev = fh->dev; 37 struct saa7146_dev *dev = fh->dev;
38 struct saa7146_vv *vv = dev->vv_data; 38 struct saa7146_vv *vv = dev->vv_data;
39 39
40 if ((fh->resources & bits) != bits) 40 BUG_ON((fh->resources & bits) != bits);
41 BUG();
42 41
43 down(&dev->lock); 42 mutex_lock(&dev->lock);
44 fh->resources &= ~bits; 43 fh->resources &= ~bits;
45 vv->resources &= ~bits; 44 vv->resources &= ~bits;
46 DEB_D(("res: put 0x%02x, cur:0x%02x\n",bits,vv->resources)); 45 DEB_D(("res: put 0x%02x, cur:0x%02x\n",bits,vv->resources));
47 up(&dev->lock); 46 mutex_unlock(&dev->lock);
48} 47}
49 48
50 49
@@ -55,8 +54,7 @@ void saa7146_dma_free(struct saa7146_dev *dev,struct saa7146_buf *buf)
55{ 54{
56 DEB_EE(("dev:%p, buf:%p\n",dev,buf)); 55 DEB_EE(("dev:%p, buf:%p\n",dev,buf));
57 56
58 if (in_interrupt()) 57 BUG_ON(in_interrupt());
59 BUG();
60 58
61 videobuf_waiton(&buf->vb,0,0); 59 videobuf_waiton(&buf->vb,0,0);
62 videobuf_dma_pci_unmap(dev->pci, &buf->vb.dma); 60 videobuf_dma_pci_unmap(dev->pci, &buf->vb.dma);
@@ -204,7 +202,7 @@ static int fops_open(struct inode *inode, struct file *file)
204 202
205 DEB_EE(("inode:%p, file:%p, minor:%d\n",inode,file,minor)); 203 DEB_EE(("inode:%p, file:%p, minor:%d\n",inode,file,minor));
206 204
207 if (down_interruptible(&saa7146_devices_lock)) 205 if (mutex_lock_interruptible(&saa7146_devices_lock))
208 return -ERESTARTSYS; 206 return -ERESTARTSYS;
209 207
210 list_for_each(list,&saa7146_devices) { 208 list_for_each(list,&saa7146_devices) {
@@ -276,7 +274,7 @@ out:
276 kfree(fh); 274 kfree(fh);
277 file->private_data = NULL; 275 file->private_data = NULL;
278 } 276 }
279 up(&saa7146_devices_lock); 277 mutex_unlock(&saa7146_devices_lock);
280 return result; 278 return result;
281} 279}
282 280
@@ -287,7 +285,7 @@ static int fops_release(struct inode *inode, struct file *file)
287 285
288 DEB_EE(("inode:%p, file:%p\n",inode,file)); 286 DEB_EE(("inode:%p, file:%p\n",inode,file));
289 287
290 if (down_interruptible(&saa7146_devices_lock)) 288 if (mutex_lock_interruptible(&saa7146_devices_lock))
291 return -ERESTARTSYS; 289 return -ERESTARTSYS;
292 290
293 if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { 291 if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
@@ -303,7 +301,7 @@ static int fops_release(struct inode *inode, struct file *file)
303 file->private_data = NULL; 301 file->private_data = NULL;
304 kfree(fh); 302 kfree(fh);
305 303
306 up(&saa7146_devices_lock); 304 mutex_unlock(&saa7146_devices_lock);
307 305
308 return 0; 306 return 0;
309} 307}