} else {
/* Just the blue screen */
}
-
+
*f++ = cb;
*f++ = cg;
*f++ = cr;
}
base_size = num_cams * sizeof(struct uvd) + sizeof(struct usbvideo);
- cams = (struct usbvideo *) kzalloc(base_size, GFP_KERNEL);
+ cams = (struct usbvideo *) kmalloc(base_size, GFP_KERNEL);
if (cams == NULL) {
err("Failed to allocate %d. bytes for usbvideo struct", base_size);
return -ENOMEM;
}
dbg("%s: Allocated $%p (%d. bytes) for %d. cameras",
__FUNCTION__, cams, base_size, num_cams);
+ memset(cams, 0, base_size);
/* Copy callbacks, apply defaults for those that are not set */
memmove(&cams->cb, cbTbl, sizeof(cams->cb));
cams->md_module = md;
if (cams->md_module == NULL)
warn("%s: module == NULL!", __FUNCTION__);
- mutex_init(&cams->lock); /* to 1 == available */
+ init_MUTEX(&cams->lock); /* to 1 == available */
for (i = 0; i < num_cams; i++) {
struct uvd *up = &cams->cam[i];
if (uvd->debug > 0)
info("%s(%p.)", __FUNCTION__, intf);
- mutex_lock(&uvd->lock);
+ down(&uvd->lock);
uvd->remove_pending = 1; /* Now all ISO data will be ignored */
/* At this time we ask to cancel outstanding URBs */
info("%s: In use, disconnect pending.", __FUNCTION__);
else
usbvideo_CameraRelease(uvd);
- mutex_unlock(&uvd->lock);
+ up(&uvd->lock);
info("USB camera disconnected.");
usbvideo_ClientDecModCount(uvd);
err("No usbvideo handle?");
return -1;
}
- mutex_lock(&cams->lock);
+ down(&cams->lock);
for (u = 0; u < cams->num_cameras; u++) {
struct uvd *uvd = &cams->cam[u];
if (!uvd->uvd_used) /* This one is free */
{
uvd->uvd_used = 1; /* In use now */
- mutex_init(&uvd->lock); /* to 1 == available */
+ init_MUTEX(&uvd->lock); /* to 1 == available */
uvd->dev = NULL;
rv = u;
break;
}
}
- mutex_unlock(&cams->lock);
+ up(&cams->lock);
return rv;
}
/* Not relying upon caller we increase module counter ourselves */
usbvideo_ClientIncModCount(uvd);
- mutex_lock(&uvd->lock);
+ down(&uvd->lock);
for (i=0; i < USBVIDEO_NUMSBUF; i++) {
uvd->sbuf[i].urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL);
if (uvd->sbuf[i].urb == NULL) {
* return control to the client's probe function right now.
*/
allocate_done:
- mutex_unlock(&uvd->lock);
+ up (&uvd->lock);
usbvideo_ClientDecModCount(uvd);
return uvd;
}
info("%s($%p)", __FUNCTION__, dev);
usbvideo_ClientIncModCount(uvd);
- mutex_lock(&uvd->lock);
+ down(&uvd->lock);
if (uvd->user) {
err("%s: Someone tried to open an already opened device!", __FUNCTION__);
}
}
}
- mutex_unlock(&uvd->lock);
+ up(&uvd->lock);
if (errCode != 0)
usbvideo_ClientDecModCount(uvd);
if (uvd->debug > 0)
if (uvd->debug > 1)
info("%s($%p)", __FUNCTION__, dev);
- mutex_lock(&uvd->lock);
+ down(&uvd->lock);
GET_CALLBACK(uvd, stopDataPump)(uvd);
usbvideo_rvfree(uvd->fbuf, uvd->fbuf_size);
uvd->fbuf = NULL;
#if USBVIDEO_REPORT_STATS
usbvideo_ReportStatistics(uvd);
-#endif
+#endif
uvd->user--;
if (uvd->remove_pending) {
info("usbvideo_v4l_close: Final disconnect.");
usbvideo_CameraRelease(uvd);
}
- mutex_unlock(&uvd->lock);
+ up(&uvd->lock);
usbvideo_ClientDecModCount(uvd);
if (uvd->debug > 1)
return 0;
}
case VIDIOCSCHAN:
- {
+ {
struct video_channel *v = arg;
if (v->channel != 0)
return -EINVAL;
vw->chromakey = 0;
if (VALID_CALLBACK(uvd, getFPS))
vw->flags = GET_CALLBACK(uvd, getFPS)(uvd);
- else
+ else
vw->flags = 10; /* FIXME: do better! */
return 0;
}
memset(vm, 0, sizeof(*vm));
vm->size = uvd->max_frame_size * USBVIDEO_NUMFRAMES;
vm->frames = USBVIDEO_NUMFRAMES;
- for(i = 0; i < USBVIDEO_NUMFRAMES; i++)
+ for(i = 0; i < USBVIDEO_NUMFRAMES; i++)
vm->offsets[i] = i * uvd->max_frame_size;
return 0;
if (*frameNum < 0 || *frameNum >= USBVIDEO_NUMFRAMES)
return -EINVAL;
-
+
if (uvd->debug >= 1)
info("VIDIOCSYNC: syncing to frame %d.", *frameNum);
if (uvd->flags & FLAGS_NO_DECODING)
struct video_buffer *vb = arg;
memset(vb, 0, sizeof(*vb));
- return 0;
- }
+ return 0;
+ }
case VIDIOCKEY:
return 0;
if (uvd->debug >= 1)
info("%s: %Zd. bytes, noblock=%d.", __FUNCTION__, count, noblock);
- mutex_lock(&uvd->lock);
+ down(&uvd->lock);
/* See if a frame is completed, then use it. */
for(i = 0; i < USBVIDEO_NUMFRAMES; i++) {
}
}
read_done:
- mutex_unlock(&uvd->lock);
+ up(&uvd->lock);
return count;
}
info("Not streaming, but interrupt!");
return;
}
-
+
uvd->stats.urb_count++;
if (urb->actual_length <= 0)
goto urb_done_with;
}
if (VALID_CALLBACK(uvd, videoStart))
GET_CALLBACK(uvd, videoStart)(uvd);
- else
+ else
err("%s: videoStart not set", __FUNCTION__);
/* We double buffer the Iso lists */
/* Invoke minidriver's magic to stop the camera */
if (VALID_CALLBACK(uvd, videoStop))
GET_CALLBACK(uvd, videoStop)(uvd);
- else
+ else
err("%s: videoStop not set", __FUNCTION__);
/* Set packet size to 0 */
info("%s($%p,%d.)", __FUNCTION__, uvd, frameNum);
switch (frame->frameState) {
- case FrameState_Unused:
+ case FrameState_Unused:
if (uvd->debug >= 2)
info("%s: FrameState_Unused", __FUNCTION__);
return -EINVAL;
- case FrameState_Ready:
- case FrameState_Grabbing:
- case FrameState_Error:
- {
+ case FrameState_Ready:
+ case FrameState_Grabbing:
+ case FrameState_Error:
+ {
int ntries, signalPending;
redo:
if (!CAMERA_IS_OPERATIONAL(uvd)) {
info("%s: Camera is not operational (1)", __FUNCTION__);
return -EIO;
}
- ntries = 0;
+ ntries = 0;
do {
RingQueue_InterruptibleSleepOn(&uvd->dp);
signalPending = signal_pending(current);
usbvideo_CollectRawData(uvd, frame);
else if (VALID_CALLBACK(uvd, processData))
GET_CALLBACK(uvd, processData)(uvd, frame);
- else
+ else
err("%s: processData not set", __FUNCTION__);
}
} while (frame->frameState == FrameState_Grabbing);
goto redo;
}
/* Note that we fall through to meet our destiny below */
- }
- case FrameState_Done:
+ }
+ case FrameState_Done:
/*
* Do all necessary postprocessing of data prepared in
* "interrupt" code and the collecting code above. The
* History:
* 09-Feb-2001 Created.
*/
-static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd,
+static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd,
struct usbvideo_frame *frame)
{
int i, j, v4l_linesize;