Commit b8167cc8 authored by Simon Evans's avatar Simon Evans Committed by Greg Kroah-Hartman

[PATCH] use __FUNCTION__ in usbvideo

This patch replaces static const char proc[] = <function name>
with __FUNCTION__
parent 2c0ac5c5
...@@ -616,18 +616,17 @@ EXPORT_SYMBOL(usbvideo_DrawLine); ...@@ -616,18 +616,17 @@ EXPORT_SYMBOL(usbvideo_DrawLine);
*/ */
void usbvideo_TestPattern(uvd_t *uvd, int fullframe, int pmode) void usbvideo_TestPattern(uvd_t *uvd, int fullframe, int pmode)
{ {
static const char proc[] = "usbvideo_TestPattern";
usbvideo_frame_t *frame; usbvideo_frame_t *frame;
int num_cell = 0; int num_cell = 0;
int scan_length = 0; int scan_length = 0;
static int num_pass = 0; static int num_pass = 0;
if (uvd == NULL) { if (uvd == NULL) {
err("%s: uvd == NULL", proc); err("%s: uvd == NULL", __FUNCTION__);
return; return;
} }
if ((uvd->curframe < 0) || (uvd->curframe >= USBVIDEO_NUMFRAMES)) { if ((uvd->curframe < 0) || (uvd->curframe >= USBVIDEO_NUMFRAMES)) {
err("%s: uvd->curframe=%d.", proc, uvd->curframe); err("%s: uvd->curframe=%d.", __FUNCTION__, uvd->curframe);
return; return;
} }
...@@ -733,17 +732,16 @@ EXPORT_SYMBOL(usbvideo_SayAndWait); ...@@ -733,17 +732,16 @@ EXPORT_SYMBOL(usbvideo_SayAndWait);
static void usbvideo_ClientIncModCount(uvd_t *uvd) static void usbvideo_ClientIncModCount(uvd_t *uvd)
{ {
static const char proc[] = "usbvideo_ClientIncModCount";
if (uvd == NULL) { if (uvd == NULL) {
err("%s: uvd == NULL", proc); err("%s: uvd == NULL", __FUNCTION__);
return; return;
} }
if (uvd->handle == NULL) { if (uvd->handle == NULL) {
err("%s: uvd->handle == NULL", proc); err("%s: uvd->handle == NULL", __FUNCTION__);
return; return;
} }
if (uvd->handle->md_module == NULL) { if (uvd->handle->md_module == NULL) {
err("%s: uvd->handle->md_module == NULL", proc); err("%s: uvd->handle->md_module == NULL", __FUNCTION__);
return; return;
} }
__MOD_INC_USE_COUNT(uvd->handle->md_module); __MOD_INC_USE_COUNT(uvd->handle->md_module);
...@@ -751,17 +749,16 @@ static void usbvideo_ClientIncModCount(uvd_t *uvd) ...@@ -751,17 +749,16 @@ static void usbvideo_ClientIncModCount(uvd_t *uvd)
static void usbvideo_ClientDecModCount(uvd_t *uvd) static void usbvideo_ClientDecModCount(uvd_t *uvd)
{ {
static const char proc[] = "usbvideo_ClientDecModCount";
if (uvd == NULL) { if (uvd == NULL) {
err("%s: uvd == NULL", proc); err("%s: uvd == NULL", __FUNCTION__);
return; return;
} }
if (uvd->handle == NULL) { if (uvd->handle == NULL) {
err("%s: uvd->handle == NULL", proc); err("%s: uvd->handle == NULL", __FUNCTION__);
return; return;
} }
if (uvd->handle->md_module == NULL) { if (uvd->handle->md_module == NULL) {
err("%s: uvd->handle->md_module == NULL", proc); err("%s: uvd->handle->md_module == NULL", __FUNCTION__);
return; return;
} }
__MOD_DEC_USE_COUNT(uvd->handle->md_module); __MOD_DEC_USE_COUNT(uvd->handle->md_module);
...@@ -776,19 +773,18 @@ int usbvideo_register( ...@@ -776,19 +773,18 @@ int usbvideo_register(
struct module *md, struct module *md,
const struct usb_device_id *id_table) const struct usb_device_id *id_table)
{ {
static const char proc[] = "usbvideo_register";
usbvideo_t *cams; usbvideo_t *cams;
int i, base_size; int i, base_size;
/* Check parameters for sanity */ /* Check parameters for sanity */
if ((num_cams <= 0) || (pCams == NULL) || (cbTbl == NULL)) { if ((num_cams <= 0) || (pCams == NULL) || (cbTbl == NULL)) {
err("%s: Illegal call", proc); err("%s: Illegal call", __FUNCTION__);
return -EINVAL; return -EINVAL;
} }
/* Check registration callback - must be set! */ /* Check registration callback - must be set! */
if (cbTbl->probe == NULL) { if (cbTbl->probe == NULL) {
err("%s: probe() is required!", proc); err("%s: probe() is required!", __FUNCTION__);
return -EINVAL; return -EINVAL;
} }
...@@ -799,7 +795,7 @@ int usbvideo_register( ...@@ -799,7 +795,7 @@ int usbvideo_register(
return -ENOMEM; return -ENOMEM;
} }
dbg("%s: Allocated $%p (%d. bytes) for %d. cameras", dbg("%s: Allocated $%p (%d. bytes) for %d. cameras",
proc, cams, base_size, num_cams); __FUNCTION__, cams, base_size, num_cams);
memset(cams, 0, base_size); memset(cams, 0, base_size);
/* Copy callbacks, apply defaults for those that are not set */ /* Copy callbacks, apply defaults for those that are not set */
...@@ -834,7 +830,7 @@ int usbvideo_register( ...@@ -834,7 +830,7 @@ int usbvideo_register(
cams->cam = (uvd_t *) &cams[1]; cams->cam = (uvd_t *) &cams[1];
cams->md_module = md; cams->md_module = md;
if (cams->md_module == NULL) if (cams->md_module == NULL)
warn("%s: module == NULL!", proc); warn("%s: module == NULL!", __FUNCTION__);
init_MUTEX(&cams->lock); /* to 1 == available */ init_MUTEX(&cams->lock); /* to 1 == available */
for (i = 0; i < num_cams; i++) { for (i = 0; i < num_cams; i++) {
...@@ -849,11 +845,11 @@ int usbvideo_register( ...@@ -849,11 +845,11 @@ int usbvideo_register(
if (up->user_data == NULL) { if (up->user_data == NULL) {
up->user_size = 0; up->user_size = 0;
err("%s: Failed to allocate user_data (%d. bytes)", err("%s: Failed to allocate user_data (%d. bytes)",
proc, up->user_size); __FUNCTION__, up->user_size);
return -ENOMEM; return -ENOMEM;
} }
dbg("%s: Allocated cams[%d].user_data=$%p (%d. bytes)", dbg("%s: Allocated cams[%d].user_data=$%p (%d. bytes)",
proc, i, up->user_data, up->user_size); __FUNCTION__, i, up->user_data, up->user_size);
} }
} }
...@@ -868,7 +864,7 @@ int usbvideo_register( ...@@ -868,7 +864,7 @@ int usbvideo_register(
#if USES_PROC_FS #if USES_PROC_FS
if (cams->uses_procfs) { if (cams->uses_procfs) {
dbg("%s: Creating /proc filesystem entries.", proc); dbg("%s: Creating /proc filesystem entries.", __FUNCTION__);
usbvideo_procfs_level1_create(cams); usbvideo_procfs_level1_create(cams);
} }
#endif #endif
...@@ -895,31 +891,30 @@ EXPORT_SYMBOL(usbvideo_register); ...@@ -895,31 +891,30 @@ EXPORT_SYMBOL(usbvideo_register);
*/ */
void usbvideo_Deregister(usbvideo_t **pCams) void usbvideo_Deregister(usbvideo_t **pCams)
{ {
static const char proc[] = "usbvideo_deregister";
usbvideo_t *cams; usbvideo_t *cams;
int i; int i;
if (pCams == NULL) { if (pCams == NULL) {
err("%s: pCams == NULL", proc); err("%s: pCams == NULL", __FUNCTION__);
return; return;
} }
cams = *pCams; cams = *pCams;
if (cams == NULL) { if (cams == NULL) {
err("%s: cams == NULL", proc); err("%s: cams == NULL", __FUNCTION__);
return; return;
} }
#if USES_PROC_FS #if USES_PROC_FS
if (cams->uses_procfs) { if (cams->uses_procfs) {
dbg("%s: Deregistering filesystem entries.", proc); dbg("%s: Deregistering filesystem entries.", __FUNCTION__);
usbvideo_procfs_level1_destroy(cams); usbvideo_procfs_level1_destroy(cams);
} }
#endif #endif
dbg("%s: Deregistering %s driver.", proc, cams->drvName); dbg("%s: Deregistering %s driver.", __FUNCTION__, cams->drvName);
usb_deregister(&cams->usbdrv); usb_deregister(&cams->usbdrv);
dbg("%s: Deallocating cams=$%p (%d. cameras)", proc, cams, cams->num_cameras); dbg("%s: Deallocating cams=$%p (%d. cameras)", __FUNCTION__, cams, cams->num_cameras);
for (i=0; i < cams->num_cameras; i++) { for (i=0; i < cams->num_cameras; i++) {
uvd_t *up = &cams->cam[i]; uvd_t *up = &cams->cam[i];
int warning = 0; int warning = 0;
...@@ -933,16 +928,16 @@ void usbvideo_Deregister(usbvideo_t **pCams) ...@@ -933,16 +928,16 @@ void usbvideo_Deregister(usbvideo_t **pCams)
} }
if (warning) { if (warning) {
err("%s: Warning: user_data=$%p user_size=%d.", err("%s: Warning: user_data=$%p user_size=%d.",
proc, up->user_data, up->user_size); __FUNCTION__, up->user_data, up->user_size);
} else { } else {
dbg("%s: Freeing %d. $%p->user_data=$%p", dbg("%s: Freeing %d. $%p->user_data=$%p",
proc, i, up, up->user_data); __FUNCTION__, i, up, up->user_data);
kfree(up->user_data); kfree(up->user_data);
} }
} }
/* Whole array was allocated in one chunk */ /* Whole array was allocated in one chunk */
dbg("%s: Freed %d uvd_t structures", dbg("%s: Freed %d uvd_t structures",
proc, cams->num_cameras); __FUNCTION__, cams->num_cameras);
kfree(cams); kfree(cams);
*pCams = NULL; *pCams = NULL;
} }
...@@ -973,17 +968,16 @@ EXPORT_SYMBOL(usbvideo_Deregister); ...@@ -973,17 +968,16 @@ EXPORT_SYMBOL(usbvideo_Deregister);
*/ */
static void usbvideo_Disconnect(struct usb_device *dev, void *ptr) static void usbvideo_Disconnect(struct usb_device *dev, void *ptr)
{ {
static const char proc[] = "usbvideo_Disconnect";
uvd_t *uvd = (uvd_t *) ptr; uvd_t *uvd = (uvd_t *) ptr;
int i; int i;
if ((dev == NULL) || (uvd == NULL)) { if ((dev == NULL) || (uvd == NULL)) {
err("%s($%p,$%p): Illegal call.", proc, dev, ptr); err("%s($%p,$%p): Illegal call.", __FUNCTION__, dev, ptr);
return; return;
} }
usbvideo_ClientIncModCount(uvd); usbvideo_ClientIncModCount(uvd);
if (uvd->debug > 0) if (uvd->debug > 0)
info("%s(%p,%p.)", proc, dev, ptr); info("%s(%p,%p.)", __FUNCTION__, dev, ptr);
down(&uvd->lock); down(&uvd->lock);
uvd->remove_pending = 1; /* Now all ISO data will be ignored */ uvd->remove_pending = 1; /* Now all ISO data will be ignored */
...@@ -999,10 +993,10 @@ static void usbvideo_Disconnect(struct usb_device *dev, void *ptr) ...@@ -999,10 +993,10 @@ static void usbvideo_Disconnect(struct usb_device *dev, void *ptr)
video_unregister_device(&uvd->vdev); video_unregister_device(&uvd->vdev);
if (uvd->debug > 0) if (uvd->debug > 0)
info("%s: Video unregistered.", proc); info("%s: Video unregistered.", __FUNCTION__);
if (uvd->user) if (uvd->user)
info("%s: In use, disconnect pending.", proc); info("%s: In use, disconnect pending.", __FUNCTION__);
else else
usbvideo_CameraRelease(uvd); usbvideo_CameraRelease(uvd);
up(&uvd->lock); up(&uvd->lock);
...@@ -1023,16 +1017,15 @@ static void usbvideo_Disconnect(struct usb_device *dev, void *ptr) ...@@ -1023,16 +1017,15 @@ static void usbvideo_Disconnect(struct usb_device *dev, void *ptr)
*/ */
static void usbvideo_CameraRelease(uvd_t *uvd) static void usbvideo_CameraRelease(uvd_t *uvd)
{ {
static const char proc[] = "usbvideo_CameraRelease";
if (uvd == NULL) { if (uvd == NULL) {
err("%s: Illegal call", proc); err("%s: Illegal call", __FUNCTION__);
return; return;
} }
#if USES_PROC_FS #if USES_PROC_FS
assert(uvd->handle != NULL); assert(uvd->handle != NULL);
if (uvd->handle->uses_procfs) { if (uvd->handle->uses_procfs) {
dbg("%s: Removing /proc/%s/ filesystem entries.", proc, uvd->handle->drvName); dbg("%s: Removing /proc/%s/ filesystem entries.", __FUNCTION__, uvd->handle->drvName);
usbvideo_procfs_level2_destroy(uvd); usbvideo_procfs_level2_destroy(uvd);
} }
#endif #endif
...@@ -1146,22 +1139,21 @@ EXPORT_SYMBOL(usbvideo_AllocateDevice); ...@@ -1146,22 +1139,21 @@ EXPORT_SYMBOL(usbvideo_AllocateDevice);
int usbvideo_RegisterVideoDevice(uvd_t *uvd) int usbvideo_RegisterVideoDevice(uvd_t *uvd)
{ {
static const char proc[] = "usbvideo_RegisterVideoDevice";
char tmp1[20], tmp2[20]; /* Buffers for printing */ char tmp1[20], tmp2[20]; /* Buffers for printing */
if (uvd == NULL) { if (uvd == NULL) {
err("%s: Illegal call.", proc); err("%s: Illegal call.", __FUNCTION__);
return -EINVAL; return -EINVAL;
} }
if (uvd->video_endp == 0) { if (uvd->video_endp == 0) {
info("%s: No video endpoint specified; data pump disabled.", proc); info("%s: No video endpoint specified; data pump disabled.", __FUNCTION__);
} }
if (uvd->paletteBits == 0) { if (uvd->paletteBits == 0) {
err("%s: No palettes specified!", proc); err("%s: No palettes specified!", __FUNCTION__);
return -EINVAL; return -EINVAL;
} }
if (uvd->defaultPalette == 0) { if (uvd->defaultPalette == 0) {
info("%s: No default palette!", proc); info("%s: No default palette!", __FUNCTION__);
} }
uvd->max_frame_size = VIDEOSIZE_X(uvd->canvas) * uvd->max_frame_size = VIDEOSIZE_X(uvd->canvas) *
...@@ -1171,17 +1163,17 @@ int usbvideo_RegisterVideoDevice(uvd_t *uvd) ...@@ -1171,17 +1163,17 @@ int usbvideo_RegisterVideoDevice(uvd_t *uvd)
if (uvd->debug > 0) { if (uvd->debug > 0) {
info("%s: iface=%d. endpoint=$%02x paletteBits=$%08lx", info("%s: iface=%d. endpoint=$%02x paletteBits=$%08lx",
proc, uvd->iface, uvd->video_endp, uvd->paletteBits); __FUNCTION__, uvd->iface, uvd->video_endp, uvd->paletteBits);
} }
if (video_register_device(&uvd->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { if (video_register_device(&uvd->vdev, VFL_TYPE_GRABBER, video_nr) == -1) {
err("%s: video_register_device failed", proc); err("%s: video_register_device failed", __FUNCTION__);
return -EPIPE; return -EPIPE;
} }
if (uvd->debug > 1) { if (uvd->debug > 1) {
info("%s: video_register_device() successful", proc); info("%s: video_register_device() successful", __FUNCTION__);
} }
if (uvd->dev == NULL) { if (uvd->dev == NULL) {
err("%s: uvd->dev == NULL", proc); err("%s: uvd->dev == NULL", __FUNCTION__);
return -EINVAL; return -EINVAL;
} }
...@@ -1194,7 +1186,7 @@ int usbvideo_RegisterVideoDevice(uvd_t *uvd) ...@@ -1194,7 +1186,7 @@ int usbvideo_RegisterVideoDevice(uvd_t *uvd)
if (uvd->handle->uses_procfs) { if (uvd->handle->uses_procfs) {
if (uvd->debug > 0) { if (uvd->debug > 0) {
info("%s: Creating /proc/video/%s/ filesystem entries.", info("%s: Creating /proc/video/%s/ filesystem entries.",
proc, uvd->handle->drvName); __FUNCTION__, uvd->handle->drvName);
} }
usbvideo_procfs_level2_create(uvd); usbvideo_procfs_level2_create(uvd);
} }
...@@ -1254,20 +1246,19 @@ static int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -1254,20 +1246,19 @@ static int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma)
*/ */
static int usbvideo_v4l_open(struct inode *inode, struct file *file) static int usbvideo_v4l_open(struct inode *inode, struct file *file)
{ {
static const char proc[] = "usbvideo_v4l_open";
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
uvd_t *uvd = (uvd_t *) dev; uvd_t *uvd = (uvd_t *) dev;
const int sb_size = FRAMES_PER_DESC * uvd->iso_packet_len; const int sb_size = FRAMES_PER_DESC * uvd->iso_packet_len;
int i, errCode = 0; int i, errCode = 0;
if (uvd->debug > 1) if (uvd->debug > 1)
info("%s($%p", proc, dev); info("%s($%p)", __FUNCTION__, dev);
usbvideo_ClientIncModCount(uvd); usbvideo_ClientIncModCount(uvd);
down(&uvd->lock); down(&uvd->lock);
if (uvd->user) { if (uvd->user) {
err("%s: Someone tried to open an already opened device!", proc); err("%s: Someone tried to open an already opened device!", __FUNCTION__);
errCode = -EBUSY; errCode = -EBUSY;
} else { } else {
/* Clear statistics */ /* Clear statistics */
...@@ -1283,7 +1274,7 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file) ...@@ -1283,7 +1274,7 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file)
RingQueue_Allocate(&uvd->dp, RING_QUEUE_SIZE); RingQueue_Allocate(&uvd->dp, RING_QUEUE_SIZE);
if ((uvd->fbuf == NULL) || if ((uvd->fbuf == NULL) ||
(!RingQueue_IsAllocated(&uvd->dp))) { (!RingQueue_IsAllocated(&uvd->dp))) {
err("%s: Failed to allocate fbuf or dp", proc); err("%s: Failed to allocate fbuf or dp", __FUNCTION__);
errCode = -ENOMEM; errCode = -ENOMEM;
} else { } else {
/* Allocate all buffers */ /* Allocate all buffers */
...@@ -1329,19 +1320,19 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file) ...@@ -1329,19 +1320,19 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file)
if (errCode == 0) { if (errCode == 0) {
if (VALID_CALLBACK(uvd, setupOnOpen)) { if (VALID_CALLBACK(uvd, setupOnOpen)) {
if (uvd->debug > 1) if (uvd->debug > 1)
info("%s: setupOnOpen callback", proc); info("%s: setupOnOpen callback", __FUNCTION__);
errCode = GET_CALLBACK(uvd, setupOnOpen)(uvd); errCode = GET_CALLBACK(uvd, setupOnOpen)(uvd);
if (errCode < 0) { if (errCode < 0) {
err("%s: setupOnOpen callback failed (%d.).", err("%s: setupOnOpen callback failed (%d.).",
proc, errCode); __FUNCTION__, errCode);
} else if (uvd->debug > 1) { } else if (uvd->debug > 1) {
info("%s: setupOnOpen callback successful", proc); info("%s: setupOnOpen callback successful", __FUNCTION__);
} }
} }
if (errCode == 0) { if (errCode == 0) {
uvd->settingsAdjusted = 0; uvd->settingsAdjusted = 0;
if (uvd->debug > 1) if (uvd->debug > 1)
info("%s: Open succeeded.", proc); info("%s: Open succeeded.", __FUNCTION__);
uvd->user++; uvd->user++;
file->private_data = uvd; file->private_data = uvd;
} }
...@@ -1351,7 +1342,7 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file) ...@@ -1351,7 +1342,7 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file)
if (errCode != 0) if (errCode != 0)
usbvideo_ClientDecModCount(uvd); usbvideo_ClientDecModCount(uvd);
if (uvd->debug > 0) if (uvd->debug > 0)
info("%s: Returning %d.", proc, errCode); info("%s: Returning %d.", __FUNCTION__, errCode);
return errCode; return errCode;
} }
...@@ -1369,13 +1360,12 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file) ...@@ -1369,13 +1360,12 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file)
*/ */
static int usbvideo_v4l_close(struct inode *inode, struct file *file) static int usbvideo_v4l_close(struct inode *inode, struct file *file)
{ {
static const char proc[] = "usbvideo_v4l_close";
struct video_device *dev = file->private_data; struct video_device *dev = file->private_data;
uvd_t *uvd = (uvd_t *) dev; uvd_t *uvd = (uvd_t *) dev;
int i; int i;
if (uvd->debug > 1) if (uvd->debug > 1)
info("%s($%p)", proc, dev); info("%s($%p)", __FUNCTION__, dev);
down(&uvd->lock); down(&uvd->lock);
GET_CALLBACK(uvd, stopDataPump)(uvd); GET_CALLBACK(uvd, stopDataPump)(uvd);
...@@ -1402,7 +1392,7 @@ static int usbvideo_v4l_close(struct inode *inode, struct file *file) ...@@ -1402,7 +1392,7 @@ static int usbvideo_v4l_close(struct inode *inode, struct file *file)
usbvideo_ClientDecModCount(uvd); usbvideo_ClientDecModCount(uvd);
if (uvd->debug > 1) if (uvd->debug > 1)
info("%s: Completed.", proc); info("%s: Completed.", __FUNCTION__);
file->private_data = NULL; file->private_data = NULL;
return 0; return 0;
} }
...@@ -1647,7 +1637,6 @@ static int usbvideo_v4l_ioctl(struct inode *inode, struct file *file, ...@@ -1647,7 +1637,6 @@ static int usbvideo_v4l_ioctl(struct inode *inode, struct file *file,
static int usbvideo_v4l_read(struct file *file, char *buf, static int usbvideo_v4l_read(struct file *file, char *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
static const char proc[] = "usbvideo_v4l_read";
uvd_t *uvd = file->private_data; uvd_t *uvd = file->private_data;
int noblock = file->f_flags & O_NONBLOCK; int noblock = file->f_flags & O_NONBLOCK;
int frmx = -1, i; int frmx = -1, i;
...@@ -1657,7 +1646,7 @@ static int usbvideo_v4l_read(struct file *file, char *buf, ...@@ -1657,7 +1646,7 @@ static int usbvideo_v4l_read(struct file *file, char *buf,
return -EFAULT; return -EFAULT;
if (uvd->debug >= 1) if (uvd->debug >= 1)
info("%s: %d. bytes, noblock=%d.", proc, count, noblock); info("%s: %d. bytes, noblock=%d.", __FUNCTION__, count, noblock);
down(&uvd->lock); down(&uvd->lock);
...@@ -1704,7 +1693,7 @@ static int usbvideo_v4l_read(struct file *file, char *buf, ...@@ -1704,7 +1693,7 @@ static int usbvideo_v4l_read(struct file *file, char *buf,
*/ */
if (frmx == -1) { if (frmx == -1) {
if (uvd->defaultPalette == 0) { if (uvd->defaultPalette == 0) {
err("%s: No default palette; don't know what to do!", proc); err("%s: No default palette; don't know what to do!", __FUNCTION__);
count = -EFAULT; count = -EFAULT;
goto read_done; goto read_done;
} }
...@@ -1776,7 +1765,7 @@ static int usbvideo_v4l_read(struct file *file, char *buf, ...@@ -1776,7 +1765,7 @@ static int usbvideo_v4l_read(struct file *file, char *buf,
frame->seqRead_Index += count; frame->seqRead_Index += count;
if (uvd->debug >= 1) { if (uvd->debug >= 1) {
err("%s: {copy} count used=%d, new seqRead_Index=%ld", err("%s: {copy} count used=%d, new seqRead_Index=%ld",
proc, count, frame->seqRead_Index); __FUNCTION__, count, frame->seqRead_Index);
} }
/* Finally check if the frame is done with and "release" it */ /* Finally check if the frame is done with and "release" it */
...@@ -1787,7 +1776,7 @@ static int usbvideo_v4l_read(struct file *file, char *buf, ...@@ -1787,7 +1776,7 @@ static int usbvideo_v4l_read(struct file *file, char *buf,
/* Mark it as available to be used again. */ /* Mark it as available to be used again. */
uvd->frame[frmx].frameState = FrameState_Unused; uvd->frame[frmx].frameState = FrameState_Unused;
if (usbvideo_NewFrame(uvd, (frmx + 1) % USBVIDEO_NUMFRAMES)) { if (usbvideo_NewFrame(uvd, (frmx + 1) % USBVIDEO_NUMFRAMES)) {
err("%s: usbvideo_NewFrame failed.", proc); err("%s: usbvideo_NewFrame failed.", __FUNCTION__);
} }
} }
read_done: read_done:
...@@ -1890,15 +1879,14 @@ static void usbvideo_IsocIrq(struct urb *urb) ...@@ -1890,15 +1879,14 @@ static void usbvideo_IsocIrq(struct urb *urb)
*/ */
static int usbvideo_StartDataPump(uvd_t *uvd) static int usbvideo_StartDataPump(uvd_t *uvd)
{ {
static const char proc[] = "usbvideo_StartDataPump";
struct usb_device *dev = uvd->dev; struct usb_device *dev = uvd->dev;
int i, errFlag; int i, errFlag;
if (uvd->debug > 1) if (uvd->debug > 1)
info("%s($%p)", proc, uvd); info("%s($%p)", __FUNCTION__, uvd);
if (!CAMERA_IS_OPERATIONAL(uvd)) { if (!CAMERA_IS_OPERATIONAL(uvd)) {
err("%s: Camera is not operational",proc); err("%s: Camera is not operational", __FUNCTION__);
return -EFAULT; return -EFAULT;
} }
uvd->curframe = -1; uvd->curframe = -1;
...@@ -1906,14 +1894,14 @@ static int usbvideo_StartDataPump(uvd_t *uvd) ...@@ -1906,14 +1894,14 @@ static int usbvideo_StartDataPump(uvd_t *uvd)
/* Alternate interface 1 is is the biggest frame size */ /* Alternate interface 1 is is the biggest frame size */
i = usb_set_interface(dev, uvd->iface, uvd->ifaceAltActive); i = usb_set_interface(dev, uvd->iface, uvd->ifaceAltActive);
if (i < 0) { if (i < 0) {
err("%s: usb_set_interface error", proc); err("%s: usb_set_interface error", __FUNCTION__);
uvd->last_error = i; uvd->last_error = i;
return -EBUSY; return -EBUSY;
} }
if (VALID_CALLBACK(uvd, videoStart)) if (VALID_CALLBACK(uvd, videoStart))
GET_CALLBACK(uvd, videoStart)(uvd); GET_CALLBACK(uvd, videoStart)(uvd);
else else
err("%s: videoStart not set", proc); err("%s: videoStart not set", __FUNCTION__);
/* We double buffer the Iso lists */ /* We double buffer the Iso lists */
for (i=0; i < USBVIDEO_NUMSBUF; i++) { for (i=0; i < USBVIDEO_NUMSBUF; i++) {
...@@ -1938,12 +1926,12 @@ static int usbvideo_StartDataPump(uvd_t *uvd) ...@@ -1938,12 +1926,12 @@ static int usbvideo_StartDataPump(uvd_t *uvd)
for (i=0; i < USBVIDEO_NUMSBUF; i++) { for (i=0; i < USBVIDEO_NUMSBUF; i++) {
errFlag = usb_submit_urb(uvd->sbuf[i].urb, GFP_KERNEL); errFlag = usb_submit_urb(uvd->sbuf[i].urb, GFP_KERNEL);
if (errFlag) if (errFlag)
err("%s: usb_submit_isoc(%d) ret %d", proc, i, errFlag); err("%s: usb_submit_isoc(%d) ret %d", __FUNCTION__, i, errFlag);
} }
uvd->streaming = 1; uvd->streaming = 1;
if (uvd->debug > 1) if (uvd->debug > 1)
info("%s: streaming=1 video_endp=$%02x", proc, uvd->video_endp); info("%s: streaming=1 video_endp=$%02x", __FUNCTION__, uvd->video_endp);
return 0; return 0;
} }
...@@ -1959,11 +1947,10 @@ static int usbvideo_StartDataPump(uvd_t *uvd) ...@@ -1959,11 +1947,10 @@ static int usbvideo_StartDataPump(uvd_t *uvd)
*/ */
static void usbvideo_StopDataPump(uvd_t *uvd) static void usbvideo_StopDataPump(uvd_t *uvd)
{ {
static const char proc[] = "usbvideo_StopDataPump";
int i, j; int i, j;
if (uvd->debug > 1) if (uvd->debug > 1)
info("%s($%p)", proc, uvd); info("%s($%p)", __FUNCTION__, uvd);
if ((uvd == NULL) || (!uvd->streaming) || (uvd->dev == NULL)) if ((uvd == NULL) || (!uvd->streaming) || (uvd->dev == NULL))
return; return;
...@@ -1972,10 +1959,10 @@ static void usbvideo_StopDataPump(uvd_t *uvd) ...@@ -1972,10 +1959,10 @@ static void usbvideo_StopDataPump(uvd_t *uvd)
for (i=0; i < USBVIDEO_NUMSBUF; i++) { for (i=0; i < USBVIDEO_NUMSBUF; i++) {
j = usb_unlink_urb(uvd->sbuf[i].urb); j = usb_unlink_urb(uvd->sbuf[i].urb);
if (j < 0) if (j < 0)
err("%s: usb_unlink_urb() error %d.", proc, j); err("%s: usb_unlink_urb() error %d.", __FUNCTION__, j);
} }
if (uvd->debug > 1) if (uvd->debug > 1)
info("%s: streaming=0", proc); info("%s: streaming=0", __FUNCTION__);
uvd->streaming = 0; uvd->streaming = 0;
if (!uvd->remove_pending) { if (!uvd->remove_pending) {
...@@ -1983,12 +1970,12 @@ static void usbvideo_StopDataPump(uvd_t *uvd) ...@@ -1983,12 +1970,12 @@ static void usbvideo_StopDataPump(uvd_t *uvd)
if (VALID_CALLBACK(uvd, videoStop)) if (VALID_CALLBACK(uvd, videoStop))
GET_CALLBACK(uvd, videoStop)(uvd); GET_CALLBACK(uvd, videoStop)(uvd);
else else
err("%s: videoStop not set" ,proc); err("%s: videoStop not set", __FUNCTION__);
/* Set packet size to 0 */ /* Set packet size to 0 */
j = usb_set_interface(uvd->dev, uvd->iface, uvd->ifaceAltInactive); j = usb_set_interface(uvd->dev, uvd->iface, uvd->ifaceAltInactive);
if (j < 0) { if (j < 0) {
err("%s: usb_set_interface() error %d.", proc, j); err("%s: usb_set_interface() error %d.", __FUNCTION__, j);
uvd->last_error = j; uvd->last_error = j;
} }
} }
...@@ -2109,16 +2096,15 @@ static void usbvideo_CollectRawData(uvd_t *uvd, usbvideo_frame_t *frame) ...@@ -2109,16 +2096,15 @@ static void usbvideo_CollectRawData(uvd_t *uvd, usbvideo_frame_t *frame)
static int usbvideo_GetFrame(uvd_t *uvd, int frameNum) static int usbvideo_GetFrame(uvd_t *uvd, int frameNum)
{ {
static const char proc[] = "usbvideo_GetFrame";
usbvideo_frame_t *frame = &uvd->frame[frameNum]; usbvideo_frame_t *frame = &uvd->frame[frameNum];
if (uvd->debug >= 2) if (uvd->debug >= 2)
info("%s($%p,%d.)", proc, uvd, frameNum); info("%s($%p,%d.)", __FUNCTION__, uvd, frameNum);
switch (frame->frameState) { switch (frame->frameState) {
case FrameState_Unused: case FrameState_Unused:
if (uvd->debug >= 2) if (uvd->debug >= 2)
info("%s: FrameState_Unused", proc); info("%s: FrameState_Unused", __FUNCTION__);
return -EINVAL; return -EINVAL;
case FrameState_Ready: case FrameState_Ready:
case FrameState_Grabbing: case FrameState_Grabbing:
...@@ -2128,7 +2114,7 @@ static int usbvideo_GetFrame(uvd_t *uvd, int frameNum) ...@@ -2128,7 +2114,7 @@ static int usbvideo_GetFrame(uvd_t *uvd, int frameNum)
redo: redo:
if (!CAMERA_IS_OPERATIONAL(uvd)) { if (!CAMERA_IS_OPERATIONAL(uvd)) {
if (uvd->debug >= 2) if (uvd->debug >= 2)
info("%s: Camera is not operational (1)", proc); info("%s: Camera is not operational (1)", __FUNCTION__);
return -EIO; return -EIO;
} }
ntries = 0; ntries = 0;
...@@ -2137,24 +2123,24 @@ static int usbvideo_GetFrame(uvd_t *uvd, int frameNum) ...@@ -2137,24 +2123,24 @@ static int usbvideo_GetFrame(uvd_t *uvd, int frameNum)
signalPending = signal_pending(current); signalPending = signal_pending(current);
if (!CAMERA_IS_OPERATIONAL(uvd)) { if (!CAMERA_IS_OPERATIONAL(uvd)) {
if (uvd->debug >= 2) if (uvd->debug >= 2)
info("%s: Camera is not operational (2)", proc); info("%s: Camera is not operational (2)", __FUNCTION__);
return -EIO; return -EIO;
} }
assert(uvd->fbuf != NULL); assert(uvd->fbuf != NULL);
if (signalPending) { if (signalPending) {
if (uvd->debug >= 2) if (uvd->debug >= 2)
info("%s: Signal=$%08x", proc, signalPending); info("%s: Signal=$%08x", __FUNCTION__, signalPending);
if (uvd->flags & FLAGS_RETRY_VIDIOCSYNC) { if (uvd->flags & FLAGS_RETRY_VIDIOCSYNC) {
usbvideo_TestPattern(uvd, 1, 0); usbvideo_TestPattern(uvd, 1, 0);
uvd->curframe = -1; uvd->curframe = -1;
uvd->stats.frame_num++; uvd->stats.frame_num++;
if (uvd->debug >= 2) if (uvd->debug >= 2)
info("%s: Forced test pattern screen", proc); info("%s: Forced test pattern screen", __FUNCTION__);
return 0; return 0;
} else { } else {
/* Standard answer: Interrupted! */ /* Standard answer: Interrupted! */
if (uvd->debug >= 2) if (uvd->debug >= 2)
info("%s: Interrupted!", proc); info("%s: Interrupted!", __FUNCTION__);
return -EINTR; return -EINTR;
} }
} else { } else {
...@@ -2164,17 +2150,17 @@ static int usbvideo_GetFrame(uvd_t *uvd, int frameNum) ...@@ -2164,17 +2150,17 @@ static int usbvideo_GetFrame(uvd_t *uvd, int frameNum)
else if (VALID_CALLBACK(uvd, processData)) else if (VALID_CALLBACK(uvd, processData))
GET_CALLBACK(uvd, processData)(uvd, frame); GET_CALLBACK(uvd, processData)(uvd, frame);
else else
err("%s: processData not set", proc); err("%s: processData not set", __FUNCTION__);
} }
} while (frame->frameState == FrameState_Grabbing); } while (frame->frameState == FrameState_Grabbing);
if (uvd->debug >= 2) { if (uvd->debug >= 2) {
info("%s: Grabbing done; state=%d. (%lu. bytes)", info("%s: Grabbing done; state=%d. (%lu. bytes)",
proc, frame->frameState, frame->seqRead_Length); __FUNCTION__, frame->frameState, frame->seqRead_Length);
} }
if (frame->frameState == FrameState_Error) { if (frame->frameState == FrameState_Error) {
int ret = usbvideo_NewFrame(uvd, frameNum); int ret = usbvideo_NewFrame(uvd, frameNum);
if (ret < 0) { if (ret < 0) {
err("%s: usbvideo_NewFrame() failed (%d.)", proc, ret); err("%s: usbvideo_NewFrame() failed (%d.)", __FUNCTION__, ret);
return ret; return ret;
} }
goto redo; goto redo;
...@@ -2206,7 +2192,7 @@ static int usbvideo_GetFrame(uvd_t *uvd, int frameNum) ...@@ -2206,7 +2192,7 @@ static int usbvideo_GetFrame(uvd_t *uvd, int frameNum)
} }
frame->frameState = FrameState_Done_Hold; frame->frameState = FrameState_Done_Hold;
if (uvd->debug >= 2) if (uvd->debug >= 2)
info("%s: Entered FrameState_Done_Hold state.", proc); info("%s: Entered FrameState_Done_Hold state.", __FUNCTION__);
return 0; return 0;
case FrameState_Done_Hold: case FrameState_Done_Hold:
...@@ -2217,12 +2203,12 @@ static int usbvideo_GetFrame(uvd_t *uvd, int frameNum) ...@@ -2217,12 +2203,12 @@ static int usbvideo_GetFrame(uvd_t *uvd, int frameNum)
* it will be released back into the wild to roam freely. * it will be released back into the wild to roam freely.
*/ */
if (uvd->debug >= 2) if (uvd->debug >= 2)
info("%s: FrameState_Done_Hold state.", proc); info("%s: FrameState_Done_Hold state.", __FUNCTION__);
return 0; return 0;
} }
/* Catch-all for other cases. We shall not be here. */ /* Catch-all for other cases. We shall not be here. */
err("%s: Invalid state %d.", proc, frame->frameState); err("%s: Invalid state %d.", __FUNCTION__, frame->frameState);
frame->frameState = FrameState_Unused; frame->frameState = FrameState_Unused;
return 0; return 0;
} }
...@@ -2313,13 +2299,12 @@ EXPORT_SYMBOL(usbvideo_DeinterlaceFrame); ...@@ -2313,13 +2299,12 @@ EXPORT_SYMBOL(usbvideo_DeinterlaceFrame);
static void usbvideo_SoftwareContrastAdjustment(uvd_t *uvd, static void usbvideo_SoftwareContrastAdjustment(uvd_t *uvd,
usbvideo_frame_t *frame) usbvideo_frame_t *frame)
{ {
static const char proc[] = "usbvideo_SoftwareContrastAdjustment";
int i, j, v4l_linesize; int i, j, v4l_linesize;
signed long adj; signed long adj;
const int ccm = 128; /* Color correction median - see below */ const int ccm = 128; /* Color correction median - see below */
if ((uvd == NULL) || (frame == NULL)) { if ((uvd == NULL) || (frame == NULL)) {
err("%s: Illegal call.", proc); err("%s: Illegal call.", __FUNCTION__);
return; return;
} }
adj = (uvd->vpic.contrast - 0x8000) >> 8; /* -128..+127 = -ccm..+(ccm-1)*/ adj = (uvd->vpic.contrast - 0x8000) >> 8; /* -128..+127 = -ccm..+(ccm-1)*/
...@@ -2371,14 +2356,12 @@ extern struct proc_dir_entry *video_proc_entry; ...@@ -2371,14 +2356,12 @@ extern struct proc_dir_entry *video_proc_entry;
static void usbvideo_procfs_level1_create(usbvideo_t *ut) static void usbvideo_procfs_level1_create(usbvideo_t *ut)
{ {
static const char proc[] = "usbvideo_procfs_level1_create";
if (ut == NULL) { if (ut == NULL) {
err("%s: ut == NULL", proc); err("%s: ut == NULL", __FUNCTION__);
return; return;
} }
if (video_proc_entry == NULL) { if (video_proc_entry == NULL) {
err("%s: /proc/video/ doesn't exist.", proc); err("%s: /proc/video/ doesn't exist.", __FUNCTION__);
return; return;
} }
ut->procfs_dEntry = create_proc_entry(ut->drvName, S_IFDIR, video_proc_entry); ut->procfs_dEntry = create_proc_entry(ut->drvName, S_IFDIR, video_proc_entry);
...@@ -2386,16 +2369,14 @@ static void usbvideo_procfs_level1_create(usbvideo_t *ut) ...@@ -2386,16 +2369,14 @@ static void usbvideo_procfs_level1_create(usbvideo_t *ut)
if (ut->md_module != NULL) if (ut->md_module != NULL)
ut->procfs_dEntry->owner = ut->md_module; ut->procfs_dEntry->owner = ut->md_module;
} else { } else {
err("%s: Unable to initialize /proc/video/%s", proc, ut->drvName); err("%s: Unable to initialize /proc/video/%s", __FUNCTION__, ut->drvName);
} }
} }
static void usbvideo_procfs_level1_destroy(usbvideo_t *ut) static void usbvideo_procfs_level1_destroy(usbvideo_t *ut)
{ {
static const char proc[] = "usbvideo_procfs_level1_destroy";
if (ut == NULL) { if (ut == NULL) {
err("%s: ut == NULL", proc); err("%s: ut == NULL", __FUNCTION__);
return; return;
} }
if (ut->procfs_dEntry != NULL) { if (ut->procfs_dEntry != NULL) {
...@@ -2406,15 +2387,13 @@ static void usbvideo_procfs_level1_destroy(usbvideo_t *ut) ...@@ -2406,15 +2387,13 @@ static void usbvideo_procfs_level1_destroy(usbvideo_t *ut)
static void usbvideo_procfs_level2_create(uvd_t *uvd) static void usbvideo_procfs_level2_create(uvd_t *uvd)
{ {
static const char proc[] = "usbvideo_procfs_level2_create";
if (uvd == NULL) { if (uvd == NULL) {
err("%s: uvd == NULL", proc); err("%s: uvd == NULL", __FUNCTION__);
return; return;
} }
assert(uvd->handle != NULL); assert(uvd->handle != NULL);
if (uvd->handle->procfs_dEntry == NULL) { if (uvd->handle->procfs_dEntry == NULL) {
err("%s: uvd->handle->procfs_dEntry == NULL", proc); err("%s: uvd->handle->procfs_dEntry == NULL", __FUNCTION__);
return; return;
} }
...@@ -2428,16 +2407,14 @@ static void usbvideo_procfs_level2_create(uvd_t *uvd) ...@@ -2428,16 +2407,14 @@ static void usbvideo_procfs_level2_create(uvd_t *uvd)
uvd->procfs_vEntry->read_proc = uvd->handle->cb.procfs_read; uvd->procfs_vEntry->read_proc = uvd->handle->cb.procfs_read;
uvd->procfs_vEntry->write_proc = uvd->handle->cb.procfs_write; uvd->procfs_vEntry->write_proc = uvd->handle->cb.procfs_write;
} else { } else {
err("%s: Failed to create entry \"%s\"", proc, uvd->videoName); err("%s: Failed to create entry \"%s\"", __FUNCTION__, uvd->videoName);
} }
} }
static void usbvideo_procfs_level2_destroy(uvd_t *uvd) static void usbvideo_procfs_level2_destroy(uvd_t *uvd)
{ {
static const char proc[] = "usbvideo_procfs_level2_destroy";
if (uvd == NULL) { if (uvd == NULL) {
err("%s: uvd == NULL", proc); err("%s: uvd == NULL", __FUNCTION__);
return; return;
} }
if (uvd->procfs_vEntry != NULL) { if (uvd->procfs_vEntry != NULL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment