aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bw-qcam.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/bw-qcam.c')
-rw-r--r--drivers/media/video/bw-qcam.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c
index 6e39e253ce53..ace4ff9ea023 100644
--- a/drivers/media/video/bw-qcam.c
+++ b/drivers/media/video/bw-qcam.c
@@ -495,7 +495,7 @@ static void qc_set(struct qcam_device *q)
495 val2 = (((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? 24 : 8) * 495 val2 = (((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? 24 : 8) *
496 q->transfer_scale; 496 q->transfer_scale;
497 } 497 }
498 val = (val + val2 - 1) / val2; 498 val = DIV_ROUND_UP(val, val2);
499 qc_command(q, 0x13); 499 qc_command(q, 0x13);
500 qc_command(q, val); 500 qc_command(q, val);
501 501
@@ -651,7 +651,7 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l
651 transperline = q->width * q->bpp; 651 transperline = q->width * q->bpp;
652 divisor = (((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? 24 : 8) * 652 divisor = (((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? 24 : 8) *
653 q->transfer_scale; 653 q->transfer_scale;
654 transperline = (transperline + divisor - 1) / divisor; 654 transperline = DIV_ROUND_UP(transperline, divisor);
655 655
656 for (i = 0, yield = yieldlines; i < linestotrans; i++) 656 for (i = 0, yield = yieldlines; i < linestotrans; i++)
657 { 657 {
@@ -894,10 +894,27 @@ static ssize_t qcam_read(struct file *file, char __user *buf,
894 return len; 894 return len;
895} 895}
896 896
897static int qcam_exclusive_open(struct inode *inode, struct file *file)
898{
899 struct video_device *dev = video_devdata(file);
900 struct qcam_device *qcam = (struct qcam_device *)dev;
901
902 return test_and_set_bit(0, &qcam->in_use) ? -EBUSY : 0;
903}
904
905static int qcam_exclusive_release(struct inode *inode, struct file *file)
906{
907 struct video_device *dev = video_devdata(file);
908 struct qcam_device *qcam = (struct qcam_device *)dev;
909
910 clear_bit(0, &qcam->in_use);
911 return 0;
912}
913
897static const struct file_operations qcam_fops = { 914static const struct file_operations qcam_fops = {
898 .owner = THIS_MODULE, 915 .owner = THIS_MODULE,
899 .open = video_exclusive_open, 916 .open = qcam_exclusive_open,
900 .release = video_exclusive_release, 917 .release = qcam_exclusive_release,
901 .ioctl = qcam_ioctl, 918 .ioctl = qcam_ioctl,
902#ifdef CONFIG_COMPAT 919#ifdef CONFIG_COMPAT
903 .compat_ioctl = v4l_compat_ioctl32, 920 .compat_ioctl = v4l_compat_ioctl32,
@@ -909,6 +926,7 @@ static struct video_device qcam_template=
909{ 926{
910 .name = "Connectix Quickcam", 927 .name = "Connectix Quickcam",
911 .fops = &qcam_fops, 928 .fops = &qcam_fops,
929 .release = video_device_release_empty,
912}; 930};
913 931
914#define MAX_CAMS 4 932#define MAX_CAMS 4