]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
media: gspca: Convert PERR to gspca_err
authorJoe Perches <joe@perches.com>
Fri, 22 Sep 2017 18:33:35 +0000 (14:33 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 8 Dec 2017 15:08:50 +0000 (10:08 -0500)
Use a more typical kernel logging style.

The current macro hides the gspca_dev argument so add it to the
macro uses instead.

Miscellanea:

o Add missing '\n' terminations to formats
o Realign arguments to open parenthesis

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
32 files changed:
drivers/media/usb/gspca/benq.c
drivers/media/usb/gspca/conex.c
drivers/media/usb/gspca/cpia1.c
drivers/media/usb/gspca/dtcs033.c
drivers/media/usb/gspca/etoms.c
drivers/media/usb/gspca/gl860/gl860.c
drivers/media/usb/gspca/gspca.c
drivers/media/usb/gspca/gspca.h
drivers/media/usb/gspca/jeilinj.c
drivers/media/usb/gspca/konica.c
drivers/media/usb/gspca/m5602/m5602_core.c
drivers/media/usb/gspca/mr97310a.c
drivers/media/usb/gspca/ov519.c
drivers/media/usb/gspca/ov534.c
drivers/media/usb/gspca/pac7302.c
drivers/media/usb/gspca/pac7311.c
drivers/media/usb/gspca/sn9c2028.c
drivers/media/usb/gspca/sonixj.c
drivers/media/usb/gspca/spca1528.c
drivers/media/usb/gspca/spca500.c
drivers/media/usb/gspca/spca501.c
drivers/media/usb/gspca/spca505.c
drivers/media/usb/gspca/spca508.c
drivers/media/usb/gspca/spca561.c
drivers/media/usb/gspca/sq905.c
drivers/media/usb/gspca/sq905c.c
drivers/media/usb/gspca/sq930x.c
drivers/media/usb/gspca/stv0680.c
drivers/media/usb/gspca/stv06xx/stv06xx.c
drivers/media/usb/gspca/sunplus.c
drivers/media/usb/gspca/touptek.c
drivers/media/usb/gspca/w996Xcf.c

index 60a728203b3bedfeaff36526a9d34e9d6b2483b6..b5955bf0d0fc7c2c0d2368f0fec2eb58e5c79167 100644 (file)
@@ -180,9 +180,9 @@ 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) {
-                       PERR("ISOC bad lengths %d / %d",
-                               urb0->iso_frame_desc[i].actual_length,
-                               urb->iso_frame_desc[i].actual_length);
+                       gspca_err(gspca_dev, "ISOC bad lengths %d / %d\n",
+                                 urb0->iso_frame_desc[i].actual_length,
+                                 urb->iso_frame_desc[i].actual_length);
                        gspca_dev->last_packet_type = DISCARD_PACKET;
                        continue;
                }
index bdcdf7999c5644bfa6abe14167c010eff702eee8..0223b33156dd1a9fc4cd0472303f1bc2cd1bd816 100644 (file)
@@ -70,7 +70,7 @@ static void reg_r(struct gspca_dev *gspca_dev,
        struct usb_device *dev = gspca_dev->dev;
 
        if (len > USB_BUF_SZ) {
-               PERR("reg_r: buffer overflow\n");
+               gspca_err(gspca_dev, "reg_r: buffer overflow\n");
                return;
        }
 
@@ -109,7 +109,7 @@ static void reg_w(struct gspca_dev *gspca_dev,
        struct usb_device *dev = gspca_dev->dev;
 
        if (len > USB_BUF_SZ) {
-               PERR("reg_w: buffer overflow\n");
+               gspca_err(gspca_dev, "reg_w: buffer overflow\n");
                return;
        }
        PDEBUG(D_USBO, "reg write [%02x] = %02x..", index, *buffer);
@@ -683,7 +683,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
                reg_w_val(gspca_dev, 0x0053, 0x00);
        } while (--retry);
        if (retry == 0)
-               PERR("Damned Errors sending jpeg Table");
+               gspca_err(gspca_dev, "Damned Errors sending jpeg Table\n");
        /* send the qtable now */
        reg_r(gspca_dev, 0x0001, 1);            /* -> 0x18 */
        length = 8;
index e91d00762e94bf45782c03620d1b30d1d5f3a545..99b456d64729e5c1653a66518dbf8d3aade53ca4 100644 (file)
@@ -419,7 +419,8 @@ 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 {
-               PERR("Unexpected first byte of command: %x", command[0]);
+               gspca_err(gspca_dev, "Unexpected first byte of command: %x\n",
+                         command[0]);
                return -EINVAL;
        }
 
@@ -722,8 +723,8 @@ 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) {
-                       PERR("unexpected state after lo power cmd: %02x",
-                            sd->params.status.systemState);
+                       gspca_err(gspca_dev, "unexpected state after lo power cmd: %02x\n",
+                                 sd->params.status.systemState);
                        printstatus(gspca_dev, &sd->params);
                }
                return -EIO;
@@ -752,8 +753,8 @@ static int goto_high_power(struct gspca_dev *gspca_dev)
                return ret;
 
        if (sd->params.status.systemState != HI_POWER_STATE) {
-               PERR("unexpected state after hi power cmd: %02x",
-                    sd->params.status.systemState);
+               gspca_err(gspca_dev, "unexpected state after hi power cmd: %02x\n",
+                         sd->params.status.systemState);
                printstatus(gspca_dev, &sd->params);
                return -EIO;
        }
@@ -1445,8 +1446,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) {
-               PERR("only firmware version 1 is supported (got: %d)",
-                    sd->params.version.firmwareVersion);
+               gspca_err(gspca_dev, "only firmware version 1 is supported (got: %d)\n",
+                         sd->params.version.firmwareVersion);
                return -ENODEV;
        }
 
@@ -1471,8 +1472,8 @@ 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) {
-                       PERR("unexpected systemstate: %02x",
-                            sd->params.status.systemState);
+                       gspca_err(gspca_dev, "unexpected systemstate: %02x\n",
+                                 sd->params.status.systemState);
                        printstatus(gspca_dev, &sd->params);
                        return -ENODEV;
                }
@@ -1519,8 +1520,9 @@ static int sd_start(struct gspca_dev *gspca_dev)
                return ret;
 
        if (sd->params.status.fatalError) {
-               PERR("fatal_error: %04x, vp_status: %04x",
-                    sd->params.status.fatalError, sd->params.status.vpStatus);
+               gspca_err(gspca_dev, "fatal_error: %04x, vp_status: %04x\n",
+                         sd->params.status.fatalError,
+                         sd->params.status.vpStatus);
                return -EIO;
        }
 
index 96bfd4e0f0ebfb0a50675455eeefbb89c502eca4..b4d42940d5de220c74ddf23198e6537b72a4a565 100644 (file)
@@ -71,8 +71,8 @@ static int reg_reqs(struct gspca_dev *gspca_dev,
 
                if (gspca_dev->usb_err < 0) {
 
-                       PERR("usb error request no: %d / %d\n",
-                               i, n_reqs);
+                       gspca_err(gspca_dev, "usb error request no: %d / %d\n",
+                                 i, n_reqs);
                } else if (preq->bRequestType & USB_DIR_IN) {
 
                        PDEBUG(D_STREAM,
@@ -176,12 +176,12 @@ static void dtcs033_setexposure(struct gspca_dev *gspca_dev,
        reg_rw(gspca_dev,
                bRequestType, bRequest, wValue, wIndex, 0);
        if (gspca_dev->usb_err < 0)
-               PERR("usb error in setexposure(gain) sequence.\n");
+               gspca_err(gspca_dev, "usb error in setexposure(gain) sequence\n");
 
        reg_rw(gspca_dev,
                bRequestType, bRequest, (xtimeVal<<4), 0x6300, 0);
        if (gspca_dev->usb_err < 0)
-               PERR("usb error in setexposure(time) sequence.\n");
+               gspca_err(gspca_dev, "usb error in setexposure(time) sequence\n");
 }
 
 /* specific webcam descriptor */
@@ -239,8 +239,8 @@ static int dtcs033_init_controls(struct gspca_dev *gspca_dev)
                                V4L2_CID_GAIN,
                                14,  33,  1,  24);/* [dB] */
        if (hdl->error) {
-               PERR("Could not initialize controls: %d\n",
-                       hdl->error);
+               gspca_err(gspca_dev, "Could not initialize controls: %d\n",
+                         hdl->error);
                return hdl->error;
        }
 
index 8f84292936e98ce592277fd9f3b72d730669b106..a88ae69d6c1e6b1ff00a4770ff70cead9f5643c1 100644 (file)
@@ -160,7 +160,7 @@ static void reg_r(struct gspca_dev *gspca_dev,
        struct usb_device *dev = gspca_dev->dev;
 
        if (len > USB_BUF_SZ) {
-               PERR("reg_r: buffer overflow\n");
+               gspca_err(gspca_dev, "reg_r: buffer overflow\n");
                return;
        }
 
@@ -268,7 +268,7 @@ static int et_video(struct gspca_dev *gspca_dev,
                     : 0);              /* stopvideo */
        ret = Et_WaitStatus(gspca_dev);
        if (ret != 0)
-               PERR("timeout video on/off");
+               gspca_err(gspca_dev, "timeout video on/off\n");
        return ret;
 }
 
index cea8d7f51c3cc9430af956066d87b045b453c062..add298cc9ab2275d11a5e3c36f254ee092c7cea0 100644 (file)
@@ -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)
-               PERR("short ctrl transfer %d/%d", r, len);
+               gspca_err(gspca_dev, "short ctrl transfer %d/%d\n", r, len);
 
        msleep(1);
 
index 961343873fd08088e059a9b6122bf5e16fa6377e..da81cb3059beb98608057199ca4925adff4518a6 100644 (file)
@@ -122,7 +122,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) {
-                       PERR("Unknown packet received");
+                       gspca_err(gspca_dev, "Unknown packet received\n");
                }
                break;
 
@@ -136,7 +136,8 @@ static void int_irq(struct urb *urb)
                break;
 
        default:
-               PERR("URB error %i, resubmitting", urb->status);
+               gspca_err(gspca_dev, "URB error %i, resubmitting\n",
+                         urb->status);
                urb->status = 0;
                ret = 0;
        }
@@ -221,7 +222,8 @@ 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) {
-               PERR("submit int URB failed with error %i", ret);
+               gspca_err(gspca_dev, "submit int URB failed with error %i\n",
+                         ret);
                goto error_submit;
        }
        gspca_dev->int_urb = urb;
@@ -307,7 +309,7 @@ static void fill_frame(struct gspca_dev *gspca_dev,
                if (gspca_dev->frozen)
                        return;
 #endif
-               PERR("urb status: %d", urb->status);
+               gspca_err(gspca_dev, "urb status: %d\n", urb->status);
                urb->status = 0;
                goto resubmit;
        }
@@ -380,7 +382,7 @@ static void bulk_irq(struct urb *urb)
                if (gspca_dev->frozen)
                        return;
 #endif
-               PERR("urb status: %d", urb->status);
+               gspca_err(gspca_dev, "urb status: %d\n", urb->status);
                urb->status = 0;
                goto resubmit;
        }
@@ -452,9 +454,9 @@ 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) {
-                       PERR("frame overflow %d > %d",
-                               gspca_dev->image_len + len,
-                               gspca_dev->frsz);
+                       gspca_err(gspca_dev, "frame overflow %d > %d\n",
+                                 gspca_dev->image_len + len,
+                                 gspca_dev->frsz);
                        packet_type = DISCARD_PACKET;
                } else {
 /* !! image is NULL only when last pkt is LAST or DISCARD
@@ -952,7 +954,8 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev)
                /* the bandwidth is not wide enough
                 * negotiate or try a lower alternate setting */
 retry:
-               PERR("alt %d - bandwidth not wide enough, trying again", alt);
+               gspca_err(gspca_dev, "alt %d - bandwidth not wide enough, trying again\n",
+                         alt);
                msleep(20);     /* wait for kill complete */
                if (gspca_dev->sd_desc->isoc_nego) {
                        ret = gspca_dev->sd_desc->isoc_nego(gspca_dev);
@@ -1738,7 +1741,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)) {
-                       PERR("dqbuf cp to user failed");
+                       gspca_err(gspca_dev, "dqbuf cp to user failed\n");
                        ret = -EFAULT;
                }
        }
@@ -1950,7 +1953,8 @@ 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) {
-               PERR("read cp to user lack %d / %zd", ret, count);
+               gspca_err(gspca_dev, "read cp to user lack %d / %zd\n",
+                         ret, count);
                ret = -EFAULT;
                goto out;
        }
index 9e0cf711642b97d32ba187853378dad4f9237f14..da65fef6aaccdd677af0dccbdf45a95fcd8eba36 100644 (file)
@@ -29,8 +29,8 @@ extern int gspca_debug;
 #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_err(gspca_dev, fmt, ...)                         \
+       v4l2_err(&(gspca_dev)->v4l2_dev, fmt, ##__VA_ARGS__)
 
 #define GSPCA_MAX_FRAMES 16    /* maximum number of video frame buffers */
 /* image transfers */
index 34e043b7d1bc38ec6d7f3a10676c841f1d98e4e7..7215c68790700b1a6d97967c70b5d291e2f7a751 100644 (file)
@@ -262,7 +262,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)
-               PERR("Start streaming command failed");
+               gspca_err(gspca_dev, "Start streaming command failed\n");
        return gspca_dev->usb_err;
 }
 
index 31b2117e8f1df037d2e4307b0f22c408dc708ebc..d51aca01167fdbe3cefa02ba6b7c680be0a69998 100644 (file)
@@ -274,7 +274,7 @@ static void sd_isoc_irq(struct urb *urb)
                if (gspca_dev->frozen)
                        return;
 #endif
-               PERR("urb status: %d", urb->status);
+               gspca_err(gspca_dev, "urb status: %d\n", urb->status);
                st = usb_submit_urb(urb, GFP_ATOMIC);
                if (st < 0)
                        pr_err("resubmit urb error %d\n", st);
@@ -292,30 +292,31 @@ static void sd_isoc_irq(struct urb *urb)
        sd->last_data_urb = NULL;
 
        if (!data_urb || data_urb->start_frame != status_urb->start_frame) {
-               PERR("lost sync on frames");
+               gspca_err(gspca_dev, "lost sync on frames\n");
                goto resubmit;
        }
 
        if (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);
+               gspca_err(gspca_dev, "no packets does not match, data: %d, status: %d\n",
+                         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) {
-                       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_err(gspca_dev, "pkt %d data-status %d, status-status %d\n",
+                                 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) {
-                       PERR("bad status packet length %d",
-                            status_urb->iso_frame_desc[i].actual_length);
+                       gspca_err(gspca_dev, "bad status packet length %d\n",
+                                 status_urb->iso_frame_desc[i].actual_length);
                        gspca_dev->last_packet_type = DISCARD_PACKET;
                        continue;
                }
@@ -360,11 +361,12 @@ resubmit:
        if (data_urb) {
                st = usb_submit_urb(data_urb, GFP_ATOMIC);
                if (st < 0)
-                       PERR("usb_submit_urb(data_urb) ret %d", st);
+                       gspca_err(gspca_dev, "usb_submit_urb(data_urb) ret %d\n",
+                                 st);
        }
        st = usb_submit_urb(status_urb, GFP_ATOMIC);
        if (st < 0)
-               PERR("usb_submit_urb(status_urb) ret %d\n", st);
+               gspca_err(gspca_dev, "usb_submit_urb(status_urb) ret %d\n", st);
 }
 
 static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
index f1dcd90219838269ed056e9b75fdd599e6570c7c..4aab17efa4cc5ee4a9551d9ac292157ec92d6429 100644 (file)
@@ -397,7 +397,7 @@ static int m5602_configure(struct gspca_dev *gspca_dev,
        return 0;
 
 fail:
-       PERR("ALi m5602 webcam failed");
+       gspca_err(gspca_dev, "ALi m5602 webcam failed\n");
        cam->cam_mode = NULL;
        cam->nmodes = 0;
 
index 8b0e32a649acffb9f8b60ec96163a0994e6a6fc0..34aacaee4453475e99dcc339c9d52dbd46435956 100644 (file)
@@ -284,7 +284,7 @@ static int zero_the_pointer(struct gspca_dev *gspca_dev)
                        return err_code;
        }
        if (status != 0x0a)
-               PERR("status is %02x", status);
+               gspca_err(gspca_dev, "status is %02x\n", status);
 
        tries = 0;
        while (tries < 4) {
@@ -325,7 +325,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)
-               PERR("Stream Stop failed");
+               gspca_err(gspca_dev, "Stream Stop failed\n");
 }
 
 static void lcd_stop(struct gspca_dev *gspca_dev)
@@ -333,7 +333,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)
-               PERR("LCD Stop failed");
+               gspca_err(gspca_dev, "LCD Stop failed\n");
 }
 
 static int isoc_enable(struct gspca_dev *gspca_dev)
index 1b30434b72ef2932f4cd1c57c527ade6b06ebdac..14ffefbb5ac1b7635be344b7c4ad1d46d9df92b0 100644 (file)
@@ -2039,7 +2039,7 @@ static void reg_w(struct sd *sd, u16 index, u16 value)
                        sd->gspca_dev.usb_buf, 1, 500);
 leave:
        if (ret < 0) {
-               PERR("reg_w %02x failed %d\n", index, ret);
+               gspca_err(gspca_dev, "reg_w %02x failed %d\n", index, ret);
                sd->gspca_dev.usb_err = ret;
                return;
        }
@@ -2081,7 +2081,7 @@ static int reg_r(struct sd *sd, u16 index)
                PDEBUG(D_USBI, "GET %02x 0000 %04x %02x",
                        req, index, ret);
        } else {
-               PERR("reg_r %02x failed %d\n", index, ret);
+               gspca_err(gspca_dev, "reg_r %02x failed %d\n", index, ret);
                sd->gspca_dev.usb_err = ret;
        }
 
@@ -2109,7 +2109,7 @@ static int reg_r8(struct sd *sd,
        if (ret >= 0) {
                ret = sd->gspca_dev.usb_buf[0];
        } else {
-               PERR("reg_r8 %02x failed %d\n", index, ret);
+               gspca_err(gspca_dev, "reg_r8 %02x failed %d\n", index, ret);
                sd->gspca_dev.usb_err = ret;
        }
 
@@ -2165,7 +2165,7 @@ 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) {
-               PERR("reg_w32 %02x failed %d\n", index, ret);
+               gspca_err(gspca_dev, "reg_w32 %02x failed %d\n", index, ret);
                sd->gspca_dev.usb_err = ret;
        }
 }
@@ -2340,7 +2340,7 @@ static void ovfx2_i2c_w(struct sd *sd, u8 reg, u8 value)
                        (u16) value, (u16) reg, NULL, 0, 500);
 
        if (ret < 0) {
-               PERR("ovfx2_i2c_w %02x failed %d\n", reg, ret);
+               gspca_err(gspca_dev, "ovfx2_i2c_w %02x failed %d\n", reg, ret);
                sd->gspca_dev.usb_err = ret;
        }
 
@@ -2365,7 +2365,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 {
-               PERR("ovfx2_i2c_r %02x failed %d\n", reg, ret);
+               gspca_err(gspca_dev, "ovfx2_i2c_r %02x failed %d\n", reg, ret);
                sd->gspca_dev.usb_err = ret;
        }
 
@@ -2617,7 +2617,7 @@ static void ov_hires_configure(struct sd *sd)
        int high, low;
 
        if (sd->bridge != BRIDGE_OVFX2) {
-               PERR("error hires sensors only supported with ovfx2\n");
+               gspca_err(gspca_dev, "error hires sensors only supported with ovfx2\n");
                return;
        }
 
@@ -2652,7 +2652,8 @@ static void ov_hires_configure(struct sd *sd)
                }
                break;
        }
-       PERR("Error unknown sensor type: %02x%02x\n", high, low);
+       gspca_err(gspca_dev, "Error unknown sensor type: %02x%02x\n",
+                 high, low);
 }
 
 /* This initializes the OV8110, OV8610 sensor. The OV8110 uses
@@ -2668,13 +2669,14 @@ static void ov8xx0_configure(struct sd *sd)
        /* Detect sensor (sub)type */
        rc = i2c_r(sd, OV7610_REG_COM_I);
        if (rc < 0) {
-               PERR("Error detecting sensor type");
+               gspca_err(gspca_dev, "Error detecting sensor type\n");
                return;
        }
        if ((rc & 3) == 1)
                sd->sensor = SEN_OV8610;
        else
-               PERR("Unknown image sensor version: %d\n", rc & 3);
+               gspca_err(gspca_dev, "Unknown image sensor version: %d\n",
+                         rc & 3);
 }
 
 /* This initializes the OV7610, OV7620, or OV76BE sensor. The OV76BE uses
@@ -2693,7 +2695,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) {
-               PERR("Error detecting sensor type\n");
+               gspca_err(gspca_dev, "Error detecting sensor type\n");
                return;
        }
        if ((rc & 3) == 3) {
@@ -2721,19 +2723,19 @@ static void ov7xx0_configure(struct sd *sd)
                /* try to read product id registers */
                high = i2c_r(sd, 0x0a);
                if (high < 0) {
-                       PERR("Error detecting camera chip PID\n");
+                       gspca_err(gspca_dev, "Error detecting camera chip PID\n");
                        return;
                }
                low = i2c_r(sd, 0x0b);
                if (low < 0) {
-                       PERR("Error detecting camera chip VER\n");
+                       gspca_err(gspca_dev, "Error detecting camera chip VER\n");
                        return;
                }
                if (high == 0x76) {
                        switch (low) {
                        case 0x30:
-                               PERR("Sensor is an OV7630/OV7635\n");
-                               PERR("7630 is not supported by this driver\n");
+                               gspca_err(gspca_dev, "Sensor is an OV7630/OV7635\n");
+                               gspca_err(gspca_dev, "7630 is not supported by this driver\n");
                                return;
                        case 0x40:
                                PDEBUG(D_PROBE, "Sensor is an OV7645");
@@ -2752,7 +2754,8 @@ static void ov7xx0_configure(struct sd *sd)
                                sd->sensor = SEN_OV7660;
                                break;
                        default:
-                               PERR("Unknown sensor: 0x76%02x\n", low);
+                               gspca_err(gspca_dev, "Unknown sensor: 0x76%02x\n",
+                                         low);
                                return;
                        }
                } else {
@@ -2760,7 +2763,8 @@ static void ov7xx0_configure(struct sd *sd)
                        sd->sensor = SEN_OV7620;
                }
        } else {
-               PERR("Unknown image sensor version: %d\n", rc & 3);
+               gspca_err(gspca_dev, "Unknown image sensor version: %d\n",
+                         rc & 3);
        }
 }
 
@@ -2775,7 +2779,7 @@ static void ov6xx0_configure(struct sd *sd)
        /* Detect sensor (sub)type */
        rc = i2c_r(sd, OV7610_REG_COM_I);
        if (rc < 0) {
-               PERR("Error detecting sensor type\n");
+               gspca_err(gspca_dev, "Error detecting sensor type\n");
                return;
        }
 
@@ -2804,7 +2808,8 @@ 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:
-               PERR("FATAL: Unknown sensor version: 0x%02x\n", rc);
+               gspca_err(gspca_dev, "FATAL: Unknown sensor version: 0x%02x\n",
+                         rc);
                return;
        }
 
@@ -3295,7 +3300,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 {
-               PERR("Can't determine sensor slave IDs\n");
+               gspca_err(gspca_dev, "Can't determine sensor slave IDs\n");
                goto error;
        }
 
@@ -3428,7 +3433,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
        }
        return gspca_dev->usb_err;
 error:
-       PERR("OV519 Config failed");
+       gspca_err(gspca_dev, "OV519 Config failed\n");
        return -EINVAL;
 }
 
@@ -3463,7 +3468,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) {
-               PERR("Couldn't get altsetting\n");
+               gspca_err(gspca_dev, "Couldn't get altsetting\n");
                sd->gspca_dev.usb_err = -EIO;
                return;
        }
@@ -3589,7 +3594,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) {
-               PERR("Couldn't get altsetting\n");
+               gspca_err(gspca_dev, "Couldn't get altsetting\n");
                sd->gspca_dev.usb_err = -EIO;
                return;
        }
@@ -4323,10 +4328,10 @@ static void ov511_pkt_scan(struct gspca_dev *gspca_dev,
                        /* Frame end */
                        if ((in[9] + 1) * 8 != gspca_dev->pixfmt.width ||
                            (in[10] + 1) * 8 != gspca_dev->pixfmt.height) {
-                               PERR("Invalid frame size, got: %dx%d, requested: %dx%d\n",
-                                       (in[9] + 1) * 8, (in[10] + 1) * 8,
-                                       gspca_dev->pixfmt.width,
-                                       gspca_dev->pixfmt.height);
+                               gspca_err(gspca_dev, "Invalid frame size, got: %dx%d, requested: %dx%d\n",
+                                         (in[9] + 1) * 8, (in[10] + 1) * 8,
+                                         gspca_dev->pixfmt.width,
+                                         gspca_dev->pixfmt.height);
                                gspca_dev->last_packet_type = DISCARD_PACKET;
                                return;
                        }
@@ -4374,8 +4379,8 @@ 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]) {
-                       PERR("Invalid packet nr: %d (expect: %d)",
-                               (int)data[len], (int)sd->packet_nr);
+                       gspca_err(gspca_dev, "Invalid packet nr: %d (expect: %d)\n",
+                                 (int)data[len], (int)sd->packet_nr);
                        gspca_dev->last_packet_type = DISCARD_PACKET;
                        return;
                }
