summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/gspca
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/usb/gspca')
-rw-r--r--drivers/media/usb/gspca/benq.c2
-rw-r--r--drivers/media/usb/gspca/conex.c12
-rw-r--r--drivers/media/usb/gspca/cpia1.c33
-rw-r--r--drivers/media/usb/gspca/etoms.c10
-rw-r--r--drivers/media/usb/gspca/gl860/gl860.c2
-rw-r--r--drivers/media/usb/gspca/gspca.c69
-rw-r--r--drivers/media/usb/gspca/gspca.h40
-rw-r--r--drivers/media/usb/gspca/jeilinj.c2
-rw-r--r--drivers/media/usb/gspca/konica.c28
-rw-r--r--drivers/media/usb/gspca/m5602/m5602_core.c6
-rw-r--r--drivers/media/usb/gspca/m5602/m5602_mt9m111.c18
-rw-r--r--drivers/media/usb/gspca/m5602/m5602_ov7660.c10
-rw-r--r--drivers/media/usb/gspca/m5602/m5602_ov9650.c26
-rw-r--r--drivers/media/usb/gspca/m5602/m5602_po1030.c21
-rw-r--r--drivers/media/usb/gspca/m5602/m5602_s5k4aa.c16
-rw-r--r--drivers/media/usb/gspca/m5602/m5602_s5k83a.c1
-rw-r--r--drivers/media/usb/gspca/mr97310a.c8
-rw-r--r--drivers/media/usb/gspca/ov519.c81
-rw-r--r--drivers/media/usb/gspca/ov534.c2
-rw-r--r--drivers/media/usb/gspca/pac207.c2
-rw-r--r--drivers/media/usb/gspca/pac7302.c7
-rw-r--r--drivers/media/usb/gspca/pac7311.c5
-rw-r--r--drivers/media/usb/gspca/pac_common.h2
-rw-r--r--drivers/media/usb/gspca/sn9c2028.c4
-rw-r--r--drivers/media/usb/gspca/sonixj.c11
-rw-r--r--drivers/media/usb/gspca/spca1528.c4
-rw-r--r--drivers/media/usb/gspca/spca500.c36
-rw-r--r--drivers/media/usb/gspca/spca501.c44
-rw-r--r--drivers/media/usb/gspca/spca505.c42
-rw-r--r--drivers/media/usb/gspca/spca508.c41
-rw-r--r--drivers/media/usb/gspca/spca561.c70
-rw-r--r--drivers/media/usb/gspca/sq905.c2
-rw-r--r--drivers/media/usb/gspca/sq905c.c6
-rw-r--r--drivers/media/usb/gspca/sq930x.c4
-rw-r--r--drivers/media/usb/gspca/stv0680.c14
-rw-r--r--drivers/media/usb/gspca/stv06xx/stv06xx.c17
-rw-r--r--drivers/media/usb/gspca/stv06xx/stv06xx_hdcs.c8
-rw-r--r--drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c14
-rw-r--r--drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c2
-rw-r--r--drivers/media/usb/gspca/stv06xx/stv06xx_vv6410.c10
-rw-r--r--drivers/media/usb/gspca/sunplus.c27
-rw-r--r--drivers/media/usb/gspca/vc032x.c9
-rw-r--r--drivers/media/usb/gspca/w996Xcf.c5
-rw-r--r--drivers/media/usb/gspca/zc3xx.c3
44 files changed, 373 insertions, 403 deletions
diff --git a/drivers/media/usb/gspca/benq.c b/drivers/media/usb/gspca/benq.c
index 352f32190e68..05f406deae13 100644
--- a/drivers/media/usb/gspca/benq.c
+++ b/drivers/media/usb/gspca/benq.c
@@ -186,7 +186,7 @@ static void sd_isoc_irq(struct urb *urb)
/* check the packet status and length */
if (urb0->iso_frame_desc[i].actual_length != SD_PKT_SZ
|| urb->iso_frame_desc[i].actual_length != SD_PKT_SZ) {
- PDEBUG(D_ERR, "ISOC bad lengths %d / %d",
+ PERR("ISOC bad lengths %d / %d",
urb0->iso_frame_desc[i].actual_length,
urb->iso_frame_desc[i].actual_length);
gspca_dev->last_packet_type = DISCARD_PACKET;
diff --git a/drivers/media/usb/gspca/conex.c b/drivers/media/usb/gspca/conex.c
index c9052f20435e..38714df31ac4 100644
--- a/drivers/media/usb/gspca/conex.c
+++ b/drivers/media/usb/gspca/conex.c
@@ -73,12 +73,11 @@ static void reg_r(struct gspca_dev *gspca_dev,
{
struct usb_device *dev = gspca_dev->dev;
-#ifdef GSPCA_DEBUG
if (len > USB_BUF_SZ) {
- pr_err("reg_r: buffer overflow\n");
+ PERR("reg_r: buffer overflow\n");
return;
}
-#endif
+
usb_control_msg(dev,
usb_rcvctrlpipe(dev, 0),
0,
@@ -113,13 +112,12 @@ static void reg_w(struct gspca_dev *gspca_dev,
{
struct usb_device *dev = gspca_dev->dev;
-#ifdef GSPCA_DEBUG
if (len > USB_BUF_SZ) {
- pr_err("reg_w: buffer overflow\n");
+ PERR("reg_w: buffer overflow\n");
return;
}
PDEBUG(D_USBO, "reg write [%02x] = %02x..", index, *buffer);
-#endif
+
memcpy(gspca_dev->usb_buf, buffer, len);
usb_control_msg(dev,
usb_sndctrlpipe(dev, 0),
@@ -689,7 +687,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
reg_w_val(gspca_dev, 0x0053, 0x00);
} while (--retry);
if (retry == 0)
- PDEBUG(D_ERR, "Damned Errors sending jpeg Table");
+ PERR("Damned Errors sending jpeg Table");
/* send the qtable now */
reg_r(gspca_dev, 0x0001, 1); /* -> 0x18 */
length = 8;
diff --git a/drivers/media/usb/gspca/cpia1.c b/drivers/media/usb/gspca/cpia1.c
index 1dcdd9f95f1c..064b53043b15 100644
--- a/drivers/media/usb/gspca/cpia1.c
+++ b/drivers/media/usb/gspca/cpia1.c
@@ -421,8 +421,7 @@ static int cpia_usb_transferCmd(struct gspca_dev *gspca_dev, u8 *command)
pipe = usb_sndctrlpipe(gspca_dev->dev, 0);
requesttype = USB_TYPE_VENDOR | USB_RECIP_DEVICE;
} else {
- PDEBUG(D_ERR, "Unexpected first byte of command: %x",
- command[0]);
+ PERR("Unexpected first byte of command: %x", command[0]);
return -EINVAL;
}
@@ -701,7 +700,7 @@ static void reset_camera_params(struct gspca_dev *gspca_dev)
params->qx3.cradled = 0;
}
-static void printstatus(struct cam_params *params)
+static void printstatus(struct gspca_dev *gspca_dev, struct cam_params *params)
{
PDEBUG(D_PROBE, "status: %02x %02x %02x %02x %02x %02x %02x %02x",
params->status.systemState, params->status.grabState,
@@ -725,10 +724,9 @@ static int goto_low_power(struct gspca_dev *gspca_dev)
if (sd->params.status.systemState != LO_POWER_STATE) {
if (sd->params.status.systemState != WARM_BOOT_STATE) {
- PDEBUG(D_ERR,
- "unexpected state after lo power cmd: %02x",
- sd->params.status.systemState);
- printstatus(&sd->params);
+ PERR("unexpected state after lo power cmd: %02x",
+ sd->params.status.systemState);
+ printstatus(gspca_dev, &sd->params);
}
return -EIO;
}
@@ -756,9 +754,9 @@ static int goto_high_power(struct gspca_dev *gspca_dev)
return ret;
if (sd->params.status.systemState != HI_POWER_STATE) {
- PDEBUG(D_ERR, "unexpected state after hi power cmd: %02x",
- sd->params.status.systemState);
- printstatus(&sd->params);
+ PERR("unexpected state after hi power cmd: %02x",
+ sd->params.status.systemState);
+ printstatus(gspca_dev, &sd->params);
return -EIO;
}
@@ -1449,8 +1447,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
sd->params.version.firmwareVersion = 0;
get_version_information(gspca_dev);
if (sd->params.version.firmwareVersion != 1) {
- PDEBUG(D_ERR, "only firmware version 1 is supported (got: %d)",
- sd->params.version.firmwareVersion);
+ PERR("only firmware version 1 is supported (got: %d)",
+ sd->params.version.firmwareVersion);
return -ENODEV;
}
@@ -1475,9 +1473,9 @@ static int sd_start(struct gspca_dev *gspca_dev)
/* Start the camera in low power mode */
if (goto_low_power(gspca_dev)) {
if (sd->params.status.systemState != WARM_BOOT_STATE) {
- PDEBUG(D_ERR, "unexpected systemstate: %02x",
- sd->params.status.systemState);
- printstatus(&sd->params);
+ PERR("unexpected systemstate: %02x",
+ sd->params.status.systemState);
+ printstatus(gspca_dev, &sd->params);
return -ENODEV;
}
@@ -1523,9 +1521,8 @@ static int sd_start(struct gspca_dev *gspca_dev)
return ret;
if (sd->params.status.fatalError) {
- PDEBUG(D_ERR, "fatal_error: %04x, vp_status: %04x",
- sd->params.status.fatalError,
- sd->params.status.vpStatus);
+ PERR("fatal_error: %04x, vp_status: %04x",
+ sd->params.status.fatalError, sd->params.status.vpStatus);
return -EIO;
}
diff --git a/drivers/media/usb/gspca/etoms.c b/drivers/media/usb/gspca/etoms.c
index 38f68e11c3a2..948a6357573d 100644
--- a/drivers/media/usb/gspca/etoms.c
+++ b/drivers/media/usb/gspca/etoms.c
@@ -163,12 +163,11 @@ static void reg_r(struct gspca_dev *gspca_dev,
{
struct usb_device *dev = gspca_dev->dev;
-#ifdef GSPCA_DEBUG
if (len > USB_BUF_SZ) {
- pr_err("reg_r: buffer overflow\n");
+ PERR("reg_r: buffer overflow\n");
return;
}
-#endif
+
usb_control_msg(dev,
usb_rcvctrlpipe(dev, 0),
0,
@@ -201,13 +200,12 @@ static void reg_w(struct gspca_dev *gspca_dev,
{
struct usb_device *dev = gspca_dev->dev;
-#ifdef GSPCA_DEBUG
if (len > USB_BUF_SZ) {
pr_err("reg_w: buffer overflow\n");
return;
}
PDEBUG(D_USBO, "reg write [%02x] = %02x..", index, *buffer);
-#endif
+
memcpy(gspca_dev->usb_buf, buffer, len);
usb_control_msg(dev,
usb_sndctrlpipe(dev, 0),
@@ -274,7 +272,7 @@ static int et_video(struct gspca_dev *gspca_dev,
: 0); /* stopvideo */
ret = Et_WaitStatus(gspca_dev);
if (ret != 0)
- PDEBUG(D_ERR, "timeout video on/off");
+ PERR("timeout video on/off");
return ret;
}
diff --git a/drivers/media/usb/gspca/gl860/gl860.c b/drivers/media/usb/gspca/gl860/gl860.c
index 96d9c28a748c..cb1e64ca59c9 100644
--- a/drivers/media/usb/gspca/gl860/gl860.c
+++ b/drivers/media/usb/gspca/gl860/gl860.c
@@ -582,7 +582,7 @@ int gl860_RTx(struct gspca_dev *gspca_dev,
pr_err("ctrl transfer failed %4d [p%02x r%d v%04x i%04x len%d]\n",
r, pref, req, val, index, len);
else if (len > 1 && r < len)
- PDEBUG(D_ERR, "short ctrl transfer %d/%d", r, len);
+ PERR("short ctrl transfer %d/%d", r, len);
msleep(1);
diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
index 5784ff4e1b2f..5800d65f9144 100644
--- a/drivers/media/usb/gspca/gspca.c
+++ b/drivers/media/usb/gspca/gspca.c
@@ -60,14 +60,14 @@ MODULE_DESCRIPTION("GSPCA USB Camera Driver");
MODULE_LICENSE("GPL");
MODULE_VERSION(GSPCA_VERSION);
-#ifdef GSPCA_DEBUG
-int gspca_debug = D_ERR | D_PROBE;
+int gspca_debug;
EXPORT_SYMBOL(gspca_debug);
-static void PDEBUG_MODE(char *txt, __u32 pixfmt, int w, int h)
+static void PDEBUG_MODE(struct gspca_dev *gspca_dev, int debug, char *txt,
+ __u32 pixfmt, int w, int h)
{
if ((pixfmt >> 24) >= '0' && (pixfmt >> 24) <= 'z') {
- PDEBUG(D_CONF|D_STREAM, "%s %c%c%c%c %dx%d",
+ PDEBUG(debug, "%s %c%c%c%c %dx%d",
txt,
pixfmt & 0xff,
(pixfmt >> 8) & 0xff,
@@ -75,15 +75,12 @@ static void PDEBUG_MODE(char *txt, __u32 pixfmt, int w, int h)
pixfmt >> 24,
w, h);
} else {
- PDEBUG(D_CONF|D_STREAM, "%s 0x%08x %dx%d",
+ PDEBUG(debug, "%s 0x%08x %dx%d",
txt,
pixfmt,
w, h);
}
}
-#else
-#define PDEBUG_MODE(txt, pixfmt, w, h)
-#endif
/* specific memory types - !! should be different from V4L2_MEMORY_xxx */
#define GSPCA_MEMORY_NO 0 /* V4L2_MEMORY_xxx starts from 1 */
@@ -129,7 +126,7 @@ static void int_irq(struct urb *urb)
case 0:
if (gspca_dev->sd_desc->int_pkt_scan(gspca_dev,
urb->transfer_buffer, urb->actual_length) < 0) {
- PDEBUG(D_ERR, "Unknown packet received");
+ PERR("Unknown packet received");
}
break;
@@ -143,7 +140,7 @@ static void int_irq(struct urb *urb)
break;
default:
- PDEBUG(D_ERR, "URB error %i, resubmitting", urb->status);
+ PERR("URB error %i, resubmitting", urb->status);
urb->status = 0;
ret = 0;
}
@@ -229,7 +226,7 @@ static int alloc_and_submit_int_urb(struct gspca_dev *gspca_dev,
urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
ret = usb_submit_urb(urb, GFP_KERNEL);
if (ret < 0) {
- PDEBUG(D_ERR, "submit int URB failed with error %i", ret);
+ PERR("submit int URB failed with error %i", ret);
goto error_submit;
}
gspca_dev->int_urb = urb;
@@ -315,7 +312,7 @@ static void fill_frame(struct gspca_dev *gspca_dev,
if (gspca_dev->frozen)
return;
#endif
- PDEBUG(D_ERR|D_PACK, "urb status: %d", urb->status);
+ PERR("urb status: %d", urb->status);
urb->status = 0;
goto resubmit;
}
@@ -388,7 +385,7 @@ static void bulk_irq(struct urb *urb)
if (gspca_dev->frozen)
return;
#endif
- PDEBUG(D_ERR|D_PACK, "urb status: %d", urb->status);
+ PERR("urb status: %d", urb->status);
urb->status = 0;
goto resubmit;
}
@@ -460,7 +457,7 @@ void gspca_frame_add(struct gspca_dev *gspca_dev,
/* append the packet to the frame buffer */
if (len > 0) {
if (gspca_dev->image_len + len > gspca_dev->frsz) {
- PDEBUG(D_ERR|D_PACK, "frame overflow %d > %d",
+ PERR("frame overflow %d > %d",
gspca_dev->image_len + len,
gspca_dev->frsz);
packet_type = DISCARD_PACKET;
@@ -960,9 +957,7 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev)
/* the bandwidth is not wide enough
* negotiate or try a lower alternate setting */
retry:
- PDEBUG(D_ERR|D_STREAM,
- "alt %d - bandwidth not wide enough - trying again",
- alt);
+ PERR("alt %d - bandwidth not wide enough, trying again", alt);
msleep(20); /* wait for kill complete */
if (gspca_dev->sd_desc->isoc_nego) {
ret = gspca_dev->sd_desc->isoc_nego(gspca_dev);
@@ -1127,10 +1122,9 @@ static int try_fmt_vid_cap(struct gspca_dev *gspca_dev,
w = fmt->fmt.pix.width;
h = fmt->fmt.pix.height;
-#ifdef GSPCA_DEBUG
- if (gspca_debug & D_CONF)
- PDEBUG_MODE("try fmt cap", fmt->fmt.pix.pixelformat, w, h);
-#endif
+ PDEBUG_MODE(gspca_dev, D_CONF, "try fmt cap",
+ fmt->fmt.pix.pixelformat, w, h);
+
/* search the closest mode for width and height */
mode = wxh_to_mode(gspca_dev, w, h);
@@ -1143,8 +1137,6 @@ static int try_fmt_vid_cap(struct gspca_dev *gspca_dev,
fmt->fmt.pix.pixelformat);
if (mode2 >= 0)
mode = mode2;
-/* else
- ; * no chance, return this mode */
}
fmt->fmt.pix = gspca_dev->cam.cam_mode[mode];
/* some drivers use priv internally, zero it before giving it to
@@ -1280,15 +1272,6 @@ static int dev_open(struct file *file)
if (!try_module_get(gspca_dev->module))
return -ENODEV;
-#ifdef GSPCA_DEBUG
- /* activate the v4l2 debug */
- if (gspca_debug & D_V4L2)
- gspca_dev->vdev.debug |= V4L2_DEBUG_IOCTL
- | V4L2_DEBUG_IOCTL_ARG;
- else
- gspca_dev->vdev.debug &= ~(V4L2_DEBUG_IOCTL
- | V4L2_DEBUG_IOCTL_ARG);
-#endif
return v4l2_fh_open(file);
}
@@ -1483,14 +1466,8 @@ static int vidioc_streamon(struct file *file, void *priv,
if (ret < 0)
goto out;
}
-#ifdef GSPCA_DEBUG
- if (gspca_debug & D_STREAM) {
- PDEBUG_MODE("stream on OK",
- gspca_dev->pixfmt,
- gspca_dev->width,
- gspca_dev->height);
- }
-#endif
+ PDEBUG_MODE(gspca_dev, D_STREAM, "stream on OK", gspca_dev->pixfmt,
+ gspca_dev->width, gspca_dev->height);
ret = 0;
out:
mutex_unlock(&gspca_dev->queue_lock);
@@ -1741,8 +1718,7 @@ static int vidioc_dqbuf(struct file *file, void *priv,
if (copy_to_user((__u8 __user *) frame->v4l2_buf.m.userptr,
frame->data,
frame->v4l2_buf.bytesused)) {
- PDEBUG(D_ERR|D_STREAM,
- "dqbuf cp to user failed");
+ PERR("dqbuf cp to user failed");
ret = -EFAULT;
}
}
@@ -1954,8 +1930,7 @@ static ssize_t dev_read(struct file *file, char __user *data,
count = frame->v4l2_buf.bytesused;
ret = copy_to_user(data, frame->data, count);
if (ret != 0) {
- PDEBUG(D_ERR|D_STREAM,
- "read cp to user lack %d / %zd", ret, count);
+ PERR("read cp to user lack %d / %zd", ret, count);
ret = -EFAULT;
goto out;
}
@@ -2290,10 +2265,6 @@ static void __exit gspca_exit(void)
module_init(gspca_init);
module_exit(gspca_exit);
-#ifdef GSPCA_DEBUG
module_param_named(debug, gspca_debug, int, 0644);
MODULE_PARM_DESC(debug,
- "Debug (bit) 0x01:error 0x02:probe 0x04:config"
- " 0x08:stream 0x10:frame 0x20:packet"
- " 0x0100: v4l2");
-#endif
+ "1:probe 2:config 3:stream 4:frame 5:packet 6:usbi 7:usbo");
diff --git a/drivers/media/usb/gspca/gspca.h b/drivers/media/usb/gspca/gspca.h
index ac62cd3b590e..c3af3212d51e 100644
--- a/drivers/media/usb/gspca/gspca.h
+++ b/drivers/media/usb/gspca/gspca.h
@@ -10,30 +10,26 @@
#include <media/v4l2-device.h>
#include <linux/mutex.h>
-/* compilation option */
-/*#define GSPCA_DEBUG 1*/
-#ifdef GSPCA_DEBUG
-/* GSPCA our debug messages */
+
+/* GSPCA debug codes */
+
+#define D_PROBE 1
+#define D_CONF 2
+#define D_STREAM 3
+#define D_FRAM 4
+#define D_PACK 5
+#define D_USBI 6
+#define D_USBO 7
+
extern int gspca_debug;
-#define PDEBUG(level, fmt, ...) \
-do { \
- if (gspca_debug & (level)) \
- pr_info(fmt, ##__VA_ARGS__); \
-} while (0)
-
-#define D_ERR 0x01
-#define D_PROBE 0x02
-#define D_CONF 0x04
-#define D_STREAM 0x08
-#define D_FRAM 0x10
-#define D_PACK 0x20
-#define D_USBI 0x00
-#define D_USBO 0x00
-#define D_V4L2 0x0100
-#else
-#define PDEBUG(level, fmt, ...) do {} while(0)
-#endif
+
+
+#define PDEBUG(level, fmt, ...) \
+ v4l2_dbg(level, gspca_debug, &gspca_dev->v4l2_dev, fmt, ##__VA_ARGS__)
+
+#define PERR(fmt, ...) \
+ v4l2_err(&gspca_dev->v4l2_dev, fmt, ##__VA_ARGS__)
#define GSPCA_MAX_FRAMES 16 /* maximum number of video frame buffers */
/* image transfers */
diff --git a/drivers/media/usb/gspca/jeilinj.c b/drivers/media/usb/gspca/jeilinj.c
index 1ba29fe7fada..8da3dde38385 100644
--- a/drivers/media/usb/gspca/jeilinj.c
+++ b/drivers/media/usb/gspca/jeilinj.c
@@ -266,7 +266,7 @@ static int jlj_start(struct gspca_dev *gspca_dev)
msleep(2);
setfreq(gspca_dev, v4l2_ctrl_g_ctrl(sd->freq));
if (gspca_dev->usb_err < 0)
- PDEBUG(D_ERR, "Start streaming command failed");
+ PERR("Start streaming command failed");
return gspca_dev->usb_err;
}
diff --git a/drivers/media/usb/gspca/konica.c b/drivers/media/usb/gspca/konica.c
index 61e25dbf2447..39c96bb4c985 100644
--- a/drivers/media/usb/gspca/konica.c
+++ b/drivers/media/usb/gspca/konica.c
@@ -277,7 +277,7 @@ static void sd_isoc_irq(struct urb *urb)
if (gspca_dev->frozen)
return;
#endif
- PDEBUG(D_ERR, "urb status: %d", urb->status);
+ PERR("urb status: %d", urb->status);
st = usb_submit_urb(urb, GFP_ATOMIC);
if (st < 0)
pr_err("resubmit urb error %d\n", st);
@@ -295,33 +295,30 @@ static void sd_isoc_irq(struct urb *urb)
sd->last_data_urb = NULL;
if (!data_urb || data_urb->start_frame != status_urb->start_frame) {
- PDEBUG(D_ERR|D_PACK, "lost sync on frames");
+ PERR("lost sync on frames");
goto resubmit;
}
if (data_urb->number_of_packets != status_urb->number_of_packets) {
- PDEBUG(D_ERR|D_PACK,
- "no packets does not match, data: %d, status: %d",
- data_urb->number_of_packets,
- status_urb->number_of_packets);
+ PERR("no packets does not match, data: %d, status: %d",
+ data_urb->number_of_packets,
+ status_urb->number_of_packets);
goto resubmit;
}
for (i = 0; i < status_urb->number_of_packets; i++) {
if (data_urb->iso_frame_desc[i].status ||
status_urb->iso_frame_desc[i].status) {
- PDEBUG(D_ERR|D_PACK,
- "pkt %d data-status %d, status-status %d", i,
- data_urb->iso_frame_desc[i].status,
- status_urb->iso_frame_desc[i].status);
+ PERR("pkt %d data-status %d, status-status %d", i,
+ data_urb->iso_frame_desc[i].status,
+ status_urb->iso_frame_desc[i].status);
gspca_dev->last_packet_type = DISCARD_PACKET;
continue;
}
if (status_urb->iso_frame_desc[i].actual_length != 1) {
- PDEBUG(D_ERR|D_PACK,
- "bad status packet length %d",
- status_urb->iso_frame_desc[i].actual_length);
+ PERR("bad status packet length %d",
+ status_urb->iso_frame_desc[i].actual_length);
gspca_dev->last_packet_type = DISCARD_PACKET;
continue;
}
@@ -366,12 +363,11 @@ resubmit:
if (data_urb) {
st = usb_submit_urb(data_urb, GFP_ATOMIC);
if (st < 0)
- PDEBUG(D_ERR|D_PACK,
- "usb_submit_urb(data_urb) ret %d", st);
+ PERR("usb_submit_urb(data_urb) ret %d", st);
}
st = usb_submit_urb(status_urb, GFP_ATOMIC);
if (st < 0)
- pr_err("usb_submit_urb(status_urb) ret %d\n", st);
+ PERR("usb_submit_urb(status_urb) ret %d\n", st);
}
static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
diff --git a/drivers/media/usb/gspca/m5602/m5602_core.c b/drivers/media/usb/gspca/m5602/m5602_core.c
index 907a968f474d..d926e62cb80b 100644
--- a/drivers/media/usb/gspca/m5602/m5602_core.c
+++ b/drivers/media/usb/gspca/m5602/m5602_core.c
@@ -41,6 +41,7 @@ MODULE_DEVICE_TABLE(usb, m5602_table);
int m5602_read_bridge(struct sd *sd, const u8 address, u8 *i2c_data)
{
int err;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *) sd;
struct usb_device *udev = sd->gspca_dev.dev;
__u8 *buf = sd->gspca_dev.usb_buf;
@@ -62,6 +63,7 @@ int m5602_read_bridge(struct sd *sd, const u8 address, u8 *i2c_data)
int m5602_write_bridge(struct sd *sd, const u8 address, const u8 i2c_data)
{
int err;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *) sd;
struct usb_device *udev = sd->gspca_dev.dev;
__u8 *buf = sd->gspca_dev.usb_buf;
@@ -98,6 +100,7 @@ int m5602_read_sensor(struct sd *sd, const u8 address,
u8 *i2c_data, const u8 len)
{
int err, i;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *) sd;
if (!len || len > sd->sensor->i2c_regW)
return -EINVAL;
@@ -147,6 +150,7 @@ int m5602_write_sensor(struct sd *sd, const u8 address,
{
int err, i;
u8 *p;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *) sd;
struct usb_device *udev = sd->gspca_dev.dev;
__u8 *buf = sd->gspca_dev.usb_buf;
@@ -378,7 +382,7 @@ static int m5602_configure(struct gspca_dev *gspca_dev,
return 0;
fail:
- PDEBUG(D_ERR, "ALi m5602 webcam failed");
+ PERR("ALi m5602 webcam failed");
cam->cam_mode = NULL;
cam->nmodes = 0;
diff --git a/drivers/media/usb/gspca/m5602/m5602_mt9m111.c b/drivers/media/usb/gspca/m5602/m5602_mt9m111.c
index b5f66921b3eb..cfa4663f8934 100644
--- a/drivers/media/usb/gspca/m5602/m5602_mt9m111.c
+++ b/drivers/media/usb/gspca/m5602/m5602_mt9m111.c
@@ -56,6 +56,7 @@ int mt9m111_probe(struct sd *sd)
{
u8 data[2] = {0x00, 0x00};
int i;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
if (force_sensor) {
if (force_sensor == MT9M111_SENSOR) {
@@ -169,6 +170,7 @@ int mt9m111_start(struct sd *sd)
int i, err = 0;
u8 data[2];
struct cam *cam = &sd->gspca_dev.cam;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int width = cam->cam_mode[sd->gspca_dev.curr_mode].width - 1;
int height = cam->cam_mode[sd->gspca_dev.curr_mode].height;
@@ -229,11 +231,11 @@ int mt9m111_start(struct sd *sd)
switch (width) {
case 640:
- PDEBUG(D_V4L2, "Configuring camera for VGA mode");
+ PDEBUG(D_CONF, "Configuring camera for VGA mode");
break;
case 320:
- PDEBUG(D_V4L2, "Configuring camera for QVGA mode");
+ PDEBUG(D_CONF, "Configuring camera for QVGA mode");
break;
}
return err;
@@ -252,7 +254,7 @@ static int mt9m111_set_hvflip(struct gspca_dev *gspca_dev)
int hflip;
int vflip;
- PDEBUG(D_V4L2, "Set hvflip to %d %d", sd->hflip->val, sd->vflip->val);
+ PDEBUG(D_CONF, "Set hvflip to %d %d", sd->hflip->val, sd->vflip->val);
/* The mt9m111 is flipped by default */
hflip = !sd->hflip->val;
@@ -293,7 +295,7 @@ static int mt9m111_set_auto_white_balance(struct gspca_dev *gspca_dev,
err = m5602_write_sensor(sd, MT9M111_CP_OPERATING_MODE_CTL, data, 2);
- PDEBUG(D_V4L2, "Set auto white balance %d", val);
+ PDEBUG(D_CONF, "Set auto white balance %d", val);
return err;
}
@@ -326,7 +328,7 @@ static int mt9m111_set_gain(struct gspca_dev *gspca_dev, __s32 val)
data[1] = (tmp & 0xff);
data[0] = (tmp & 0xff00) >> 8;
- PDEBUG(D_V4L2, "tmp=%d, data[1]=%d, data[0]=%d", tmp,
+ PDEBUG(D_CONF, "tmp=%d, data[1]=%d, data[0]=%d", tmp,
data[1], data[0]);
err = m5602_write_sensor(sd, MT9M111_SC_GLOBAL_GAIN,
@@ -344,7 +346,7 @@ static int mt9m111_set_green_balance(struct gspca_dev *gspca_dev, __s32 val)
data[1] = (val & 0xff);
data[0] = (val & 0xff00) >> 8;
- PDEBUG(D_V4L2, "Set green balance %d", val);
+ PDEBUG(D_CONF, "Set green balance %d", val);
err = m5602_write_sensor(sd, MT9M111_SC_GREEN_1_GAIN,
data, 2);
if (err < 0)
@@ -362,7 +364,7 @@ static int mt9m111_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val)
data[1] = (val & 0xff);
data[0] = (val & 0xff00) >> 8;
- PDEBUG(D_V4L2, "Set blue balance %d", val);
+ PDEBUG(D_CONF, "Set blue balance %d", val);
return m5602_write_sensor(sd, MT9M111_SC_BLUE_GAIN,
data, 2);
@@ -376,7 +378,7 @@ static int mt9m111_set_red_balance(struct gspca_dev *gspca_dev, __s32 val)
data[1] = (val & 0xff);
data[0] = (val & 0xff00) >> 8;
- PDEBUG(D_V4L2, "Set red balance %d", val);
+ PDEBUG(D_CONF, "Set red balance %d", val);
return m5602_write_sensor(sd, MT9M111_SC_RED_GAIN,
data, 2);
diff --git a/drivers/media/usb/gspca/m5602/m5602_ov7660.c b/drivers/media/usb/gspca/m5602/m5602_ov7660.c
index 3bbe3ad5d4a9..4ac78893cc5f 100644
--- a/drivers/media/usb/gspca/m5602/m5602_ov7660.c
+++ b/drivers/media/usb/gspca/m5602/m5602_ov7660.c
@@ -175,7 +175,7 @@ static int ov7660_set_gain(struct gspca_dev *gspca_dev, __s32 val)
u8 i2c_data = val;
struct sd *sd = (struct sd *) gspca_dev;
- PDEBUG(D_V4L2, "Setting gain to %d", val);
+ PDEBUG(D_CONF, "Setting gain to %d", val);
err = m5602_write_sensor(sd, OV7660_GAIN, &i2c_data, 1);
return err;
@@ -188,7 +188,7 @@ static int ov7660_set_auto_white_balance(struct gspca_dev *gspca_dev,
u8 i2c_data;
struct sd *sd = (struct sd *) gspca_dev;
- PDEBUG(D_V4L2, "Set auto white balance to %d", val);
+ PDEBUG(D_CONF, "Set auto white balance to %d", val);
err = m5602_read_sensor(sd, OV7660_COM8, &i2c_data, 1);
if (err < 0)
@@ -206,7 +206,7 @@ static int ov7660_set_auto_gain(struct gspca_dev *gspca_dev, __s32 val)
u8 i2c_data;
struct sd *sd = (struct sd *) gspca_dev;
- PDEBUG(D_V4L2, "Set auto gain control to %d", val);
+ PDEBUG(D_CONF, "Set auto gain control to %d", val);
err = m5602_read_sensor(sd, OV7660_COM8, &i2c_data, 1);
if (err < 0)
@@ -224,7 +224,7 @@ static int ov7660_set_auto_exposure(struct gspca_dev *gspca_dev,
u8 i2c_data;
struct sd *sd = (struct sd *) gspca_dev;
- PDEBUG(D_V4L2, "Set auto exposure control to %d", val);
+ PDEBUG(D_CONF, "Set auto exposure control to %d", val);
err = m5602_read_sensor(sd, OV7660_COM8, &i2c_data, 1);
if (err < 0)
@@ -242,7 +242,7 @@ static int ov7660_set_hvflip(struct gspca_dev *gspca_dev)
u8 i2c_data;
struct sd *sd = (struct sd *) gspca_dev;
- PDEBUG(D_V4L2, "Set hvflip to %d, %d", sd->hflip->val, sd->vflip->val);
+ PDEBUG(D_CONF, "Set hvflip to %d, %d", sd->hflip->val, sd->vflip->val);
i2c_data = (sd->hflip->val << 5) | (sd->vflip->val << 4);
diff --git a/drivers/media/usb/gspca/m5602/m5602_ov9650.c b/drivers/media/usb/gspca/m5602/m5602_ov9650.c
index e2fe2f942fe6..59bc62bfae26 100644
--- a/drivers/media/usb/gspca/m5602/m5602_ov9650.c
+++ b/drivers/media/usb/gspca/m5602/m5602_ov9650.c
@@ -147,6 +147,7 @@ int ov9650_probe(struct sd *sd)
{
int err = 0;
u8 prod_id = 0, ver_id = 0, i;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
if (force_sensor) {
if (force_sensor == OV9650_SENSOR) {
@@ -268,6 +269,7 @@ int ov9650_start(struct sd *sd)
int height = cam->cam_mode[sd->gspca_dev.curr_mode].height;
int ver_offs = cam->cam_mode[sd->gspca_dev.curr_mode].priv;
int hor_offs = OV9650_LEFT_OFFSET;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
if ((!dmi_check_system(ov9650_flip_dmi_table) &&
sd->vflip->val) ||
@@ -351,7 +353,7 @@ int ov9650_start(struct sd *sd)
switch (width) {
case 640:
- PDEBUG(D_V4L2, "Configuring camera for VGA mode");
+ PDEBUG(D_CONF, "Configuring camera for VGA mode");
data = OV9650_VGA_SELECT | OV9650_RGB_SELECT |
OV9650_RAW_RGB_SELECT;
@@ -359,7 +361,7 @@ int ov9650_start(struct sd *sd)
break;
case 352:
- PDEBUG(D_V4L2, "Configuring camera for CIF mode");
+ PDEBUG(D_CONF, "Configuring camera for CIF mode");
data = OV9650_CIF_SELECT | OV9650_RGB_SELECT |
OV9650_RAW_RGB_SELECT;
@@ -367,7 +369,7 @@ int ov9650_start(struct sd *sd)
break;
case 320:
- PDEBUG(D_V4L2, "Configuring camera for QVGA mode");
+ PDEBUG(D_CONF, "Configuring camera for QVGA mode");
data = OV9650_QVGA_SELECT | OV9650_RGB_SELECT |
OV9650_RAW_RGB_SELECT;
@@ -375,7 +377,7 @@ int ov9650_start(struct sd *sd)
break;
case 176:
- PDEBUG(D_V4L2, "Configuring camera for QCIF mode");
+ PDEBUG(D_CONF, "Configuring camera for QCIF mode");
data = OV9650_QCIF_SELECT | OV9650_RGB_SELECT |
OV9650_RAW_RGB_SELECT;
@@ -404,7 +406,7 @@ static int ov9650_set_exposure(struct gspca_dev *gspca_dev, __s32 val)
u8 i2c_data;
int err;
- PDEBUG(D_V4L2, "Set exposure to %d", val);
+ PDEBUG(D_CONF, "Set exposure to %d", val);
/* The 6 MSBs */
i2c_data = (val >> 10) & 0x3f;
@@ -432,7 +434,7 @@ static int ov9650_set_gain(struct gspca_dev *gspca_dev, __s32 val)
u8 i2c_data;
struct sd *sd = (struct sd *) gspca_dev;
- PDEBUG(D_V4L2, "Setting gain to %d", val);
+ PDEBUG(D_CONF, "Setting gain to %d", val);
/* The 2 MSB */
/* Read the OV9650_VREF register first to avoid
@@ -460,7 +462,7 @@ static int ov9650_set_red_balance(struct gspca_dev *gspca_dev, __s32 val)
u8 i2c_data;
struct sd *sd = (struct sd *) gspca_dev;
- PDEBUG(D_V4L2, "Set red gain to %d", val);
+ PDEBUG(D_CONF, "Set red gain to %d", val);
i2c_data = val & 0xff;
err = m5602_write_sensor(sd, OV9650_RED, &i2c_data, 1);
@@ -473,7 +475,7 @@ static int ov9650_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val)
u8 i2c_data;
struct sd *sd = (struct sd *) gspca_dev;
- PDEBUG(D_V4L2, "Set blue gain to %d", val);
+ PDEBUG(D_CONF, "Set blue gain to %d", val);
i2c_data = val & 0xff;
err = m5602_write_sensor(sd, OV9650_BLUE, &i2c_data, 1);
@@ -488,7 +490,7 @@ static int ov9650_set_hvflip(struct gspca_dev *gspca_dev)
int hflip = sd->hflip->val;
int vflip = sd->vflip->val;
- PDEBUG(D_V4L2, "Set hvflip to %d %d", hflip, vflip);
+ PDEBUG(D_CONF, "Set hvflip to %d %d", hflip, vflip);
if (dmi_check_system(ov9650_flip_dmi_table))
vflip = !vflip;
@@ -512,7 +514,7 @@ static int ov9650_set_auto_exposure(struct gspca_dev *gspca_dev,
u8 i2c_data;
struct sd *sd = (struct sd *) gspca_dev;
- PDEBUG(D_V4L2, "Set auto exposure control to %d", val);
+ PDEBUG(D_CONF, "Set auto exposure control to %d", val);
err = m5602_read_sensor(sd, OV9650_COM8, &i2c_data, 1);
if (err < 0)
@@ -531,7 +533,7 @@ static int ov9650_set_auto_white_balance(struct gspca_dev *gspca_dev,
u8 i2c_data;
struct sd *sd = (struct sd *) gspca_dev;
- PDEBUG(D_V4L2, "Set auto white balance to %d", val);
+ PDEBUG(D_CONF, "Set auto white balance to %d", val);
err = m5602_read_sensor(sd, OV9650_COM8, &i2c_data, 1);
if (err < 0)
@@ -549,7 +551,7 @@ static int ov9650_set_auto_gain(struct gspca_dev *gspca_dev, __s32 val)
u8 i2c_data;
struct sd *sd = (struct sd *) gspca_dev;
- PDEBUG(D_V4L2, "Set auto gain control to %d", val);
+ PDEBUG(D_CONF, "Set auto gain control to %d", val);
err = m5602_read_sensor(sd, OV9650_COM8, &i2c_data, 1);
if (err < 0)
diff --git a/drivers/media/usb/gspca/m5602/m5602_po1030.c b/drivers/media/usb/gspca/m5602/m5602_po1030.c
index 189086291303..4bf5c43424b7 100644
--- a/drivers/media/usb/gspca/m5602/m5602_po1030.c
+++ b/drivers/media/usb/gspca/m5602/m5602_po1030.c
@@ -55,6 +55,7 @@ static const struct v4l2_ctrl_config po1030_greenbal_cfg = {
int po1030_probe(struct sd *sd)
{
u8 dev_id_h = 0, i;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
if (force_sensor) {
if (force_sensor == PO1030_SENSOR) {
@@ -305,10 +306,10 @@ static int po1030_set_exposure(struct gspca_dev *gspca_dev, __s32 val)
u8 i2c_data;
int err;
- PDEBUG(D_V4L2, "Set exposure to %d", val & 0xffff);
+ PDEBUG(D_CONF, "Set exposure to %d", val & 0xffff);
i2c_data = ((val & 0xff00) >> 8);
- PDEBUG(D_V4L2, "Set exposure to high byte to 0x%x",
+ PDEBUG(D_CONF, "Set exposure to high byte to 0x%x",
i2c_data);
err = m5602_write_sensor(sd, PO1030_INTEGLINES_H,
@@ -317,7 +318,7 @@ static int po1030_set_exposure(struct gspca_dev *gspca_dev, __s32 val)
return err;
i2c_data = (val & 0xff);
- PDEBUG(D_V4L2, "Set exposure to low byte to 0x%x",
+ PDEBUG(D_CONF, "Set exposure to low byte to 0x%x",
i2c_data);
err = m5602_write_sensor(sd, PO1030_INTEGLINES_M,
&i2c_data, 1);
@@ -332,7 +333,7 @@ static int po1030_set_gain(struct gspca_dev *gspca_dev, __s32 val)
int err;
i2c_data = val & 0xff;
- PDEBUG(D_V4L2, "Set global gain to %d", i2c_data);
+ PDEBUG(D_CONF, "Set global gain to %d", i2c_data);
err = m5602_write_sensor(sd, PO1030_GLOBALGAIN,
&i2c_data, 1);
return err;
@@ -344,7 +345,7 @@ static int po1030_set_hvflip(struct gspca_dev *gspca_dev)
u8 i2c_data;
int err;
- PDEBUG(D_V4L2, "Set hvflip %d %d", sd->hflip->val, sd->vflip->val);
+ PDEBUG(D_CONF, "Set hvflip %d %d", sd->hflip->val, sd->vflip->val);
err = m5602_read_sensor(sd, PO1030_CONTROL2, &i2c_data, 1);
if (err < 0)
return err;
@@ -365,7 +366,7 @@ static int po1030_set_red_balance(struct gspca_dev *gspca_dev, __s32 val)
int err;
i2c_data = val & 0xff;
- PDEBUG(D_V4L2, "Set red gain to %d", i2c_data);
+ PDEBUG(D_CONF, "Set red gain to %d", i2c_data);
err = m5602_write_sensor(sd, PO1030_RED_GAIN,
&i2c_data, 1);
return err;
@@ -378,7 +379,7 @@ static int po1030_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val)
int err;
i2c_data = val & 0xff;
- PDEBUG(D_V4L2, "Set blue gain to %d", i2c_data);
+ PDEBUG(D_CONF, "Set blue gain to %d", i2c_data);
err = m5602_write_sensor(sd, PO1030_BLUE_GAIN,
&i2c_data, 1);
@@ -392,7 +393,7 @@ static int po1030_set_green_balance(struct gspca_dev *gspca_dev, __s32 val)
int err;
i2c_data = val & 0xff;
- PDEBUG(D_V4L2, "Set green gain to %d", i2c_data);
+ PDEBUG(D_CONF, "Set green gain to %d", i2c_data);
err = m5602_write_sensor(sd, PO1030_GREEN_1_GAIN,
&i2c_data, 1);
@@ -414,7 +415,7 @@ static int po1030_set_auto_white_balance(struct gspca_dev *gspca_dev,
if (err < 0)
return err;
- PDEBUG(D_V4L2, "Set auto white balance to %d", val);
+ PDEBUG(D_CONF, "Set auto white balance to %d", val);
i2c_data = (i2c_data & 0xfe) | (val & 0x01);
err = m5602_write_sensor(sd, PO1030_AUTOCTRL1, &i2c_data, 1);
return err;
@@ -431,7 +432,7 @@ static int po1030_set_auto_exposure(struct gspca_dev *gspca_dev,
if (err < 0)
return err;
- PDEBUG(D_V4L2, "Set auto exposure to %d", val);
+ PDEBUG(D_CONF, "Set auto exposure to %d", val);
val = (val == V4L2_EXPOSURE_AUTO);
i2c_data = (i2c_data & 0xfd) | ((val & 0x01) << 1);
return m5602_write_sensor(sd, PO1030_AUTOCTRL1, &i2c_data, 1);
diff --git a/drivers/media/usb/gspca/m5602/m5602_s5k4aa.c b/drivers/media/usb/gspca/m5602/m5602_s5k4aa.c
index 42ffaf04771c..7d12599458e2 100644
--- a/drivers/media/usb/gspca/m5602/m5602_s5k4aa.c
+++ b/drivers/media/usb/gspca/m5602/m5602_s5k4aa.c
@@ -145,6 +145,7 @@ int s5k4aa_probe(struct sd *sd)
{
u8 prod_id[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
const u8 expected_prod_id[6] = {0x00, 0x10, 0x00, 0x4b, 0x33, 0x75};
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int i, err = 0;
if (force_sensor) {
@@ -215,10 +216,11 @@ int s5k4aa_start(struct sd *sd)
int i, err = 0;
u8 data[2];
struct cam *cam = &sd->gspca_dev.cam;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
switch (cam->cam_mode[sd->gspca_dev.curr_mode].width) {
case 1280:
- PDEBUG(D_V4L2, "Configuring camera for SXGA mode");
+ PDEBUG(D_CONF, "Configuring camera for SXGA mode");
for (i = 0; i < ARRAY_SIZE(SXGA_s5k4aa); i++) {
switch (SXGA_s5k4aa[i][0]) {
@@ -251,7 +253,7 @@ int s5k4aa_start(struct sd *sd)
break;
case 640:
- PDEBUG(D_V4L2, "Configuring camera for VGA mode");
+ PDEBUG(D_CONF, "Configuring camera for VGA mode");
for (i = 0; i < ARRAY_SIZE(VGA_s5k4aa); i++) {
switch (VGA_s5k4aa[i][0]) {
@@ -367,7 +369,7 @@ static int s5k4aa_set_exposure(struct gspca_dev *gspca_dev, __s32 val)
u8 data = S5K4AA_PAGE_MAP_2;
int err;
- PDEBUG(D_V4L2, "Set exposure to %d", val);
+ PDEBUG(D_CONF, "Set exposure to %d", val);
err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
if (err < 0)
return err;
@@ -389,7 +391,7 @@ static int s5k4aa_set_hvflip(struct gspca_dev *gspca_dev)
int hflip = sd->hflip->val;
int vflip = sd->vflip->val;
- PDEBUG(D_V4L2, "Set hvflip %d %d", hflip, vflip);
+ PDEBUG(D_CONF, "Set hvflip %d %d", hflip, vflip);
err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
if (err < 0)
return err;
@@ -439,7 +441,7 @@ static int s5k4aa_set_gain(struct gspca_dev *gspca_dev, __s32 val)
u8 data = S5K4AA_PAGE_MAP_2;
int err;
- PDEBUG(D_V4L2, "Set gain to %d", val);
+ PDEBUG(D_CONF, "Set gain to %d", val);
err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
if (err < 0)
return err;
@@ -456,7 +458,7 @@ static int s5k4aa_set_brightness(struct gspca_dev *gspca_dev, __s32 val)
u8 data = S5K4AA_PAGE_MAP_2;
int err;
- PDEBUG(D_V4L2, "Set brightness to %d", val);
+ PDEBUG(D_CONF, "Set brightness to %d", val);
err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
if (err < 0)
return err;
@@ -471,7 +473,7 @@ static int s5k4aa_set_noise(struct gspca_dev *gspca_dev, __s32 val)
u8 data = S5K4AA_PAGE_MAP_2;
int err;
- PDEBUG(D_V4L2, "Set noise to %d", val);
+ PDEBUG(D_CONF, "Set noise to %d", val);
err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
if (err < 0)
return err;
diff --git a/drivers/media/usb/gspca/m5602/m5602_s5k83a.c b/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
index 69ee6e26b8ea..7cbc3a00bda8 100644
--- a/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
+++ b/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
@@ -51,6 +51,7 @@ int s5k83a_probe(struct sd *sd)
{
u8 prod_id = 0, ver_id = 0;
int i, err = 0;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
if (force_sensor) {
if (force_sensor == S5K83A_SENSOR) {
diff --git a/drivers/media/usb/gspca/mr97310a.c b/drivers/media/usb/gspca/mr97310a.c
index 8f4714df5990..68bb2f359666 100644
--- a/drivers/media/usb/gspca/mr97310a.c
+++ b/drivers/media/usb/gspca/mr97310a.c
@@ -289,7 +289,7 @@ static int zero_the_pointer(struct gspca_dev *gspca_dev)
return err_code;
}
if (status != 0x0a)
- PDEBUG(D_ERR, "status is %02x", status);
+ PERR("status is %02x", status);
tries = 0;
while (tries < 4) {
@@ -330,7 +330,7 @@ static void stream_stop(struct gspca_dev *gspca_dev)
gspca_dev->usb_buf[0] = 0x01;
gspca_dev->usb_buf[1] = 0x00;
if (mr_write(gspca_dev, 2) < 0)
- PDEBUG(D_ERR, "Stream Stop failed");
+ PERR("Stream Stop failed");
}
static void lcd_stop(struct gspca_dev *gspca_dev)
@@ -338,7 +338,7 @@ static void lcd_stop(struct gspca_dev *gspca_dev)
gspca_dev->usb_buf[0] = 0x19;
gspca_dev->usb_buf[1] = 0x54;
if (mr_write(gspca_dev, 2) < 0)
- PDEBUG(D_ERR, "LCD Stop failed");
+ PERR("LCD Stop failed");
}
static int isoc_enable(struct gspca_dev *gspca_dev)
@@ -1026,7 +1026,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct sd *sd = (struct sd *) gspca_dev;
unsigned char *sof;
- sof = pac_find_sof(&sd->sof_read, data, len);
+ sof = pac_find_sof(gspca_dev, &sd->sof_read, data, len);
if (sof) {
int n;
diff --git a/drivers/media/usb/gspca/ov519.c b/drivers/media/usb/gspca/ov519.c
index 9ad19a7ef81b..a3958ee86816 100644
--- a/drivers/media/usb/gspca/ov519.c
+++ b/drivers/media/usb/gspca/ov519.c
@@ -2034,6 +2034,7 @@ static unsigned char ov7670_abs_to_sm(unsigned char v)
/* Write a OV519 register */
static void reg_w(struct sd *sd, u16 index, u16 value)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int ret, req = 0;
if (sd->gspca_dev.usb_err < 0)
@@ -2071,7 +2072,7 @@ static void reg_w(struct sd *sd, u16 index, u16 value)
sd->gspca_dev.usb_buf, 1, 500);
leave:
if (ret < 0) {
- pr_err("reg_w %02x failed %d\n", index, ret);
+ PERR("reg_w %02x failed %d\n", index, ret);
sd->gspca_dev.usb_err = ret;
return;
}
@@ -2081,6 +2082,7 @@ leave:
/* returns: negative is error, pos or zero is data */
static int reg_r(struct sd *sd, u16 index)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int ret;
int req;
@@ -2110,7 +2112,7 @@ static int reg_r(struct sd *sd, u16 index)
PDEBUG(D_USBI, "GET %02x 0000 %04x %02x",
req, index, ret);
} else {
- pr_err("reg_r %02x failed %d\n", index, ret);
+ PERR("reg_r %02x failed %d\n", index, ret);
sd->gspca_dev.usb_err = ret;
}
@@ -2121,6 +2123,7 @@ static int reg_r(struct sd *sd, u16 index)
static int reg_r8(struct sd *sd,
u16 index)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int ret;
if (sd->gspca_dev.usb_err < 0)
@@ -2135,7 +2138,7 @@ static int reg_r8(struct sd *sd,
if (ret >= 0) {
ret = sd->gspca_dev.usb_buf[0];
} else {
- pr_err("reg_r8 %02x failed %d\n", index, ret);
+ PERR("reg_r8 %02x failed %d\n", index, ret);
sd->gspca_dev.usb_err = ret;
}
@@ -2174,6 +2177,7 @@ static void reg_w_mask(struct sd *sd,
*/
static void ov518_reg_w32(struct sd *sd, u16 index, u32 value, int n)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int ret;
if (sd->gspca_dev.usb_err < 0)
@@ -2188,13 +2192,14 @@ static void ov518_reg_w32(struct sd *sd, u16 index, u32 value, int n)
0, index,
sd->gspca_dev.usb_buf, n, 500);
if (ret < 0) {
- pr_err("reg_w32 %02x failed %d\n", index, ret);
+ PERR("reg_w32 %02x failed %d\n", index, ret);
sd->gspca_dev.usb_err = ret;
}
}
static void ov511_i2c_w(struct sd *sd, u8 reg, u8 value)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int rc, retries;
PDEBUG(D_USBO, "ov511_i2c_w %02x %02x", reg, value);
@@ -2228,6 +2233,7 @@ static void ov511_i2c_w(struct sd *sd, u8 reg, u8 value)
static int ov511_i2c_r(struct sd *sd, u8 reg)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int rc, value, retries;
/* Two byte write cycle */
@@ -2300,6 +2306,8 @@ static void ov518_i2c_w(struct sd *sd,
u8 reg,
u8 value)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
+
PDEBUG(D_USBO, "ov518_i2c_w %02x %02x", reg, value);
/* Select camera register */
@@ -2325,6 +2333,7 @@ static void ov518_i2c_w(struct sd *sd,
*/
static int ov518_i2c_r(struct sd *sd, u8 reg)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int value;
/* Select camera register */
@@ -2345,6 +2354,7 @@ static int ov518_i2c_r(struct sd *sd, u8 reg)
static void ovfx2_i2c_w(struct sd *sd, u8 reg, u8 value)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int ret;
if (sd->gspca_dev.usb_err < 0)
@@ -2357,7 +2367,7 @@ static void ovfx2_i2c_w(struct sd *sd, u8 reg, u8 value)
(u16) value, (u16) reg, NULL, 0, 500);
if (ret < 0) {
- pr_err("ovfx2_i2c_w %02x failed %d\n", reg, ret);
+ PERR("ovfx2_i2c_w %02x failed %d\n", reg, ret);
sd->gspca_dev.usb_err = ret;
}
@@ -2366,6 +2376,7 @@ static void ovfx2_i2c_w(struct sd *sd, u8 reg, u8 value)
static int ovfx2_i2c_r(struct sd *sd, u8 reg)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int ret;
if (sd->gspca_dev.usb_err < 0)
@@ -2381,7 +2392,7 @@ static int ovfx2_i2c_r(struct sd *sd, u8 reg)
ret = sd->gspca_dev.usb_buf[0];
PDEBUG(D_USBI, "ovfx2_i2c_r %02x %02x", reg, ret);
} else {
- pr_err("ovfx2_i2c_r %02x failed %d\n", reg, ret);
+ PERR("ovfx2_i2c_r %02x failed %d\n", reg, ret);
sd->gspca_dev.usb_err = ret;
}
@@ -2478,6 +2489,8 @@ static void i2c_w_mask(struct sd *sd,
* registers while the camera is streaming */
static inline void ov51x_stop(struct sd *sd)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
+
PDEBUG(D_STREAM, "stopping");
sd->stopped = 1;
switch (sd->bridge) {
@@ -2507,6 +2520,8 @@ static inline void ov51x_stop(struct sd *sd)
* actually stopped (for performance). */
static inline void ov51x_restart(struct sd *sd)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
+
PDEBUG(D_STREAM, "restarting");
if (!sd->stopped)
return;
@@ -2545,6 +2560,7 @@ static void ov51x_set_slave_ids(struct sd *sd, u8 slave);
static int init_ov_sensor(struct sd *sd, u8 slave)
{
int i;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
ov51x_set_slave_ids(sd, slave);
@@ -2624,10 +2640,11 @@ static void write_i2c_regvals(struct sd *sd,
/* This initializes the OV2x10 / OV3610 / OV3620 / OV9600 */
static void ov_hires_configure(struct sd *sd)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int high, low;
if (sd->bridge != BRIDGE_OVFX2) {
- pr_err("error hires sensors only supported with ovfx2\n");
+ PERR("error hires sensors only supported with ovfx2\n");
return;
}
@@ -2662,7 +2679,7 @@ static void ov_hires_configure(struct sd *sd)
}
break;
}
- pr_err("Error unknown sensor type: %02x%02x\n", high, low);
+ PERR("Error unknown sensor type: %02x%02x\n", high, low);
}
/* This initializes the OV8110, OV8610 sensor. The OV8110 uses
@@ -2670,6 +2687,7 @@ static void ov_hires_configure(struct sd *sd)
*/
static void ov8xx0_configure(struct sd *sd)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int rc;
PDEBUG(D_PROBE, "starting ov8xx0 configuration");
@@ -2677,13 +2695,13 @@ static void ov8xx0_configure(struct sd *sd)
/* Detect sensor (sub)type */
rc = i2c_r(sd, OV7610_REG_COM_I);
if (rc < 0) {
- PDEBUG(D_ERR, "Error detecting sensor type");
+ PERR("Error detecting sensor type");
return;
}
if ((rc & 3) == 1)
sd->sensor = SEN_OV8610;
else
- pr_err("Unknown image sensor version: %d\n", rc & 3);
+ PERR("Unknown image sensor version: %d\n", rc & 3);
}
/* This initializes the OV7610, OV7620, or OV76BE sensor. The OV76BE uses
@@ -2691,6 +2709,7 @@ static void ov8xx0_configure(struct sd *sd)
*/
static void ov7xx0_configure(struct sd *sd)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int rc, high, low;
PDEBUG(D_PROBE, "starting OV7xx0 configuration");
@@ -2701,7 +2720,7 @@ static void ov7xx0_configure(struct sd *sd)
/* add OV7670 here
* it appears to be wrongly detected as a 7610 by default */
if (rc < 0) {
- pr_err("Error detecting sensor type\n");
+ PERR("Error detecting sensor type\n");
return;
}
if ((rc & 3) == 3) {
@@ -2729,19 +2748,19 @@ static void ov7xx0_configure(struct sd *sd)
/* try to read product id registers */
high = i2c_r(sd, 0x0a);
if (high < 0) {
- pr_err("Error detecting camera chip PID\n");
+ PERR("Error detecting camera chip PID\n");
return;
}
low = i2c_r(sd, 0x0b);
if (low < 0) {
- pr_err("Error detecting camera chip VER\n");
+ PERR("Error detecting camera chip VER\n");
return;
}
if (high == 0x76) {
switch (low) {
case 0x30:
- pr_err("Sensor is an OV7630/OV7635\n");
- pr_err("7630 is not supported by this driver\n");
+ PERR("Sensor is an OV7630/OV7635\n");
+ PERR("7630 is not supported by this driver\n");
return;
case 0x40:
PDEBUG(D_PROBE, "Sensor is an OV7645");
@@ -2760,7 +2779,7 @@ static void ov7xx0_configure(struct sd *sd)
sd->sensor = SEN_OV7660;
break;
default:
- pr_err("Unknown sensor: 0x76%02x\n", low);
+ PERR("Unknown sensor: 0x76%02x\n", low);
return;
}
} else {
@@ -2768,20 +2787,22 @@ static void ov7xx0_configure(struct sd *sd)
sd->sensor = SEN_OV7620;
}
} else {
- pr_err("Unknown image sensor version: %d\n", rc & 3);
+ PERR("Unknown image sensor version: %d\n", rc & 3);
}
}
/* This initializes the OV6620, OV6630, OV6630AE, or OV6630AF sensor. */
static void ov6xx0_configure(struct sd *sd)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int rc;
+
PDEBUG(D_PROBE, "starting OV6xx0 configuration");
/* Detect sensor (sub)type */
rc = i2c_r(sd, OV7610_REG_COM_I);
if (rc < 0) {
- pr_err("Error detecting sensor type\n");
+ PERR("Error detecting sensor type\n");
return;
}
@@ -2810,7 +2831,7 @@ static void ov6xx0_configure(struct sd *sd)
pr_warn("WARNING: Sensor is an OV66307. Your camera may have been misdetected in previous driver versions.\n");
break;
default:
- pr_err("FATAL: Unknown sensor version: 0x%02x\n", rc);
+ PERR("FATAL: Unknown sensor version: 0x%02x\n", rc);
return;
}
@@ -2907,6 +2928,7 @@ static void ov51x_upload_quan_tables(struct sd *sd)
7, 7, 7, 7, 7, 7, 8, 8
};
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
const unsigned char *pYTable, *pUVTable;
unsigned char val0, val1;
int i, size, reg = R51x_COMP_LUT_BEGIN;
@@ -3300,7 +3322,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
} else if (init_ov_sensor(sd, OV_HIRES_SID) >= 0) {
ov_hires_configure(sd);
} else {
- pr_err("Can't determine sensor slave IDs\n");
+ PERR("Can't determine sensor slave IDs\n");
goto error;
}
@@ -3433,7 +3455,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
}
return gspca_dev->usb_err;
error:
- PDEBUG(D_ERR, "OV519 Config failed");
+ PERR("OV519 Config failed");
return -EINVAL;
}
@@ -3459,6 +3481,7 @@ static int sd_isoc_init(struct gspca_dev *gspca_dev)
*/
static void ov511_mode_init_regs(struct sd *sd)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int hsegs, vsegs, packet_size, fps, needed;
int interlaced = 0;
struct usb_host_interface *alt;
@@ -3467,7 +3490,7 @@ static void ov511_mode_init_regs(struct sd *sd)
intf = usb_ifnum_to_if(sd->gspca_dev.dev, sd->gspca_dev.iface);
alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt);
if (!alt) {
- pr_err("Couldn't get altsetting\n");
+ PERR("Couldn't get altsetting\n");
sd->gspca_dev.usb_err = -EIO;
return;
}
@@ -3583,6 +3606,7 @@ static void ov511_mode_init_regs(struct sd *sd)
*/
static void ov518_mode_init_regs(struct sd *sd)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int hsegs, vsegs, packet_size;
struct usb_host_interface *alt;
struct usb_interface *intf;
@@ -3590,7 +3614,7 @@ static void ov518_mode_init_regs(struct sd *sd)
intf = usb_ifnum_to_if(sd->gspca_dev.dev, sd->gspca_dev.iface);
alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt);
if (!alt) {
- pr_err("Couldn't get altsetting\n");
+ PERR("Couldn't get altsetting\n");
sd->gspca_dev.usb_err = -EIO;
return;
}
@@ -3750,6 +3774,8 @@ static void ov519_mode_init_regs(struct sd *sd)
/* windows reads 0x55 at this point, why? */
};
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
+
/******** Set the mode ********/
switch (sd->sensor) {
default:
@@ -3865,11 +3891,10 @@ static void ov519_mode_init_regs(struct sd *sd)
static void mode_init_ov_sensor_regs(struct sd *sd)
{
- struct gspca_dev *gspca_dev;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int qvga, xstart, xend, ystart, yend;
u8 v;
- gspca_dev = &sd->gspca_dev;
qvga = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv & 1;
/******** Mode (VGA/QVGA) and sensor specific regs ********/
@@ -4304,7 +4329,7 @@ static void ov511_pkt_scan(struct gspca_dev *gspca_dev,
/* Frame end */
if ((in[9] + 1) * 8 != gspca_dev->width ||
(in[10] + 1) * 8 != gspca_dev->height) {
- PDEBUG(D_ERR, "Invalid frame size, got: %dx%d,"
+ PERR("Invalid frame size, got: %dx%d,"
" requested: %dx%d\n",
(in[9] + 1) * 8, (in[10] + 1) * 8,
gspca_dev->width, gspca_dev->height);
@@ -4355,7 +4380,7 @@ static void ov518_pkt_scan(struct gspca_dev *gspca_dev,
except that they may contain part of the footer), are
numbered 0 */
else if (sd->packet_nr == 0 || data[len]) {
- PDEBUG(D_ERR, "Invalid packet nr: %d (expect: %d)",
+ PERR("Invalid packet nr: %d (expect: %d)",
(int)data[len], (int)sd->packet_nr);
gspca_dev->last_packet_type = DISCARD_PACKET;
return;
@@ -4898,7 +4923,7 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
QUALITY_MIN, QUALITY_MAX, 1, QUALITY_DEF);
if (hdl->error) {
- pr_err("Could not initialize controls\n");
+ PERR("Could not initialize controls\n");
return hdl->error;
}
if (gspca_dev->autogain)
diff --git a/drivers/media/usb/gspca/ov534.c b/drivers/media/usb/gspca/ov534.c
index bb09d7884b89..2e28c81a03ab 100644
--- a/drivers/media/usb/gspca/ov534.c
+++ b/drivers/media/usb/gspca/ov534.c
@@ -690,7 +690,7 @@ static int sccb_check_status(struct gspca_dev *gspca_dev)
case 0x03:
break;
default:
- PDEBUG(D_ERR, "sccb status 0x%02x, attempt %d/5",
+ PERR("sccb status 0x%02x, attempt %d/5",
data, i + 1);
}
}
diff --git a/drivers/media/usb/gspca/pac207.c b/drivers/media/usb/gspca/pac207.c
index 3b75097dd34e..83519be94e58 100644
--- a/drivers/media/usb/gspca/pac207.c
+++ b/drivers/media/usb/gspca/pac207.c
@@ -373,7 +373,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct sd *sd = (struct sd *) gspca_dev;
unsigned char *sof;
- sof = pac_find_sof(&sd->sof_read, data, len);
+ sof = pac_find_sof(gspca_dev, &sd->sof_read, data, len);
if (sof) {
int n;
diff --git a/drivers/media/usb/gspca/pac7302.c b/drivers/media/usb/gspca/pac7302.c
index add6f725ba50..682ef3340911 100644
--- a/drivers/media/usb/gspca/pac7302.c
+++ b/drivers/media/usb/gspca/pac7302.c
@@ -344,13 +344,10 @@ static void reg_w_var(struct gspca_dev *gspca_dev,
reg_w_page(gspca_dev, page3, page3_len);
break;
default:
-#ifdef GSPCA_DEBUG
if (len > USB_BUF_SZ) {
- PDEBUG(D_ERR|D_STREAM,
- "Incorrect variable sequence");
+ PERR("Incorrect variable sequence");
return;
}
-#endif
while (len > 0) {
if (len < 8) {
reg_w_buf(gspca_dev,
@@ -795,7 +792,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
u8 *image;
u8 *sof;
- sof = pac_find_sof(&sd->sof_read, data, len);
+ sof = pac_find_sof(gspca_dev, &sd->sof_read, data, len);
if (sof) {
int n, lum_offset, footer_length;
diff --git a/drivers/media/usb/gspca/pac7311.c b/drivers/media/usb/gspca/pac7311.c
index a12dfbf6e051..1a5bdc853a80 100644
--- a/drivers/media/usb/gspca/pac7311.c
+++ b/drivers/media/usb/gspca/pac7311.c
@@ -262,8 +262,7 @@ static void reg_w_var(struct gspca_dev *gspca_dev,
break;
default:
if (len > USB_BUF_SZ) {
- PDEBUG(D_ERR|D_STREAM,
- "Incorrect variable sequence");
+ PERR("Incorrect variable sequence");
return;
}
while (len > 0) {
@@ -575,7 +574,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
u8 *image;
unsigned char *sof;
- sof = pac_find_sof(&sd->sof_read, data, len);
+ sof = pac_find_sof(gspca_dev, &sd->sof_read, data, len);
if (sof) {
int n, lum_offset, footer_length;
diff --git a/drivers/media/usb/gspca/pac_common.h b/drivers/media/usb/gspca/pac_common.h
index 8462a7c1a338..fbc5e226c3e4 100644
--- a/drivers/media/usb/gspca/pac_common.h
+++ b/drivers/media/usb/gspca/pac_common.h
@@ -71,7 +71,7 @@ static const unsigned char pac_sof_marker[5] =
+----------+
*/
-static unsigned char *pac_find_sof(u8 *sof_read,
+static unsigned char *pac_find_sof(struct gspca_dev *gspca_dev, u8 *sof_read,
unsigned char *m, int len)
{
int i;
diff --git a/drivers/media/usb/gspca/sn9c2028.c b/drivers/media/usb/gspca/sn9c2028.c
index 03fa3fd940b4..39b6b2e02963 100644
--- a/drivers/media/usb/gspca/sn9c2028.c
+++ b/drivers/media/usb/gspca/sn9c2028.c
@@ -650,13 +650,13 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
result = sn9c2028_read1(gspca_dev);
if (result < 0)
- PDEBUG(D_ERR, "Camera Stop read failed");
+ PERR("Camera Stop read failed");
memset(data, 0, 6);
data[0] = 0x14;
result = sn9c2028_command(gspca_dev, data);
if (result < 0)
- PDEBUG(D_ERR, "Camera Stop command failed");
+ PERR("Camera Stop command failed");
}
/* Include sn9c2028 sof detection functions */
diff --git a/drivers/media/usb/gspca/sonixj.c b/drivers/media/usb/gspca/sonixj.c
index 8246e1dc3e9d..3b5ccb1c4cdf 100644
--- a/drivers/media/usb/gspca/sonixj.c
+++ b/drivers/media/usb/gspca/sonixj.c
@@ -1159,12 +1159,11 @@ static void reg_r(struct gspca_dev *gspca_dev,
if (gspca_dev->usb_err < 0)
return;
-#ifdef GSPCA_DEBUG
if (len > USB_BUF_SZ) {
- pr_err("reg_r: buffer overflow\n");
+ PERR("reg_r: buffer overflow\n");
return;
}
-#endif
+
ret = usb_control_msg(gspca_dev->dev,
usb_rcvctrlpipe(gspca_dev->dev, 0),
0,
@@ -1213,12 +1212,12 @@ static void reg_w(struct gspca_dev *gspca_dev,
return;
PDEBUG(D_USBO, "reg_w [%04x] = %02x %02x ..",
value, buffer[0], buffer[1]);
-#ifdef GSPCA_DEBUG
+
if (len > USB_BUF_SZ) {
- pr_err("reg_w: buffer overflow\n");
+ PERR("reg_w: buffer overflow\n");
return;
}
-#endif
+
memcpy(gspca_dev->usb_buf, buffer, len);
ret = usb_control_msg(gspca_dev->dev,
usb_sndctrlpipe(gspca_dev->dev, 0),
diff --git a/drivers/media/usb/gspca/spca1528.c b/drivers/media/usb/gspca/spca1528.c
index 14d635277d71..688592b289ea 100644
--- a/drivers/media/usb/gspca/spca1528.c
+++ b/drivers/media/usb/gspca/spca1528.c
@@ -146,7 +146,7 @@ static void wait_status_0(struct gspca_dev *gspca_dev)
w += 15;
msleep(w);
} while (--i > 0);
- PDEBUG(D_ERR, "wait_status_0 timeout");
+ PERR("wait_status_0 timeout");
gspca_dev->usb_err = -ETIME;
}
@@ -164,7 +164,7 @@ static void wait_status_1(struct gspca_dev *gspca_dev)
return;
}
} while (--i > 0);
- PDEBUG(D_ERR, "wait_status_1 timeout");
+ PERR("wait_status_1 timeout");
gspca_dev->usb_err = -ETIME;
}
diff --git a/drivers/media/usb/gspca/spca500.c b/drivers/media/usb/gspca/spca500.c
index 25cb68d0556d..9f8bf51fd64b 100644
--- a/drivers/media/usb/gspca/spca500.c
+++ b/drivers/media/usb/gspca/spca500.c
@@ -489,7 +489,7 @@ static int spca500_full_reset(struct gspca_dev *gspca_dev)
return err;
err = reg_r_wait(gspca_dev, 0x06, 0, 0);
if (err < 0) {
- PDEBUG(D_ERR, "reg_r_wait() failed");
+ PERR("reg_r_wait() failed");
return err;
}
/* all ok */
@@ -505,7 +505,7 @@ static int spca500_full_reset(struct gspca_dev *gspca_dev)
static int spca500_synch310(struct gspca_dev *gspca_dev)
{
if (usb_set_interface(gspca_dev->dev, gspca_dev->iface, 0) < 0) {
- PDEBUG(D_ERR, "Set packet size: set interface error");
+ PERR("Set packet size: set interface error");
goto error;
}
spca500_ping310(gspca_dev);
@@ -519,7 +519,7 @@ static int spca500_synch310(struct gspca_dev *gspca_dev)
if (usb_set_interface(gspca_dev->dev,
gspca_dev->iface,
gspca_dev->alt) < 0) {
- PDEBUG(D_ERR, "Set packet size: set interface error");
+ PERR("Set packet size: set interface error");
goto error;
}
return 0;
@@ -544,7 +544,7 @@ static void spca500_reinit(struct gspca_dev *gspca_dev)
err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840,
qtable_pocketdv);
if (err < 0)
- PDEBUG(D_ERR|D_STREAM, "spca50x_setup_qtable failed on init");
+ PERR("spca50x_setup_qtable failed on init");
/* set qtable index */
reg_w(gspca_dev, 0x00, 0x8880, 2);
@@ -639,7 +639,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
0x00, 0x8800, 0x8840,
qtable_creative_pccam);
if (err < 0)
- PDEBUG(D_ERR, "spca50x_setup_qtable failed");
+ PERR("spca50x_setup_qtable failed");
/* Init SDRAM - needed for SDRAM access */
reg_w(gspca_dev, 0x00, 0x870a, 0x04);
@@ -647,7 +647,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0x00, 0x8000, 0x0004);
msleep(500);
if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0)
- PDEBUG(D_ERR, "reg_r_wait() failed");
+ PERR("reg_r_wait() failed");
reg_r(gspca_dev, 0x816b, 1);
Data = gspca_dev->usb_buf[0];
@@ -660,13 +660,13 @@ static int sd_start(struct gspca_dev *gspca_dev)
/* enable drop packet */
err = reg_w(gspca_dev, 0x00, 0x850a, 0x0001);
if (err < 0)
- PDEBUG(D_ERR, "failed to enable drop packet");
+ PERR("failed to enable drop packet");
reg_w(gspca_dev, 0x00, 0x8880, 3);
err = spca50x_setup_qtable(gspca_dev,
0x00, 0x8800, 0x8840,
qtable_creative_pccam);
if (err < 0)
- PDEBUG(D_ERR, "spca50x_setup_qtable failed");
+ PERR("spca50x_setup_qtable failed");
/* Init SDRAM - needed for SDRAM access */
reg_w(gspca_dev, 0x00, 0x870a, 0x04);
@@ -675,7 +675,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0x00, 0x8000, 0x0004);
if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0)
- PDEBUG(D_ERR, "reg_r_wait() failed");
+ PERR("reg_r_wait() failed");
reg_r(gspca_dev, 0x816b, 1);
Data = gspca_dev->usb_buf[0];
@@ -689,18 +689,18 @@ static int sd_start(struct gspca_dev *gspca_dev)
/* do a full reset */
err = spca500_full_reset(gspca_dev);
if (err < 0)
- PDEBUG(D_ERR, "spca500_full_reset failed");
+ PERR("spca500_full_reset failed");
/* enable drop packet */
err = reg_w(gspca_dev, 0x00, 0x850a, 0x0001);
if (err < 0)
- PDEBUG(D_ERR, "failed to enable drop packet");
+ PERR("failed to enable drop packet");
reg_w(gspca_dev, 0x00, 0x8880, 3);
err = spca50x_setup_qtable(gspca_dev,
0x00, 0x8800, 0x8840,
qtable_creative_pccam);
if (err < 0)
- PDEBUG(D_ERR, "spca50x_setup_qtable failed");
+ PERR("spca50x_setup_qtable failed");
spca500_setmode(gspca_dev, xmult, ymult);
reg_w(gspca_dev, 0x20, 0x0001, 0x0004);
@@ -709,7 +709,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0x00, 0x8000, 0x0004);
if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0)
- PDEBUG(D_ERR, "reg_r_wait() failed");
+ PERR("reg_r_wait() failed");
reg_r(gspca_dev, 0x816b, 1);
Data = gspca_dev->usb_buf[0];
@@ -722,7 +722,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
/* do a full reset */
err = spca500_full_reset(gspca_dev);
if (err < 0)
- PDEBUG(D_ERR, "spca500_full_reset failed");
+ PERR("spca500_full_reset failed");
/* enable drop packet */
reg_w(gspca_dev, 0x00, 0x850a, 0x0001);
reg_w(gspca_dev, 0x00, 0x8880, 0);
@@ -730,7 +730,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
0x00, 0x8800, 0x8840,
qtable_kodak_ez200);
if (err < 0)
- PDEBUG(D_ERR, "spca50x_setup_qtable failed");
+ PERR("spca50x_setup_qtable failed");
spca500_setmode(gspca_dev, xmult, ymult);
reg_w(gspca_dev, 0x20, 0x0001, 0x0004);
@@ -739,7 +739,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0x00, 0x8000, 0x0004);
if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0)
- PDEBUG(D_ERR, "reg_r_wait() failed");
+ PERR("reg_r_wait() failed");
reg_r(gspca_dev, 0x816b, 1);
Data = gspca_dev->usb_buf[0];
@@ -765,7 +765,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
err = spca50x_setup_qtable(gspca_dev,
0x00, 0x8800, 0x8840, qtable_pocketdv);
if (err < 0)
- PDEBUG(D_ERR, "spca50x_setup_qtable failed");
+ PERR("spca50x_setup_qtable failed");
reg_w(gspca_dev, 0x00, 0x8880, 2);
/* familycam Quicksmart pocketDV stuff */
@@ -795,7 +795,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
0x00, 0x8800,
0x8840, qtable_creative_pccam);
if (err < 0)
- PDEBUG(D_ERR, "spca50x_setup_qtable failed");
+ PERR("spca50x_setup_qtable failed");
reg_w(gspca_dev, 0x00, 0x8880, 3);
reg_w(gspca_dev, 0x00, 0x800a, 0x00);
/* Init SDRAM - needed for SDRAM access */
diff --git a/drivers/media/usb/gspca/spca501.c b/drivers/media/usb/gspca/spca501.c
index 3b7f777785b4..d92fd17d6701 100644
--- a/drivers/media/usb/gspca/spca501.c
+++ b/drivers/media/usb/gspca/spca501.c
@@ -1756,10 +1756,11 @@ static const __u16 spca501c_mysterious_init_data[][3] = {
{}
};
-static int reg_write(struct usb_device *dev,
- __u16 req, __u16 index, __u16 value)
+static int reg_write(struct gspca_dev *gspca_dev,
+ __u16 req, __u16 index, __u16 value)
{
int ret;
+ struct usb_device *dev = gspca_dev->dev;
ret = usb_control_msg(dev,
usb_sndctrlpipe(dev, 0),
@@ -1774,17 +1775,15 @@ static int reg_write(struct usb_device *dev,
}
-static int write_vector(struct gspca_dev *gspca_dev,
- const __u16 data[][3])
+static int write_vector(struct gspca_dev *gspca_dev, const __u16 data[][3])
{
- struct usb_device *dev = gspca_dev->dev;
int ret, i = 0;
while (data[i][0] != 0 || data[i][1] != 0 || data[i][2] != 0) {
- ret = reg_write(dev, data[i][0], data[i][2], data[i][1]);
+ ret = reg_write(gspca_dev, data[i][0], data[i][2],
+ data[i][1]);
if (ret < 0) {
- PDEBUG(D_ERR,
- "Reg write failed for 0x%02x,0x%02x,0x%02x",
+ PERR("Reg write failed for 0x%02x,0x%02x,0x%02x",
data[i][0], data[i][1], data[i][2]);
return ret;
}
@@ -1795,30 +1794,28 @@ static int write_vector(struct gspca_dev *gspca_dev,
static void setbrightness(struct gspca_dev *gspca_dev, s32 val)
{
- reg_write(gspca_dev->dev, SPCA501_REG_CCDSP, 0x12, val);
+ reg_write(gspca_dev, SPCA501_REG_CCDSP, 0x12, val);
}
static void setcontrast(struct gspca_dev *gspca_dev, s32 val)
{
- reg_write(gspca_dev->dev, 0x00, 0x00,
- (val >> 8) & 0xff);
- reg_write(gspca_dev->dev, 0x00, 0x01,
- val & 0xff);
+ reg_write(gspca_dev, 0x00, 0x00, (val >> 8) & 0xff);
+ reg_write(gspca_dev, 0x00, 0x01, val & 0xff);
}
static void setcolors(struct gspca_dev *gspca_dev, s32 val)
{
- reg_write(gspca_dev->dev, SPCA501_REG_CCDSP, 0x0c, val);
+ reg_write(gspca_dev, SPCA501_REG_CCDSP, 0x0c, val);
}
static void setblue_balance(struct gspca_dev *gspca_dev, s32 val)
{
- reg_write(gspca_dev->dev, SPCA501_REG_CCDSP, 0x11, val);
+ reg_write(gspca_dev, SPCA501_REG_CCDSP, 0x11, val);
}
static void setred_balance(struct gspca_dev *gspca_dev, s32 val)
{
- reg_write(gspca_dev->dev, SPCA501_REG_CCDSP, 0x13, val);
+ reg_write(gspca_dev, SPCA501_REG_CCDSP, 0x13, val);
}
/* this function is called at probe time */
@@ -1868,7 +1865,6 @@ error:
static int sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
- struct usb_device *dev = gspca_dev->dev;
int mode;
switch (sd->subtype) {
@@ -1895,20 +1891,20 @@ static int sd_start(struct gspca_dev *gspca_dev)
/* Enable ISO packet machine CTRL reg=2,
* index=1 bitmask=0x2 (bit ordinal 1) */
- reg_write(dev, SPCA50X_REG_USB, 0x6, 0x94);
+ reg_write(gspca_dev, SPCA50X_REG_USB, 0x6, 0x94);
switch (mode) {
case 0: /* 640x480 */
- reg_write(dev, SPCA50X_REG_USB, 0x07, 0x004a);
+ reg_write(gspca_dev, SPCA50X_REG_USB, 0x07, 0x004a);
break;
case 1: /* 320x240 */
- reg_write(dev, SPCA50X_REG_USB, 0x07, 0x104a);
+ reg_write(gspca_dev, SPCA50X_REG_USB, 0x07, 0x104a);
break;
default:
/* case 2: * 160x120 */
- reg_write(dev, SPCA50X_REG_USB, 0x07, 0x204a);
+ reg_write(gspca_dev, SPCA50X_REG_USB, 0x07, 0x204a);
break;
}
- reg_write(dev, SPCA501_REG_CTLRL, 0x01, 0x02);
+ reg_write(gspca_dev, SPCA501_REG_CTLRL, 0x01, 0x02);
return 0;
}
@@ -1917,7 +1913,7 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
{
/* Disable ISO packet
* machine CTRL reg=2, index=1 bitmask=0x0 (bit ordinal 1) */
- reg_write(gspca_dev->dev, SPCA501_REG_CTLRL, 0x01, 0x00);
+ reg_write(gspca_dev, SPCA501_REG_CTLRL, 0x01, 0x00);
}
/* called on streamoff with alt 0 and on disconnect */
@@ -1925,7 +1921,7 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
{
if (!gspca_dev->present)
return;
- reg_write(gspca_dev->dev, SPCA501_REG_CTLRL, 0x05, 0x00);
+ reg_write(gspca_dev, SPCA501_REG_CTLRL, 0x05, 0x00);
}
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
diff --git a/drivers/media/usb/gspca/spca505.c b/drivers/media/usb/gspca/spca505.c
index bc7d67c3cb04..232b330d2dd3 100644
--- a/drivers/media/usb/gspca/spca505.c
+++ b/drivers/media/usb/gspca/spca505.c
@@ -544,10 +544,11 @@ static const u8 spca505b_open_data_ccd[][3] = {
{}
};
-static int reg_write(struct usb_device *dev,
+static int reg_write(struct gspca_dev *gspca_dev,
u16 req, u16 index, u16 value)
{
int ret;
+ struct usb_device *dev = gspca_dev->dev;
ret = usb_control_msg(dev,
usb_sndctrlpipe(dev, 0),
@@ -584,11 +585,11 @@ static int reg_read(struct gspca_dev *gspca_dev,
static int write_vector(struct gspca_dev *gspca_dev,
const u8 data[][3])
{
- struct usb_device *dev = gspca_dev->dev;
int ret, i = 0;
while (data[i][0] != 0) {
- ret = reg_write(dev, data[i][0], data[i][2], data[i][1]);
+ ret = reg_write(gspca_dev, data[i][0], data[i][2],
+ data[i][1]);
if (ret < 0)
return ret;
i++;
@@ -629,14 +630,13 @@ static int sd_init(struct gspca_dev *gspca_dev)
static void setbrightness(struct gspca_dev *gspca_dev, s32 brightness)
{
- reg_write(gspca_dev->dev, 0x05, 0x00, (255 - brightness) >> 6);
- reg_write(gspca_dev->dev, 0x05, 0x01, (255 - brightness) << 2);
+ reg_write(gspca_dev, 0x05, 0x00, (255 - brightness) >> 6);
+ reg_write(gspca_dev, 0x05, 0x01, (255 - brightness) << 2);
}
static int sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
- struct usb_device *dev = gspca_dev->dev;
int ret, mode;
static u8 mode_tb[][3] = {
/* r00 r06 r07 */
@@ -654,9 +654,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
ret = reg_read(gspca_dev, 0x06, 0x16);
if (ret < 0) {
- PDEBUG(D_ERR|D_CONF,
- "register read failed err: %d",
- ret);
+ PERR("register read failed err: %d", ret);
return ret;
}
if (ret != 0x0101) {
@@ -664,22 +662,22 @@ static int sd_start(struct gspca_dev *gspca_dev)
ret);
}
- ret = reg_write(gspca_dev->dev, 0x06, 0x16, 0x0a);
+ ret = reg_write(gspca_dev, 0x06, 0x16, 0x0a);
if (ret < 0)
return ret;
- reg_write(gspca_dev->dev, 0x05, 0xc2, 0x12);
+ reg_write(gspca_dev, 0x05, 0xc2, 0x12);
/* necessary because without it we can see stream
* only once after loading module */
/* stopping usb registers Tomasz change */
- reg_write(dev, 0x02, 0x00, 0x00);
+ reg_write(gspca_dev, 0x02, 0x00, 0x00);
mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
- reg_write(dev, SPCA50X_REG_COMPRESS, 0x00, mode_tb[mode][0]);
- reg_write(dev, SPCA50X_REG_COMPRESS, 0x06, mode_tb[mode][1]);
- reg_write(dev, SPCA50X_REG_COMPRESS, 0x07, mode_tb[mode][2]);
+ reg_write(gspca_dev, SPCA50X_REG_COMPRESS, 0x00, mode_tb[mode][0]);
+ reg_write(gspca_dev, SPCA50X_REG_COMPRESS, 0x06, mode_tb[mode][1]);
+ reg_write(gspca_dev, SPCA50X_REG_COMPRESS, 0x07, mode_tb[mode][2]);
- return reg_write(dev, SPCA50X_REG_USB,
+ return reg_write(gspca_dev, SPCA50X_REG_USB,
SPCA50X_USB_CTRL,
SPCA50X_CUSB_ENABLE);
}
@@ -687,7 +685,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
static void sd_stopN(struct gspca_dev *gspca_dev)
{
/* Disable ISO packet machine */
- reg_write(gspca_dev->dev, 0x02, 0x00, 0x00);
+ reg_write(gspca_dev, 0x02, 0x00, 0x00);
}
/* called on streamoff with alt 0 and on disconnect */
@@ -697,11 +695,11 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
return;
/* This maybe reset or power control */
- reg_write(gspca_dev->dev, 0x03, 0x03, 0x20);
- reg_write(gspca_dev->dev, 0x03, 0x01, 0x00);
- reg_write(gspca_dev->dev, 0x03, 0x00, 0x01);
- reg_write(gspca_dev->dev, 0x05, 0x10, 0x01);
- reg_write(gspca_dev->dev, 0x05, 0x11, 0x0f);
+ reg_write(gspca_dev, 0x03, 0x03, 0x20);
+ reg_write(gspca_dev, 0x03, 0x01, 0x00);
+ reg_write(gspca_dev, 0x03, 0x00, 0x01);
+ reg_write(gspca_dev, 0x05, 0x10, 0x01);
+ reg_write(gspca_dev, 0x05, 0x11, 0x0f);
}
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
diff --git a/drivers/media/usb/gspca/spca508.c b/drivers/media/usb/gspca/spca508.c
index 1286b4170b88..75f2beb2ea5a 100644
--- a/drivers/media/usb/gspca/spca508.c
+++ b/drivers/media/usb/gspca/spca508.c
@@ -1241,10 +1241,10 @@ static const u16 spca508_vista_init_data[][2] = {
{}
};
-static int reg_write(struct usb_device *dev,
- u16 index, u16 value)
+static int reg_write(struct gspca_dev *gspca_dev, u16 index, u16 value)
{
int ret;
+ struct usb_device *dev = gspca_dev->dev;
ret = usb_control_msg(dev,
usb_sndctrlpipe(dev, 0),
@@ -1286,22 +1286,21 @@ static int reg_read(struct gspca_dev *gspca_dev,
static int ssi_w(struct gspca_dev *gspca_dev,
u16 reg, u16 val)
{
- struct usb_device *dev = gspca_dev->dev;
int ret, retry;
- ret = reg_write(dev, 0x8802, reg >> 8);
+ ret = reg_write(gspca_dev, 0x8802, reg >> 8);
if (ret < 0)
goto out;
- ret = reg_write(dev, 0x8801, reg & 0x00ff);
+ ret = reg_write(gspca_dev, 0x8801, reg & 0x00ff);
if (ret < 0)
goto out;
if ((reg & 0xff00) == 0x1000) { /* if 2 bytes */
- ret = reg_write(dev, 0x8805, val & 0x00ff);
+ ret = reg_write(gspca_dev, 0x8805, val & 0x00ff);
if (ret < 0)
goto out;
val >>= 8;
}
- ret = reg_write(dev, 0x8800, val);
+ ret = reg_write(gspca_dev, 0x8800, val);
if (ret < 0)
goto out;
@@ -1314,8 +1313,7 @@ static int ssi_w(struct gspca_dev *gspca_dev,
if (gspca_dev->usb_buf[0] == 0)
break;
if (--retry <= 0) {
- PDEBUG(D_ERR, "ssi_w busy %02x",
- gspca_dev->usb_buf[0]);
+ PERR("ssi_w busy %02x", gspca_dev->usb_buf[0]);
ret = -1;
break;
}
@@ -1329,7 +1327,6 @@ out:
static int write_vector(struct gspca_dev *gspca_dev,
const u16 (*data)[2])
{
- struct usb_device *dev = gspca_dev->dev;
int ret = 0;
while ((*data)[1] != 0) {
@@ -1337,7 +1334,8 @@ static int write_vector(struct gspca_dev *gspca_dev,
if ((*data)[1] == 0xdd00) /* delay */
msleep((*data)[0]);
else
- ret = reg_write(dev, (*data)[1], (*data)[0]);
+ ret = reg_write(gspca_dev, (*data)[1],
+ (*data)[0]);
} else {
ret = ssi_w(gspca_dev, (*data)[1], (*data)[0]);
}
@@ -1363,8 +1361,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
spca508cs110_init_data, /* MicroInnovationIC200 4 */
spca508_init_data, /* ViewQuestVQ110 5 */
};
-
-#ifdef GSPCA_DEBUG
int data1, data2;
/* Read from global register the USB product and vendor IDs, just to
@@ -1381,7 +1377,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
data1 = reg_read(gspca_dev, 0x8621);
PDEBUG(D_PROBE, "Window 1 average luminance: %d", data1);
-#endif
cam = &gspca_dev->cam;
cam->cam_mode = sif_mode;
@@ -1404,26 +1399,26 @@ static int sd_start(struct gspca_dev *gspca_dev)
int mode;
mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
- reg_write(gspca_dev->dev, 0x8500, mode);
+ reg_write(gspca_dev, 0x8500, mode);
switch (mode) {
case 0:
case 1:
- reg_write(gspca_dev->dev, 0x8700, 0x28); /* clock */
+ reg_write(gspca_dev, 0x8700, 0x28); /* clock */
break;
default:
/* case 2: */
/* case 3: */
- reg_write(gspca_dev->dev, 0x8700, 0x23); /* clock */
+ reg_write(gspca_dev, 0x8700, 0x23); /* clock */
break;
}
- reg_write(gspca_dev->dev, 0x8112, 0x10 | 0x20);
+ reg_write(gspca_dev, 0x8112, 0x10 | 0x20);
return 0;
}
static void sd_stopN(struct gspca_dev *gspca_dev)
{
/* Video ISO disable, Video Drop Packet enable: */
- reg_write(gspca_dev->dev, 0x8112, 0x20);
+ reg_write(gspca_dev, 0x8112, 0x20);
}
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
@@ -1450,10 +1445,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
static void setbrightness(struct gspca_dev *gspca_dev, s32 brightness)
{
/* MX seem contrast */
- reg_write(gspca_dev->dev, 0x8651, brightness);
- reg_write(gspca_dev->dev, 0x8652, brightness);
- reg_write(gspca_dev->dev, 0x8653, brightness);
- reg_write(gspca_dev->dev, 0x8654, brightness);
+ reg_write(gspca_dev, 0x8651, brightness);
+ reg_write(gspca_dev, 0x8652, brightness);
+ reg_write(gspca_dev, 0x8653, brightness);
+ reg_write(gspca_dev, 0x8654, brightness);
}
static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
diff --git a/drivers/media/usb/gspca/spca561.c b/drivers/media/usb/gspca/spca561.c
index d1db3d8f6522..403d71cd65d9 100644
--- a/drivers/media/usb/gspca/spca561.c
+++ b/drivers/media/usb/gspca/spca561.c
@@ -285,9 +285,10 @@ static const __u16 spca561_161rev12A_data2[][2] = {
{}
};
-static void reg_w_val(struct usb_device *dev, __u16 index, __u8 value)
+static void reg_w_val(struct gspca_dev *gspca_dev, __u16 index, __u8 value)
{
int ret;
+ struct usb_device *dev = gspca_dev->dev;
ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
0, /* request */
@@ -301,12 +302,11 @@ static void reg_w_val(struct usb_device *dev, __u16 index, __u8 value)
static void write_vector(struct gspca_dev *gspca_dev,
const __u16 data[][2])
{
- struct usb_device *dev = gspca_dev->dev;
int i;
i = 0;
while (data[i][1] != 0) {
- reg_w_val(dev, data[i][1], data[i][0]);
+ reg_w_val(gspca_dev, data[i][1], data[i][0]);
i++;
}
}
@@ -339,9 +339,9 @@ static void i2c_write(struct gspca_dev *gspca_dev, __u16 value, __u16 reg)
{
int retry = 60;
- reg_w_val(gspca_dev->dev, 0x8801, reg);
- reg_w_val(gspca_dev->dev, 0x8805, value);
- reg_w_val(gspca_dev->dev, 0x8800, value >> 8);
+ reg_w_val(gspca_dev, 0x8801, reg);
+ reg_w_val(gspca_dev, 0x8805, value);
+ reg_w_val(gspca_dev, 0x8800, value >> 8);
do {
reg_r(gspca_dev, 0x8803, 1);
if (!gspca_dev->usb_buf[0])
@@ -355,9 +355,9 @@ static int i2c_read(struct gspca_dev *gspca_dev, __u16 reg, __u8 mode)
int retry = 60;
__u8 value;
- reg_w_val(gspca_dev->dev, 0x8804, 0x92);
- reg_w_val(gspca_dev->dev, 0x8801, reg);
- reg_w_val(gspca_dev->dev, 0x8802, mode | 0x01);
+ reg_w_val(gspca_dev, 0x8804, 0x92);
+ reg_w_val(gspca_dev, 0x8801, reg);
+ reg_w_val(gspca_dev, 0x8802, mode | 0x01);
do {
reg_r(gspca_dev, 0x8803, 1);
if (!gspca_dev->usb_buf[0]) {
@@ -459,14 +459,13 @@ static int sd_init_72a(struct gspca_dev *gspca_dev)
write_sensor_72a(gspca_dev, rev72a_init_sensor1);
write_vector(gspca_dev, rev72a_init_data2);
write_sensor_72a(gspca_dev, rev72a_init_sensor2);
- reg_w_val(gspca_dev->dev, 0x8112, 0x30);
+ reg_w_val(gspca_dev, 0x8112, 0x30);
return 0;
}
static void setbrightness(struct gspca_dev *gspca_dev, s32 val)
{
struct sd *sd = (struct sd *) gspca_dev;
- struct usb_device *dev = gspca_dev->dev;
__u16 reg;
if (sd->chip_revision == Rev012A)
@@ -474,16 +473,15 @@ static void setbrightness(struct gspca_dev *gspca_dev, s32 val)
else
reg = 0x8611;
- reg_w_val(dev, reg + 0, val); /* R */
- reg_w_val(dev, reg + 1, val); /* Gr */
- reg_w_val(dev, reg + 2, val); /* B */
- reg_w_val(dev, reg + 3, val); /* Gb */
+ reg_w_val(gspca_dev, reg + 0, val); /* R */
+ reg_w_val(gspca_dev, reg + 1, val); /* Gr */
+ reg_w_val(gspca_dev, reg + 2, val); /* B */
+ reg_w_val(gspca_dev, reg + 3, val); /* Gb */
}
static void setwhite(struct gspca_dev *gspca_dev, s32 white, s32 contrast)
{
struct sd *sd = (struct sd *) gspca_dev;
- struct usb_device *dev = gspca_dev->dev;
__u8 blue, red;
__u16 reg;
@@ -496,11 +494,11 @@ static void setwhite(struct gspca_dev *gspca_dev, s32 white, s32 contrast)
reg = 0x8651;
red += contrast - 0x20;
blue += contrast - 0x20;
- reg_w_val(dev, 0x8652, contrast + 0x20); /* Gr */
- reg_w_val(dev, 0x8654, contrast + 0x20); /* Gb */
+ reg_w_val(gspca_dev, 0x8652, contrast + 0x20); /* Gr */
+ reg_w_val(gspca_dev, 0x8654, contrast + 0x20); /* Gb */
}
- reg_w_val(dev, reg, red);
- reg_w_val(dev, reg + 2, blue);
+ reg_w_val(gspca_dev, reg, red);
+ reg_w_val(gspca_dev, reg + 2, blue);
}
/* rev 12a only */
@@ -570,7 +568,6 @@ static void setautogain(struct gspca_dev *gspca_dev, s32 val)
static int sd_start_12a(struct gspca_dev *gspca_dev)
{
- struct usb_device *dev = gspca_dev->dev;
int mode;
static const __u8 Reg8391[8] =
{0x92, 0x30, 0x20, 0x00, 0x0c, 0x00, 0x00, 0x00};
@@ -578,34 +575,33 @@ static int sd_start_12a(struct gspca_dev *gspca_dev)
mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
if (mode <= 1) {
/* Use compression on 320x240 and above */
- reg_w_val(dev, 0x8500, 0x10 | mode);
+ reg_w_val(gspca_dev, 0x8500, 0x10 | mode);
} else {
/* I couldn't get the compression to work below 320x240
* Fortunately at these resolutions the bandwidth
* is sufficient to push raw frames at ~20fps */
- reg_w_val(dev, 0x8500, mode);
+ reg_w_val(gspca_dev, 0x8500, mode);
} /* -- qq@kuku.eu.org */
gspca_dev->usb_buf[0] = 0xaa;
gspca_dev->usb_buf[1] = 0x00;
reg_w_buf(gspca_dev, 0x8307, 2);
/* clock - lower 0x8X values lead to fps > 30 */
- reg_w_val(gspca_dev->dev, 0x8700, 0x8a);
+ reg_w_val(gspca_dev, 0x8700, 0x8a);
/* 0x8f 0x85 0x27 clock */
- reg_w_val(gspca_dev->dev, 0x8112, 0x1e | 0x20);
- reg_w_val(gspca_dev->dev, 0x850b, 0x03);
+ reg_w_val(gspca_dev, 0x8112, 0x1e | 0x20);
+ reg_w_val(gspca_dev, 0x850b, 0x03);
memcpy(gspca_dev->usb_buf, Reg8391, 8);
reg_w_buf(gspca_dev, 0x8391, 8);
reg_w_buf(gspca_dev, 0x8390, 8);
/* Led ON (bit 3 -> 0 */
- reg_w_val(gspca_dev->dev, 0x8114, 0x00);
+ reg_w_val(gspca_dev, 0x8114, 0x00);
return 0;
}
static int sd_start_72a(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
- struct usb_device *dev = gspca_dev->dev;
int Clck;
int mode;
@@ -630,15 +626,15 @@ static int sd_start_72a(struct gspca_dev *gspca_dev)
Clck = 0x21;
break;
}
- reg_w_val(dev, 0x8700, Clck); /* 0x27 clock */
- reg_w_val(dev, 0x8702, 0x81);
- reg_w_val(dev, 0x8500, mode); /* mode */
+ reg_w_val(gspca_dev, 0x8700, Clck); /* 0x27 clock */
+ reg_w_val(gspca_dev, 0x8702, 0x81);
+ reg_w_val(gspca_dev, 0x8500, mode); /* mode */
write_sensor_72a(gspca_dev, rev72a_init_sensor2);
setwhite(gspca_dev, v4l2_ctrl_g_ctrl(sd->hue),
v4l2_ctrl_g_ctrl(sd->contrast));
/* setbrightness(gspca_dev); * fixme: bad values */
setautogain(gspca_dev, v4l2_ctrl_g_ctrl(sd->autogain));
- reg_w_val(dev, 0x8112, 0x10 | 0x20);
+ reg_w_val(gspca_dev, 0x8112, 0x10 | 0x20);
return 0;
}
@@ -647,12 +643,12 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
if (sd->chip_revision == Rev012A) {
- reg_w_val(gspca_dev->dev, 0x8112, 0x0e);
+ reg_w_val(gspca_dev, 0x8112, 0x0e);
/* Led Off (bit 3 -> 1 */
- reg_w_val(gspca_dev->dev, 0x8114, 0x08);
+ reg_w_val(gspca_dev, 0x8114, 0x08);
} else {
- reg_w_val(gspca_dev->dev, 0x8112, 0x20);
-/* reg_w_val(gspca_dev->dev, 0x8102, 0x00); ?? */
+ reg_w_val(gspca_dev, 0x8112, 0x20);
+/* reg_w_val(gspca_dev, 0x8102, 0x00); ?? */
}
}
@@ -736,7 +732,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
/* This should never happen */
if (len < 2) {
- PDEBUG(D_ERR, "Short SOF packet, ignoring");
+ PERR("Short SOF packet, ignoring");
gspca_dev->last_packet_type = DISCARD_PACKET;
return;
}
diff --git a/drivers/media/usb/gspca/sq905.c b/drivers/media/usb/gspca/sq905.c
index 1d99f10a3e19..a7ae0ec9fa91 100644
--- a/drivers/media/usb/gspca/sq905.c
+++ b/drivers/media/usb/gspca/sq905.c
@@ -387,7 +387,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
}
if (ret < 0) {
- PDEBUG(D_ERR, "Start streaming command failed");
+ PERR("Start streaming command failed");
return ret;
}
/* Start the workqueue function to do the streaming */
diff --git a/drivers/media/usb/gspca/sq905c.c b/drivers/media/usb/gspca/sq905c.c
index 410cdcbb55d4..acb19fb9a3df 100644
--- a/drivers/media/usb/gspca/sq905c.c
+++ b/drivers/media/usb/gspca/sq905c.c
@@ -215,13 +215,13 @@ static int sd_config(struct gspca_dev *gspca_dev,
ret = sq905c_command(gspca_dev, SQ905C_GET_ID, 0);
if (ret < 0) {
- PDEBUG(D_ERR, "Get version command failed");
+ PERR("Get version command failed");
return ret;
}
ret = sq905c_read(gspca_dev, 0xf5, 0, 20);
if (ret < 0) {
- PDEBUG(D_ERR, "Reading version command failed");
+ PERR("Reading version command failed");
return ret;
}
/* Note we leave out the usb id and the manufacturing date */
@@ -286,7 +286,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
}
if (ret < 0) {
- PDEBUG(D_ERR, "Start streaming command failed");
+ PERR("Start streaming command failed");
return ret;
}
/* Start the workqueue function to do the streaming */
diff --git a/drivers/media/usb/gspca/sq930x.c b/drivers/media/usb/gspca/sq930x.c
index 7e8748b31e85..b10d0821111c 100644
--- a/drivers/media/usb/gspca/sq930x.c
+++ b/drivers/media/usb/gspca/sq930x.c
@@ -541,13 +541,11 @@ static void ucbus_write(struct gspca_dev *gspca_dev,
if (gspca_dev->usb_err < 0)
return;
-#ifdef GSPCA_DEBUG
if ((batchsize - 1) * 3 > USB_BUF_SZ) {
- pr_err("Bug: usb_buf overflow\n");
+ PERR("Bug: usb_buf overflow\n");
gspca_dev->usb_err = -ENOMEM;
return;
}
-#endif
for (;;) {
len = ncmds;
diff --git a/drivers/media/usb/gspca/stv0680.c b/drivers/media/usb/gspca/stv0680.c
index 67605272aaa8..9c0827631b9c 100644
--- a/drivers/media/usb/gspca/stv0680.c
+++ b/drivers/media/usb/gspca/stv0680.c
@@ -86,7 +86,7 @@ static int stv_sndctrl(struct gspca_dev *gspca_dev, int set, u8 req, u16 val,
static int stv0680_handle_error(struct gspca_dev *gspca_dev, int ret)
{
stv_sndctrl(gspca_dev, 0, 0x80, 0, 0x02); /* Get Last Error */
- PDEBUG(D_ERR, "last error: %i, command = 0x%x",
+ PERR("last error: %i, command = 0x%x",
gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]);
return ret;
}
@@ -98,7 +98,7 @@ static int stv0680_get_video_mode(struct gspca_dev *gspca_dev)
gspca_dev->usb_buf[0] = 0x0f;
if (stv_sndctrl(gspca_dev, 0, 0x87, 0, 0x08) != 0x08) {
- PDEBUG(D_ERR, "Get_Camera_Mode failed");
+ PERR("Get_Camera_Mode failed");
return stv0680_handle_error(gspca_dev, -EIO);
}
@@ -116,13 +116,13 @@ static int stv0680_set_video_mode(struct gspca_dev *gspca_dev, u8 mode)
gspca_dev->usb_buf[0] = mode;
if (stv_sndctrl(gspca_dev, 3, 0x07, 0x0100, 0x08) != 0x08) {
- PDEBUG(D_ERR, "Set_Camera_Mode failed");
+ PERR("Set_Camera_Mode failed");
return stv0680_handle_error(gspca_dev, -EIO);
}
/* Verify we got what we've asked for */
if (stv0680_get_video_mode(gspca_dev) != mode) {
- PDEBUG(D_ERR, "Error setting camera video mode!");
+ PERR("Error setting camera video mode!");
return -EIO;
}
@@ -146,7 +146,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
/* ping camera to be sure STV0680 is present */
if (stv_sndctrl(gspca_dev, 0, 0x88, 0x5678, 0x02) != 0x02 ||
gspca_dev->usb_buf[0] != 0x56 || gspca_dev->usb_buf[1] != 0x78) {
- PDEBUG(D_ERR, "STV(e): camera ping failed!!");
+ PERR("STV(e): camera ping failed!!");
return stv0680_handle_error(gspca_dev, -ENODEV);
}
@@ -156,7 +156,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
if (stv_sndctrl(gspca_dev, 2, 0x06, 0x0200, 0x22) != 0x22 ||
gspca_dev->usb_buf[7] != 0xa0 || gspca_dev->usb_buf[8] != 0x23) {
- PDEBUG(D_ERR, "Could not get descriptor 0200.");
+ PERR("Could not get descriptor 0200.");
return stv0680_handle_error(gspca_dev, -ENODEV);
}
if (stv_sndctrl(gspca_dev, 0, 0x8a, 0, 0x02) != 0x02)
@@ -167,7 +167,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
return stv0680_handle_error(gspca_dev, -ENODEV);
if (!(gspca_dev->usb_buf[7] & 0x09)) {
- PDEBUG(D_ERR, "Camera supports neither CIF nor QVGA mode");
+ PERR("Camera supports neither CIF nor QVGA mode");
return -ENODEV;
}
if (gspca_dev->usb_buf[7] & 0x01)
diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx.c b/drivers/media/usb/gspca/stv06xx/stv06xx.c
index 657160b4a1f7..55ee7a61c67f 100644
--- a/drivers/media/usb/gspca/stv06xx/stv06xx.c
+++ b/drivers/media/usb/gspca/stv06xx/stv06xx.c
@@ -42,8 +42,10 @@ static bool dump_sensor;
int stv06xx_write_bridge(struct sd *sd, u16 address, u16 i2c_data)
{
int err;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
struct usb_device *udev = sd->gspca_dev.dev;
__u8 *buf = sd->gspca_dev.usb_buf;
+
u8 len = (i2c_data > 0xff) ? 2 : 1;
buf[0] = i2c_data & 0xff;
@@ -62,6 +64,7 @@ int stv06xx_write_bridge(struct sd *sd, u16 address, u16 i2c_data)
int stv06xx_read_bridge(struct sd *sd, u16 address, u8 *i2c_data)
{
int err;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
struct usb_device *udev = sd->gspca_dev.dev;
__u8 *buf = sd->gspca_dev.usb_buf;
@@ -110,6 +113,7 @@ static int stv06xx_write_sensor_finish(struct sd *sd)
int stv06xx_write_sensor_bytes(struct sd *sd, const u8 *data, u8 len)
{
int err, i, j;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
struct usb_device *udev = sd->gspca_dev.dev;
__u8 *buf = sd->gspca_dev.usb_buf;
@@ -139,6 +143,7 @@ int stv06xx_write_sensor_bytes(struct sd *sd, const u8 *data, u8 len)
int stv06xx_write_sensor_words(struct sd *sd, const u16 *data, u8 len)
{
int err, i, j;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
struct usb_device *udev = sd->gspca_dev.dev;
__u8 *buf = sd->gspca_dev.usb_buf;
@@ -170,6 +175,7 @@ int stv06xx_write_sensor_words(struct sd *sd, const u16 *data, u8 len)
int stv06xx_read_sensor(struct sd *sd, const u8 address, u16 *value)
{
int err;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
struct usb_device *udev = sd->gspca_dev.dev;
__u8 *buf = sd->gspca_dev.usb_buf;
@@ -283,7 +289,7 @@ static int stv06xx_start(struct gspca_dev *gspca_dev)
intf = usb_ifnum_to_if(sd->gspca_dev.dev, sd->gspca_dev.iface);
alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt);
if (!alt) {
- PDEBUG(D_ERR, "Couldn't get altsetting");
+ PERR("Couldn't get altsetting");
return -EIO;
}
@@ -341,7 +347,7 @@ static int stv06xx_isoc_nego(struct gspca_dev *gspca_dev)
ret = usb_set_interface(gspca_dev->dev, gspca_dev->iface, 1);
if (ret < 0)
- PDEBUG(D_ERR|D_STREAM, "set alt 1 err %d", ret);
+ PERR("set alt 1 err %d", ret);
return ret;
}
@@ -406,7 +412,7 @@ static void stv06xx_pkt_scan(struct gspca_dev *gspca_dev,
len -= 4;
if (len < chunk_len) {
- PDEBUG(D_ERR, "URB packet length is smaller"
+ PERR("URB packet length is smaller"
" than the specified chunk length");
gspca_dev->last_packet_type = DISCARD_PACKET;
return;
@@ -449,7 +455,7 @@ frame_data:
sd->to_skip = gspca_dev->width * 4;
if (chunk_len)
- PDEBUG(D_ERR, "Chunk length is "
+ PERR("Chunk length is "
"non-zero on a SOF");
break;
@@ -463,7 +469,7 @@ frame_data:
NULL, 0);
if (chunk_len)
- PDEBUG(D_ERR, "Chunk length is "
+ PERR("Chunk length is "
"non-zero on a EOF");
break;
@@ -596,7 +602,6 @@ MODULE_DEVICE_TABLE(usb, device_table);
static int sd_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
- PDEBUG(D_PROBE, "Probing for a stv06xx device");
return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
THIS_MODULE);
}
diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx_hdcs.c b/drivers/media/usb/gspca/stv06xx/stv06xx_hdcs.c
index 06fa54c5efb2..2220b70d47e6 100644
--- a/drivers/media/usb/gspca/stv06xx/stv06xx_hdcs.c
+++ b/drivers/media/usb/gspca/stv06xx/stv06xx_hdcs.c
@@ -255,7 +255,7 @@ static int hdcs_set_exposure(struct gspca_dev *gspca_dev, __s32 val)
if (err < 0)
return err;
}
- PDEBUG(D_V4L2, "Writing exposure %d, rowexp %d, srowexp %d",
+ PDEBUG(D_CONF, "Writing exposure %d, rowexp %d, srowexp %d",
val, rowexp, srowexp);
return err;
}
@@ -280,7 +280,7 @@ static int hdcs_set_gains(struct sd *sd, u8 g)
static int hdcs_set_gain(struct gspca_dev *gspca_dev, __s32 val)
{
- PDEBUG(D_V4L2, "Writing gain %d", val);
+ PDEBUG(D_CONF, "Writing gain %d", val);
return hdcs_set_gains((struct sd *) gspca_dev,
val & 0xff);
}
@@ -467,6 +467,8 @@ static int hdcs_probe_1020(struct sd *sd)
static int hdcs_start(struct sd *sd)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
+
PDEBUG(D_STREAM, "Starting stream");
return hdcs_set_state(sd, HDCS_STATE_RUN);
@@ -474,6 +476,8 @@ static int hdcs_start(struct sd *sd)
static int hdcs_stop(struct sd *sd)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
+
PDEBUG(D_STREAM, "Halting stream");
return hdcs_set_state(sd, HDCS_STATE_SLEEP);
diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c b/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c
index cdfc3d05ab6b..8206b7743300 100644
--- a/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c
+++ b/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c
@@ -190,6 +190,7 @@ static int pb0100_start(struct sd *sd)
int err, packet_size, max_packet_size;
struct usb_host_interface *alt;
struct usb_interface *intf;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
struct cam *cam = &sd->gspca_dev.cam;
u32 mode = cam->cam_mode[sd->gspca_dev.curr_mode].priv;
@@ -239,6 +240,7 @@ static int pb0100_start(struct sd *sd)
static int pb0100_stop(struct sd *sd)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int err;
err = stv06xx_write_sensor(sd, PB_ABORTFRAME, 1);
@@ -334,7 +336,7 @@ static int pb0100_set_gain(struct gspca_dev *gspca_dev, __s32 val)
err = stv06xx_write_sensor(sd, PB_G1GAIN, val);
if (!err)
err = stv06xx_write_sensor(sd, PB_G2GAIN, val);
- PDEBUG(D_V4L2, "Set green gain to %d, status: %d", val, err);
+ PDEBUG(D_CONF, "Set green gain to %d, status: %d", val, err);
if (!err)
err = pb0100_set_red_balance(gspca_dev, ctrls->red->val);
@@ -357,7 +359,7 @@ static int pb0100_set_red_balance(struct gspca_dev *gspca_dev, __s32 val)
val = 255;
err = stv06xx_write_sensor(sd, PB_RGAIN, val);
- PDEBUG(D_V4L2, "Set red gain to %d, status: %d", val, err);
+ PDEBUG(D_CONF, "Set red gain to %d, status: %d", val, err);
return err;
}
@@ -375,7 +377,7 @@ static int pb0100_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val)
val = 255;
err = stv06xx_write_sensor(sd, PB_BGAIN, val);
- PDEBUG(D_V4L2, "Set blue gain to %d, status: %d", val, err);
+ PDEBUG(D_CONF, "Set blue gain to %d, status: %d", val, err);
return err;
}
@@ -386,7 +388,7 @@ static int pb0100_set_exposure(struct gspca_dev *gspca_dev, __s32 val)
int err;
err = stv06xx_write_sensor(sd, PB_RINTTIME, val);
- PDEBUG(D_V4L2, "Set exposure to %d, status: %d", val, err);
+ PDEBUG(D_CONF, "Set exposure to %d, status: %d", val, err);
return err;
}
@@ -406,7 +408,7 @@ static int pb0100_set_autogain(struct gspca_dev *gspca_dev, __s32 val)
val = 0;
err = stv06xx_write_sensor(sd, PB_EXPGAIN, val);
- PDEBUG(D_V4L2, "Set autogain to %d (natural: %d), status: %d",
+ PDEBUG(D_CONF, "Set autogain to %d (natural: %d), status: %d",
val, ctrls->natural->val, err);
return err;
@@ -428,7 +430,7 @@ static int pb0100_set_autogain_target(struct gspca_dev *gspca_dev, __s32 val)
if (!err)
err = stv06xx_write_sensor(sd, PB_R22, darkpixels);
- PDEBUG(D_V4L2, "Set autogain target to %d, status: %d", val, err);
+ PDEBUG(D_CONF, "Set autogain target to %d, status: %d", val, err);
return err;
}
diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c b/drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c
index 8a57990dfe0f..515a9e121653 100644
--- a/drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c
+++ b/drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c
@@ -279,6 +279,8 @@ static int st6422_start(struct sd *sd)
static int st6422_stop(struct sd *sd)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
+
PDEBUG(D_STREAM, "Halting stream");
return 0;
diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx_vv6410.c b/drivers/media/usb/gspca/stv06xx/stv06xx_vv6410.c
index e95fa8997d22..bf3e5c317a26 100644
--- a/drivers/media/usb/gspca/stv06xx/stv06xx_vv6410.c
+++ b/drivers/media/usb/gspca/stv06xx/stv06xx_vv6410.c
@@ -131,6 +131,7 @@ static int vv6410_init(struct sd *sd)
static int vv6410_start(struct sd *sd)
{
int err;
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
struct cam *cam = &sd->gspca_dev.cam;
u32 priv = cam->cam_mode[sd->gspca_dev.curr_mode].priv;
@@ -163,6 +164,7 @@ static int vv6410_start(struct sd *sd)
static int vv6410_stop(struct sd *sd)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int err;
/* Turn off LED */
@@ -208,7 +210,7 @@ static int vv6410_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
else
i2c_data &= ~VV6410_HFLIP;
- PDEBUG(D_V4L2, "Set horizontal flip to %d", val);
+ PDEBUG(D_CONF, "Set horizontal flip to %d", val);
err = stv06xx_write_sensor(sd, VV6410_DATAFORMAT, i2c_data);
return (err < 0) ? err : 0;
@@ -229,7 +231,7 @@ static int vv6410_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
else
i2c_data &= ~VV6410_VFLIP;
- PDEBUG(D_V4L2, "Set vertical flip to %d", val);
+ PDEBUG(D_CONF, "Set vertical flip to %d", val);
err = stv06xx_write_sensor(sd, VV6410_DATAFORMAT, i2c_data);
return (err < 0) ? err : 0;
@@ -240,7 +242,7 @@ static int vv6410_set_analog_gain(struct gspca_dev *gspca_dev, __s32 val)
int err;
struct sd *sd = (struct sd *) gspca_dev;
- PDEBUG(D_V4L2, "Set analog gain to %d", val);
+ PDEBUG(D_CONF, "Set analog gain to %d", val);
err = stv06xx_write_sensor(sd, VV6410_ANALOGGAIN, 0xf0 | (val & 0xf));
return (err < 0) ? err : 0;
@@ -257,7 +259,7 @@ static int vv6410_set_exposure(struct gspca_dev *gspca_dev, __s32 val)
fine = val % VV6410_CIF_LINELENGTH;
coarse = min(512, val / VV6410_CIF_LINELENGTH);
- PDEBUG(D_V4L2, "Set coarse exposure to %d, fine expsure to %d",
+ PDEBUG(D_CONF, "Set coarse exposure to %d, fine expsure to %d",
coarse, fine);
err = stv06xx_write_sensor(sd, VV6410_FINEH, fine >> 8);
diff --git a/drivers/media/usb/gspca/sunplus.c b/drivers/media/usb/gspca/sunplus.c
index 9ccfcb1c6479..af8767a9bd4c 100644
--- a/drivers/media/usb/gspca/sunplus.c
+++ b/drivers/media/usb/gspca/sunplus.c
@@ -251,12 +251,10 @@ static void reg_r(struct gspca_dev *gspca_dev,
{
int ret;
-#ifdef GSPCA_DEBUG
if (len > USB_BUF_SZ) {
- pr_err("reg_r: buffer overflow\n");
+ PERR("reg_r: buffer overflow\n");
return;
}
-#endif
if (gspca_dev->usb_err < 0)
return;
ret = usb_control_msg(gspca_dev->dev,
@@ -357,12 +355,14 @@ static void spca504_acknowledged_command(struct gspca_dev *gspca_dev,
PDEBUG(D_FRAM, "after wait 0x%04x", gspca_dev->usb_buf[0]);
}
-#ifdef GSPCA_DEBUG
static void spca504_read_info(struct gspca_dev *gspca_dev)
{
int i;
u8 info[6];
+ if (gspca_debug < D_STREAM)
+ return;
+
for (i = 0; i < 6; i++) {
reg_r(gspca_dev, 0, i, 1);
info[i] = gspca_dev->usb_buf[0];
@@ -373,7 +373,6 @@ static void spca504_read_info(struct gspca_dev *gspca_dev)
info[0], info[1], info[2],
info[3], info[4], info[5]);
}
-#endif
static void spca504A_acknowledged_command(struct gspca_dev *gspca_dev,
u8 req,
@@ -432,11 +431,13 @@ static void spca504B_WaitCmdStatus(struct gspca_dev *gspca_dev)
}
}
-#ifdef GSPCA_DEBUG
static void spca50x_GetFirmware(struct gspca_dev *gspca_dev)
{
u8 *data;
+ if (gspca_debug < D_STREAM)
+ return;
+
data = gspca_dev->usb_buf;
reg_r(gspca_dev, 0x20, 0, 5);
PDEBUG(D_STREAM, "FirmWare: %d %d %d %d %d",
@@ -444,7 +445,6 @@ static void spca50x_GetFirmware(struct gspca_dev *gspca_dev)
reg_r(gspca_dev, 0x23, 0, 64);
reg_r(gspca_dev, 0x23, 1, 64);
}
-#endif
static void spca504B_SetSizeType(struct gspca_dev *gspca_dev)
{
@@ -457,9 +457,8 @@ static void spca504B_SetSizeType(struct gspca_dev *gspca_dev)
reg_w_riv(gspca_dev, 0x31, 0, 0);
spca504B_WaitCmdStatus(gspca_dev);
spca504B_PollingDataReady(gspca_dev);
-#ifdef GSPCA_DEBUG
spca50x_GetFirmware(gspca_dev);
-#endif
+
reg_w_1(gspca_dev, 0x24, 0, 8, 2); /* type */
reg_r(gspca_dev, 0x24, 8, 1);
@@ -645,14 +644,10 @@ static int sd_init(struct gspca_dev *gspca_dev)
/* fall thru */
case BRIDGE_SPCA533:
spca504B_PollingDataReady(gspca_dev);
-#ifdef GSPCA_DEBUG
spca50x_GetFirmware(gspca_dev);
-#endif
break;
case BRIDGE_SPCA536:
-#ifdef GSPCA_DEBUG
spca50x_GetFirmware(gspca_dev);
-#endif
reg_r(gspca_dev, 0x00, 0x5002, 1);
reg_w_1(gspca_dev, 0x24, 0, 0, 0);
reg_r(gspca_dev, 0x24, 0, 1);
@@ -678,9 +673,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
/* case BRIDGE_SPCA504: */
PDEBUG(D_STREAM, "Opening SPCA504");
if (sd->subtype == AiptekMiniPenCam13) {
-#ifdef GSPCA_DEBUG
spca504_read_info(gspca_dev);
-#endif
/* Set AE AWB Banding Type 3-> 50Hz 2-> 60Hz */
spca504A_acknowledged_command(gspca_dev, 0x24,
@@ -752,9 +745,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
break;
case BRIDGE_SPCA504:
if (sd->subtype == AiptekMiniPenCam13) {
-#ifdef GSPCA_DEBUG
spca504_read_info(gspca_dev);
-#endif
/* Set AE AWB Banding Type 3-> 50Hz 2-> 60Hz */
spca504A_acknowledged_command(gspca_dev, 0x24,
@@ -766,9 +757,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
0, 0, 0x9d, 1);
} else {
spca504_acknowledged_command(gspca_dev, 0x24, 8, 3);
-#ifdef GSPCA_DEBUG
spca504_read_info(gspca_dev);
-#endif
spca504_acknowledged_command(gspca_dev, 0x24, 8, 3);
spca504_acknowledged_command(gspca_dev, 0x24, 0, 0);
}
diff --git a/drivers/media/usb/gspca/vc032x.c b/drivers/media/usb/gspca/vc032x.c
index e50079503d96..c00ac57de510 100644
--- a/drivers/media/usb/gspca/vc032x.c
+++ b/drivers/media/usb/gspca/vc032x.c
@@ -2927,7 +2927,6 @@ static void reg_r(struct gspca_dev *gspca_dev,
u16 len)
{
reg_r_i(gspca_dev, req, index, len);
-#ifdef GSPCA_DEBUG
if (gspca_dev->usb_err < 0)
return;
if (len == 1)
@@ -2936,7 +2935,6 @@ static void reg_r(struct gspca_dev *gspca_dev,
else
PDEBUG(D_USBI, "GET %02x 0001 %04x %*ph",
req, index, 3, gspca_dev->usb_buf);
-#endif
}
static void reg_w_i(struct gspca_dev *gspca_dev,
@@ -2964,11 +2962,9 @@ static void reg_w(struct gspca_dev *gspca_dev,
u16 value,
u16 index)
{
-#ifdef GSPCA_DEBUG
if (gspca_dev->usb_err < 0)
return;
PDEBUG(D_USBO, "SET %02x %04x %04x", req, value, index);
-#endif
reg_w_i(gspca_dev, req, value, index);
}
@@ -3044,8 +3040,7 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
if (value == 0 && ptsensor_info->IdAdd == 0x82)
value = read_sensor_register(gspca_dev, 0x83);
if (value != 0) {
- PDEBUG(D_ERR|D_PROBE, "Sensor ID %04x (%d)",
- value, i);
+ PDEBUG(D_PROBE, "Sensor ID %04x (%d)", value, i);
if (value == ptsensor_info->VpId)
return ptsensor_info->sensorId;
@@ -3069,14 +3064,12 @@ static void i2c_write(struct gspca_dev *gspca_dev,
{
int retry;
-#ifdef GSPCA_DEBUG
if (gspca_dev->usb_err < 0)
return;
if (size == 1)
PDEBUG(D_USBO, "i2c_w %02x %02x", reg, *val);
else
PDEBUG(D_USBO, "i2c_w %02x %02x%02x", reg, *val, val[1]);
-#endif
reg_r_i(gspca_dev, 0xa1, 0xb33f, 1);
/*fixme:should check if (!(gspca_dev->usb_buf[0] & 0x02)) error*/
reg_w_i(gspca_dev, 0xa0, size, 0xb334);
diff --git a/drivers/media/usb/gspca/w996Xcf.c b/drivers/media/usb/gspca/w996Xcf.c
index 9e3a909e0a00..2165da0c7ce1 100644
--- a/drivers/media/usb/gspca/w996Xcf.c
+++ b/drivers/media/usb/gspca/w996Xcf.c
@@ -232,6 +232,7 @@ static void w9968cf_smbus_write_nack(struct sd *sd)
static void w9968cf_smbus_read_ack(struct sd *sd)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int sda;
/* Ensure SDA is high before raising clock to avoid a spurious stop */
@@ -248,6 +249,7 @@ static void w9968cf_smbus_read_ack(struct sd *sd)
/* SMBus protocol: S Addr Wr [A] Subaddr [A] Value [A] P */
static void w9968cf_i2c_w(struct sd *sd, u8 reg, u8 value)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
u16* data = (u16 *)sd->gspca_dev.usb_buf;
data[0] = 0x082f | ((sd->sensor_addr & 0x80) ? 0x1500 : 0x0);
@@ -297,6 +299,7 @@ static void w9968cf_i2c_w(struct sd *sd, u8 reg, u8 value)
/* SMBus protocol: S Addr Wr [A] Subaddr [A] P S Addr+1 Rd [A] [Value] NA P */
static int w9968cf_i2c_r(struct sd *sd, u8 reg)
{
+ struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
int ret = 0;
u8 value;
@@ -326,7 +329,7 @@ static int w9968cf_i2c_r(struct sd *sd, u8 reg)
ret = value;
PDEBUG(D_USBI, "i2c [0x%02X] -> 0x%02X", reg, value);
} else
- PDEBUG(D_ERR, "i2c read [0x%02x] failed", reg);
+ PERR("i2c read [0x%02x] failed", reg);
return ret;
}
diff --git a/drivers/media/usb/gspca/zc3xx.c b/drivers/media/usb/gspca/zc3xx.c
index a8dc421f9f1f..cbfc2f921427 100644
--- a/drivers/media/usb/gspca/zc3xx.c
+++ b/drivers/media/usb/gspca/zc3xx.c
@@ -6259,12 +6259,11 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev)
retword |= i2c_read(gspca_dev, 0x01); /* ID 1 */
PDEBUG(D_PROBE, "probe 3wr vga 2 0x%04x", retword);
if (retword == 0x2030) {
-#ifdef GSPCA_DEBUG
u8 retbyte;
retbyte = i2c_read(gspca_dev, 0x02); /* revision number */
PDEBUG(D_PROBE, "sensor PO2030 rev 0x%02x", retbyte);
-#endif
+
send_unknown(gspca_dev, SENSOR_PO2030);
return retword;
}
OpenPOWER on IntegriCloud