patch-2.3.19 linux/drivers/char/c-qcam.c
Next file: linux/drivers/char/cyclades.c
Previous file: linux/drivers/char/bw-qcam.h
Back to the patch index
Back to the overall index
- Lines: 64
- Date:
Sat Oct 2 07:35:15 1999
- Orig file:
v2.3.18/linux/drivers/char/c-qcam.c
- Orig date:
Mon Jul 5 20:07:02 1999
diff -u --recursive --new-file v2.3.18/linux/drivers/char/c-qcam.c linux/drivers/char/c-qcam.c
@@ -16,6 +16,7 @@
#include <linux/sched.h>
#include <linux/version.h>
#include <linux/videodev.h>
+#include <asm/semaphore.h>
#include <asm/uaccess.h>
struct qcam_device {
@@ -28,6 +29,7 @@
int contrast, brightness, whitebal;
int top, left;
unsigned int bidirectional;
+ struct semaphore lock;
};
/* The three possible QuickCam modes */
@@ -516,10 +518,12 @@
qcam->brightness = p.brightness>>8;
qcam->contrast = p.contrast>>8;
qcam->whitebal = p.whiteness>>8;
-
+
+ down(&qcam->lock);
parport_claim_or_block(qcam->pdev);
qc_setup(qcam);
parport_release(qcam->pdev);
+ up(&qcam->lock);
return 0;
}
case VIDIOCSWIN:
@@ -564,9 +568,11 @@
#endif
/* Ok we figured out what to use from our
wide choice */
+ down(&qcam->lock);
parport_claim_or_block(qcam->pdev);
qc_setup(qcam);
parport_release(qcam->pdev);
+ up(&qcam->lock);
return 0;
}
case VIDIOCGWIN:
@@ -608,10 +614,13 @@
{
struct qcam_device *qcam=(struct qcam_device *)v;
int len;
+
+ down(&qcam->lock);
parport_claim_or_block(qcam->pdev);
/* Probably should have a semaphore against multiple users */
len = qc_capture(qcam, buf,count);
parport_release(qcam->pdev);
+ up(&qcam->lock);
return len;
}
@@ -660,6 +669,7 @@
memcpy(&q->vdev, &qcam_template, sizeof(qcam_template));
+ init_MUTEX(&q->lock);
q->width = q->ccd_width = 320;
q->height = q->ccd_height = 240;
q->mode = QC_MILLIONS | QC_DECIMATION_1;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)