@@ -4918,7 +4923,7 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
                        QUALITY_MIN, QUALITY_MAX, 1, QUALITY_DEF);
 
        if (hdl->error) {
-               PERR("Could not initialize controls\n");
+               gspca_err(gspca_dev, "Could not initialize controls\n");
                return hdl->error;
        }
        if (gspca_dev->autogain)
index 32849ff86b09dfa6b793d94d4435edab776a3f28..bba2c5ce331c9371e7d9cd7d2650646c47077fc2 100644 (file)
@@ -689,8 +689,8 @@ static int sccb_check_status(struct gspca_dev *gspca_dev)
                case 0x03:
                        break;
                default:
-                       PERR("sccb status 0x%02x, attempt %d/5",
-                              data, i + 1);
+                       gspca_err(gspca_dev, "sccb status 0x%02x, attempt %d/5\n",
+                                 data, i + 1);
                }
        }
        return 0;
index 595535e143e647c8b5b232b31a8d20ffc9c112b7..b8ff201c7bb920b51e82529b75f79a80e69f16fb 100644 (file)
@@ -339,7 +339,7 @@ static void reg_w_var(struct gspca_dev *gspca_dev,
                        break;
                default:
                        if (len > USB_BUF_SZ) {
-                               PERR("Incorrect variable sequence");
+                               gspca_err(gspca_dev, "Incorrect variable sequence\n");
                                return;
                        }
                        while (len > 0) {
index 8bac2d9326bf8f9beee707087d15b4953d9e72d0..44db4f4afa221aa95e73346f7ba9351aa2df3b83 100644 (file)
@@ -258,7 +258,7 @@ static void reg_w_var(struct gspca_dev *gspca_dev,
                        break;
                default:
                        if (len > USB_BUF_SZ) {
-                               PERR("Incorrect variable sequence");
+                               gspca_err(gspca_dev, "Incorrect variable sequence\n");
                                return;
                        }
                        while (len > 0) {
index 5d32dd359d84d49a1ebf63a8f37e8c4d838320d8..469bc2ced1a3d36dd26d8924d2ba412b18c93566 100644 (file)
@@ -849,13 +849,13 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
 
        result = sn9c2028_read1(gspca_dev);
        if (result < 0)
-               PERR("Camera Stop read failed");
+               gspca_err(gspca_dev, "Camera Stop read failed\n");
 
        memset(data, 0, 6);
        data[0] = 0x14;
        result = sn9c2028_command(gspca_dev, data);
        if (result < 0)
-               PERR("Camera Stop command failed");
+               gspca_err(gspca_dev, "Camera Stop command failed\n");
 }
 
 static void do_autogain(struct gspca_dev *gspca_dev, int avg_lum)
index 5eeaf16ac5e82a2793d7ca8800d3a5bb28e175da..9d7c3d8c226fe530ad8a3cf8a22e9ec6bda00f43 100644 (file)
@@ -1155,7 +1155,7 @@ static void reg_r(struct gspca_dev *gspca_dev,
        if (gspca_dev->usb_err < 0)
                return;
        if (len > USB_BUF_SZ) {
-               PERR("reg_r: buffer overflow\n");
+               gspca_err(gspca_dev, "reg_r: buffer overflow\n");
                return;
        }
 
@@ -1209,7 +1209,7 @@ static void reg_w(struct gspca_dev *gspca_dev,
                value, buffer[0], buffer[1]);
 
        if (len > USB_BUF_SZ) {
-               PERR("reg_w: buffer overflow\n");
+               gspca_err(gspca_dev, "reg_w: buffer overflow\n");
                return;
        }
 
index 327ec901abe149d8be6a4bdf267a5aa53a9e7728..e53dd3c7066cc5b9fff5b68630dc38767d894f99 100644 (file)
@@ -142,7 +142,7 @@ static void wait_status_0(struct gspca_dev *gspca_dev)
                w += 15;
                msleep(w);
        } while (--i > 0);
-       PERR("wait_status_0 timeout");
+       gspca_err(gspca_dev, "wait_status_0 timeout\n");
        gspca_dev->usb_err = -ETIME;
 }
 
@@ -160,7 +160,7 @@ static void wait_status_1(struct gspca_dev *gspca_dev)
                        return;
                }
        } while (--i > 0);
-       PERR("wait_status_1 timeout");
+       gspca_err(gspca_dev, "wait_status_1 timeout\n");
        gspca_dev->usb_err = -ETIME;
 }
 
index da2d9027914c61a9d33c8cd97f20277cdc9f3a35..b25960643f7b2f6afeced06eb85d4c7d95406ba6 100644 (file)
@@ -485,7 +485,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) {
-               PERR("reg_r_wait() failed");
+               gspca_err(gspca_dev, "reg_r_wait() failed\n");
                return err;
        }
        /* all ok */
@@ -501,7 +501,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) {
-               PERR("Set packet size: set interface error");
+               gspca_err(gspca_dev, "Set packet size: set interface error\n");
                goto error;
        }
        spca500_ping310(gspca_dev);
@@ -515,7 +515,7 @@ static int spca500_synch310(struct gspca_dev *gspca_dev)
        if (usb_set_interface(gspca_dev->dev,
                                gspca_dev->iface,
                                gspca_dev->alt) < 0) {
-               PERR("Set packet size: set interface error");
+               gspca_err(gspca_dev, "Set packet size: set interface error\n");
                goto error;
        }
        return 0;
@@ -540,7 +540,7 @@ static void spca500_reinit(struct gspca_dev *gspca_dev)
        err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840,
                                 qtable_pocketdv);
        if (err < 0)
-               PERR("spca50x_setup_qtable failed on init");
+               gspca_err(gspca_dev, "spca50x_setup_qtable failed on init\n");
 
        /* set qtable index */
        reg_w(gspca_dev, 0x00, 0x8880, 2);
@@ -636,7 +636,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
                                           0x00, 0x8800, 0x8840,
                                           qtable_creative_pccam);
                if (err < 0)
-                       PERR("spca50x_setup_qtable failed");
+                       gspca_err(gspca_dev, "spca50x_setup_qtable failed\n");
                /* Init SDRAM - needed for SDRAM access */
                reg_w(gspca_dev, 0x00, 0x870a, 0x04);
 
@@ -644,7 +644,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)
-                       PERR("reg_r_wait() failed");
+                       gspca_err(gspca_dev, "reg_r_wait() failed\n");
 
                reg_r(gspca_dev, 0x816b, 1);
                Data = gspca_dev->usb_buf[0];
