diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2006-03-20 11:59:42 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-03-24 14:26:52 -0500 |
commit | 2ae151911e31e6a012a46431cc515cc251242573 (patch) | |
tree | b0c10dad3622738f9f3e08d14f817d53c143dd59 /drivers/media/video/cpia2/cpia2_v4l.c | |
parent | bc2c7c365bd18c00f5fefaf1a560c440f3ce13f3 (diff) |
V4L/DVB (3569): PATCH: switch cpia2 to mutexes and use ioctl 32 compat lib func
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cpia2/cpia2_v4l.c')
-rw-r--r-- | drivers/media/video/cpia2/cpia2_v4l.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index 08f8be345fa8..481e178ef56d 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c | |||
@@ -255,7 +255,7 @@ static int cpia2_open(struct inode *inode, struct file *file) | |||
255 | return -ENODEV; | 255 | return -ENODEV; |
256 | } | 256 | } |
257 | 257 | ||
258 | if(down_interruptible(&cam->busy_lock)) | 258 | if(mutex_lock_interruptible(&cam->busy_lock)) |
259 | return -ERESTARTSYS; | 259 | return -ERESTARTSYS; |
260 | 260 | ||
261 | if(!cam->present) { | 261 | if(!cam->present) { |
@@ -299,7 +299,7 @@ skip_init: | |||
299 | cpia2_dbg_dump_registers(cam); | 299 | cpia2_dbg_dump_registers(cam); |
300 | 300 | ||
301 | err_return: | 301 | err_return: |
302 | up(&cam->busy_lock); | 302 | mutex_unlock(&cam->busy_lock); |
303 | return retval; | 303 | return retval; |
304 | } | 304 | } |
305 | 305 | ||
@@ -314,7 +314,7 @@ static int cpia2_close(struct inode *inode, struct file *file) | |||
314 | struct camera_data *cam = video_get_drvdata(dev); | 314 | struct camera_data *cam = video_get_drvdata(dev); |
315 | struct cpia2_fh *fh = file->private_data; | 315 | struct cpia2_fh *fh = file->private_data; |
316 | 316 | ||
317 | down(&cam->busy_lock); | 317 | mutex_lock(&cam->busy_lock); |
318 | 318 | ||
319 | if (cam->present && | 319 | if (cam->present && |
320 | (cam->open_count == 1 | 320 | (cam->open_count == 1 |
@@ -347,7 +347,7 @@ static int cpia2_close(struct inode *inode, struct file *file) | |||
347 | } | 347 | } |
348 | } | 348 | } |
349 | 349 | ||
350 | up(&cam->busy_lock); | 350 | mutex_unlock(&cam->busy_lock); |
351 | 351 | ||
352 | return 0; | 352 | return 0; |
353 | } | 353 | } |
@@ -523,11 +523,11 @@ static int sync(struct camera_data *cam, int frame_nr) | |||
523 | return 0; | 523 | return 0; |
524 | } | 524 | } |
525 | 525 | ||
526 | up(&cam->busy_lock); | 526 | mutex_unlock(&cam->busy_lock); |
527 | wait_event_interruptible(cam->wq_stream, | 527 | wait_event_interruptible(cam->wq_stream, |
528 | !cam->streaming || | 528 | !cam->streaming || |
529 | frame->status == FRAME_READY); | 529 | frame->status == FRAME_READY); |
530 | down(&cam->busy_lock); | 530 | mutex_lock(&cam->busy_lock); |
531 | if (signal_pending(current)) | 531 | if (signal_pending(current)) |
532 | return -ERESTARTSYS; | 532 | return -ERESTARTSYS; |
533 | if(!cam->present) | 533 | if(!cam->present) |
@@ -1544,11 +1544,11 @@ static int ioctl_dqbuf(void *arg,struct camera_data *cam, struct file *file) | |||
1544 | if(frame < 0) { | 1544 | if(frame < 0) { |
1545 | /* Wait for a frame to become available */ | 1545 | /* Wait for a frame to become available */ |
1546 | struct framebuf *cb=cam->curbuff; | 1546 | struct framebuf *cb=cam->curbuff; |
1547 | up(&cam->busy_lock); | 1547 | mutex_unlock(&cam->busy_lock); |
1548 | wait_event_interruptible(cam->wq_stream, | 1548 | wait_event_interruptible(cam->wq_stream, |
1549 | !cam->present || | 1549 | !cam->present || |
1550 | (cb=cam->curbuff)->status == FRAME_READY); | 1550 | (cb=cam->curbuff)->status == FRAME_READY); |
1551 | down(&cam->busy_lock); | 1551 | mutex_lock(&cam->busy_lock); |
1552 | if (signal_pending(current)) | 1552 | if (signal_pending(current)) |
1553 | return -ERESTARTSYS; | 1553 | return -ERESTARTSYS; |
1554 | if(!cam->present) | 1554 | if(!cam->present) |
@@ -1591,11 +1591,11 @@ static int cpia2_do_ioctl(struct inode *inode, struct file *file, | |||
1591 | return -ENOTTY; | 1591 | return -ENOTTY; |
1592 | 1592 | ||
1593 | /* make this _really_ smp-safe */ | 1593 | /* make this _really_ smp-safe */ |
1594 | if (down_interruptible(&cam->busy_lock)) | 1594 | if (mutex_lock_interruptible(&cam->busy_lock)) |
1595 | return -ERESTARTSYS; | 1595 | return -ERESTARTSYS; |
1596 | 1596 | ||
1597 | if (!cam->present) { | 1597 | if (!cam->present) { |
1598 | up(&cam->busy_lock); | 1598 | mutex_unlock(&cam->busy_lock); |
1599 | return -ENODEV; | 1599 | return -ENODEV; |
1600 | } | 1600 | } |
1601 | 1601 | ||
@@ -1608,7 +1608,7 @@ static int cpia2_do_ioctl(struct inode *inode, struct file *file, | |||
1608 | struct cpia2_fh *fh = file->private_data; | 1608 | struct cpia2_fh *fh = file->private_data; |
1609 | retval = v4l2_prio_check(&cam->prio, &fh->prio); | 1609 | retval = v4l2_prio_check(&cam->prio, &fh->prio); |
1610 | if(retval) { | 1610 | if(retval) { |
1611 | up(&cam->busy_lock); | 1611 | mutex_unlock(&cam->busy_lock); |
1612 | return retval; | 1612 | return retval; |
1613 | } | 1613 | } |
1614 | break; | 1614 | break; |
@@ -1618,7 +1618,7 @@ static int cpia2_do_ioctl(struct inode *inode, struct file *file, | |||
1618 | { | 1618 | { |
1619 | struct cpia2_fh *fh = file->private_data; | 1619 | struct cpia2_fh *fh = file->private_data; |
1620 | if(fh->prio != V4L2_PRIORITY_RECORD) { | 1620 | if(fh->prio != V4L2_PRIORITY_RECORD) { |
1621 | up(&cam->busy_lock); | 1621 | mutex_unlock(&cam->busy_lock); |
1622 | return -EBUSY; | 1622 | return -EBUSY; |
1623 | } | 1623 | } |
1624 | break; | 1624 | break; |
@@ -1847,7 +1847,7 @@ static int cpia2_do_ioctl(struct inode *inode, struct file *file, | |||
1847 | break; | 1847 | break; |
1848 | } | 1848 | } |
1849 | 1849 | ||
1850 | up(&cam->busy_lock); | 1850 | mutex_unlock(&cam->busy_lock); |
1851 | return retval; | 1851 | return retval; |
1852 | } | 1852 | } |
1853 | 1853 | ||
@@ -1924,14 +1924,15 @@ static void reset_camera_struct_v4l(struct camera_data *cam) | |||
1924 | * The v4l video device structure initialized for this device | 1924 | * The v4l video device structure initialized for this device |
1925 | ***/ | 1925 | ***/ |
1926 | static struct file_operations fops_template = { | 1926 | static struct file_operations fops_template = { |
1927 | .owner= THIS_MODULE, | 1927 | .owner = THIS_MODULE, |
1928 | .open= cpia2_open, | 1928 | .open = cpia2_open, |
1929 | .release= cpia2_close, | 1929 | .release = cpia2_close, |
1930 | .read= cpia2_v4l_read, | 1930 | .read = cpia2_v4l_read, |
1931 | .poll= cpia2_v4l_poll, | 1931 | .poll = cpia2_v4l_poll, |
1932 | .ioctl= cpia2_ioctl, | 1932 | .ioctl = cpia2_ioctl, |
1933 | .llseek= no_llseek, | 1933 | .llseek = no_llseek, |
1934 | .mmap= cpia2_mmap, | 1934 | .compat_ioctl = v4l_compat_ioctl32, |
1935 | .mmap = cpia2_mmap, | ||
1935 | }; | 1936 | }; |
1936 | 1937 | ||
1937 | static struct video_device cpia2_template = { | 1938 | static struct video_device cpia2_template = { |