@@ -657,13 +657,13 @@ static int sd_start(struct gspca_dev *gspca_dev)
                /* enable drop packet */
                err = reg_w(gspca_dev, 0x00, 0x850a, 0x0001);
                if (err < 0)
-                       PERR("failed to enable drop packet");
+                       gspca_err(gspca_dev, "failed to enable drop packet\n");
                reg_w(gspca_dev, 0x00, 0x8880, 3);
                err = spca50x_setup_qtable(gspca_dev,
                                           0x00, 0x8800, 0x8840,
                                           qtable_creative_pccam);
                if (err < 0)
-                       PERR("spca50x_setup_qtable failed");
+                       gspca_err(gspca_dev, "spca50x_setup_qtable failed\n");
 
                /* Init SDRAM - needed for SDRAM access */
                reg_w(gspca_dev, 0x00, 0x870a, 0x04);
@@ -672,7 +672,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)
-                       PERR("reg_r_wait() failed");
+                       gspca_err(gspca_dev, "reg_r_wait() failed\n");
 
                reg_r(gspca_dev, 0x816b, 1);
                Data = gspca_dev->usb_buf[0];
@@ -686,18 +686,18 @@ static int sd_start(struct gspca_dev *gspca_dev)
                /* do a full reset */
                err = spca500_full_reset(gspca_dev);
                if (err < 0)
-                       PERR("spca500_full_reset failed");
+                       gspca_err(gspca_dev, "spca500_full_reset failed\n");
 
                /* enable drop packet */
                err = reg_w(gspca_dev, 0x00, 0x850a, 0x0001);
                if (err < 0)
-                       PERR("failed to enable drop packet");
+                       gspca_err(gspca_dev, "failed to enable drop packet\n");
                reg_w(gspca_dev, 0x00, 0x8880, 3);
                err = spca50x_setup_qtable(gspca_dev,
                                           0x00, 0x8800, 0x8840,
                                           qtable_creative_pccam);
                if (err < 0)
-                       PERR("spca50x_setup_qtable failed");
+                       gspca_err(gspca_dev, "spca50x_setup_qtable failed\n");
 
                spca500_setmode(gspca_dev, xmult, ymult);
                reg_w(gspca_dev, 0x20, 0x0001, 0x0004);
@@ -706,7 +706,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)
-                       PERR("reg_r_wait() failed");
+                       gspca_err(gspca_dev, "reg_r_wait() failed\n");
 
                reg_r(gspca_dev, 0x816b, 1);
                Data = gspca_dev->usb_buf[0];
@@ -719,7 +719,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
                /* do a full reset */
                err = spca500_full_reset(gspca_dev);
                if (err < 0)
-                       PERR("spca500_full_reset failed");
+                       gspca_err(gspca_dev, "spca500_full_reset failed\n");
                /* enable drop packet */
                reg_w(gspca_dev, 0x00, 0x850a, 0x0001);
                reg_w(gspca_dev, 0x00, 0x8880, 0);
@@ -727,7 +727,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
                                           0x00, 0x8800, 0x8840,
                                           qtable_kodak_ez200);
                if (err < 0)
-                       PERR("spca50x_setup_qtable failed");
+                       gspca_err(gspca_dev, "spca50x_setup_qtable failed\n");
                spca500_setmode(gspca_dev, xmult, ymult);
 
                reg_w(gspca_dev, 0x20, 0x0001, 0x0004);
@@ -736,7 +736,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)
-                       PERR("reg_r_wait() failed");
+                       gspca_err(gspca_dev, "reg_r_wait() failed\n");
 
                reg_r(gspca_dev, 0x816b, 1);
                Data = gspca_dev->usb_buf[0];
@@ -762,7 +762,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
                err = spca50x_setup_qtable(gspca_dev,
                                   0x00, 0x8800, 0x8840, qtable_pocketdv);
                if (err < 0)
-                       PERR("spca50x_setup_qtable failed");
+                       gspca_err(gspca_dev, "spca50x_setup_qtable failed\n");
                reg_w(gspca_dev, 0x00, 0x8880, 2);
 
                /* familycam Quicksmart pocketDV stuff */
@@ -792,7 +792,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
                                        0x00, 0x8800,
                                        0x8840, qtable_creative_pccam);
                if (err < 0)
-                       PERR("spca50x_setup_qtable failed");
+                       gspca_err(gspca_dev, "spca50x_setup_qtable failed\n");
                reg_w(gspca_dev, 0x00, 0x8880, 3);
                reg_w(gspca_dev, 0x00, 0x800a, 0x00);
                /* Init SDRAM - needed for SDRAM access */
index ae5a80987553a2567f31890c3f5c3bbbb4045e32..29861588302f87e26a236696856844769c6e6a53 100644 (file)
@@ -1779,8 +1779,8 @@ static int write_vector(struct gspca_dev *gspca_dev, const __u16 data[][3])
                ret = reg_write(gspca_dev, data[i][0], data[i][2],
                                                                data[i][1]);
                if (ret < 0) {
-                       PERR("Reg write failed for 0x%02x,0x%02x,0x%02x",
-                               data[i][0], data[i][1], data[i][2]);
+                       gspca_err(gspca_dev, "Reg write failed for 0x%02x,0x%02x,0x%02x\n",
+                                 data[i][0], data[i][1], data[i][2]);
                        return ret;
                }
                i++;
index 1553cc766c0422fd97040bdbb1039bc6bf394109..02b5e2d81c643b08522ed1ec547d86717e64d31a 100644 (file)
@@ -650,7 +650,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
        ret = reg_read(gspca_dev, 0x06, 0x16);
 
        if (ret < 0) {
-               PERR("register read failed err: %d", ret);
+               gspca_err(gspca_dev, "register read failed err: %d\n", ret);
                return ret;
        }
        if (ret != 0x0101) {
index 1e0ba6b24e2180ddf576d2ec11918904fd1845a9..aafffaf1d2b52b65287fa6070f4b1158a6eb99a2 100644 (file)
@@ -1309,7 +1309,8 @@ static int ssi_w(struct gspca_dev *gspca_dev,
                if (gspca_dev->usb_buf[0] == 0)
                        break;
                if (--retry <= 0) {
-                       PERR("ssi_w busy %02x", gspca_dev->usb_buf[0]);
+                       gspca_err(gspca_dev, "ssi_w busy %02x\n",
+                                 gspca_dev->usb_buf[0]);
                        ret = -1;
                        break;
                }
index 4ff704cf9ed6cc2c21f36a384fd2fb6da980a969..a75bd90bd9e3eb781994e643bc6f67fca01a08a7 100644 (file)
@@ -728,7 +728,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
 
                /* This should never happen */
                if (len < 2) {
-                       PERR("Short SOF packet, ignoring");
+                       gspca_err(gspca_dev, "Short SOF packet, ignoring\n");
                        gspca_dev->last_packet_type = DISCARD_PACKET;
                        return;
                }
index f1da34a10ce88af679128cf15dc5f7ea7ed6b413..948808305a6afd9b51d2e5be367c4db03a45a542 100644 (file)
@@ -382,7 +382,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
        }
 
        if (ret < 0) {
-               PERR("Start streaming command failed");
+               gspca_err(gspca_dev, "Start streaming command failed\n");
                return ret;
        }
        /* Start the workqueue function to do the streaming */
index 8b4e4948a0cb6d25f1128ede0cd386176d239612..4fbfcf366f71ca6dbc6799c539204e39e144c1b9 100644 (file)
@@ -211,13 +211,13 @@ static int sd_config(struct gspca_dev *gspca_dev,
 
        ret = sq905c_command(gspca_dev, SQ905C_GET_ID, 0);
        if (ret < 0) {
-               PERR("Get version command failed");
+               gspca_err(gspca_dev, "Get version command failed\n");
                return ret;
        }
 
        ret = sq905c_read(gspca_dev, 0xf5, 0, 20);
        if (ret < 0) {
-               PERR("Reading version command failed");
+               gspca_err(gspca_dev, "Reading version command failed\n");
                return ret;
        }
        /* Note we leave out the usb id and the manufacturing date */
@@ -279,7 +279,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
        }
 
        if (ret < 0) {
-               PERR("Start streaming command failed");
+               gspca_err(gspca_dev, "Start streaming command failed\n");
                return ret;
        }
        /* Start the workqueue function to do the streaming */
index aa9a9411b801818f222b668410084a89192981d5..af48bd6dbe8cda78818decf4c66c5d4efa85fa03 100644 (file)
@@ -538,7 +538,7 @@ static void ucbus_write(struct gspca_dev *gspca_dev,
                return;
 
        if ((batchsize - 1) * 3 > USB_BUF_SZ) {
-               PERR("Bug: usb_buf overflow\n");
+               gspca_err(gspca_dev, "Bug: usb_buf overflow\n");
                gspca_dev->usb_err = -ENOMEM;
                return;
        }
index 29a65d05cbb22c416ab09397e2ce8b08315bf410..4ff6ae18d8dd28fd8e1d662855c8996735d400ad 100644 (file)
@@ -82,8 +82,8 @@ 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 */
-       PERR("last error: %i,  command = 0x%x",
-              gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]);
+       gspca_err(gspca_dev, "last error: %i,  command = 0x%x\n",
+                 gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]);
        return ret;
 }
 
@@ -94,7 +94,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) {
-               PERR("Get_Camera_Mode failed");
+               gspca_err(gspca_dev, "Get_Camera_Mode failed\n");
                return stv0680_handle_error(gspca_dev, -EIO);
        }
 
@@ -112,13 +112,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) {
-               PERR("Set_Camera_Mode failed");
+               gspca_err(gspca_dev, "Set_Camera_Mode failed\n");
                return stv0680_handle_error(gspca_dev, -EIO);
        }
 
        /* Verify we got what we've asked for */
        if (stv0680_get_video_mode(gspca_dev) != mode) {
-               PERR("Error setting camera video mode!");
+               gspca_err(gspca_dev, "Error setting camera video mode!\n");
                return -EIO;
        }
 
@@ -142,7 +142,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) {
-               PERR("STV(e): camera ping failed!!");
+               gspca_err(gspca_dev, "STV(e): camera ping failed!!\n");
                return stv0680_handle_error(gspca_dev, -ENODEV);
        }
 
@@ -152,7 +152,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) {
-               PERR("Could not get descriptor 0200.");
+               gspca_err(gspca_dev, "Could not get descriptor 0200\n");
                return stv0680_handle_error(gspca_dev, -ENODEV);
        }
        if (stv_sndctrl(gspca_dev, 0, 0x8a, 0, 0x02) != 0x02)
@@ -163,7 +163,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
                return stv0680_handle_error(gspca_dev, -ENODEV);
 
        if (!(gspca_dev->usb_buf[7] & 0x09)) {
-               PERR("Camera supports neither CIF nor QVGA mode");
+               gspca_err(gspca_dev, "Camera supports neither CIF nor QVGA mode\n");
                return -ENODEV;
        }
        if (gspca_dev->usb_buf[7] & 0x01)
index e72c3e1ab9ff41f0a39d685d4615a8bd3cb06914..3db1c24b3d6d77ee43c0d256336ca713d637cd38 100644 (file)
@@ -285,7 +285,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) {
-               PERR("Couldn't get altsetting");
+               gspca_err(gspca_dev, "Couldn't get altsetting\n");
                return -EIO;
        }
 
@@ -343,7 +343,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)
-               PERR("set alt 1 err %d", ret);
+               gspca_err(gspca_dev, "set alt 1 err %d\n", ret);
 
        return ret;
 }
@@ -408,7 +408,7 @@ static void stv06xx_pkt_scan(struct gspca_dev *gspca_dev,
                len -= 4;
 
                if (len < chunk_len) {
-                       PERR("URB packet length is smaller than the specified chunk length");
+                       gspca_err(gspca_dev, "URB packet length is smaller than the specified chunk length\n");
                        gspca_dev->last_packet_type = DISCARD_PACKET;
                        return;
                }
@@ -450,7 +450,7 @@ frame_data:
                                sd->to_skip = gspca_dev->pixfmt.width * 4;
 
                        if (chunk_len)
-                               PERR("Chunk length is non-zero on a SOF");
+                               gspca_err(gspca_dev, "Chunk length is non-zero on a SOF\n");
                        break;
 
                case 0x8002:
@@ -463,7 +463,7 @@ frame_data:
                                        NULL, 0);
 
                        if (chunk_len)
-                               PERR("Chunk length is non-zero on a EOF");
+                               gspca_err(gspca_dev, "Chunk length is non-zero on a EOF\n");
                        break;
 
                case 0x0005:
index 8c2785aea3cd046a5d60fd824d21579290f3626b..44b07344f0f72e1dbb2cb31baf76aec1543f4c12 100644 (file)
@@ -248,7 +248,7 @@ static void reg_r(struct gspca_dev *gspca_dev,
        int ret;
 
        if (len > USB_BUF_SZ) {
-               PERR("reg_r: buffer overflow\n");
+               gspca_err(gspca_dev, "reg_r: buffer overflow\n");
                return;
        }
        if (gspca_dev->usb_err < 0)
index b8af4370d27c584ac3870a2a21b73c340baa86b3..a1bb1704d33944548a4d96f12796175d173d79bc 100644 (file)
@@ -195,15 +195,15 @@ static const struct v4l2_pix_format vga_mode[] = {
 static int val_reply(struct gspca_dev *gspca_dev, const char *reply, int rc)
 {
        if (rc < 0) {
-               PERR("reply has error %d", rc);
+               gspca_err(gspca_dev, "reply has error %d\n", rc);
                return -EIO;
        }
        if (rc != 1) {
-               PERR("Bad reply size %d", rc);
+               gspca_err(gspca_dev, "Bad reply size %d\n", rc);
                return -EIO;
        }
        if (reply[0] != 0x08) {
-               PERR("Bad reply 0x%02x", (int)reply[0]);
+               gspca_err(gspca_dev, "Bad reply 0x%02x\n", (int)reply[0]);
                return -EIO;
        }
        return 0;
@@ -221,14 +221,14 @@ static void reg_w(struct gspca_dev *gspca_dev, u16 value, u16 index)
                0x0B, 0xC0, value, index, buff, 1, 500);
        PDEBUG(D_USBO, "rc=%d, ret={0x%02x}", rc, (int)buff[0]);
        if (rc < 0) {
-               PERR("Failed reg_w(0x0B, 0xC0, 0x%04X, 0x%04X) w/ rc %d\n",
-                       value, index, rc);
+               gspca_err(gspca_dev, "Failed reg_w(0x0B, 0xC0, 0x%04X, 0x%04X) w/ rc %d\n",
+                         value, index, rc);
                gspca_dev->usb_err = rc;
                return;
        }
        if (val_reply(gspca_dev, buff, rc)) {
-               PERR("Bad reply to reg_w(0x0B, 0xC0, 0x%04X, 0x%04X\n",
-                       value, index);
+               gspca_err(gspca_dev, "Bad reply to reg_w(0x0B, 0xC0, 0x%04X, 0x%04X\n",
+                         value, index);
                gspca_dev->usb_err = -EIO;
        }
 }
@@ -254,7 +254,7 @@ static void setexposure(struct gspca_dev *gspca_dev, s32 val)
        else if (w == 3264)
                value = val * 3 / 2;
        else {
-               PERR("Invalid width %u\n", w);
+               gspca_err(gspca_dev, "Invalid width %u\n", w);
                gspca_dev->usb_err = -EINVAL;
                return;
        }
@@ -372,7 +372,7 @@ static void configure_wh(struct gspca_dev *gspca_dev)
                reg_w_buf(gspca_dev,
                               reg_init_res, ARRAY_SIZE(reg_init_res));
        } else {
-               PERR("bad width %u\n", w);
+               gspca_err(gspca_dev, "bad width %u\n", w);
                gspca_dev->usb_err = -EINVAL;
                return;
        }
@@ -392,7 +392,7 @@ static void configure_wh(struct gspca_dev *gspca_dev)
                reg_w(gspca_dev, 0x0B4B, REG_FRAME_LENGTH_LINES_);
                reg_w(gspca_dev, 0x1F40, REG_LINE_LENGTH_PCK_);
        } else {
-               PERR("bad width %u\n", w);
+               gspca_err(gspca_dev, "bad width %u\n", w);
                gspca_dev->usb_err = -EINVAL;
                return;
        }
@@ -458,7 +458,7 @@ static int configure(struct gspca_dev *gspca_dev)
        rc = usb_control_msg(gspca_dev->dev, usb_rcvctrlpipe(gspca_dev->dev, 0),
                             0x16, 0xC0, 0x0000, 0x0000, buff, 2, 500);
        if (val_reply(gspca_dev, buff, rc)) {
-               PERR("failed key req");
+               gspca_err(gspca_dev, "failed key req\n");
                return -EIO;
        }
 
@@ -475,21 +475,24 @@ static int configure(struct gspca_dev *gspca_dev)
        rc = usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0),
                             0x01, 0x40, 0x0001, 0x000F, NULL, 0, 500);
        if (rc < 0) {
-               PERR("failed to replay packet 176 w/ rc %d\n", rc);
+               gspca_err(gspca_dev, "failed to replay packet 176 w/ rc %d\n",
+                         rc);
                return rc;
        }
 
        rc = usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0),
                             0x01, 0x40, 0x0000, 0x000F, NULL, 0, 500);
        if (rc < 0) {
-               PERR("failed to replay packet 178 w/ rc %d\n", rc);
+               gspca_err(gspca_dev, "failed to replay packet 178 w/ rc %d\n",
+                         rc);
                return rc;
        }
 
        rc = usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0),
                             0x01, 0x40, 0x0001, 0x000F, NULL, 0, 500);
        if (rc < 0) {
-               PERR("failed to replay packet 180 w/ rc %d\n", rc);
+               gspca_err(gspca_dev, "failed to replay packet 180 w/ rc %d\n",
+                         rc);
                return rc;
        }
 
@@ -511,7 +514,8 @@ static int configure(struct gspca_dev *gspca_dev)
        rc = usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0),
                             0x01, 0x40, 0x0003, 0x000F, NULL, 0, 500);
        if (rc < 0) {
-               PERR("failed to replay final packet w/ rc %d\n", rc);
+               gspca_err(gspca_dev, "failed to replay final packet w/ rc %d\n",
+                         rc);
                return rc;
        }
 
@@ -545,7 +549,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
 
        rc = configure(gspca_dev);
        if (rc < 0) {
-               PERR("Failed configure");
+               gspca_err(gspca_dev, "Failed configure\n");
                return rc;
        }
        /* First two frames have messed up gains
@@ -641,7 +645,7 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
                        V4L2_CID_RED_BALANCE, 0, 1023, 1, 295);
 
        if (hdl->error) {
-               PERR("Could not initialize controls\n");
+               gspca_err(gspca_dev, "Could not initialize controls\n");
                return hdl->error;
        }
        return 0;
index 728d2322c433ad25488737f0ecfbe6f2daee8725..d149cb7f00190035f85414a742ca53985df66874 100644 (file)
@@ -333,7 +333,7 @@ static int w9968cf_i2c_r(struct sd *sd, u8 reg)
                ret = value;
                PDEBUG(D_USBI, "i2c [0x%02X] -> 0x%02X", reg, value);
        } else
-               PERR("i2c read [0x%02x] failed", reg);
+               gspca_err(gspca_dev, "i2c read [0x%02x] failed\n", reg);
 
        return ret;
 }