From cee32edb2302b6199dd763d44573f6b4f220f0e8 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Mon, 18 Sep 2017 10:24:44 -0400 Subject: media: cxusb: pass buf as a const u8 * pointer and make buf static const Don't populate the read-only u8 array buf on the stack at run time but instead make it static const; makes object code smaller saving over 480 bytes: Before: text data bss dec hex filename 33030 65936 192 99158 18356 drivers/media/usb/dvb-usb/cxusb.o After: text data bss dec hex filename 32446 66032 192 98670 1816e drivers/media/usb/dvb-usb/cxusb.o Signed-off-by: Colin Ian King Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/cxusb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c index 37dea0adc695..247dc164dd63 100644 --- a/drivers/media/usb/dvb-usb/cxusb.c +++ b/drivers/media/usb/dvb-usb/cxusb.c @@ -56,7 +56,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); #define deb_i2c(args...) dprintk(dvb_usb_cxusb_debug, 0x02, args) static int cxusb_ctrl_msg(struct dvb_usb_device *d, - u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen) + u8 cmd, const u8 *wbuf, int wlen, u8 *rbuf, int rlen) { struct cxusb_state *st = d->priv; int ret; @@ -290,7 +290,8 @@ static int cxusb_aver_power_ctrl(struct dvb_usb_device *d, int onoff) /* FIXME: We don't know why, but we need to configure the * lgdt3303 with the register settings below on resume */ int i; - u8 buf, bufs[] = { + u8 buf; + static const u8 bufs[] = { 0x0e, 0x2, 0x00, 0x7f, 0x0e, 0x2, 0x02, 0xfe, 0x0e, 0x2, 0x02, 0x01, -- cgit v1.2.3 From c0f71bbb810237a38734607ca4599632f7f5d47f Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Fri, 22 Sep 2017 09:07:06 -0400 Subject: media: hdpvr: Fix an error handling path in hdpvr_probe() Here, hdpvr_register_videodev() is responsible for setup and register a video device. Also defining and initializing a worker. hdpvr_register_videodev() is calling by hdpvr_probe at last. So no need to flush any work here. Unregister v4l2, free buffers and memory. If hdpvr_probe() will fail. Signed-off-by: Arvind Yadav Reported-by: Andrey Konovalov Tested-by: Andrey Konovalov Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/hdpvr/hdpvr-core.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c index dbe29c6c4d8b..1e8cbaf36896 100644 --- a/drivers/media/usb/hdpvr/hdpvr-core.c +++ b/drivers/media/usb/hdpvr/hdpvr-core.c @@ -292,7 +292,7 @@ static int hdpvr_probe(struct usb_interface *interface, /* register v4l2_device early so it can be used for printks */ if (v4l2_device_register(&interface->dev, &dev->v4l2_dev)) { dev_err(&interface->dev, "v4l2_device_register failed\n"); - goto error; + goto error_free_dev; } mutex_init(&dev->io_mutex); @@ -301,7 +301,7 @@ static int hdpvr_probe(struct usb_interface *interface, dev->usbc_buf = kmalloc(64, GFP_KERNEL); if (!dev->usbc_buf) { v4l2_err(&dev->v4l2_dev, "Out of memory\n"); - goto error; + goto error_v4l2_unregister; } init_waitqueue_head(&dev->wait_buffer); @@ -339,13 +339,13 @@ static int hdpvr_probe(struct usb_interface *interface, } if (!dev->bulk_in_endpointAddr) { v4l2_err(&dev->v4l2_dev, "Could not find bulk-in endpoint\n"); - goto error; + goto error_put_usb; } /* init the device */ if (hdpvr_device_init(dev)) { v4l2_err(&dev->v4l2_dev, "device init failed\n"); - goto error; + goto error_put_usb; } mutex_lock(&dev->io_mutex); @@ -353,7 +353,7 @@ static int hdpvr_probe(struct usb_interface *interface, mutex_unlock(&dev->io_mutex); v4l2_err(&dev->v4l2_dev, "allocating transfer buffers failed\n"); - goto error; + goto error_put_usb; } mutex_unlock(&dev->io_mutex); @@ -361,7 +361,7 @@ static int hdpvr_probe(struct usb_interface *interface, retval = hdpvr_register_i2c_adapter(dev); if (retval < 0) { v4l2_err(&dev->v4l2_dev, "i2c adapter register failed\n"); - goto error; + goto error_free_buffers; } client = hdpvr_register_ir_rx_i2c(dev); @@ -394,13 +394,17 @@ static int hdpvr_probe(struct usb_interface *interface, reg_fail: #if IS_ENABLED(CONFIG_I2C) i2c_del_adapter(&dev->i2c_adapter); +error_free_buffers: #endif + hdpvr_free_buffers(dev); +error_put_usb: + usb_put_dev(dev->udev); + kfree(dev->usbc_buf); +error_v4l2_unregister: + v4l2_device_unregister(&dev->v4l2_dev); +error_free_dev: + kfree(dev); error: - if (dev) { - flush_work(&dev->worker); - /* this frees allocated memory */ - hdpvr_delete(dev); - } return retval; } -- cgit v1.2.3 From 6e298d58473520a806d59b7aa51dcb194d1a1b03 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 22 Sep 2017 09:48:41 -0400 Subject: media: stk-webcam: Fix use after free on disconnect We free the stk_camera device too early. It's allocate first in probe and it should be freed last in stk_camera_disconnect(). Reported-by: Andrey Konovalov Signed-off-by: Dan Carpenter Acked-by: Sakari Ailus Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/stkwebcam/stk-webcam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c index c0bba773db25..e748c976d967 100644 --- a/drivers/media/usb/stkwebcam/stk-webcam.c +++ b/drivers/media/usb/stkwebcam/stk-webcam.c @@ -1241,7 +1241,6 @@ static void stk_v4l_dev_release(struct video_device *vd) if (dev->sio_bufs != NULL || dev->isobufs != NULL) pr_err("We are leaking memory\n"); usb_put_intf(dev->interface); - kfree(dev); } static const struct video_device stk_v4l_data = { @@ -1391,6 +1390,7 @@ static void stk_camera_disconnect(struct usb_interface *interface) video_unregister_device(&dev->vdev); v4l2_ctrl_handler_free(&dev->hdl); v4l2_device_unregister(&dev->v4l2_dev); + kfree(dev); } #ifdef CONFIG_PM -- cgit v1.2.3 From 52173c5f3f6476eb9100691ec47b10d6740eed4a Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Fri, 22 Sep 2017 14:33:35 -0400 Subject: media: gspca: Convert PERR to gspca_err 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 Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/gspca/benq.c | 6 +-- drivers/media/usb/gspca/conex.c | 6 +-- drivers/media/usb/gspca/cpia1.c | 24 ++++++----- drivers/media/usb/gspca/dtcs033.c | 12 +++--- drivers/media/usb/gspca/etoms.c | 4 +- drivers/media/usb/gspca/gl860/gl860.c | 2 +- drivers/media/usb/gspca/gspca.c | 26 +++++++----- drivers/media/usb/gspca/gspca.h | 4 +- drivers/media/usb/gspca/jeilinj.c | 2 +- drivers/media/usb/gspca/konica.c | 26 ++++++------ drivers/media/usb/gspca/m5602/m5602_core.c | 2 +- drivers/media/usb/gspca/mr97310a.c | 6 +-- drivers/media/usb/gspca/ov519.c | 65 ++++++++++++++++-------------- drivers/media/usb/gspca/ov534.c | 4 +- drivers/media/usb/gspca/pac7302.c | 2 +- drivers/media/usb/gspca/pac7311.c | 2 +- drivers/media/usb/gspca/sn9c2028.c | 4 +- drivers/media/usb/gspca/sonixj.c | 4 +- drivers/media/usb/gspca/spca1528.c | 4 +- drivers/media/usb/gspca/spca500.c | 36 ++++++++--------- drivers/media/usb/gspca/spca501.c | 4 +- drivers/media/usb/gspca/spca505.c | 2 +- drivers/media/usb/gspca/spca508.c | 3 +- drivers/media/usb/gspca/spca561.c | 2 +- drivers/media/usb/gspca/sq905.c | 2 +- drivers/media/usb/gspca/sq905c.c | 6 +-- drivers/media/usb/gspca/sq930x.c | 2 +- drivers/media/usb/gspca/stv0680.c | 16 ++++---- drivers/media/usb/gspca/stv06xx/stv06xx.c | 10 ++--- drivers/media/usb/gspca/sunplus.c | 2 +- drivers/media/usb/gspca/touptek.c | 38 +++++++++-------- drivers/media/usb/gspca/w996Xcf.c | 2 +- 32 files changed, 174 insertions(+), 156 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/gspca/benq.c b/drivers/media/usb/gspca/benq.c index 60a728203b3b..b5955bf0d0fc 100644 --- a/drivers/media/usb/gspca/benq.c +++ b/drivers/media/usb/gspca/benq.c @@ -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; } diff --git a/drivers/media/usb/gspca/conex.c b/drivers/media/usb/gspca/conex.c index bdcdf7999c56..0223b33156dd 100644 --- a/drivers/media/usb/gspca/conex.c +++ b/drivers/media/usb/gspca/conex.c @@ -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; diff --git a/drivers/media/usb/gspca/cpia1.c b/drivers/media/usb/gspca/cpia1.c index e91d00762e94..99b456d64729 100644 --- a/drivers/media/usb/gspca/cpia1.c +++ b/drivers/media/usb/gspca/cpia1.c @@ -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; } diff --git a/drivers/media/usb/gspca/dtcs033.c b/drivers/media/usb/gspca/dtcs033.c index 96bfd4e0f0eb..b4d42940d5de 100644 --- a/drivers/media/usb/gspca/dtcs033.c +++ b/drivers/media/usb/gspca/dtcs033.c @@ -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; } diff --git a/drivers/media/usb/gspca/etoms.c b/drivers/media/usb/gspca/etoms.c index 8f84292936e9..a88ae69d6c1e 100644 --- a/drivers/media/usb/gspca/etoms.c +++ b/drivers/media/usb/gspca/etoms.c @@ -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; } diff --git a/drivers/media/usb/gspca/gl860/gl860.c b/drivers/media/usb/gspca/gl860/gl860.c index cea8d7f51c3c..add298cc9ab2 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) - PERR("short ctrl transfer %d/%d", r, len); + gspca_err(gspca_dev, "short ctrl transfer %d/%d\n", r, len); msleep(1); diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c index 961343873fd0..da81cb3059be 100644 --- a/drivers/media/usb/gspca/gspca.c +++ b/drivers/media/usb/gspca/gspca.c @@ -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; } diff --git a/drivers/media/usb/gspca/gspca.h b/drivers/media/usb/gspca/gspca.h index 9e0cf711642b..da65fef6aacc 100644 --- a/drivers/media/usb/gspca/gspca.h +++ b/drivers/media/usb/gspca/gspca.h @@ -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 */ diff --git a/drivers/media/usb/gspca/jeilinj.c b/drivers/media/usb/gspca/jeilinj.c index 34e043b7d1bc..7215c6879070 100644 --- a/drivers/media/usb/gspca/jeilinj.c +++ b/drivers/media/usb/gspca/jeilinj.c @@ -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; } diff --git a/drivers/media/usb/gspca/konica.c b/drivers/media/usb/gspca/konica.c index 31b2117e8f1d..d51aca01167f 100644 --- a/drivers/media/usb/gspca/konica.c +++ b/drivers/media/usb/gspca/konica.c @@ -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) diff --git a/drivers/media/usb/gspca/m5602/m5602_core.c b/drivers/media/usb/gspca/m5602/m5602_core.c index f1dcd9021983..4aab17efa4cc 100644 --- a/drivers/media/usb/gspca/m5602/m5602_core.c +++ b/drivers/media/usb/gspca/m5602/m5602_core.c @@ -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; diff --git a/drivers/media/usb/gspca/mr97310a.c b/drivers/media/usb/gspca/mr97310a.c index 8b0e32a649ac..34aacaee4453 100644 --- a/drivers/media/usb/gspca/mr97310a.c +++ b/drivers/media/usb/gspca/mr97310a.c @@ -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) diff --git a/drivers/media/usb/gspca/ov519.c b/drivers/media/usb/gspca/ov519.c index 1b30434b72ef..14ffefbb5ac1 100644 --- a/drivers/media/usb/gspca/ov519.c +++ b/drivers/media/usb/gspca/ov519.c @@ -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) diff --git a/drivers/media/usb/gspca/ov534.c b/drivers/media/usb/gspca/ov534.c index 32849ff86b09..bba2c5ce331c 100644 --- a/drivers/media/usb/gspca/ov534.c +++ b/drivers/media/usb/gspca/ov534.c @@ -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; diff --git a/drivers/media/usb/gspca/pac7302.c b/drivers/media/usb/gspca/pac7302.c index 595535e143e6..b8ff201c7bb9 100644 --- a/drivers/media/usb/gspca/pac7302.c +++ b/drivers/media/usb/gspca/pac7302.c @@ -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) { diff --git a/drivers/media/usb/gspca/pac7311.c b/drivers/media/usb/gspca/pac7311.c index 8bac2d9326bf..44db4f4afa22 100644 --- a/drivers/media/usb/gspca/pac7311.c +++ b/drivers/media/usb/gspca/pac7311.c @@ -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) { diff --git a/drivers/media/usb/gspca/sn9c2028.c b/drivers/media/usb/gspca/sn9c2028.c index 5d32dd359d84..469bc2ced1a3 100644 --- a/drivers/media/usb/gspca/sn9c2028.c +++ b/drivers/media/usb/gspca/sn9c2028.c @@ -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) diff --git a/drivers/media/usb/gspca/sonixj.c b/drivers/media/usb/gspca/sonixj.c index 5eeaf16ac5e8..9d7c3d8c226f 100644 --- a/drivers/media/usb/gspca/sonixj.c +++ b/drivers/media/usb/gspca/sonixj.c @@ -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; } diff --git a/drivers/media/usb/gspca/spca1528.c b/drivers/media/usb/gspca/spca1528.c index 327ec901abe1..e53dd3c7066c 100644 --- a/drivers/media/usb/gspca/spca1528.c +++ b/drivers/media/usb/gspca/spca1528.c @@ -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; } diff --git a/drivers/media/usb/gspca/spca500.c b/drivers/media/usb/gspca/spca500.c index da2d9027914c..b25960643f7b 100644 --- a/drivers/media/usb/gspca/spca500.c +++ b/drivers/media/usb/gspca/spca500.c @@ -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 */ diff --git a/drivers/media/usb/gspca/spca501.c b/drivers/media/usb/gspca/spca501.c index ae5a80987553..29861588302f 100644 --- a/drivers/media/usb/gspca/spca501.c +++ b/drivers/media/usb/gspca/spca501.c @@ -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++; diff --git a/drivers/media/usb/gspca/spca505.c b/drivers/media/usb/gspca/spca505.c index 1553cc766c04..02b5e2d81c64 100644 --- a/drivers/media/usb/gspca/spca505.c +++ b/drivers/media/usb/gspca/spca505.c @@ -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) { diff --git a/drivers/media/usb/gspca/spca508.c b/drivers/media/usb/gspca/spca508.c index 1e0ba6b24e21..aafffaf1d2b5 100644 --- a/drivers/media/usb/gspca/spca508.c +++ b/drivers/media/usb/gspca/spca508.c @@ -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; } diff --git a/drivers/media/usb/gspca/spca561.c b/drivers/media/usb/gspca/spca561.c index 4ff704cf9ed6..a75bd90bd9e3 100644 --- a/drivers/media/usb/gspca/spca561.c +++ b/drivers/media/usb/gspca/spca561.c @@ -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; } diff --git a/drivers/media/usb/gspca/sq905.c b/drivers/media/usb/gspca/sq905.c index f1da34a10ce8..948808305a6a 100644 --- a/drivers/media/usb/gspca/sq905.c +++ b/drivers/media/usb/gspca/sq905.c @@ -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 */ diff --git a/drivers/media/usb/gspca/sq905c.c b/drivers/media/usb/gspca/sq905c.c index 8b4e4948a0cb..4fbfcf366f71 100644 --- a/drivers/media/usb/gspca/sq905c.c +++ b/drivers/media/usb/gspca/sq905c.c @@ -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 */ diff --git a/drivers/media/usb/gspca/sq930x.c b/drivers/media/usb/gspca/sq930x.c index aa9a9411b801..af48bd6dbe8c 100644 --- a/drivers/media/usb/gspca/sq930x.c +++ b/drivers/media/usb/gspca/sq930x.c @@ -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; } diff --git a/drivers/media/usb/gspca/stv0680.c b/drivers/media/usb/gspca/stv0680.c index 29a65d05cbb2..4ff6ae18d8dd 100644 --- a/drivers/media/usb/gspca/stv0680.c +++ b/drivers/media/usb/gspca/stv0680.c @@ -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) diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx.c b/drivers/media/usb/gspca/stv06xx/stv06xx.c index e72c3e1ab9ff..3db1c24b3d6d 100644 --- a/drivers/media/usb/gspca/stv06xx/stv06xx.c +++ b/drivers/media/usb/gspca/stv06xx/stv06xx.c @@ -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: diff --git a/drivers/media/usb/gspca/sunplus.c b/drivers/media/usb/gspca/sunplus.c index 8c2785aea3cd..44b07344f0f7 100644 --- a/drivers/media/usb/gspca/sunplus.c +++ b/drivers/media/usb/gspca/sunplus.c @@ -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) diff --git a/drivers/media/usb/gspca/touptek.c b/drivers/media/usb/gspca/touptek.c index b8af4370d27c..a1bb1704d339 100644 --- a/drivers/media/usb/gspca/touptek.c +++ b/drivers/media/usb/gspca/touptek.c @@ -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; diff --git a/drivers/media/usb/gspca/w996Xcf.c b/drivers/media/usb/gspca/w996Xcf.c index 728d2322c433..d149cb7f0019 100644 --- a/drivers/media/usb/gspca/w996Xcf.c +++ b/drivers/media/usb/gspca/w996Xcf.c @@ -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; } -- cgit v1.2.3 From 37d5efb01910752d8d3846a2c4db0528c1dfa137 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Fri, 22 Sep 2017 15:20:33 -0400 Subject: media: gspca: Convert PDEBUG to gspca_dbg Use a more typical 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 o Remove commented out uses of PDEBUG Signed-off-by: Joe Perches Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/gspca/autogain_functions.c | 16 +-- drivers/media/usb/gspca/benq.c | 2 +- drivers/media/usb/gspca/conex.c | 7 +- drivers/media/usb/gspca/cpia1.c | 50 ++++----- drivers/media/usb/gspca/dtcs033.c | 16 +-- drivers/media/usb/gspca/etoms.c | 34 +++--- drivers/media/usb/gspca/finepix.c | 4 +- drivers/media/usb/gspca/gl860/gl860.c | 35 ++++--- drivers/media/usb/gspca/gspca.c | 127 ++++++++++++----------- drivers/media/usb/gspca/gspca.h | 5 +- drivers/media/usb/gspca/jeilinj.c | 17 +-- drivers/media/usb/gspca/jl2005bcd.c | 45 ++++---- drivers/media/usb/gspca/kinect.c | 11 +- drivers/media/usb/gspca/konica.c | 2 +- drivers/media/usb/gspca/m5602/m5602_core.c | 32 +++--- drivers/media/usb/gspca/m5602/m5602_mt9m111.c | 21 ++-- drivers/media/usb/gspca/m5602/m5602_ov7660.c | 11 +- drivers/media/usb/gspca/m5602/m5602_ov9650.c | 26 ++--- drivers/media/usb/gspca/m5602/m5602_po1030.c | 27 ++--- drivers/media/usb/gspca/m5602/m5602_s5k4aa.c | 16 +-- drivers/media/usb/gspca/m5602/m5602_s5k83a.c | 2 +- drivers/media/usb/gspca/mars.c | 4 +- drivers/media/usb/gspca/mr97310a.c | 23 ++-- drivers/media/usb/gspca/nw80x.c | 24 +++-- drivers/media/usb/gspca/ov519.c | 90 ++++++++-------- drivers/media/usb/gspca/ov534.c | 21 ++-- drivers/media/usb/gspca/ov534_9.c | 23 ++-- drivers/media/usb/gspca/pac207.c | 16 +-- drivers/media/usb/gspca/pac_common.h | 7 +- drivers/media/usb/gspca/sn9c2028.c | 30 +++--- drivers/media/usb/gspca/sn9c2028.h | 7 +- drivers/media/usb/gspca/sn9c20x.c | 2 +- drivers/media/usb/gspca/sonixj.c | 54 +++++----- drivers/media/usb/gspca/spca1528.c | 13 +-- drivers/media/usb/gspca/spca500.c | 30 +++--- drivers/media/usb/gspca/spca501.c | 6 +- drivers/media/usb/gspca/spca505.c | 4 +- drivers/media/usb/gspca/spca506.c | 16 +-- drivers/media/usb/gspca/spca508.c | 17 +-- drivers/media/usb/gspca/spca561.c | 20 ++-- drivers/media/usb/gspca/sq905.c | 14 +-- drivers/media/usb/gspca/sq905c.c | 31 +++--- drivers/media/usb/gspca/sq930x.c | 27 ++--- drivers/media/usb/gspca/stk014.c | 6 +- drivers/media/usb/gspca/stk1135.c | 15 +-- drivers/media/usb/gspca/stv0680.c | 20 ++-- drivers/media/usb/gspca/stv06xx/stv06xx.c | 64 ++++++------ drivers/media/usb/gspca/stv06xx/stv06xx_hdcs.c | 10 +- drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c | 23 ++-- drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c | 2 +- drivers/media/usb/gspca/stv06xx/stv06xx_vv6410.c | 16 +-- drivers/media/usb/gspca/sunplus.c | 34 +++--- drivers/media/usb/gspca/t613.c | 24 ++--- drivers/media/usb/gspca/topro.c | 6 +- drivers/media/usb/gspca/touptek.c | 51 ++++----- drivers/media/usb/gspca/vc032x.c | 51 ++++----- drivers/media/usb/gspca/w996Xcf.c | 7 +- drivers/media/usb/gspca/xirlink_cit.c | 32 +++--- drivers/media/usb/gspca/zc3xx.c | 83 ++++++++------- 59 files changed, 742 insertions(+), 687 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/gspca/autogain_functions.c b/drivers/media/usb/gspca/autogain_functions.c index 427db745e027..f721e83596be 100644 --- a/drivers/media/usb/gspca/autogain_functions.c +++ b/drivers/media/usb/gspca/autogain_functions.c @@ -41,8 +41,8 @@ int gspca_expo_autogain( desired lumination fast (with the risc of a slight overshoot) */ steps = abs(desired_avg_lum - avg_lum) / deadzone; - PDEBUG(D_FRAM, "autogain: lum: %d, desired: %d, steps: %d", - avg_lum, desired_avg_lum, steps); + gspca_dbg(gspca_dev, D_FRAM, "autogain: lum: %d, desired: %d, steps: %d\n", + avg_lum, desired_avg_lum, steps); for (i = 0; i < steps; i++) { if (avg_lum > desired_avg_lum) { @@ -84,8 +84,8 @@ int gspca_expo_autogain( } if (retval) - PDEBUG(D_FRAM, "autogain: changed gain: %d, expo: %d", - gain, exposure); + gspca_dbg(gspca_dev, D_FRAM, "autogain: changed gain: %d, expo: %d\n", + gain, exposure); return retval; } EXPORT_SYMBOL(gspca_expo_autogain); @@ -126,8 +126,8 @@ int gspca_coarse_grained_expo_autogain( desired lumination fast (with the risc of a slight overshoot) */ steps = (desired_avg_lum - avg_lum) / deadzone; - PDEBUG(D_FRAM, "autogain: lum: %d, desired: %d, steps: %d", - avg_lum, desired_avg_lum, steps); + gspca_dbg(gspca_dev, D_FRAM, "autogain: lum: %d, desired: %d, steps: %d\n", + avg_lum, desired_avg_lum, steps); if ((gain + steps) > gain_high && exposure < gspca_dev->exposure->maximum) { @@ -167,8 +167,8 @@ int gspca_coarse_grained_expo_autogain( } if (retval) - PDEBUG(D_FRAM, "autogain: changed gain: %d, expo: %d", - gain, exposure); + gspca_dbg(gspca_dev, D_FRAM, "autogain: changed gain: %d, expo: %d\n", + gain, exposure); return retval; } EXPORT_SYMBOL(gspca_coarse_grained_expo_autogain); diff --git a/drivers/media/usb/gspca/benq.c b/drivers/media/usb/gspca/benq.c index b5955bf0d0fc..8a8db5eb6d5f 100644 --- a/drivers/media/usb/gspca/benq.c +++ b/drivers/media/usb/gspca/benq.c @@ -152,7 +152,7 @@ static void sd_isoc_irq(struct urb *urb) u8 *data; int i, st; - PDEBUG(D_PACK, "sd isoc irq"); + gspca_dbg(gspca_dev, D_PACK, "sd isoc irq\n"); if (!gspca_dev->streaming) return; if (urb->status != 0) { diff --git a/drivers/media/usb/gspca/conex.c b/drivers/media/usb/gspca/conex.c index 0223b33156dd..6df4e204e291 100644 --- a/drivers/media/usb/gspca/conex.c +++ b/drivers/media/usb/gspca/conex.c @@ -81,8 +81,8 @@ static void reg_r(struct gspca_dev *gspca_dev, 0, index, gspca_dev->usb_buf, len, 500); - PDEBUG(D_USBI, "reg read [%02x] -> %02x ..", - index, gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_USBI, "reg read [%02x] -> %02x ..\n", + index, gspca_dev->usb_buf[0]); } /* the bytes to write are in gspca_dev->usb_buf */ @@ -112,7 +112,8 @@ static void reg_w(struct gspca_dev *gspca_dev, gspca_err(gspca_dev, "reg_w: buffer overflow\n"); return; } - PDEBUG(D_USBO, "reg write [%02x] = %02x..", index, *buffer); + gspca_dbg(gspca_dev, D_USBO, "reg write [%02x] = %02x..\n", + index, *buffer); memcpy(gspca_dev->usb_buf, buffer, len); usb_control_msg(dev, diff --git a/drivers/media/usb/gspca/cpia1.c b/drivers/media/usb/gspca/cpia1.c index 99b456d64729..8d41cd46a79d 100644 --- a/drivers/media/usb/gspca/cpia1.c +++ b/drivers/media/usb/gspca/cpia1.c @@ -701,11 +701,11 @@ static void reset_camera_params(struct gspca_dev *gspca_dev) 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, - params->status.streamState, params->status.fatalError, - params->status.cmdError, params->status.debugFlags, - params->status.vpStatus, params->status.errorCode); + gspca_dbg(gspca_dev, D_PROBE, "status: %02x %02x %02x %02x %02x %02x %02x %02x\n", + params->status.systemState, params->status.grabState, + params->status.streamState, params->status.fatalError, + params->status.cmdError, params->status.debugFlags, + params->status.vpStatus, params->status.errorCode); } static int goto_low_power(struct gspca_dev *gspca_dev) @@ -730,7 +730,7 @@ static int goto_low_power(struct gspca_dev *gspca_dev) return -EIO; } - PDEBUG(D_CONF, "camera now in LOW power state"); + gspca_dbg(gspca_dev, D_CONF, "camera now in LOW power state\n"); return 0; } @@ -759,7 +759,7 @@ static int goto_high_power(struct gspca_dev *gspca_dev) return -EIO; } - PDEBUG(D_CONF, "camera now in HIGH power state"); + gspca_dbg(gspca_dev, D_CONF, "camera now in HIGH power state\n"); return 0; } @@ -1302,7 +1302,7 @@ static void monitor_exposure(struct gspca_dev *gspca_dev) sd->params.exposure.coarseExpHi = new_exposure >> 8; setexp = 1; sd->exposure_status = EXPOSURE_NORMAL; - PDEBUG(D_CONF, "Automatically decreasing sensor_fps"); + gspca_dbg(gspca_dev, D_CONF, "Automatically decreasing sensor_fps\n"); } else if ((sd->exposure_status == EXPOSURE_VERY_LIGHT || sd->exposure_status == EXPOSURE_LIGHT) && @@ -1331,7 +1331,7 @@ static void monitor_exposure(struct gspca_dev *gspca_dev) sd->params.exposure.coarseExpHi = new_exposure >> 8; setexp = 1; sd->exposure_status = EXPOSURE_NORMAL; - PDEBUG(D_CONF, "Automatically increasing sensor_fps"); + gspca_dbg(gspca_dev, D_CONF, "Automatically increasing sensor_fps\n"); } } else { /* Flicker control off */ @@ -1349,7 +1349,7 @@ static void monitor_exposure(struct gspca_dev *gspca_dev) setexp = 1; } sd->exposure_status = EXPOSURE_NORMAL; - PDEBUG(D_CONF, "Automatically decreasing sensor_fps"); + gspca_dbg(gspca_dev, D_CONF, "Automatically decreasing sensor_fps\n"); } else if ((sd->exposure_status == EXPOSURE_VERY_LIGHT || sd->exposure_status == EXPOSURE_LIGHT) && @@ -1366,7 +1366,7 @@ static void monitor_exposure(struct gspca_dev *gspca_dev) setexp = 1; } sd->exposure_status = EXPOSURE_NORMAL; - PDEBUG(D_CONF, "Automatically increasing sensor_fps"); + gspca_dbg(gspca_dev, D_CONF, "Automatically increasing sensor_fps\n"); } } @@ -1434,8 +1434,8 @@ static int sd_config(struct gspca_dev *gspca_dev, sd->mainsFreq = FREQ_DEF == V4L2_CID_POWER_LINE_FREQUENCY_60HZ; reset_camera_params(gspca_dev); - PDEBUG(D_PROBE, "cpia CPiA camera detected (vid/pid 0x%04X:0x%04X)", - id->idVendor, id->idProduct); + gspca_dbg(gspca_dev, D_PROBE, "cpia CPiA camera detected (vid/pid 0x%04X:0x%04X)\n", + id->idVendor, id->idProduct); cam = &gspca_dev->cam; cam->cam_mode = mode; @@ -1669,18 +1669,18 @@ static int sd_init(struct gspca_dev *gspca_dev) sd_stopN(gspca_dev); - PDEBUG(D_PROBE, "CPIA Version: %d.%02d (%d.%d)", - sd->params.version.firmwareVersion, - sd->params.version.firmwareRevision, - sd->params.version.vcVersion, - sd->params.version.vcRevision); - PDEBUG(D_PROBE, "CPIA PnP-ID: %04x:%04x:%04x", - sd->params.pnpID.vendor, sd->params.pnpID.product, - sd->params.pnpID.deviceRevision); - PDEBUG(D_PROBE, "VP-Version: %d.%d %04x", - sd->params.vpVersion.vpVersion, - sd->params.vpVersion.vpRevision, - sd->params.vpVersion.cameraHeadID); + gspca_dbg(gspca_dev, D_PROBE, "CPIA Version: %d.%02d (%d.%d)\n", + sd->params.version.firmwareVersion, + sd->params.version.firmwareRevision, + sd->params.version.vcVersion, + sd->params.version.vcRevision); + gspca_dbg(gspca_dev, D_PROBE, "CPIA PnP-ID: %04x:%04x:%04x", + sd->params.pnpID.vendor, sd->params.pnpID.product, + sd->params.pnpID.deviceRevision); + gspca_dbg(gspca_dev, D_PROBE, "VP-Version: %d.%d %04x", + sd->params.vpVersion.vpVersion, + sd->params.vpVersion.vpRevision, + sd->params.vpVersion.cameraHeadID); return 0; } diff --git a/drivers/media/usb/gspca/dtcs033.c b/drivers/media/usb/gspca/dtcs033.c index b4d42940d5de..cdf27cf0112a 100644 --- a/drivers/media/usb/gspca/dtcs033.c +++ b/drivers/media/usb/gspca/dtcs033.c @@ -75,14 +75,14 @@ static int reg_reqs(struct gspca_dev *gspca_dev, i, n_reqs); } else if (preq->bRequestType & USB_DIR_IN) { - PDEBUG(D_STREAM, - "USB IN (%d) returned[%d] %02X %02X %02X %s", - i, - preq->wLength, - gspca_dev->usb_buf[0], - gspca_dev->usb_buf[1], - gspca_dev->usb_buf[2], - preq->wLength > 3 ? "...\n" : "\n"); + gspca_dbg(gspca_dev, D_STREAM, + "USB IN (%d) returned[%d] %02X %02X %02X %s\n", + i, + preq->wLength, + gspca_dev->usb_buf[0], + gspca_dev->usb_buf[1], + gspca_dev->usb_buf[2], + preq->wLength > 3 ? "...\n" : "\n"); } i++; diff --git a/drivers/media/usb/gspca/etoms.c b/drivers/media/usb/gspca/etoms.c index a88ae69d6c1e..48b28897051f 100644 --- a/drivers/media/usb/gspca/etoms.c +++ b/drivers/media/usb/gspca/etoms.c @@ -170,8 +170,8 @@ static void reg_r(struct gspca_dev *gspca_dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, 0, index, gspca_dev->usb_buf, len, 500); - PDEBUG(D_USBI, "reg read [%02x] -> %02x ..", - index, gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_USBI, "reg read [%02x] -> %02x ..\n", + index, gspca_dev->usb_buf[0]); } static void reg_w_val(struct gspca_dev *gspca_dev, @@ -200,7 +200,8 @@ static void reg_w(struct gspca_dev *gspca_dev, pr_err("reg_w: buffer overflow\n"); return; } - PDEBUG(D_USBO, "reg write [%02x] = %02x..", index, *buffer); + gspca_dbg(gspca_dev, D_USBO, "reg write [%02x] = %02x..\n", + index, *buffer); memcpy(gspca_dev->usb_buf, buffer, len); usb_control_msg(dev, @@ -277,7 +278,7 @@ static void Et_init2(struct gspca_dev *gspca_dev) __u8 value; static const __u8 FormLine[] = { 0x84, 0x03, 0x14, 0xf4, 0x01, 0x05 }; - PDEBUG(D_STREAM, "Open Init2 ET"); + gspca_dbg(gspca_dev, D_STREAM, "Open Init2 ET\n"); reg_w_val(gspca_dev, ET_GPIO_DIR_CTRL, 0x2f); reg_w_val(gspca_dev, ET_GPIO_OUT, 0x10); reg_r(gspca_dev, ET_GPIO_IN, 1); @@ -416,8 +417,6 @@ static void setcolors(struct gspca_dev *gspca_dev, s32 val) i2c_w(gspca_dev, PAS106_REG13, &i2cflags, 1, 3); i2c_w(gspca_dev, PAS106_REG9, I2cc, sizeof I2cc, 1); } -/* PDEBUG(D_CONF , "Etoms red %d blue %d green %d", - I2cc[3], I2cc[0], green); */ } static s32 getcolors(struct gspca_dev *gspca_dev) @@ -451,7 +450,7 @@ static void Et_init1(struct gspca_dev *gspca_dev) /* __u8 I2c0 [] = {0x0a, 0x12, 0x05, 0xfe, 0xfe, 0xc0, 0x01, 0x00}; * 1/60000 hmm ?? */ - PDEBUG(D_STREAM, "Open Init1 ET"); + gspca_dbg(gspca_dev, D_STREAM, "Open Init1 ET\n\n"); reg_w_val(gspca_dev, ET_GPIO_DIR_CTRL, 7); reg_r(gspca_dev, ET_GPIO_IN, 1); reg_w_val(gspca_dev, ET_RESET_ALL, 1); @@ -463,9 +462,9 @@ static void Et_init1(struct gspca_dev *gspca_dev) value = ET_COMP_VAL1; else value = ET_COMP_VAL0; - PDEBUG(D_STREAM, "Open mode %d Compression %d", - gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv, - value); + gspca_dbg(gspca_dev, D_STREAM, "Open mode %d Compression %d\n", + gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv, + value); reg_w_val(gspca_dev, ET_COMP, value); reg_w_val(gspca_dev, ET_MAXQt, 0x1d); reg_w_val(gspca_dev, ET_MINQt, 0x02); @@ -604,7 +603,8 @@ static __u8 Et_getgainG(struct gspca_dev *gspca_dev) if (sd->sensor == SENSOR_PAS106) { i2c_r(gspca_dev, PAS106_REG0e); - PDEBUG(D_CONF, "Etoms gain G %d", gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_CONF, "Etoms gain G %d\n", + gspca_dev->usb_buf[0]); return gspca_dev->usb_buf[0]; } return 0x1f; @@ -652,11 +652,11 @@ static void do_autogain(struct gspca_dev *gspca_dev) b = ((b << 7) >> 10); g = ((g << 9) + (g << 7) + (g << 5)) >> 10; luma = LIMIT(r + g + b); - PDEBUG(D_FRAM, "Etoms luma G %d", luma); + gspca_dbg(gspca_dev, D_FRAM, "Etoms luma G %d\n", luma); if (luma < luma_mean - luma_delta || luma > luma_mean + luma_delta) { Gbright += (luma_mean - luma) >> spring; Gbright = BLIMIT(Gbright); - PDEBUG(D_FRAM, "Etoms Gbright %d", Gbright); + gspca_dbg(gspca_dev, D_FRAM, "Etoms Gbright %d\n", Gbright); Et_setgainG(gspca_dev, (__u8) Gbright); } } @@ -673,10 +673,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, seqframe = data[0] & 0x3f; len = (int) (((data[0] & 0xc0) << 2) | data[1]); if (seqframe == 0x3f) { - PDEBUG(D_FRAM, - "header packet found datalength %d !!", len); - PDEBUG(D_FRAM, "G %d R %d G %d B %d", - data[2], data[3], data[4], data[5]); + gspca_dbg(gspca_dev, D_FRAM, + "header packet found datalength %d !!\n", len); + gspca_dbg(gspca_dev, D_FRAM, "G %d R %d G %d B %d", + data[2], data[3], data[4], data[5]); data += 30; /* don't change datalength as the chips provided it */ gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); diff --git a/drivers/media/usb/gspca/finepix.c b/drivers/media/usb/gspca/finepix.c index 7bb469aa61a7..1ef1239eb3db 100644 --- a/drivers/media/usb/gspca/finepix.c +++ b/drivers/media/usb/gspca/finepix.c @@ -89,7 +89,7 @@ static void dostream(struct work_struct *work) int ret = 0; int len; - PDEBUG(D_STREAM, "dostream started"); + gspca_dbg(gspca_dev, D_STREAM, "dostream started\n"); /* loop reading a frame */ again: @@ -160,7 +160,7 @@ again: } out: - PDEBUG(D_STREAM, "dostream stopped"); + gspca_dbg(gspca_dev, D_STREAM, "dostream stopped\n"); } /* this function is called at probe time */ diff --git a/drivers/media/usb/gspca/gl860/gl860.c b/drivers/media/usb/gspca/gl860/gl860.c index add298cc9ab2..262200af76a3 100644 --- a/drivers/media/usb/gspca/gl860/gl860.c +++ b/drivers/media/usb/gspca/gl860/gl860.c @@ -661,7 +661,7 @@ static int gl860_guess_sensor(struct gspca_dev *gspca_dev, ctrl_out(gspca_dev, 0x40, 1, 0x006a, 0x000d, 0, NULL); msleep(56); - PDEBUG(D_PROBE, "probing for sensor MI2020 or OVXXXX"); + gspca_dbg(gspca_dev, D_PROBE, "probing for sensor MI2020 or OVXXXX\n"); nOV = 0; for (ntry = 0; ntry < 4; ntry++) { ctrl_out(gspca_dev, 0x40, 1, 0x0040, 0x0000, 0, NULL); @@ -671,14 +671,14 @@ static int gl860_guess_sensor(struct gspca_dev *gspca_dev, ctrl_out(gspca_dev, 0x40, 1, 0x7a00, 0x8030, 0, NULL); msleep(10); ctrl_in(gspca_dev, 0xc0, 2, 0x7a00, 0x8030, 1, &probe); - PDEBUG(D_PROBE, "probe=0x%02x", probe); + gspca_dbg(gspca_dev, D_PROBE, "probe=0x%02x\n", probe); if (probe == 0xff) nOV++; } if (nOV) { - PDEBUG(D_PROBE, "0xff -> OVXXXX"); - PDEBUG(D_PROBE, "probing for sensor OV2640 or OV9655"); + gspca_dbg(gspca_dev, D_PROBE, "0xff -> OVXXXX\n"); + gspca_dbg(gspca_dev, D_PROBE, "probing for sensor OV2640 or OV9655"); nb26 = nb96 = 0; for (ntry = 0; ntry < 4; ntry++) { @@ -694,22 +694,23 @@ static int gl860_guess_sensor(struct gspca_dev *gspca_dev, 1, &probe); if (probe == 0x26 || probe == 0x40) { - PDEBUG(D_PROBE, - "probe=0x%02x -> OV2640", - probe); + gspca_dbg(gspca_dev, D_PROBE, + "probe=0x%02x -> OV2640\n", + probe); sd->sensor = ID_OV2640; nb26 += 4; break; } if (probe == 0x96 || probe == 0x55) { - PDEBUG(D_PROBE, - "probe=0x%02x -> OV9655", - probe); + gspca_dbg(gspca_dev, D_PROBE, + "probe=0x%02x -> OV9655\n", + probe); sd->sensor = ID_OV9655; nb96 += 4; break; } - PDEBUG(D_PROBE, "probe=0x%02x", probe); + gspca_dbg(gspca_dev, D_PROBE, "probe=0x%02x\n", + probe); if (probe == 0x00) nb26++; if (probe == 0xff) @@ -719,21 +720,21 @@ static int gl860_guess_sensor(struct gspca_dev *gspca_dev, if (nb26 < 4 && nb96 < 4) return -1; } else { - PDEBUG(D_PROBE, "Not any 0xff -> MI2020"); + gspca_dbg(gspca_dev, D_PROBE, "Not any 0xff -> MI2020\n"); sd->sensor = ID_MI2020; } } if (_MI1320_) { - PDEBUG(D_PROBE, "05e3:f191 sensor MI1320 (1.3M)"); + gspca_dbg(gspca_dev, D_PROBE, "05e3:f191 sensor MI1320 (1.3M)\n"); } else if (_MI2020_) { - PDEBUG(D_PROBE, "05e3:0503 sensor MI2020 (2.0M)"); + gspca_dbg(gspca_dev, D_PROBE, "05e3:0503 sensor MI2020 (2.0M)\n"); } else if (_OV9655_) { - PDEBUG(D_PROBE, "05e3:0503 sensor OV9655 (1.3M)"); + gspca_dbg(gspca_dev, D_PROBE, "05e3:0503 sensor OV9655 (1.3M)\n"); } else if (_OV2640_) { - PDEBUG(D_PROBE, "05e3:0503 sensor OV2640 (2.0M)"); + gspca_dbg(gspca_dev, D_PROBE, "05e3:0503 sensor OV2640 (2.0M)\n"); } else { - PDEBUG(D_PROBE, "***** Unknown sensor *****"); + gspca_dbg(gspca_dev, D_PROBE, "***** Unknown sensor *****\n"); return -1; } diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c index da81cb3059be..101649770ef4 100644 --- a/drivers/media/usb/gspca/gspca.c +++ b/drivers/media/usb/gspca/gspca.c @@ -63,18 +63,18 @@ 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(debug, "%s %c%c%c%c %dx%d", - txt, - pixfmt & 0xff, - (pixfmt >> 8) & 0xff, - (pixfmt >> 16) & 0xff, - pixfmt >> 24, - w, h); + gspca_dbg(gspca_dev, debug, "%s %c%c%c%c %dx%d\n", + txt, + pixfmt & 0xff, + (pixfmt >> 8) & 0xff, + (pixfmt >> 16) & 0xff, + pixfmt >> 24, + w, h); } else { - PDEBUG(debug, "%s 0x%08x %dx%d", - txt, - pixfmt, - w, h); + gspca_dbg(gspca_dev, debug, "%s 0x%08x %dx%d\n", + txt, + pixfmt, + w, h); } } @@ -198,8 +198,8 @@ static int alloc_and_submit_int_urb(struct gspca_dev *gspca_dev, buffer_len = le16_to_cpu(ep->wMaxPacketSize); interval = ep->bInterval; - PDEBUG(D_CONF, "found int in endpoint: 0x%x, buffer_len=%u, interval=%u", - ep->bEndpointAddress, buffer_len, interval); + gspca_dbg(gspca_dev, D_CONF, "found int in endpoint: 0x%x, buffer_len=%u, interval=%u\n", + ep->bEndpointAddress, buffer_len, interval); dev = gspca_dev->dev; @@ -332,8 +332,8 @@ static void fill_frame(struct gspca_dev *gspca_dev, } /* let the packet be analyzed by the subdriver */ - PDEBUG(D_PACK, "packet [%d] o:%d l:%d", - i, urb->iso_frame_desc[i].offset, len); + gspca_dbg(gspca_dev, D_PACK, "packet [%d] o:%d l:%d\n", + i, urb->iso_frame_desc[i].offset, len); data = (u8 *) urb->transfer_buffer + urb->iso_frame_desc[i].offset; pkt_scan(gspca_dev, data, len); @@ -355,7 +355,7 @@ static void isoc_irq(struct urb *urb) { struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context; - PDEBUG(D_PACK, "isoc irq"); + gspca_dbg(gspca_dev, D_PACK, "isoc irq\n"); if (!gspca_dev->streaming) return; fill_frame(gspca_dev, urb); @@ -369,7 +369,7 @@ static void bulk_irq(struct urb *urb) struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context; int st; - PDEBUG(D_PACK, "bulk irq"); + gspca_dbg(gspca_dev, D_PACK, "bulk irq\n"); if (!gspca_dev->streaming) return; switch (urb->status) { @@ -387,7 +387,7 @@ static void bulk_irq(struct urb *urb) goto resubmit; } - PDEBUG(D_PACK, "packet l:%d", urb->actual_length); + gspca_dbg(gspca_dev, D_PACK, "packet l:%d\n", urb->actual_length); gspca_dev->sd_desc->pkt_scan(gspca_dev, urb->transfer_buffer, urb->actual_length); @@ -420,7 +420,7 @@ void gspca_frame_add(struct gspca_dev *gspca_dev, struct gspca_frame *frame; int i, j; - PDEBUG(D_PACK, "add t:%d l:%d", packet_type, len); + gspca_dbg(gspca_dev, D_PACK, "add t:%d l:%d\n", packet_type, len); if (packet_type == FIRST_PACKET) { i = atomic_read(&gspca_dev->fr_i); @@ -486,8 +486,8 @@ void gspca_frame_add(struct gspca_dev *gspca_dev, i = (i + 1) % GSPCA_MAX_FRAMES; atomic_set(&gspca_dev->fr_i, i); wake_up_interruptible(&gspca_dev->wq); /* event = new frame */ - PDEBUG(D_FRAM, "frame complete len:%d", - frame->v4l2_buf.bytesused); + gspca_dbg(gspca_dev, D_FRAM, "frame complete len:%d\n", + frame->v4l2_buf.bytesused); gspca_dev->image = NULL; gspca_dev->image_len = 0; } @@ -502,7 +502,7 @@ static int frame_alloc(struct gspca_dev *gspca_dev, struct file *file, int i; frsz = gspca_dev->pixfmt.sizeimage; - PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz); + gspca_dbg(gspca_dev, D_STREAM, "frame alloc frsz: %d\n", frsz); frsz = PAGE_ALIGN(frsz); if (count >= GSPCA_MAX_FRAMES) count = GSPCA_MAX_FRAMES - 1; @@ -537,7 +537,7 @@ static void frame_free(struct gspca_dev *gspca_dev) { int i; - PDEBUG(D_STREAM, "frame free"); + gspca_dbg(gspca_dev, D_STREAM, "frame free\n"); if (gspca_dev->frbuf != NULL) { vfree(gspca_dev->frbuf); gspca_dev->frbuf = NULL; @@ -555,7 +555,7 @@ static void destroy_urbs(struct gspca_dev *gspca_dev) struct urb *urb; unsigned int i; - PDEBUG(D_STREAM, "kill transfer"); + gspca_dbg(gspca_dev, D_STREAM, "kill transfer\n"); for (i = 0; i < MAX_NURBS; i++) { urb = gspca_dev->urb[i]; if (urb == NULL) @@ -596,7 +596,7 @@ static void gspca_stream_off(struct gspca_dev *gspca_dev) gspca_input_create_urb(gspca_dev); if (gspca_dev->sd_desc->stop0) gspca_dev->sd_desc->stop0(gspca_dev); - PDEBUG(D_STREAM, "stream off OK"); + gspca_dbg(gspca_dev, D_STREAM, "stream off OK\n"); } /* @@ -655,7 +655,7 @@ static u32 which_bandwidth(struct gspca_dev *gspca_dev) bandwidth *= 30; /* 30 fps */ } - PDEBUG(D_STREAM, "min bandwidth: %d", bandwidth); + gspca_dbg(gspca_dev, D_STREAM, "min bandwidth: %d\n", bandwidth); return bandwidth; } @@ -715,8 +715,8 @@ static int build_isoc_ep_tb(struct gspca_dev *gspca_dev, } if (!found) break; - PDEBUG(D_STREAM, "alt %d bandwidth %d", - ep_tb->alt, ep_tb->bandwidth); + gspca_dbg(gspca_dev, D_STREAM, "alt %d bandwidth %d\n", + ep_tb->alt, ep_tb->bandwidth); last_bw = ep_tb->bandwidth; i++; ep_tb++; @@ -734,7 +734,7 @@ static int build_isoc_ep_tb(struct gspca_dev *gspca_dev, gspca_dev->dev->speed == USB_SPEED_FULL && last_bw >= 1000000 && i > 1) { - PDEBUG(D_STREAM, "dev has usb audio, skipping highest alt"); + gspca_dbg(gspca_dev, D_STREAM, "dev has usb audio, skipping highest alt\n"); i--; ep_tb--; } @@ -774,16 +774,16 @@ static int create_urbs(struct gspca_dev *gspca_dev, if (npkt == 0) npkt = 32; /* default value */ bsize = psize * npkt; - PDEBUG(D_STREAM, - "isoc %d pkts size %d = bsize:%d", - npkt, psize, bsize); + gspca_dbg(gspca_dev, D_STREAM, + "isoc %d pkts size %d = bsize:%d\n", + npkt, psize, bsize); nurbs = DEF_NURBS; } else { /* bulk */ npkt = 0; bsize = gspca_dev->cam.bulk_size; if (bsize == 0) bsize = psize; - PDEBUG(D_STREAM, "bulk bsize:%d", bsize); + gspca_dbg(gspca_dev, D_STREAM, "bulk bsize:%d\n", bsize); if (gspca_dev->cam.bulk_nurbs != 0) nurbs = gspca_dev->cam.bulk_nurbs; else @@ -902,7 +902,8 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev) } } if (!gspca_dev->cam.no_urb_create) { - PDEBUG(D_STREAM, "init transfer alt %d", alt); + gspca_dbg(gspca_dev, D_STREAM, "init transfer alt %d\n", + alt); ret = create_urbs(gspca_dev, alt_xfer(&intf->altsetting[alt], xfer, gspca_dev->xfer_ep)); @@ -1285,7 +1286,7 @@ static int dev_open(struct file *file) struct gspca_dev *gspca_dev = video_drvdata(file); int ret; - PDEBUG(D_STREAM, "[%s] open", current->comm); + gspca_dbg(gspca_dev, D_STREAM, "[%s] open\n", current->comm); /* protect the subdriver against rmmod */ if (!try_module_get(gspca_dev->module)) @@ -1301,7 +1302,7 @@ static int dev_close(struct file *file) { struct gspca_dev *gspca_dev = video_drvdata(file); - PDEBUG(D_STREAM, "[%s] close", current->comm); + gspca_dbg(gspca_dev, D_STREAM, "[%s] close\n", current->comm); /* Needed for gspca_stream_off, always lock before queue_lock! */ if (mutex_lock_interruptible(&gspca_dev->usb_lock)) @@ -1322,7 +1323,7 @@ static int dev_close(struct file *file) mutex_unlock(&gspca_dev->queue_lock); mutex_unlock(&gspca_dev->usb_lock); - PDEBUG(D_STREAM, "close done"); + gspca_dbg(gspca_dev, D_STREAM, "close done\n"); return v4l2_fh_release(file); } @@ -1443,7 +1444,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, } out: mutex_unlock(&gspca_dev->queue_lock); - PDEBUG(D_STREAM, "reqbufs st:%d c:%d", ret, rb->count); + gspca_dbg(gspca_dev, D_STREAM, "reqbufs st:%d c:%d\n", ret, rb->count); return ret; } @@ -1601,7 +1602,8 @@ static int dev_mmap(struct file *file, struct vm_area_struct *vma) start = vma->vm_start; size = vma->vm_end - vma->vm_start; - PDEBUG(D_STREAM, "mmap start:%08x size:%d", (int) start, (int) size); + gspca_dbg(gspca_dev, D_STREAM, "mmap start:%08x size:%d\n", + (int) start, (int)size); if (mutex_lock_interruptible(&gspca_dev->queue_lock)) return -ERESTARTSYS; @@ -1613,7 +1615,7 @@ static int dev_mmap(struct file *file, struct vm_area_struct *vma) frame = NULL; for (i = 0; i < gspca_dev->nframes; ++i) { if (gspca_dev->frame[i].v4l2_buf.memory != V4L2_MEMORY_MMAP) { - PDEBUG(D_STREAM, "mmap bad memory type"); + gspca_dbg(gspca_dev, D_STREAM, "mmap bad memory type\n"); break; } if ((gspca_dev->frame[i].v4l2_buf.m.offset >> PAGE_SHIFT) @@ -1623,12 +1625,12 @@ static int dev_mmap(struct file *file, struct vm_area_struct *vma) } } if (frame == NULL) { - PDEBUG(D_STREAM, "mmap no frame buffer found"); + gspca_dbg(gspca_dev, D_STREAM, "mmap no frame buffer found\n"); ret = -EINVAL; goto out; } if (size != frame->v4l2_buf.length) { - PDEBUG(D_STREAM, "mmap bad size"); + gspca_dbg(gspca_dev, D_STREAM, "mmap bad size\n"); ret = -EINVAL; goto out; } @@ -1696,7 +1698,7 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct gspca_frame *frame; int i, j, ret; - PDEBUG(D_FRAM, "dqbuf"); + gspca_dbg(gspca_dev, D_FRAM, "dqbuf\n"); if (mutex_lock_interruptible(&gspca_dev->queue_lock)) return -ERESTARTSYS; @@ -1734,7 +1736,7 @@ static int vidioc_dqbuf(struct file *file, void *priv, frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_DONE; memcpy(v4l2_buf, &frame->v4l2_buf, sizeof *v4l2_buf); - PDEBUG(D_FRAM, "dqbuf %d", j); + gspca_dbg(gspca_dev, D_FRAM, "dqbuf %d\n", j); ret = 0; if (gspca_dev->memory == V4L2_MEMORY_USERPTR) { @@ -1772,27 +1774,27 @@ static int vidioc_qbuf(struct file *file, void *priv, struct gspca_frame *frame; int i, index, ret; - PDEBUG(D_FRAM, "qbuf %d", v4l2_buf->index); + gspca_dbg(gspca_dev, D_FRAM, "qbuf %d\n", v4l2_buf->index); if (mutex_lock_interruptible(&gspca_dev->queue_lock)) return -ERESTARTSYS; index = v4l2_buf->index; if ((unsigned) index >= gspca_dev->nframes) { - PDEBUG(D_FRAM, - "qbuf idx %d >= %d", index, gspca_dev->nframes); + gspca_dbg(gspca_dev, D_FRAM, + "qbuf idx %d >= %d\n", index, gspca_dev->nframes); ret = -EINVAL; goto out; } if (v4l2_buf->memory != gspca_dev->memory) { - PDEBUG(D_FRAM, "qbuf bad memory type"); + gspca_dbg(gspca_dev, D_FRAM, "qbuf bad memory type\n"); ret = -EINVAL; goto out; } frame = &gspca_dev->frame[index]; if (frame->v4l2_buf.flags & BUF_ALL_FLAGS) { - PDEBUG(D_FRAM, "qbuf bad state"); + gspca_dbg(gspca_dev, D_FRAM, "qbuf bad state\n"); ret = -EINVAL; goto out; } @@ -1826,7 +1828,7 @@ static int read_alloc(struct gspca_dev *gspca_dev, struct v4l2_buffer v4l2_buf; int i, ret; - PDEBUG(D_STREAM, "read alloc"); + gspca_dbg(gspca_dev, D_STREAM, "read alloc\n"); if (mutex_lock_interruptible(&gspca_dev->usb_lock)) return -ERESTARTSYS; @@ -1840,7 +1842,8 @@ static int read_alloc(struct gspca_dev *gspca_dev, rb.memory = GSPCA_MEMORY_READ; ret = vidioc_reqbufs(file, gspca_dev, &rb); if (ret != 0) { - PDEBUG(D_STREAM, "read reqbuf err %d", ret); + gspca_dbg(gspca_dev, D_STREAM, "read reqbuf err %d\n", + ret); goto out; } memset(&v4l2_buf, 0, sizeof v4l2_buf); @@ -1850,7 +1853,8 @@ static int read_alloc(struct gspca_dev *gspca_dev, v4l2_buf.index = i; ret = vidioc_qbuf(file, gspca_dev, &v4l2_buf); if (ret != 0) { - PDEBUG(D_STREAM, "read qbuf err: %d", ret); + gspca_dbg(gspca_dev, D_STREAM, "read qbuf err: %d\n", + ret); goto out; } } @@ -1859,7 +1863,7 @@ static int read_alloc(struct gspca_dev *gspca_dev, /* start streaming */ ret = vidioc_streamon(file, gspca_dev, V4L2_BUF_TYPE_VIDEO_CAPTURE); if (ret != 0) - PDEBUG(D_STREAM, "read streamon err %d", ret); + gspca_dbg(gspca_dev, D_STREAM, "read streamon err %d\n", ret); out: mutex_unlock(&gspca_dev->usb_lock); return ret; @@ -1871,7 +1875,7 @@ static unsigned int dev_poll(struct file *file, poll_table *wait) unsigned long req_events = poll_requested_events(wait); int ret = 0; - PDEBUG(D_FRAM, "poll"); + gspca_dbg(gspca_dev, D_FRAM, "poll\n"); if (req_events & POLLPRI) ret |= v4l2_ctrl_poll(file, wait); @@ -1913,7 +1917,7 @@ static ssize_t dev_read(struct file *file, char __user *data, struct timeval timestamp; int n, ret, ret2; - PDEBUG(D_FRAM, "read (%zd)", count); + gspca_dbg(gspca_dev, D_FRAM, "read (%zd)\n", count); if (gspca_dev->memory == GSPCA_MEMORY_NO) { /* first time ? */ ret = read_alloc(gspca_dev, file); if (ret != 0) @@ -1930,7 +1934,8 @@ static ssize_t dev_read(struct file *file, char __user *data, v4l2_buf.memory = GSPCA_MEMORY_READ; ret = vidioc_dqbuf(file, gspca_dev, &v4l2_buf); if (ret != 0) { - PDEBUG(D_STREAM, "read dqbuf err %d", ret); + gspca_dbg(gspca_dev, D_STREAM, "read dqbuf err %d\n", + ret); return ret; } @@ -1943,7 +1948,8 @@ static ssize_t dev_read(struct file *file, char __user *data, break; ret = vidioc_qbuf(file, gspca_dev, &v4l2_buf); if (ret != 0) { - PDEBUG(D_STREAM, "read qbuf err %d", ret); + gspca_dbg(gspca_dev, D_STREAM, "read qbuf err %d\n", + ret); return ret; } } @@ -2132,7 +2138,8 @@ int gspca_dev_probe2(struct usb_interface *intf, } usb_set_intfdata(intf, gspca_dev); - PDEBUG(D_PROBE, "%s created", video_device_node_name(&gspca_dev->vdev)); + gspca_dbg(gspca_dev, D_PROBE, "%s created\n", + video_device_node_name(&gspca_dev->vdev)); gspca_input_create_urb(gspca_dev); @@ -2187,8 +2194,8 @@ void gspca_disconnect(struct usb_interface *intf) struct input_dev *input_dev; #endif - PDEBUG(D_PROBE, "%s disconnect", - video_device_node_name(&gspca_dev->vdev)); + gspca_dbg(gspca_dev, D_PROBE, "%s disconnect\n", + video_device_node_name(&gspca_dev->vdev)); mutex_lock(&gspca_dev->usb_lock); diff --git a/drivers/media/usb/gspca/gspca.h b/drivers/media/usb/gspca/gspca.h index da65fef6aacc..249cb38a542f 100644 --- a/drivers/media/usb/gspca/gspca.h +++ b/drivers/media/usb/gspca/gspca.h @@ -26,8 +26,9 @@ extern int gspca_debug; -#define PDEBUG(level, fmt, ...) \ - v4l2_dbg(level, gspca_debug, &gspca_dev->v4l2_dev, fmt, ##__VA_ARGS__) +#define gspca_dbg(gspca_dev, level, fmt, ...) \ + v4l2_dbg(level, gspca_debug, &(gspca_dev)->v4l2_dev, \ + fmt, ##__VA_ARGS__) #define gspca_err(gspca_dev, fmt, ...) \ v4l2_err(&(gspca_dev)->v4l2_dev, fmt, ##__VA_ARGS__) diff --git a/drivers/media/usb/gspca/jeilinj.c b/drivers/media/usb/gspca/jeilinj.c index 7215c6879070..86d0a0a45631 100644 --- a/drivers/media/usb/gspca/jeilinj.c +++ b/drivers/media/usb/gspca/jeilinj.c @@ -273,17 +273,18 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, int packet_type; u32 header_marker; - PDEBUG(D_STREAM, "Got %d bytes out of %d for Block 0", - len, JEILINJ_MAX_TRANSFER); + gspca_dbg(gspca_dev, D_STREAM, "Got %d bytes out of %d for Block 0\n", + len, JEILINJ_MAX_TRANSFER); if (len != JEILINJ_MAX_TRANSFER) { - PDEBUG(D_PACK, "bad length"); + gspca_dbg(gspca_dev, D_PACK, "bad length\n"); goto discard; } /* check if it's start of frame */ header_marker = ((u32 *)data)[0]; if (header_marker == FRAME_START) { sd->blocks_left = data[0x0a] - 1; - PDEBUG(D_STREAM, "blocks_left = 0x%x", sd->blocks_left); + gspca_dbg(gspca_dev, D_STREAM, "blocks_left = 0x%x\n", + sd->blocks_left); /* Start a new frame, and add the JPEG header, first thing */ gspca_frame_add(gspca_dev, FIRST_PACKET, sd->jpeg_hdr, JPEG_HDR_SZ); @@ -292,8 +293,8 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, data + FRAME_HEADER_LEN, JEILINJ_MAX_TRANSFER - FRAME_HEADER_LEN); } else if (sd->blocks_left > 0) { - PDEBUG(D_STREAM, "%d blocks remaining for frame", - sd->blocks_left); + gspca_dbg(gspca_dev, D_STREAM, "%d blocks remaining for frame\n", + sd->blocks_left); sd->blocks_left -= 1; if (sd->blocks_left == 0) packet_type = LAST_PACKET; @@ -378,8 +379,8 @@ static int sd_start(struct gspca_dev *gspca_dev) gspca_dev->pixfmt.width, 0x21); /* JPEG 422 */ jpeg_set_qual(dev->jpeg_hdr, dev->quality); - PDEBUG(D_STREAM, "Start streaming at %dx%d", - gspca_dev->pixfmt.height, gspca_dev->pixfmt.width); + gspca_dbg(gspca_dev, D_STREAM, "Start streaming at %dx%d\n", + gspca_dev->pixfmt.height, gspca_dev->pixfmt.width); jlj_start(gspca_dev); return gspca_dev->usb_err; } diff --git a/drivers/media/usb/gspca/jl2005bcd.c b/drivers/media/usb/gspca/jl2005bcd.c index 17c7a953564c..d668589598d6 100644 --- a/drivers/media/usb/gspca/jl2005bcd.c +++ b/drivers/media/usb/gspca/jl2005bcd.c @@ -149,7 +149,8 @@ static int jl2005c_start_new_frame(struct gspca_dev *gspca_dev) return retval; i++; } - PDEBUG(D_FRAM, "frame_brightness is 0x%02x", gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_FRAM, "frame_brightness is 0x%02x\n", + gspca_dev->usb_buf[0]); return retval; } @@ -176,10 +177,11 @@ static int jl2005c_get_firmware_id(struct gspca_dev *gspca_dev) int retval = -1; unsigned char regs_to_read[] = {0x57, 0x02, 0x03, 0x5d, 0x5e, 0x5f}; - PDEBUG(D_PROBE, "Running jl2005c_get_firmware_id"); + gspca_dbg(gspca_dev, D_PROBE, "Running jl2005c_get_firmware_id\n"); /* Read the first ID byte once for warmup */ retval = jl2005c_read_reg(gspca_dev, regs_to_read[0]); - PDEBUG(D_PROBE, "response is %02x", gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_PROBE, "response is %02x\n", + gspca_dev->usb_buf[0]); if (retval < 0) return retval; /* Now actually get the ID string */ @@ -189,13 +191,13 @@ static int jl2005c_get_firmware_id(struct gspca_dev *gspca_dev) return retval; sd->firmware_id[i] = gspca_dev->usb_buf[0]; } - PDEBUG(D_PROBE, "firmware ID is %02x%02x%02x%02x%02x%02x", - sd->firmware_id[0], - sd->firmware_id[1], - sd->firmware_id[2], - sd->firmware_id[3], - sd->firmware_id[4], - sd->firmware_id[5]); + gspca_dbg(gspca_dev, D_PROBE, "firmware ID is %02x%02x%02x%02x%02x%02x\n", + sd->firmware_id[0], + sd->firmware_id[1], + sd->firmware_id[2], + sd->firmware_id[3], + sd->firmware_id[4], + sd->firmware_id[5]); return 0; } @@ -341,9 +343,9 @@ static void jl2005c_dostream(struct work_struct *work) usb_rcvbulkpipe(gspca_dev->dev, 0x82), buffer, JL2005C_MAX_TRANSFER, &act_len, JL2005C_DATA_TIMEOUT); - PDEBUG(D_PACK, - "Got %d bytes out of %d for header", - act_len, JL2005C_MAX_TRANSFER); + gspca_dbg(gspca_dev, D_PACK, + "Got %d bytes out of %d for header\n", + act_len, JL2005C_MAX_TRANSFER); if (ret < 0 || act_len < JL2005C_MAX_TRANSFER) goto quit_stream; /* Check whether we actually got the first blodk */ @@ -354,7 +356,8 @@ static void jl2005c_dostream(struct work_struct *work) /* total size to fetch is byte 7, times blocksize * of which we already got act_len */ bytes_left = buffer[0x07] * dev->block_size - act_len; - PDEBUG(D_PACK, "bytes_left = 0x%x", bytes_left); + gspca_dbg(gspca_dev, D_PACK, "bytes_left = 0x%x\n", + bytes_left); /* We keep the header. It has other information, too.*/ packet_type = FIRST_PACKET; gspca_frame_add(gspca_dev, packet_type, @@ -370,9 +373,9 @@ static void jl2005c_dostream(struct work_struct *work) JL2005C_DATA_TIMEOUT); if (ret < 0 || act_len < data_len) goto quit_stream; - PDEBUG(D_PACK, - "Got %d bytes out of %d for frame", - data_len, bytes_left); + gspca_dbg(gspca_dev, D_PACK, + "Got %d bytes out of %d for frame\n", + data_len, bytes_left); bytes_left -= data_len; if (bytes_left == 0) { packet_type = LAST_PACKET; @@ -449,19 +452,19 @@ static int sd_start(struct gspca_dev *gspca_dev) switch (gspca_dev->pixfmt.width) { case 640: - PDEBUG(D_STREAM, "Start streaming at vga resolution"); + gspca_dbg(gspca_dev, D_STREAM, "Start streaming at vga resolution\n"); jl2005c_stream_start_vga_lg(gspca_dev); break; case 320: - PDEBUG(D_STREAM, "Start streaming at qvga resolution"); + gspca_dbg(gspca_dev, D_STREAM, "Start streaming at qvga resolution\n"); jl2005c_stream_start_vga_small(gspca_dev); break; case 352: - PDEBUG(D_STREAM, "Start streaming at cif resolution"); + gspca_dbg(gspca_dev, D_STREAM, "Start streaming at cif resolution\n"); jl2005c_stream_start_cif_lg(gspca_dev); break; case 176: - PDEBUG(D_STREAM, "Start streaming at qcif resolution"); + gspca_dbg(gspca_dev, D_STREAM, "Start streaming at qcif resolution\n"); jl2005c_stream_start_cif_small(gspca_dev); break; default: diff --git a/drivers/media/usb/gspca/kinect.c b/drivers/media/usb/gspca/kinect.c index 2f28b38c5479..0cfdf8a1e19d 100644 --- a/drivers/media/usb/gspca/kinect.c +++ b/drivers/media/usb/gspca/kinect.c @@ -151,8 +151,9 @@ static int send_cmd(struct gspca_dev *gspca_dev, uint16_t cmd, void *cmdbuf, memcpy(obuf+sizeof(*chdr), cmdbuf, cmd_len); res = kinect_write(udev, obuf, cmd_len + sizeof(*chdr)); - PDEBUG(D_USBO, "Control cmd=%04x tag=%04x len=%04x: %d", cmd, - sd->cam_tag, cmd_len, res); + gspca_dbg(gspca_dev, D_USBO, "Control cmd=%04x tag=%04x len=%04x: %d\n", + cmd, + sd->cam_tag, cmd_len, res); if (res < 0) { pr_err("send_cmd: Output control transfer failed (%d)\n", res); return res; @@ -161,7 +162,7 @@ static int send_cmd(struct gspca_dev *gspca_dev, uint16_t cmd, void *cmdbuf, do { actual_len = kinect_read(udev, ibuf, 0x200); } while (actual_len == 0); - PDEBUG(D_USBO, "Control reply: %d", actual_len); + gspca_dbg(gspca_dev, D_USBO, "Control reply: %d\n", actual_len); if (actual_len < sizeof(*rhdr)) { pr_err("send_cmd: Input control transfer failed (%d)\n", actual_len); @@ -213,7 +214,7 @@ static int write_register(struct gspca_dev *gspca_dev, uint16_t reg, cmd[0] = cpu_to_le16(reg); cmd[1] = cpu_to_le16(data); - PDEBUG(D_USBO, "Write Reg 0x%04x <= 0x%02x", reg, data); + gspca_dbg(gspca_dev, D_USBO, "Write Reg 0x%04x <= 0x%02x\n", reg, data); res = send_cmd(gspca_dev, 0x03, cmd, 4, reply, 4); if (res < 0) return res; @@ -274,7 +275,7 @@ static int sd_config_depth(struct gspca_dev *gspca_dev, /* this function is called at probe and resume time */ static int sd_init(struct gspca_dev *gspca_dev) { - PDEBUG(D_PROBE, "Kinect Camera device."); + gspca_dbg(gspca_dev, D_PROBE, "Kinect Camera device.\n"); return 0; } diff --git a/drivers/media/usb/gspca/konica.c b/drivers/media/usb/gspca/konica.c index d51aca01167f..989ae997f66d 100644 --- a/drivers/media/usb/gspca/konica.c +++ b/drivers/media/usb/gspca/konica.c @@ -263,7 +263,7 @@ static void sd_isoc_irq(struct urb *urb) u8 *data; int i, st; - PDEBUG(D_PACK, "sd isoc irq"); + gspca_dbg(gspca_dev, D_PACK, "sd isoc irq\n"); if (!gspca_dev->streaming) return; diff --git a/drivers/media/usb/gspca/m5602/m5602_core.c b/drivers/media/usb/gspca/m5602/m5602_core.c index 4aab17efa4cc..b83ec4285a0b 100644 --- a/drivers/media/usb/gspca/m5602/m5602_core.c +++ b/drivers/media/usb/gspca/m5602/m5602_core.c @@ -66,8 +66,8 @@ int m5602_read_bridge(struct sd *sd, const u8 address, u8 *i2c_data) 1, M5602_URB_MSG_TIMEOUT); *i2c_data = buf[0]; - PDEBUG(D_CONF, "Reading bridge register 0x%x containing 0x%x", - address, *i2c_data); + gspca_dbg(gspca_dev, D_CONF, "Reading bridge register 0x%x containing 0x%x\n", + address, *i2c_data); /* usb_control_msg(...) returns the number of bytes sent upon success, mask that and return zero instead*/ @@ -82,8 +82,8 @@ int m5602_write_bridge(struct sd *sd, const u8 address, const u8 i2c_data) struct usb_device *udev = sd->gspca_dev.dev; __u8 *buf = sd->gspca_dev.usb_buf; - PDEBUG(D_CONF, "Writing bridge register 0x%x with 0x%x", - address, i2c_data); + gspca_dbg(gspca_dev, D_CONF, "Writing bridge register 0x%x with 0x%x\n", + address, i2c_data); memcpy(buf, bridge_urb_skeleton, sizeof(bridge_urb_skeleton)); @@ -154,8 +154,8 @@ int m5602_read_sensor(struct sd *sd, const u8 address, err = m5602_read_bridge(sd, M5602_XB_I2C_DATA, &(i2c_data[i])); - PDEBUG(D_CONF, "Reading sensor register 0x%x containing 0x%x ", - address, *i2c_data); + gspca_dbg(gspca_dev, D_CONF, "Reading sensor register 0x%x containing 0x%x\n", + address, *i2c_data); } return err; } @@ -187,8 +187,8 @@ int m5602_write_sensor(struct sd *sd, const u8 address, memcpy(p, sensor_urb_skeleton + 16, 4); p[3] = i2c_data[i]; p += 4; - PDEBUG(D_CONF, "Writing sensor register 0x%x with 0x%x", - address, i2c_data[i]); + gspca_dbg(gspca_dev, D_CONF, "Writing sensor register 0x%x with 0x%x\n", + address, i2c_data[i]); } /* Copy the tailer */ @@ -264,7 +264,7 @@ static int m5602_init(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; int err; - PDEBUG(D_CONF, "Initializing ALi m5602 webcam"); + gspca_dbg(gspca_dev, D_CONF, "Initializing ALi m5602 webcam\n"); /* Run the init sequence */ err = sd->sensor->init(sd); @@ -299,7 +299,7 @@ static int m5602_start_transfer(struct gspca_dev *gspca_dev) 0x04, 0x40, 0x19, 0x0000, buf, sizeof(buffer), M5602_URB_MSG_TIMEOUT); - PDEBUG(D_STREAM, "Transfer started"); + gspca_dbg(gspca_dev, D_STREAM, "Transfer started\n"); return (err < 0) ? err : 0; } @@ -309,14 +309,14 @@ static void m5602_urb_complete(struct gspca_dev *gspca_dev, struct sd *sd = (struct sd *) gspca_dev; if (len < 6) { - PDEBUG(D_PACK, "Packet is less than 6 bytes"); + gspca_dbg(gspca_dev, D_PACK, "Packet is less than 6 bytes\n"); return; } /* Frame delimiter: ff xx xx xx ff ff */ if (data[0] == 0xff && data[4] == 0xff && data[5] == 0xff && data[2] != sd->frame_id) { - PDEBUG(D_FRAM, "Frame delimiter detected"); + gspca_dbg(gspca_dev, D_FRAM, "Frame delimiter detected\n"); sd->frame_id = data[2]; /* Remove the extra fluff appended on each header */ @@ -331,8 +331,8 @@ static void m5602_urb_complete(struct gspca_dev *gspca_dev, /* Create a new frame */ gspca_frame_add(gspca_dev, FIRST_PACKET, data, len); - PDEBUG(D_FRAM, "Starting new frame %d", - sd->frame_count); + gspca_dbg(gspca_dev, D_FRAM, "Starting new frame %d\n", + sd->frame_count); } else { int cur_frame_len; @@ -343,8 +343,8 @@ static void m5602_urb_complete(struct gspca_dev *gspca_dev, len -= 4; if (cur_frame_len + len <= gspca_dev->frsz) { - PDEBUG(D_FRAM, "Continuing frame %d copying %d bytes", - sd->frame_count, len); + gspca_dbg(gspca_dev, D_FRAM, "Continuing frame %d copying %d bytes\n", + sd->frame_count, len); gspca_frame_add(gspca_dev, INTER_PACKET, data, len); diff --git a/drivers/media/usb/gspca/m5602/m5602_mt9m111.c b/drivers/media/usb/gspca/m5602/m5602_mt9m111.c index 7d01ddd7ed01..c9947c4a0f63 100644 --- a/drivers/media/usb/gspca/m5602/m5602_mt9m111.c +++ b/drivers/media/usb/gspca/m5602/m5602_mt9m111.c @@ -212,7 +212,7 @@ int mt9m111_probe(struct sd *sd) return -ENODEV; } - PDEBUG(D_PROBE, "Probing for a mt9m111 sensor"); + gspca_dbg(gspca_dev, D_PROBE, "Probing for a mt9m111 sensor\n"); /* Do the preinit */ for (i = 0; i < ARRAY_SIZE(preinit_mt9m111); i++) { @@ -375,11 +375,11 @@ int mt9m111_start(struct sd *sd) switch (width) { case 640: - PDEBUG(D_CONF, "Configuring camera for VGA mode"); + gspca_dbg(gspca_dev, D_CONF, "Configuring camera for VGA mode\n"); break; case 320: - PDEBUG(D_CONF, "Configuring camera for QVGA mode"); + gspca_dbg(gspca_dev, D_CONF, "Configuring camera for QVGA mode\n"); break; } return err; @@ -398,7 +398,8 @@ static int mt9m111_set_hvflip(struct gspca_dev *gspca_dev) int hflip; int vflip; - PDEBUG(D_CONF, "Set hvflip to %d %d", sd->hflip->val, sd->vflip->val); + gspca_dbg(gspca_dev, D_CONF, "Set hvflip to %d %d\n", + sd->hflip->val, sd->vflip->val); /* The mt9m111 is flipped by default */ hflip = !sd->hflip->val; @@ -439,7 +440,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_CONF, "Set auto white balance %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set auto white balance %d\n", val); return err; } @@ -472,8 +473,8 @@ static int mt9m111_set_gain(struct gspca_dev *gspca_dev, __s32 val) data[1] = (tmp & 0xff); data[0] = (tmp & 0xff00) >> 8; - PDEBUG(D_CONF, "tmp=%d, data[1]=%d, data[0]=%d", tmp, - data[1], data[0]); + gspca_dbg(gspca_dev, D_CONF, "tmp=%d, data[1]=%d, data[0]=%d\n", tmp, + data[1], data[0]); err = m5602_write_sensor(sd, MT9M111_SC_GLOBAL_GAIN, data, 2); @@ -490,7 +491,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_CONF, "Set green balance %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set green balance %d\n", val); err = m5602_write_sensor(sd, MT9M111_SC_GREEN_1_GAIN, data, 2); if (err < 0) @@ -508,7 +509,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_CONF, "Set blue balance %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set blue balance %d\n", val); return m5602_write_sensor(sd, MT9M111_SC_BLUE_GAIN, data, 2); @@ -522,7 +523,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_CONF, "Set red balance %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set red balance %d\n", 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 672b7a520695..aa1f569c82fd 100644 --- a/drivers/media/usb/gspca/m5602/m5602_ov7660.c +++ b/drivers/media/usb/gspca/m5602/m5602_ov7660.c @@ -330,7 +330,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_CONF, "Setting gain to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Setting gain to %d\n", val); err = m5602_write_sensor(sd, OV7660_GAIN, &i2c_data, 1); return err; @@ -343,7 +343,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_CONF, "Set auto white balance to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set auto white balance to %d\n", val); err = m5602_read_sensor(sd, OV7660_COM8, &i2c_data, 1); if (err < 0) @@ -361,7 +361,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_CONF, "Set auto gain control to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set auto gain control to %d\n", val); err = m5602_read_sensor(sd, OV7660_COM8, &i2c_data, 1); if (err < 0) @@ -379,7 +379,7 @@ static int ov7660_set_auto_exposure(struct gspca_dev *gspca_dev, u8 i2c_data; struct sd *sd = (struct sd *) gspca_dev; - PDEBUG(D_CONF, "Set auto exposure control to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set auto exposure control to %d\n", val); err = m5602_read_sensor(sd, OV7660_COM8, &i2c_data, 1); if (err < 0) @@ -397,7 +397,8 @@ static int ov7660_set_hvflip(struct gspca_dev *gspca_dev) u8 i2c_data; struct sd *sd = (struct sd *) gspca_dev; - PDEBUG(D_CONF, "Set hvflip to %d, %d", sd->hflip->val, sd->vflip->val); + gspca_dbg(gspca_dev, D_CONF, "Set hvflip to %d, %d\n", + 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 4544d3a1ad58..2ffbb54e89f9 100644 --- a/drivers/media/usb/gspca/m5602/m5602_ov9650.c +++ b/drivers/media/usb/gspca/m5602/m5602_ov9650.c @@ -311,7 +311,7 @@ int ov9650_probe(struct sd *sd) return -ENODEV; } - PDEBUG(D_PROBE, "Probing for an ov9650 sensor"); + gspca_dbg(gspca_dev, D_PROBE, "Probing for an ov9650 sensor\n"); /* Run the pre-init before probing the sensor */ for (i = 0; i < ARRAY_SIZE(preinit_ov9650) && !err; i++) { @@ -505,7 +505,7 @@ int ov9650_start(struct sd *sd) switch (width) { case 640: - PDEBUG(D_CONF, "Configuring camera for VGA mode"); + gspca_dbg(gspca_dev, D_CONF, "Configuring camera for VGA mode\n"); data = OV9650_VGA_SELECT | OV9650_RGB_SELECT | OV9650_RAW_RGB_SELECT; @@ -513,7 +513,7 @@ int ov9650_start(struct sd *sd) break; case 352: - PDEBUG(D_CONF, "Configuring camera for CIF mode"); + gspca_dbg(gspca_dev, D_CONF, "Configuring camera for CIF mode\n"); data = OV9650_CIF_SELECT | OV9650_RGB_SELECT | OV9650_RAW_RGB_SELECT; @@ -521,7 +521,7 @@ int ov9650_start(struct sd *sd) break; case 320: - PDEBUG(D_CONF, "Configuring camera for QVGA mode"); + gspca_dbg(gspca_dev, D_CONF, "Configuring camera for QVGA mode\n"); data = OV9650_QVGA_SELECT | OV9650_RGB_SELECT | OV9650_RAW_RGB_SELECT; @@ -529,7 +529,7 @@ int ov9650_start(struct sd *sd) break; case 176: - PDEBUG(D_CONF, "Configuring camera for QCIF mode"); + gspca_dbg(gspca_dev, D_CONF, "Configuring camera for QCIF mode\n"); data = OV9650_QCIF_SELECT | OV9650_RGB_SELECT | OV9650_RAW_RGB_SELECT; @@ -558,7 +558,7 @@ static int ov9650_set_exposure(struct gspca_dev *gspca_dev, __s32 val) u8 i2c_data; int err; - PDEBUG(D_CONF, "Set exposure to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set exposure to %d\n", val); /* The 6 MSBs */ i2c_data = (val >> 10) & 0x3f; @@ -586,7 +586,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_CONF, "Setting gain to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Setting gain to %d\n", val); /* The 2 MSB */ /* Read the OV9650_VREF register first to avoid @@ -614,7 +614,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_CONF, "Set red gain to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set red gain to %d\n", val); i2c_data = val & 0xff; err = m5602_write_sensor(sd, OV9650_RED, &i2c_data, 1); @@ -627,7 +627,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_CONF, "Set blue gain to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set blue gain to %d\n", val); i2c_data = val & 0xff; err = m5602_write_sensor(sd, OV9650_BLUE, &i2c_data, 1); @@ -642,7 +642,7 @@ static int ov9650_set_hvflip(struct gspca_dev *gspca_dev) int hflip = sd->hflip->val; int vflip = sd->vflip->val; - PDEBUG(D_CONF, "Set hvflip to %d %d", hflip, vflip); + gspca_dbg(gspca_dev, D_CONF, "Set hvflip to %d %d\n", hflip, vflip); if (dmi_check_system(ov9650_flip_dmi_table)) vflip = !vflip; @@ -666,7 +666,7 @@ static int ov9650_set_auto_exposure(struct gspca_dev *gspca_dev, u8 i2c_data; struct sd *sd = (struct sd *) gspca_dev; - PDEBUG(D_CONF, "Set auto exposure control to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set auto exposure control to %d\n", val); err = m5602_read_sensor(sd, OV9650_COM8, &i2c_data, 1); if (err < 0) @@ -685,7 +685,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_CONF, "Set auto white balance to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set auto white balance to %d\n", val); err = m5602_read_sensor(sd, OV9650_COM8, &i2c_data, 1); if (err < 0) @@ -703,7 +703,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_CONF, "Set auto gain control to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set auto gain control to %d\n", 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 a0a90dd34ca8..37d2891e5f5b 100644 --- a/drivers/media/usb/gspca/m5602/m5602_po1030.c +++ b/drivers/media/usb/gspca/m5602/m5602_po1030.c @@ -171,7 +171,7 @@ int po1030_probe(struct sd *sd) return -ENODEV; } - PDEBUG(D_PROBE, "Probing for a po1030 sensor"); + gspca_dbg(gspca_dev, D_PROBE, "Probing for a po1030 sensor\n"); /* Run the pre-init to actually probe the unit */ for (i = 0; i < ARRAY_SIZE(preinit_po1030); i++) { @@ -410,11 +410,11 @@ static int po1030_set_exposure(struct gspca_dev *gspca_dev, __s32 val) u8 i2c_data; int err; - PDEBUG(D_CONF, "Set exposure to %d", val & 0xffff); + gspca_dbg(gspca_dev, D_CONF, "Set exposure to %d\n", val & 0xffff); i2c_data = ((val & 0xff00) >> 8); - PDEBUG(D_CONF, "Set exposure to high byte to 0x%x", - i2c_data); + gspca_dbg(gspca_dev, D_CONF, "Set exposure to high byte to 0x%x\n", + i2c_data); err = m5602_write_sensor(sd, PO1030_INTEGLINES_H, &i2c_data, 1); @@ -422,8 +422,8 @@ static int po1030_set_exposure(struct gspca_dev *gspca_dev, __s32 val) return err; i2c_data = (val & 0xff); - PDEBUG(D_CONF, "Set exposure to low byte to 0x%x", - i2c_data); + gspca_dbg(gspca_dev, D_CONF, "Set exposure to low byte to 0x%x\n", + i2c_data); err = m5602_write_sensor(sd, PO1030_INTEGLINES_M, &i2c_data, 1); @@ -437,7 +437,7 @@ static int po1030_set_gain(struct gspca_dev *gspca_dev, __s32 val) int err; i2c_data = val & 0xff; - PDEBUG(D_CONF, "Set global gain to %d", i2c_data); + gspca_dbg(gspca_dev, D_CONF, "Set global gain to %d\n", i2c_data); err = m5602_write_sensor(sd, PO1030_GLOBALGAIN, &i2c_data, 1); return err; @@ -449,7 +449,8 @@ static int po1030_set_hvflip(struct gspca_dev *gspca_dev) u8 i2c_data; int err; - PDEBUG(D_CONF, "Set hvflip %d %d", sd->hflip->val, sd->vflip->val); + gspca_dbg(gspca_dev, D_CONF, "Set hvflip %d %d\n", + sd->hflip->val, sd->vflip->val); err = m5602_read_sensor(sd, PO1030_CONTROL2, &i2c_data, 1); if (err < 0) return err; @@ -470,7 +471,7 @@ static int po1030_set_red_balance(struct gspca_dev *gspca_dev, __s32 val) int err; i2c_data = val & 0xff; - PDEBUG(D_CONF, "Set red gain to %d", i2c_data); + gspca_dbg(gspca_dev, D_CONF, "Set red gain to %d\n", i2c_data); err = m5602_write_sensor(sd, PO1030_RED_GAIN, &i2c_data, 1); return err; @@ -483,7 +484,7 @@ static int po1030_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val) int err; i2c_data = val & 0xff; - PDEBUG(D_CONF, "Set blue gain to %d", i2c_data); + gspca_dbg(gspca_dev, D_CONF, "Set blue gain to %d\n", i2c_data); err = m5602_write_sensor(sd, PO1030_BLUE_GAIN, &i2c_data, 1); @@ -497,7 +498,7 @@ static int po1030_set_green_balance(struct gspca_dev *gspca_dev, __s32 val) int err; i2c_data = val & 0xff; - PDEBUG(D_CONF, "Set green gain to %d", i2c_data); + gspca_dbg(gspca_dev, D_CONF, "Set green gain to %d\n", i2c_data); err = m5602_write_sensor(sd, PO1030_GREEN_1_GAIN, &i2c_data, 1); @@ -519,7 +520,7 @@ static int po1030_set_auto_white_balance(struct gspca_dev *gspca_dev, if (err < 0) return err; - PDEBUG(D_CONF, "Set auto white balance to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set auto white balance to %d\n", val); i2c_data = (i2c_data & 0xfe) | (val & 0x01); err = m5602_write_sensor(sd, PO1030_AUTOCTRL1, &i2c_data, 1); return err; @@ -536,7 +537,7 @@ static int po1030_set_auto_exposure(struct gspca_dev *gspca_dev, if (err < 0) return err; - PDEBUG(D_CONF, "Set auto exposure to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set auto exposure to %d\n", 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 8447b9c5f8e0..cec4a5838aec 100644 --- a/drivers/media/usb/gspca/m5602/m5602_s5k4aa.c +++ b/drivers/media/usb/gspca/m5602/m5602_s5k4aa.c @@ -357,7 +357,7 @@ int s5k4aa_probe(struct sd *sd) return -ENODEV; } - PDEBUG(D_PROBE, "Probing for a s5k4aa sensor"); + gspca_dbg(gspca_dev, D_PROBE, "Probing for a s5k4aa sensor\n"); /* Preinit the sensor */ for (i = 0; i < ARRAY_SIZE(preinit_s5k4aa) && !err; i++) { @@ -419,7 +419,7 @@ int s5k4aa_start(struct sd *sd) switch (cam->cam_mode[sd->gspca_dev.curr_mode].width) { case 1280: - PDEBUG(D_CONF, "Configuring camera for SXGA mode"); + gspca_dbg(gspca_dev, D_CONF, "Configuring camera for SXGA mode\n"); for (i = 0; i < ARRAY_SIZE(SXGA_s5k4aa); i++) { switch (SXGA_s5k4aa[i][0]) { @@ -452,7 +452,7 @@ int s5k4aa_start(struct sd *sd) break; case 640: - PDEBUG(D_CONF, "Configuring camera for VGA mode"); + gspca_dbg(gspca_dev, D_CONF, "Configuring camera for VGA mode\n"); for (i = 0; i < ARRAY_SIZE(VGA_s5k4aa); i++) { switch (VGA_s5k4aa[i][0]) { @@ -568,7 +568,7 @@ static int s5k4aa_set_exposure(struct gspca_dev *gspca_dev, __s32 val) u8 data = S5K4AA_PAGE_MAP_2; int err; - PDEBUG(D_CONF, "Set exposure to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set exposure to %d\n", val); err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); if (err < 0) return err; @@ -590,7 +590,7 @@ static int s5k4aa_set_hvflip(struct gspca_dev *gspca_dev) int hflip = sd->hflip->val; int vflip = sd->vflip->val; - PDEBUG(D_CONF, "Set hvflip %d %d", hflip, vflip); + gspca_dbg(gspca_dev, D_CONF, "Set hvflip %d %d\n", hflip, vflip); err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); if (err < 0) return err; @@ -640,7 +640,7 @@ static int s5k4aa_set_gain(struct gspca_dev *gspca_dev, __s32 val) u8 data = S5K4AA_PAGE_MAP_2; int err; - PDEBUG(D_CONF, "Set gain to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set gain to %d\n", val); err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); if (err < 0) return err; @@ -657,7 +657,7 @@ static int s5k4aa_set_brightness(struct gspca_dev *gspca_dev, __s32 val) u8 data = S5K4AA_PAGE_MAP_2; int err; - PDEBUG(D_CONF, "Set brightness to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set brightness to %d\n", val); err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); if (err < 0) return err; @@ -672,7 +672,7 @@ static int s5k4aa_set_noise(struct gspca_dev *gspca_dev, __s32 val) u8 data = S5K4AA_PAGE_MAP_2; int err; - PDEBUG(D_CONF, "Set noise to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set noise to %d\n", 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 6ad8d4849680..3d8ab18138aa 100644 --- a/drivers/media/usb/gspca/m5602/m5602_s5k83a.c +++ b/drivers/media/usb/gspca/m5602/m5602_s5k83a.c @@ -187,7 +187,7 @@ int s5k83a_probe(struct sd *sd) return -ENODEV; } - PDEBUG(D_PROBE, "Probing for a s5k83a sensor"); + gspca_dbg(gspca_dev, D_PROBE, "Probing for a s5k83a sensor\n"); /* Preinit the sensor */ for (i = 0; i < ARRAY_SIZE(preinit_s5k83a) && !err; i++) { diff --git a/drivers/media/usb/gspca/mars.c b/drivers/media/usb/gspca/mars.c index 25df55e840c7..a537cb195c46 100644 --- a/drivers/media/usb/gspca/mars.c +++ b/drivers/media/usb/gspca/mars.c @@ -378,8 +378,8 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, || data[5 + p] == 0x65 || data[5 + p] == 0x66 || data[5 + p] == 0x67) { - PDEBUG(D_PACK, "sof offset: %d len: %d", - p, len); + gspca_dbg(gspca_dev, D_PACK, "sof offset: %d len: %d\n", + p, len); gspca_frame_add(gspca_dev, LAST_PACKET, data, p); diff --git a/drivers/media/usb/gspca/mr97310a.c b/drivers/media/usb/gspca/mr97310a.c index 34aacaee4453..bea196361215 100644 --- a/drivers/media/usb/gspca/mr97310a.c +++ b/drivers/media/usb/gspca/mr97310a.c @@ -221,10 +221,11 @@ static int cam_get_response16(struct gspca_dev *gspca_dev, u8 reg, int verbose) return err_code; if (verbose) - PDEBUG(D_PROBE, "Register: %02x reads %02x%02x%02x", reg, - gspca_dev->usb_buf[0], - gspca_dev->usb_buf[1], - gspca_dev->usb_buf[2]); + gspca_dbg(gspca_dev, D_PROBE, "Register: %02x reads %02x%02x%02x\n", + reg, + gspca_dev->usb_buf[0], + gspca_dev->usb_buf[1], + gspca_dev->usb_buf[2]); return 0; } @@ -413,8 +414,8 @@ static int sd_config(struct gspca_dev *gspca_dev, gspca_dev->usb_buf[1]); return -ENODEV; } - PDEBUG(D_PROBE, "MR97310A CIF camera detected, sensor: %d", - sd->sensor_type); + gspca_dbg(gspca_dev, D_PROBE, "MR97310A CIF camera detected, sensor: %d\n", + sd->sensor_type); } else { sd->cam_type = CAM_TYPE_VGA; @@ -458,7 +459,7 @@ static int sd_config(struct gspca_dev *gspca_dev, switch (gspca_dev->usb_buf[1]) { case 0x50: sd->sensor_type = 0; - PDEBUG(D_PROBE, "sensor_type corrected to 0"); + gspca_dbg(gspca_dev, D_PROBE, "sensor_type corrected to 0\n"); break; case 0x20: /* Nothing to do here. */ @@ -470,16 +471,16 @@ static int sd_config(struct gspca_dev *gspca_dev, pr_err("Please report this\n"); } } - PDEBUG(D_PROBE, "MR97310A VGA camera detected, sensor: %d", - sd->sensor_type); + gspca_dbg(gspca_dev, D_PROBE, "MR97310A VGA camera detected, sensor: %d\n", + sd->sensor_type); } /* Stop streaming as we've started it only to probe the sensor type. */ sd_stopN(gspca_dev); if (force_sensor_type != -1) { sd->sensor_type = !!force_sensor_type; - PDEBUG(D_PROBE, "Forcing sensor type to: %d", - sd->sensor_type); + gspca_dbg(gspca_dev, D_PROBE, "Forcing sensor type to: %d\n", + sd->sensor_type); } return 0; diff --git a/drivers/media/usb/gspca/nw80x.c b/drivers/media/usb/gspca/nw80x.c index 5d2d0bcb038d..bedc04a72e97 100644 --- a/drivers/media/usb/gspca/nw80x.c +++ b/drivers/media/usb/gspca/nw80x.c @@ -1543,10 +1543,11 @@ static void reg_w(struct gspca_dev *gspca_dev, if (gspca_dev->usb_err < 0) return; if (len == 1) - PDEBUG(D_USBO, "SET 00 0000 %04x %02x", index, *data); + gspca_dbg(gspca_dev, D_USBO, "SET 00 0000 %04x %02x\n", + index, *data); else - PDEBUG(D_USBO, "SET 00 0000 %04x %02x %02x ...", - index, *data, data[1]); + gspca_dbg(gspca_dev, D_USBO, "SET 00 0000 %04x %02x %02x ...\n", + index, *data, data[1]); memcpy(gspca_dev->usb_buf, data, len); ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 0x00, @@ -1583,12 +1584,12 @@ static void reg_r(struct gspca_dev *gspca_dev, return; } if (len == 1) - PDEBUG(D_USBI, "GET 00 0000 %04x %02x", - index, gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_USBI, "GET 00 0000 %04x %02x\n", + index, gspca_dev->usb_buf[0]); else - PDEBUG(D_USBI, "GET 00 0000 %04x %02x %02x ..", - index, gspca_dev->usb_buf[0], - gspca_dev->usb_buf[1]); + gspca_dbg(gspca_dev, D_USBI, "GET 00 0000 %04x %02x %02x ..\n", + index, gspca_dev->usb_buf[0], + gspca_dev->usb_buf[1]); } static void i2c_w(struct gspca_dev *gspca_dev, @@ -1762,8 +1763,8 @@ static int sd_config(struct gspca_dev *gspca_dev, sd->webcam = P35u; } else if (id->idVendor == 0x06a5 && id->idProduct == 0xd800) { reg_r(gspca_dev, 0x0403, 1); /* GPIO */ - PDEBUG(D_PROBE, "et31x110 sensor type %02x", - gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_PROBE, "et31x110 sensor type %02x\n", + gspca_dev->usb_buf[0]); switch (gspca_dev->usb_buf[0] >> 1) { case 0x00: /* ?? */ if (sd->webcam == Generic800) @@ -1785,7 +1786,8 @@ static int sd_config(struct gspca_dev *gspca_dev, gspca_dev->usb_err = -ENODEV; return gspca_dev->usb_err; } - PDEBUG(D_PROBE, "Bridge nw80%d - type: %d", sd->bridge, sd->webcam); + gspca_dbg(gspca_dev, D_PROBE, "Bridge nw80%d - type: %d\n", + sd->bridge, sd->webcam); if (sd->bridge == BRIDGE_NW800) { switch (sd->webcam) { diff --git a/drivers/media/usb/gspca/ov519.c b/drivers/media/usb/gspca/ov519.c index 14ffefbb5ac1..10fcbe9e8614 100644 --- a/drivers/media/usb/gspca/ov519.c +++ b/drivers/media/usb/gspca/ov519.c @@ -2016,8 +2016,8 @@ static void reg_w(struct sd *sd, u16 index, u16 value) req = 0x0a; /* fall through */ case BRIDGE_W9968CF: - PDEBUG(D_USBO, "SET %02x %04x %04x", - req, value, index); + gspca_dbg(gspca_dev, D_USBO, "SET %02x %04x %04x\n", + req, value, index); ret = usb_control_msg(sd->gspca_dev.dev, usb_sndctrlpipe(sd->gspca_dev.dev, 0), req, @@ -2028,8 +2028,8 @@ static void reg_w(struct sd *sd, u16 index, u16 value) req = 1; } - PDEBUG(D_USBO, "SET %02x 0000 %04x %02x", - req, index, value); + gspca_dbg(gspca_dev, D_USBO, "SET %02x 0000 %04x %02x\n", + req, index, value); sd->gspca_dev.usb_buf[0] = value; ret = usb_control_msg(sd->gspca_dev.dev, usb_sndctrlpipe(sd->gspca_dev.dev, 0), @@ -2078,8 +2078,8 @@ static int reg_r(struct sd *sd, u16 index) if (ret >= 0) { ret = sd->gspca_dev.usb_buf[0]; - PDEBUG(D_USBI, "GET %02x 0000 %04x %02x", - req, index, ret); + gspca_dbg(gspca_dev, D_USBI, "GET %02x 0000 %04x %02x\n", + req, index, ret); } else { gspca_err(gspca_dev, "reg_r %02x failed %d\n", index, ret); sd->gspca_dev.usb_err = ret; @@ -2175,7 +2175,7 @@ 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); + gspca_dbg(gspca_dev, D_USBO, "ov511_i2c_w %02x %02x\n", reg, value); /* Three byte write cycle */ for (retries = 6; ; ) { @@ -2198,7 +2198,7 @@ static void ov511_i2c_w(struct sd *sd, u8 reg, u8 value) if ((rc & 2) == 0) /* Ack? */ break; if (--retries < 0) { - PDEBUG(D_USBO, "i2c write retries exhausted"); + gspca_dbg(gspca_dev, D_USBO, "i2c write retries exhausted\n"); return; } } @@ -2231,7 +2231,7 @@ static int ov511_i2c_r(struct sd *sd, u8 reg) reg_w(sd, R511_I2C_CTL, 0x10); if (--retries < 0) { - PDEBUG(D_USBI, "i2c write retries exhausted"); + gspca_dbg(gspca_dev, D_USBI, "i2c write retries exhausted\n"); return -1; } } @@ -2255,14 +2255,14 @@ static int ov511_i2c_r(struct sd *sd, u8 reg) reg_w(sd, R511_I2C_CTL, 0x10); if (--retries < 0) { - PDEBUG(D_USBI, "i2c read retries exhausted"); + gspca_dbg(gspca_dev, D_USBI, "i2c read retries exhausted\n"); return -1; } } value = reg_r(sd, R51x_I2C_DATA); - PDEBUG(D_USBI, "ov511_i2c_r %02x %02x", reg, value); + gspca_dbg(gspca_dev, D_USBI, "ov511_i2c_r %02x %02x\n", reg, value); /* This is needed to make i2c_w() work */ reg_w(sd, R511_I2C_CTL, 0x05); @@ -2281,7 +2281,7 @@ static void ov518_i2c_w(struct sd *sd, { struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; - PDEBUG(D_USBO, "ov518_i2c_w %02x %02x", reg, value); + gspca_dbg(gspca_dev, D_USBO, "ov518_i2c_w %02x %02x\n", reg, value); /* Select camera register */ reg_w(sd, R51x_I2C_SADDR_3, reg); @@ -2321,7 +2321,7 @@ static int ov518_i2c_r(struct sd *sd, u8 reg) reg_r8(sd, R518_I2C_CTL); value = reg_r(sd, R51x_I2C_DATA); - PDEBUG(D_USBI, "ov518_i2c_r %02x %02x", reg, value); + gspca_dbg(gspca_dev, D_USBI, "ov518_i2c_r %02x %02x\n", reg, value); return value; } @@ -2344,7 +2344,7 @@ static void ovfx2_i2c_w(struct sd *sd, u8 reg, u8 value) sd->gspca_dev.usb_err = ret; } - PDEBUG(D_USBO, "ovfx2_i2c_w %02x %02x", reg, value); + gspca_dbg(gspca_dev, D_USBO, "ovfx2_i2c_w %02x %02x\n", reg, value); } static int ovfx2_i2c_r(struct sd *sd, u8 reg) @@ -2363,7 +2363,8 @@ static int ovfx2_i2c_r(struct sd *sd, u8 reg) if (ret >= 0) { ret = sd->gspca_dev.usb_buf[0]; - PDEBUG(D_USBI, "ovfx2_i2c_r %02x %02x", reg, ret); + gspca_dbg(gspca_dev, D_USBI, "ovfx2_i2c_r %02x %02x\n", + reg, ret); } else { gspca_err(gspca_dev, "ovfx2_i2c_r %02x failed %d\n", reg, ret); sd->gspca_dev.usb_err = ret; @@ -2464,7 +2465,7 @@ static inline void ov51x_stop(struct sd *sd) { struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; - PDEBUG(D_STREAM, "stopping"); + gspca_dbg(gspca_dev, D_STREAM, "stopping\n"); sd->stopped = 1; switch (sd->bridge) { case BRIDGE_OV511: @@ -2495,7 +2496,7 @@ static inline void ov51x_restart(struct sd *sd) { struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; - PDEBUG(D_STREAM, "restarting"); + gspca_dbg(gspca_dev, D_STREAM, "restarting\n"); if (!sd->stopped) return; sd->stopped = 0; @@ -2546,7 +2547,8 @@ static int init_ov_sensor(struct sd *sd, u8 slave) for (i = 0; i < i2c_detect_tries; i++) { if (i2c_r(sd, OV7610_REG_ID_HIGH) == 0x7f && i2c_r(sd, OV7610_REG_ID_LOW) == 0xa2) { - PDEBUG(D_PROBE, "I2C synced in %d attempt(s)", i); + gspca_dbg(gspca_dev, D_PROBE, "I2C synced in %d attempt(s)\n", + i); return 0; } @@ -2621,7 +2623,7 @@ static void ov_hires_configure(struct sd *sd) return; } - PDEBUG(D_PROBE, "starting ov hires configuration"); + gspca_dbg(gspca_dev, D_PROBE, "starting ov hires configuration\n"); /* Detect sensor (sub)type */ high = i2c_r(sd, 0x0a); @@ -2631,22 +2633,22 @@ static void ov_hires_configure(struct sd *sd) case 0x96: switch (low) { case 0x40: - PDEBUG(D_PROBE, "Sensor is a OV2610"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor is a OV2610\n"); sd->sensor = SEN_OV2610; return; case 0x41: - PDEBUG(D_PROBE, "Sensor is a OV2610AE"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor is a OV2610AE\n"); sd->sensor = SEN_OV2610AE; return; case 0xb1: - PDEBUG(D_PROBE, "Sensor is a OV9600"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor is a OV9600\n"); sd->sensor = SEN_OV9600; return; } break; case 0x36: if ((low & 0x0f) == 0x00) { - PDEBUG(D_PROBE, "Sensor is a OV3610"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor is a OV3610\n"); sd->sensor = SEN_OV3610; return; } @@ -2664,7 +2666,7 @@ static void ov8xx0_configure(struct sd *sd) struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int rc; - PDEBUG(D_PROBE, "starting ov8xx0 configuration"); + gspca_dbg(gspca_dev, D_PROBE, "starting ov8xx0 configuration\n"); /* Detect sensor (sub)type */ rc = i2c_r(sd, OV7610_REG_COM_I); @@ -2687,7 +2689,7 @@ 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"); + gspca_dbg(gspca_dev, D_PROBE, "starting OV7xx0 configuration\n"); /* Detect sensor (sub)type */ rc = i2c_r(sd, OV7610_REG_COM_I); @@ -2704,19 +2706,20 @@ static void ov7xx0_configure(struct sd *sd) low = i2c_r(sd, 0x0b); /* info("%x, %x", high, low); */ if (high == 0x76 && (low & 0xf0) == 0x70) { - PDEBUG(D_PROBE, "Sensor is an OV76%02x", low); + gspca_dbg(gspca_dev, D_PROBE, "Sensor is an OV76%02x\n", + low); sd->sensor = SEN_OV7670; } else { - PDEBUG(D_PROBE, "Sensor is an OV7610"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor is an OV7610\n"); sd->sensor = SEN_OV7610; } } else if ((rc & 3) == 1) { /* I don't know what's different about the 76BE yet. */ if (i2c_r(sd, 0x15) & 1) { - PDEBUG(D_PROBE, "Sensor is an OV7620AE"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor is an OV7620AE\n"); sd->sensor = SEN_OV7620AE; } else { - PDEBUG(D_PROBE, "Sensor is an OV76BE"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor is an OV76BE\n"); sd->sensor = SEN_OV76BE; } } else if ((rc & 3) == 0) { @@ -2738,19 +2741,19 @@ static void ov7xx0_configure(struct sd *sd) gspca_err(gspca_dev, "7630 is not supported by this driver\n"); return; case 0x40: - PDEBUG(D_PROBE, "Sensor is an OV7645"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor is an OV7645\n"); sd->sensor = SEN_OV7640; /* FIXME */ break; case 0x45: - PDEBUG(D_PROBE, "Sensor is an OV7645B"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor is an OV7645B\n"); sd->sensor = SEN_OV7640; /* FIXME */ break; case 0x48: - PDEBUG(D_PROBE, "Sensor is an OV7648"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor is an OV7648\n"); sd->sensor = SEN_OV7648; break; case 0x60: - PDEBUG(D_PROBE, "Sensor is a OV7660"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor is a OV7660\n"); sd->sensor = SEN_OV7660; break; default: @@ -2759,7 +2762,7 @@ static void ov7xx0_configure(struct sd *sd) return; } } else { - PDEBUG(D_PROBE, "Sensor is an OV7620"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor is an OV7620\n"); sd->sensor = SEN_OV7620; } } else { @@ -2774,7 +2777,7 @@ static void ov6xx0_configure(struct sd *sd) struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int rc; - PDEBUG(D_PROBE, "starting OV6xx0 configuration"); + gspca_dbg(gspca_dev, D_PROBE, "starting OV6xx0 configuration\n"); /* Detect sensor (sub)type */ rc = i2c_r(sd, OV7610_REG_COM_I); @@ -2793,15 +2796,15 @@ static void ov6xx0_configure(struct sd *sd) break; case 0x01: sd->sensor = SEN_OV6620; - PDEBUG(D_PROBE, "Sensor is an OV6620"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor is an OV6620\n"); break; case 0x02: sd->sensor = SEN_OV6630; - PDEBUG(D_PROBE, "Sensor is an OV66308AE"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor is an OV66308AE\n"); break; case 0x03: sd->sensor = SEN_OV66308AF; - PDEBUG(D_PROBE, "Sensor is an OV66308AF"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor is an OV66308AF\n"); break; case 0x90: sd->sensor = SEN_OV6630; @@ -2911,7 +2914,7 @@ static void ov51x_upload_quan_tables(struct sd *sd) unsigned char val0, val1; int i, size, reg = R51x_COMP_LUT_BEGIN; - PDEBUG(D_PROBE, "Uploading quantization tables"); + gspca_dbg(gspca_dev, D_PROBE, "Uploading quantization tables\n"); if (sd->bridge == BRIDGE_OV511 || sd->bridge == BRIDGE_OV511PLUS) { pYTable = yQuanTable511; @@ -2989,7 +2992,8 @@ static void ov511_configure(struct gspca_dev *gspca_dev) { 0x77, 0x04 }, }; - PDEBUG(D_PROBE, "Device custom id %x", reg_r(sd, R51x_SYS_CUST_ID)); + gspca_dbg(gspca_dev, D_PROBE, "Device custom id %x\n", + reg_r(sd, R51x_SYS_CUST_ID)); write_regvals(sd, init_511, ARRAY_SIZE(init_511)); @@ -3059,7 +3063,7 @@ static void ov518_configure(struct gspca_dev *gspca_dev) /* First 5 bits of custom ID reg are a revision ID on OV518 */ sd->revision = reg_r(sd, R51x_SYS_CUST_ID) & 0x1f; - PDEBUG(D_PROBE, "Device revision %d", sd->revision); + gspca_dbg(gspca_dev, D_PROBE, "Device revision %d\n", sd->revision); write_regvals(sd, init_518, ARRAY_SIZE(init_518)); @@ -3866,8 +3870,8 @@ static void ov519_mode_init_regs(struct sd *sd) } break; case SEN_OV7670: /* guesses, based on 7640 */ - PDEBUG(D_STREAM, "Setting framerate to %d fps", - (sd->frame_rate == 0) ? 15 : sd->frame_rate); + gspca_dbg(gspca_dev, D_STREAM, "Setting framerate to %d fps\n", + (sd->frame_rate == 0) ? 15 : sd->frame_rate); reg_w(sd, 0xa4, 0x10); switch (sd->frame_rate) { case 30: diff --git a/drivers/media/usb/gspca/ov534.c b/drivers/media/usb/gspca/ov534.c index bba2c5ce331c..f293921a1f2b 100644 --- a/drivers/media/usb/gspca/ov534.c +++ b/drivers/media/usb/gspca/ov534.c @@ -612,7 +612,7 @@ static void ov534_reg_write(struct gspca_dev *gspca_dev, u16 reg, u8 val) if (gspca_dev->usb_err < 0) return; - PDEBUG(D_USBO, "SET 01 0000 %04x %02x", reg, val); + gspca_dbg(gspca_dev, D_USBO, "SET 01 0000 %04x %02x\n", reg, val); gspca_dev->usb_buf[0] = val; ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), @@ -637,7 +637,8 @@ static u8 ov534_reg_read(struct gspca_dev *gspca_dev, u16 reg) 0x01, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x00, reg, gspca_dev->usb_buf, 1, CTRL_TIMEOUT); - PDEBUG(D_USBI, "GET 01 0000 %04x %02x", reg, gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_USBI, "GET 01 0000 %04x %02x\n", + reg, gspca_dev->usb_buf[0]); if (ret < 0) { pr_err("read failed %d\n", ret); gspca_dev->usb_err = ret; @@ -651,7 +652,7 @@ static void ov534_set_led(struct gspca_dev *gspca_dev, int status) { u8 data; - PDEBUG(D_CONF, "led status: %d", status); + gspca_dbg(gspca_dev, D_CONF, "led status: %d\n", status); data = ov534_reg_read(gspca_dev, 0x21); data |= 0x80; @@ -698,7 +699,7 @@ static int sccb_check_status(struct gspca_dev *gspca_dev) static void sccb_reg_write(struct gspca_dev *gspca_dev, u8 reg, u8 val) { - PDEBUG(D_USBO, "sccb write: %02x %02x", reg, val); + gspca_dbg(gspca_dev, D_USBO, "sccb write: %02x %02x\n", reg, val); ov534_reg_write(gspca_dev, OV534_REG_SUBADDR, reg); ov534_reg_write(gspca_dev, OV534_REG_WRITE, val); ov534_reg_write(gspca_dev, OV534_REG_OPERATION, OV534_OP_WRITE_3); @@ -800,7 +801,7 @@ static void set_frame_rate(struct gspca_dev *gspca_dev) sccb_reg_write(gspca_dev, 0x0d, r->r0d); ov534_reg_write(gspca_dev, 0xe5, r->re5); - PDEBUG(D_PROBE, "frame_rate: %d", r->fps); + gspca_dbg(gspca_dev, D_PROBE, "frame_rate: %d\n", r->fps); } static void sethue(struct gspca_dev *gspca_dev, s32 val) @@ -1283,7 +1284,7 @@ static int sd_init(struct gspca_dev *gspca_dev) sensor_id = sccb_reg_read(gspca_dev, 0x0a) << 8; sccb_reg_read(gspca_dev, 0x0b); sensor_id |= sccb_reg_read(gspca_dev, 0x0b); - PDEBUG(D_PROBE, "Sensor ID: %04x", sensor_id); + gspca_dbg(gspca_dev, D_PROBE, "Sensor ID: %04x\n", sensor_id); if ((sensor_id & 0xfff0) == 0x7670) { sd->sensor = SENSOR_OV767x; @@ -1407,19 +1408,19 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, /* Verify UVC header. Header length is always 12 */ if (data[0] != 12 || len < 12) { - PDEBUG(D_PACK, "bad header"); + gspca_dbg(gspca_dev, D_PACK, "bad header\n"); goto discard; } /* Check errors */ if (data[1] & UVC_STREAM_ERR) { - PDEBUG(D_PACK, "payload error"); + gspca_dbg(gspca_dev, D_PACK, "payload error\n"); goto discard; } /* Extract PTS and FID */ if (!(data[1] & UVC_STREAM_PTS)) { - PDEBUG(D_PACK, "PTS not present"); + gspca_dbg(gspca_dev, D_PACK, "PTS not present\n"); goto discard; } this_pts = (data[5] << 24) | (data[4] << 16) @@ -1442,7 +1443,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, && gspca_dev->image_len + len - 12 != gspca_dev->pixfmt.width * gspca_dev->pixfmt.height * 2) { - PDEBUG(D_PACK, "wrong sized frame"); + gspca_dbg(gspca_dev, D_PACK, "wrong sized frame\n"); goto discard; } gspca_frame_add(gspca_dev, LAST_PACKET, diff --git a/drivers/media/usb/gspca/ov534_9.c b/drivers/media/usb/gspca/ov534_9.c index b2a92e518118..3d1364d2f83e 100644 --- a/drivers/media/usb/gspca/ov534_9.c +++ b/drivers/media/usb/gspca/ov534_9.c @@ -1133,7 +1133,7 @@ static void reg_w_i(struct gspca_dev *gspca_dev, u16 reg, u8 val) static void reg_w(struct gspca_dev *gspca_dev, u16 reg, u8 val) { - PDEBUG(D_USBO, "reg_w [%04x] = %02x", reg, val); + gspca_dbg(gspca_dev, D_USBO, "reg_w [%04x] = %02x\n", reg, val); reg_w_i(gspca_dev, reg, val); } @@ -1149,7 +1149,8 @@ static u8 reg_r(struct gspca_dev *gspca_dev, u16 reg) 0x01, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x00, reg, gspca_dev->usb_buf, 1, CTRL_TIMEOUT); - PDEBUG(D_USBI, "reg_r [%04x] -> %02x", reg, gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_USBI, "reg_r [%04x] -> %02x\n", + reg, gspca_dev->usb_buf[0]); if (ret < 0) { pr_err("reg_r err %d\n", ret); gspca_dev->usb_err = ret; @@ -1174,9 +1175,9 @@ static int sccb_check_status(struct gspca_dev *gspca_dev) case 0x03: break; default: - PDEBUG(D_USBI|D_USBO, - "sccb status 0x%02x, attempt %d/5", - data, i + 1); + gspca_dbg(gspca_dev, D_USBI|D_USBO, + "sccb status 0x%02x, attempt %d/5\n", + data, i + 1); } } return 0; @@ -1184,7 +1185,7 @@ static int sccb_check_status(struct gspca_dev *gspca_dev) static void sccb_write(struct gspca_dev *gspca_dev, u8 reg, u8 val) { - PDEBUG(D_USBO, "sccb_write [%02x] = %02x", reg, val); + gspca_dbg(gspca_dev, D_USBO, "sccb_write [%02x] = %02x\n", reg, val); reg_w_i(gspca_dev, OV534_REG_SUBADDR, reg); reg_w_i(gspca_dev, OV534_REG_WRITE, val); reg_w_i(gspca_dev, OV534_REG_OPERATION, OV534_OP_WRITE_3); @@ -1238,7 +1239,7 @@ static void set_led(struct gspca_dev *gspca_dev, int status) { u8 data; - PDEBUG(D_CONF, "led status: %d", status); + gspca_dbg(gspca_dev, D_CONF, "led status: %d\n", status); data = reg_r(gspca_dev, 0x21); data |= 0x80; @@ -1423,7 +1424,7 @@ static int sd_init(struct gspca_dev *gspca_dev) sensor_id = sccb_read(gspca_dev, 0x0a) << 8; sccb_read(gspca_dev, 0x0b); sensor_id |= sccb_read(gspca_dev, 0x0b); - PDEBUG(D_PROBE, "Sensor ID: %04x", sensor_id); + gspca_dbg(gspca_dev, D_PROBE, "Sensor ID: %04x\n", sensor_id); /* initialize */ if ((sensor_id & 0xfff0) == 0x9650) { @@ -1651,19 +1652,19 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, /* Verify UVC header. Header length is always 12 */ if (data[0] != 12 || len < 12) { - PDEBUG(D_PACK, "bad header"); + gspca_dbg(gspca_dev, D_PACK, "bad header\n"); goto discard; } /* Check errors */ if (data[1] & UVC_STREAM_ERR) { - PDEBUG(D_PACK, "payload error"); + gspca_dbg(gspca_dev, D_PACK, "payload error\n"); goto discard; } /* Extract PTS and FID */ if (!(data[1] & UVC_STREAM_PTS)) { - PDEBUG(D_PACK, "PTS not present"); + gspca_dbg(gspca_dev, D_PACK, "PTS not present\n"); goto discard; } this_pts = (data[5] << 24) | (data[4] << 16) diff --git a/drivers/media/usb/gspca/pac207.c b/drivers/media/usb/gspca/pac207.c index 01c185d367e5..a1df7af8fef5 100644 --- a/drivers/media/usb/gspca/pac207.c +++ b/drivers/media/usb/gspca/pac207.c @@ -166,17 +166,17 @@ static int sd_config(struct gspca_dev *gspca_dev, idreg[1] = pac207_read_reg(gspca_dev, 0x0001); idreg[0] = ((idreg[0] & 0x0f) << 4) | ((idreg[1] & 0xf0) >> 4); idreg[1] = idreg[1] & 0x0f; - PDEBUG(D_PROBE, "Pixart Sensor ID 0x%02X Chips ID 0x%02X", - idreg[0], idreg[1]); + gspca_dbg(gspca_dev, D_PROBE, "Pixart Sensor ID 0x%02X Chips ID 0x%02X\n", + idreg[0], idreg[1]); if (idreg[0] != 0x27) { - PDEBUG(D_PROBE, "Error invalid sensor ID!"); + gspca_dbg(gspca_dev, D_PROBE, "Error invalid sensor ID!\n"); return -ENODEV; } - PDEBUG(D_PROBE, - "Pixart PAC207BCA Image Processor and Control Chip detected (vid/pid 0x%04X:0x%04X)", - id->idVendor, id->idProduct); + gspca_dbg(gspca_dev, D_PROBE, + "Pixart PAC207BCA Image Processor and Control Chip detected (vid/pid 0x%04X:0x%04X)\n", + id->idVendor, id->idProduct); cam = &gspca_dev->cam; cam->cam_mode = sif_mode; @@ -315,9 +315,9 @@ static int sd_start(struct gspca_dev *gspca_dev) mode = 0x02; if (gspca_dev->pixfmt.width == 176) { /* 176x144 */ mode |= 0x01; - PDEBUG(D_STREAM, "pac207_start mode 176x144"); + gspca_dbg(gspca_dev, D_STREAM, "pac207_start mode 176x144\n"); } else { /* 352x288 */ - PDEBUG(D_STREAM, "pac207_start mode 352x288"); + gspca_dbg(gspca_dev, D_STREAM, "pac207_start mode 352x288\n"); } pac207_write_reg(gspca_dev, 0x41, mode); diff --git a/drivers/media/usb/gspca/pac_common.h b/drivers/media/usb/gspca/pac_common.h index 4047bcb6c2b5..31f2a42af4dd 100644 --- a/drivers/media/usb/gspca/pac_common.h +++ b/drivers/media/usb/gspca/pac_common.h @@ -107,10 +107,9 @@ static unsigned char *pac_find_sof(struct gspca_dev *gspca_dev, u8 *sof_read, switch (m[i]) { case 0x96: /* Pattern found */ - PDEBUG(D_FRAM, - "SOF found, bytes to analyze: %u." - " Frame starts at byte #%u", - len, i + 1); + gspca_dbg(gspca_dev, D_FRAM, + "SOF found, bytes to analyze: %u - Frame starts at byte #%u\n", + len, i + 1); *sof_read = 0; return m + i + 1; break; diff --git a/drivers/media/usb/gspca/sn9c2028.c b/drivers/media/usb/gspca/sn9c2028.c index 469bc2ced1a3..a1f7189545e1 100644 --- a/drivers/media/usb/gspca/sn9c2028.c +++ b/drivers/media/usb/gspca/sn9c2028.c @@ -69,8 +69,9 @@ static int sn9c2028_command(struct gspca_dev *gspca_dev, u8 *command) { int rc; - PDEBUG(D_USBO, "sending command %02x%02x%02x%02x%02x%02x", command[0], - command[1], command[2], command[3], command[4], command[5]); + gspca_dbg(gspca_dev, D_USBO, "sending command %02x%02x%02x%02x%02x%02x\n", + command[0], command[1], command[2], + command[3], command[4], command[5]); memcpy(gspca_dev->usb_buf, command, 6); rc = usb_control_msg(gspca_dev->dev, @@ -100,7 +101,8 @@ static int sn9c2028_read1(struct gspca_dev *gspca_dev) pr_err("read1 error %d\n", rc); return (rc < 0) ? rc : -EIO; } - PDEBUG(D_USBI, "read1 response %02x", gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_USBI, "read1 response %02x\n", + gspca_dev->usb_buf[0]); return gspca_dev->usb_buf[0]; } @@ -117,8 +119,8 @@ static int sn9c2028_read4(struct gspca_dev *gspca_dev, u8 *reading) return (rc < 0) ? rc : -EIO; } memcpy(reading, gspca_dev->usb_buf, 4); - PDEBUG(D_USBI, "read4 response %02x%02x%02x%02x", reading[0], - reading[1], reading[2], reading[3]); + gspca_dbg(gspca_dev, D_USBI, "read4 response %02x%02x%02x%02x\n", + reading[0], reading[1], reading[2], reading[3]); return rc; } @@ -175,32 +177,32 @@ static int sd_config(struct gspca_dev *gspca_dev, struct sd *sd = (struct sd *) gspca_dev; struct cam *cam = &gspca_dev->cam; - PDEBUG(D_PROBE, "SN9C2028 camera detected (vid/pid 0x%04X:0x%04X)", - id->idVendor, id->idProduct); + gspca_dbg(gspca_dev, D_PROBE, "SN9C2028 camera detected (vid/pid 0x%04X:0x%04X)\n", + id->idVendor, id->idProduct); sd->model = id->idProduct; switch (sd->model) { case 0x7005: - PDEBUG(D_PROBE, "Genius Smart 300 camera"); + gspca_dbg(gspca_dev, D_PROBE, "Genius Smart 300 camera\n"); break; case 0x7003: - PDEBUG(D_PROBE, "Genius Videocam Live v2"); + gspca_dbg(gspca_dev, D_PROBE, "Genius Videocam Live v2\n"); break; case 0x8000: - PDEBUG(D_PROBE, "DC31VC"); + gspca_dbg(gspca_dev, D_PROBE, "DC31VC\n"); break; case 0x8001: - PDEBUG(D_PROBE, "Spy camera"); + gspca_dbg(gspca_dev, D_PROBE, "Spy camera\n"); break; case 0x8003: - PDEBUG(D_PROBE, "CIF camera"); + gspca_dbg(gspca_dev, D_PROBE, "CIF camera\n"); break; case 0x8008: - PDEBUG(D_PROBE, "Mini-Shotz ms-350 camera"); + gspca_dbg(gspca_dev, D_PROBE, "Mini-Shotz ms-350 camera\n"); break; case 0x800a: - PDEBUG(D_PROBE, "Vivitar 3350b type camera"); + gspca_dbg(gspca_dev, D_PROBE, "Vivitar 3350b type camera\n"); cam->input_flags = V4L2_IN_ST_VFLIP | V4L2_IN_ST_HFLIP; break; } diff --git a/drivers/media/usb/gspca/sn9c2028.h b/drivers/media/usb/gspca/sn9c2028.h index 85761aa7c8b2..29f1571f9242 100644 --- a/drivers/media/usb/gspca/sn9c2028.h +++ b/drivers/media/usb/gspca/sn9c2028.h @@ -43,10 +43,9 @@ static unsigned char *sn9c2028_find_sof(struct gspca_dev *gspca_dev, if (sd->sof_read == 12) sd->avg_lum = (m[i] << 8) + sd->avg_lum_l; if (sd->sof_read == sizeof(sn9c2028_sof_marker)) { - PDEBUG(D_FRAM, - "SOF found, bytes to analyze: %u." - " Frame starts at byte #%u", - len, i + 1); + gspca_dbg(gspca_dev, D_FRAM, + "SOF found, bytes to analyze: %u - Frame starts at byte #%u\n", + len, i + 1); sd->sof_read = 0; return m + i + 1; } diff --git a/drivers/media/usb/gspca/sn9c20x.c b/drivers/media/usb/gspca/sn9c20x.c index c605f78d6186..cfa2a04d9f3f 100644 --- a/drivers/media/usb/gspca/sn9c20x.c +++ b/drivers/media/usb/gspca/sn9c20x.c @@ -2153,7 +2153,7 @@ static void qual_upd(struct work_struct *work) /* To protect gspca_dev->usb_buf and gspca_dev->usb_err */ mutex_lock(&gspca_dev->usb_lock); - PDEBUG(D_STREAM, "qual_upd %d%%", qual); + gspca_dbg(gspca_dev, D_STREAM, "qual_upd %d%%\n", qual); gspca_dev->usb_err = 0; set_quality(gspca_dev, qual); mutex_unlock(&gspca_dev->usb_lock); diff --git a/drivers/media/usb/gspca/sonixj.c b/drivers/media/usb/gspca/sonixj.c index 9d7c3d8c226f..df8d8482b795 100644 --- a/drivers/media/usb/gspca/sonixj.c +++ b/drivers/media/usb/gspca/sonixj.c @@ -1166,7 +1166,8 @@ static void reg_r(struct gspca_dev *gspca_dev, value, 0, gspca_dev->usb_buf, len, 500); - PDEBUG(D_USBI, "reg_r [%02x] -> %02x", value, gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_USBI, "reg_r [%02x] -> %02x\n", + value, gspca_dev->usb_buf[0]); if (ret < 0) { pr_err("reg_r err %d\n", ret); gspca_dev->usb_err = ret; @@ -1181,7 +1182,7 @@ static void reg_w1(struct gspca_dev *gspca_dev, if (gspca_dev->usb_err < 0) return; - PDEBUG(D_USBO, "reg_w1 [%04x] = %02x", value, data); + gspca_dbg(gspca_dev, D_USBO, "reg_w1 [%04x] = %02x\n", value, data); gspca_dev->usb_buf[0] = data; ret = usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), @@ -1205,8 +1206,8 @@ static void reg_w(struct gspca_dev *gspca_dev, if (gspca_dev->usb_err < 0) return; - PDEBUG(D_USBO, "reg_w [%04x] = %02x %02x ..", - value, buffer[0], buffer[1]); + gspca_dbg(gspca_dev, D_USBO, "reg_w [%04x] = %02x %02x ..\n", + value, buffer[0], buffer[1]); if (len > USB_BUF_SZ) { gspca_err(gspca_dev, "reg_w: buffer overflow\n"); @@ -1235,7 +1236,7 @@ static void i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val) if (gspca_dev->usb_err < 0) return; - PDEBUG(D_USBO, "i2c_w1 [%02x] = %02x", reg, val); + gspca_dbg(gspca_dev, D_USBO, "i2c_w1 [%02x] = %02x\n", reg, val); switch (sd->sensor) { case SENSOR_ADCM1700: case SENSOR_OM6802: @@ -1276,8 +1277,8 @@ static void i2c_w8(struct gspca_dev *gspca_dev, if (gspca_dev->usb_err < 0) return; - PDEBUG(D_USBO, "i2c_w8 [%02x] = %02x ..", - buffer[2], buffer[3]); + gspca_dbg(gspca_dev, D_USBO, "i2c_w8 [%02x] = %02x ..\n", + buffer[2], buffer[3]); memcpy(gspca_dev->usb_buf, buffer, 8); ret = usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), @@ -1349,7 +1350,7 @@ static void hv7131r_probe(struct gspca_dev *gspca_dev) if (gspca_dev->usb_buf[0] == 0x02 /* chip ID (02 is R) */ && gspca_dev->usb_buf[1] == 0x09 && gspca_dev->usb_buf[2] == 0x01) { - PDEBUG(D_PROBE, "Sensor HV7131R found"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor HV7131R found\n"); return; } pr_warn("Erroneous HV7131R ID 0x%02x 0x%02x 0x%02x\n", @@ -1396,18 +1397,19 @@ static void mi0360_probe(struct gspca_dev *gspca_dev) return; switch (val) { case 0x8221: - PDEBUG(D_PROBE, "Sensor mi0360b"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor mi0360b\n"); sd->sensor = SENSOR_MI0360B; break; case 0x823a: - PDEBUG(D_PROBE, "Sensor mt9v111"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor mt9v111\n"); sd->sensor = SENSOR_MT9V111; break; case 0x8243: - PDEBUG(D_PROBE, "Sensor mi0360"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor mi0360\n"); break; default: - PDEBUG(D_PROBE, "Unknown sensor %04x - forced to mi0360", val); + gspca_dbg(gspca_dev, D_PROBE, "Unknown sensor %04x - forced to mi0360\n", + val); break; } } @@ -1432,10 +1434,10 @@ static void ov7630_probe(struct gspca_dev *gspca_dev) /*fixme: only valid for 0c45:613e?*/ gspca_dev->cam.input_flags = V4L2_IN_ST_VFLIP | V4L2_IN_ST_HFLIP; - PDEBUG(D_PROBE, "Sensor soi768"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor soi768\n"); return; } - PDEBUG(D_PROBE, "Sensor ov%04x", val); + gspca_dbg(gspca_dev, D_PROBE, "Sensor ov%04x\n", val); } static void ov7648_probe(struct gspca_dev *gspca_dev) @@ -1452,7 +1454,7 @@ static void ov7648_probe(struct gspca_dev *gspca_dev) reg_w1(gspca_dev, 0x01, 0x29); reg_w1(gspca_dev, 0x17, 0x42); if ((val & 0xff00) == 0x7600) { /* ov76xx */ - PDEBUG(D_PROBE, "Sensor ov%04x", val); + gspca_dbg(gspca_dev, D_PROBE, "Sensor ov%04x\n", val); return; } @@ -1467,7 +1469,7 @@ static void ov7648_probe(struct gspca_dev *gspca_dev) if (gspca_dev->usb_err < 0) return; if (val == 0x1030) { /* po1030 */ - PDEBUG(D_PROBE, "Sensor po1030"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor po1030\n"); sd->sensor = SENSOR_PO1030; return; } @@ -1490,7 +1492,7 @@ static void po2030n_probe(struct gspca_dev *gspca_dev) reg_w1(gspca_dev, 0x01, 0x29); /* reset */ reg_w1(gspca_dev, 0x17, 0x42); if (val == 0x99) { /* gc0307 (?) */ - PDEBUG(D_PROBE, "Sensor gc0307"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor gc0307\n"); sd->sensor = SENSOR_GC0307; return; } @@ -1506,7 +1508,7 @@ static void po2030n_probe(struct gspca_dev *gspca_dev) if (gspca_dev->usb_err < 0) return; if (val == 0x2030) { - PDEBUG(D_PROBE, "Sensor po2030n"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor po2030n\n"); /* sd->sensor = SENSOR_PO2030N; */ } else { pr_err("Unknown sensor ID %04x\n", val); @@ -1558,7 +1560,7 @@ static int sd_init(struct gspca_dev *gspca_dev) regF1 = gspca_dev->usb_buf[0]; if (gspca_dev->usb_err < 0) return gspca_dev->usb_err; - PDEBUG(D_PROBE, "Sonix chip id: %02x", regF1); + gspca_dbg(gspca_dev, D_PROBE, "Sonix chip id: %02x\n", regF1); if (gspca_dev->audio) regGpio[1] |= 0x04; /* with audio */ switch (sd->bridge) { @@ -1758,10 +1760,10 @@ static u32 expo_adjust(struct gspca_dev *gspca_dev, | ((expo & 0x0003) << 4); i2c_w8(gspca_dev, expoMo10); i2c_w8(gspca_dev, gainMo); - PDEBUG(D_FRAM, "set exposure %d", - ((expoMo10[3] & 0x07) << 10) - | (expoMof[3] << 2) - | ((expoMo10[3] & 0x30) >> 4)); + gspca_dbg(gspca_dev, D_FRAM, "set exposure %d\n", + ((expoMo10[3] & 0x07) << 10) + | (expoMof[3] << 2) + | ((expoMo10[3] & 0x30) >> 4)); break; } case SENSOR_MT9V111: { @@ -1789,7 +1791,7 @@ static u32 expo_adjust(struct gspca_dev *gspca_dev, gainOm[3] = expo >> 2; i2c_w8(gspca_dev, gainOm); reg_w1(gspca_dev, 0x96, expo >> 5); - PDEBUG(D_FRAM, "set exposure %d", gainOm[3]); + gspca_dbg(gspca_dev, D_FRAM, "set exposure %d\n", gainOm[3]); break; } } @@ -2162,7 +2164,7 @@ static void qual_upd(struct work_struct *work) /* To protect gspca_dev->usb_buf and gspca_dev->usb_err */ mutex_lock(&gspca_dev->usb_lock); - PDEBUG(D_STREAM, "qual_upd %d%%", sd->quality); + gspca_dbg(gspca_dev, D_STREAM, "qual_upd %d%%\n", sd->quality); gspca_dev->usb_err = 0; setjpegqual(gspca_dev); mutex_unlock(&gspca_dev->usb_lock); @@ -2584,7 +2586,7 @@ static void do_autogain(struct gspca_dev *gspca_dev) sd->ag_cnt = AG_CNT_START; delta = atomic_read(&sd->avg_lum); - PDEBUG(D_FRAM, "mean lum %d", delta); + gspca_dbg(gspca_dev, D_FRAM, "mean lum %d\n", delta); if (sd->sensor == SENSOR_PO2030N) { gspca_expo_autogain(gspca_dev, delta, luma_mean, luma_delta, diff --git a/drivers/media/usb/gspca/spca1528.c b/drivers/media/usb/gspca/spca1528.c index e53dd3c7066c..d25924e430f3 100644 --- a/drivers/media/usb/gspca/spca1528.c +++ b/drivers/media/usb/gspca/spca1528.c @@ -75,8 +75,8 @@ static void reg_r(struct gspca_dev *gspca_dev, index, gspca_dev->usb_buf, len, 500); - PDEBUG(D_USBI, "GET %02x 0000 %04x %02x", req, index, - gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_USBI, "GET %02x 0000 %04x %02x\n", req, index, + gspca_dev->usb_buf[0]); if (ret < 0) { pr_err("reg_r err %d\n", ret); gspca_dev->usb_err = ret; @@ -93,7 +93,7 @@ static void reg_w(struct gspca_dev *gspca_dev, if (gspca_dev->usb_err < 0) return; - PDEBUG(D_USBO, "SET %02x %04x %04x", req, value, index); + gspca_dbg(gspca_dev, D_USBO, "SET %02x %04x %04x\n", req, value, index); ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), req, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, @@ -116,7 +116,8 @@ static void reg_wb(struct gspca_dev *gspca_dev, if (gspca_dev->usb_err < 0) return; - PDEBUG(D_USBO, "SET %02x %04x %04x %02x", req, value, index, byte); + gspca_dbg(gspca_dev, D_USBO, "SET %02x %04x %04x %02x\n", + req, value, index, byte); gspca_dev->usb_buf[0] = byte; ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), req, @@ -216,8 +217,8 @@ static int sd_init(struct gspca_dev *gspca_dev) reg_r(gspca_dev, 0x20, 0x0000, 1); reg_r(gspca_dev, 0x20, 0x0000, 5); reg_r(gspca_dev, 0x23, 0x0000, 64); - PDEBUG(D_PROBE, "%s%s", &gspca_dev->usb_buf[0x1c], - &gspca_dev->usb_buf[0x30]); + gspca_dbg(gspca_dev, D_PROBE, "%s%s\n", &gspca_dev->usb_buf[0x1c], + &gspca_dev->usb_buf[0x30]); reg_r(gspca_dev, 0x23, 0x0001, 64); return gspca_dev->usb_err; } diff --git a/drivers/media/usb/gspca/spca500.c b/drivers/media/usb/gspca/spca500.c index b25960643f7b..e90d2f3b4a67 100644 --- a/drivers/media/usb/gspca/spca500.c +++ b/drivers/media/usb/gspca/spca500.c @@ -328,7 +328,8 @@ static int reg_w(struct gspca_dev *gspca_dev, { int ret; - PDEBUG(D_USBO, "reg write: [0x%02x] = 0x%02x", index, value); + gspca_dbg(gspca_dev, D_USBO, "reg write: [0x%02x] = 0x%02x\n", + index, value); ret = usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), req, @@ -423,15 +424,15 @@ static int spca50x_setup_qtable(struct gspca_dev *gspca_dev, static void spca500_ping310(struct gspca_dev *gspca_dev) { reg_r(gspca_dev, 0x0d04, 2); - PDEBUG(D_STREAM, "ClickSmart310 ping 0x0d04 0x%02x 0x%02x", - gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]); + gspca_dbg(gspca_dev, D_STREAM, "ClickSmart310 ping 0x0d04 0x%02x 0x%02x\n", + gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]); } static void spca500_clksmart310_init(struct gspca_dev *gspca_dev) { reg_r(gspca_dev, 0x0d05, 2); - PDEBUG(D_STREAM, "ClickSmart310 init 0x0d05 0x%02x 0x%02x", - gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]); + gspca_dbg(gspca_dev, D_STREAM, "ClickSmart310 init 0x0d05 0x%02x 0x%02x\n", + gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]); reg_w(gspca_dev, 0x00, 0x8167, 0x5a); spca500_ping310(gspca_dev); @@ -509,7 +510,8 @@ static int spca500_synch310(struct gspca_dev *gspca_dev) reg_r(gspca_dev, 0x0d00, 1); /* need alt setting here */ - PDEBUG(D_PACK, "ClickSmart310 sync alt: %d", gspca_dev->alt); + gspca_dbg(gspca_dev, D_PACK, "ClickSmart310 sync alt: %d\n", + gspca_dev->alt); /* Windoze use pipe with altsetting 6 why 7 here */ if (usb_set_interface(gspca_dev->dev, @@ -587,12 +589,12 @@ static int sd_init(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; /* initialisation of spca500 based cameras is deferred */ - PDEBUG(D_STREAM, "SPCA500 init"); + gspca_dbg(gspca_dev, D_STREAM, "SPCA500 init\n"); if (sd->subtype == LogitechClickSmart310) spca500_clksmart310_init(gspca_dev); /* else spca500_initialise(gspca_dev); */ - PDEBUG(D_STREAM, "SPCA500 init done"); + gspca_dbg(gspca_dev, D_STREAM, "SPCA500 init done\n"); return 0; } @@ -619,10 +621,10 @@ static int sd_start(struct gspca_dev *gspca_dev) /* is there a sensor here ? */ reg_r(gspca_dev, 0x8a04, 1); - PDEBUG(D_STREAM, "Spca500 Sensor Address 0x%02x", - gspca_dev->usb_buf[0]); - PDEBUG(D_STREAM, "Spca500 curr_mode: %d Xmult: 0x%02x, Ymult: 0x%02x", - gspca_dev->curr_mode, xmult, ymult); + gspca_dbg(gspca_dev, D_STREAM, "Spca500 Sensor Address 0x%02x\n", + gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_STREAM, "Spca500 curr_mode: %d Xmult: 0x%02x, Ymult: 0x%02x", + gspca_dev->curr_mode, xmult, ymult); /* setup qtable */ switch (sd->subtype) { @@ -820,8 +822,8 @@ static void sd_stopN(struct gspca_dev *gspca_dev) /* switch to video camera mode */ reg_w(gspca_dev, 0x00, 0x8000, 0x0004); reg_r(gspca_dev, 0x8000, 1); - PDEBUG(D_STREAM, "stop SPCA500 done reg8000: 0x%2x", - gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_STREAM, "stop SPCA500 done reg8000: 0x%2x\n", + gspca_dev->usb_buf[0]); } static void sd_pkt_scan(struct gspca_dev *gspca_dev, diff --git a/drivers/media/usb/gspca/spca501.c b/drivers/media/usb/gspca/spca501.c index 29861588302f..2cce74b166d8 100644 --- a/drivers/media/usb/gspca/spca501.c +++ b/drivers/media/usb/gspca/spca501.c @@ -1763,8 +1763,8 @@ static int reg_write(struct gspca_dev *gspca_dev, req, USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, index, NULL, 0, 500); - PDEBUG(D_USBO, "reg write: 0x%02x 0x%02x 0x%02x", - req, index, value); + gspca_dbg(gspca_dev, D_USBO, "reg write: 0x%02x 0x%02x 0x%02x\n", + req, index, value); if (ret < 0) pr_err("reg write: error %d\n", ret); return ret; @@ -1852,7 +1852,7 @@ static int sd_init(struct gspca_dev *gspca_dev) goto error; break; } - PDEBUG(D_STREAM, "Initializing SPCA501 finished"); + gspca_dbg(gspca_dev, D_STREAM, "Initializing SPCA501 finished\n"); return 0; error: return -EINVAL; diff --git a/drivers/media/usb/gspca/spca505.c b/drivers/media/usb/gspca/spca505.c index 02b5e2d81c64..07aae9cd5a30 100644 --- a/drivers/media/usb/gspca/spca505.c +++ b/drivers/media/usb/gspca/spca505.c @@ -551,8 +551,8 @@ static int reg_write(struct gspca_dev *gspca_dev, req, USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, index, NULL, 0, 500); - PDEBUG(D_USBO, "reg write: 0x%02x,0x%02x:0x%02x, %d", - req, index, value, ret); + gspca_dbg(gspca_dev, D_USBO, "reg write: 0x%02x,0x%02x:0x%02x, %d\n", + req, index, value, ret); if (ret < 0) pr_err("reg write: error %d\n", ret); return ret; diff --git a/drivers/media/usb/gspca/spca506.c b/drivers/media/usb/gspca/spca506.c index 843c93f5acf3..6332b3f0b918 100644 --- a/drivers/media/usb/gspca/spca506.c +++ b/drivers/media/usb/gspca/spca506.c @@ -126,7 +126,7 @@ static void spca506_SetNormeInput(struct gspca_dev *gspca_dev, __u8 setbit1 = 0x00; __u8 videomask = 0x00; - PDEBUG(D_STREAM, "** Open Set Norme **"); + gspca_dbg(gspca_dev, D_STREAM, "** Open Set Norme **\n"); spca506_Initi2c(gspca_dev); /* NTSC bit0 -> 1(525 l) PAL SECAM bit0 -> 0 (625 l) */ /* Composite channel bit1 -> 1 S-video bit 1 -> 0 */ @@ -153,8 +153,9 @@ static void spca506_SetNormeInput(struct gspca_dev *gspca_dev, sd->norme = norme; sd->channel = channel; - PDEBUG(D_STREAM, "Set Video Byte to 0x%2x", videomask); - PDEBUG(D_STREAM, "Set Norme: %08x Channel %d", norme, channel); + gspca_dbg(gspca_dev, D_STREAM, "Set Video Byte to 0x%2x\n", videomask); + gspca_dbg(gspca_dev, D_STREAM, "Set Norme: %08x Channel %d", + norme, channel); } static void spca506_GetNormeInput(struct gspca_dev *gspca_dev, @@ -166,7 +167,8 @@ static void spca506_GetNormeInput(struct gspca_dev *gspca_dev, we use your own copy in spca50x struct */ *norme = sd->norme; *channel = sd->channel; - PDEBUG(D_STREAM, "Get Norme: %d Channel %d", *norme, *channel); + gspca_dbg(gspca_dev, D_STREAM, "Get Norme: %d Channel %d\n", + *norme, *channel); } static void spca506_Setsize(struct gspca_dev *gspca_dev, __u16 code, @@ -174,7 +176,7 @@ static void spca506_Setsize(struct gspca_dev *gspca_dev, __u16 code, { struct usb_device *dev = gspca_dev->dev; - PDEBUG(D_STREAM, "** SetSize **"); + gspca_dbg(gspca_dev, D_STREAM, "** SetSize **\n"); reg_w(dev, 0x04, (0x18 | (code & 0x07)), 0x0000); /* Soft snap 0x40 Hard 0x41 */ reg_w(dev, 0x04, 0x41, 0x0001); @@ -317,7 +319,7 @@ static int sd_init(struct gspca_dev *gspca_dev) spca506_WriteI2c(gspca_dev, 0x00, 0x60); spca506_WriteI2c(gspca_dev, 0x05, 0x61); spca506_WriteI2c(gspca_dev, 0x9f, 0x62); - PDEBUG(D_STREAM, "** Close Init *"); + gspca_dbg(gspca_dev, D_STREAM, "** Close Init *\n"); return 0; } @@ -445,7 +447,7 @@ static int sd_start(struct gspca_dev *gspca_dev) reg_w(dev, 0x02, 0x01, 0x0000); reg_w(dev, 0x03, 0x12, 0x0000); reg_r(gspca_dev, 0x04, 0x0001, 2); - PDEBUG(D_STREAM, "webcam started"); + gspca_dbg(gspca_dev, D_STREAM, "webcam started\n"); spca506_GetNormeInput(gspca_dev, &norme, &channel); spca506_SetNormeInput(gspca_dev, norme, channel); return 0; diff --git a/drivers/media/usb/gspca/spca508.c b/drivers/media/usb/gspca/spca508.c index aafffaf1d2b5..d80fd397eaf2 100644 --- a/drivers/media/usb/gspca/spca508.c +++ b/drivers/media/usb/gspca/spca508.c @@ -1247,8 +1247,8 @@ static int reg_write(struct gspca_dev *gspca_dev, u16 index, u16 value) 0, /* request */ USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, index, NULL, 0, 500); - PDEBUG(D_USBO, "reg write i:0x%04x = 0x%02x", - index, value); + gspca_dbg(gspca_dev, D_USBO, "reg write i:0x%04x = 0x%02x\n", + index, value); if (ret < 0) pr_err("reg write: error %d\n", ret); return ret; @@ -1269,8 +1269,8 @@ static int reg_read(struct gspca_dev *gspca_dev, index, gspca_dev->usb_buf, 1, 500); /* timeout */ - PDEBUG(D_USBI, "reg read i:%04x --> %02x", - index, gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_USBI, "reg read i:%04x --> %02x\n", + index, gspca_dev->usb_buf[0]); if (ret < 0) { pr_err("reg_read err %d\n", ret); return ret; @@ -1366,14 +1366,17 @@ static int sd_config(struct gspca_dev *gspca_dev, * is a 508. */ data1 = reg_read(gspca_dev, 0x8104); data2 = reg_read(gspca_dev, 0x8105); - PDEBUG(D_PROBE, "Webcam Vendor ID: 0x%02x%02x", data2, data1); + gspca_dbg(gspca_dev, D_PROBE, "Webcam Vendor ID: 0x%02x%02x\n", + data2, data1); data1 = reg_read(gspca_dev, 0x8106); data2 = reg_read(gspca_dev, 0x8107); - PDEBUG(D_PROBE, "Webcam Product ID: 0x%02x%02x", data2, data1); + gspca_dbg(gspca_dev, D_PROBE, "Webcam Product ID: 0x%02x%02x\n", + data2, data1); data1 = reg_read(gspca_dev, 0x8621); - PDEBUG(D_PROBE, "Window 1 average luminance: %d", data1); + gspca_dbg(gspca_dev, D_PROBE, "Window 1 average luminance: %d\n", + data1); cam = &gspca_dev->cam; cam->cam_mode = sif_mode; diff --git a/drivers/media/usb/gspca/spca561.c b/drivers/media/usb/gspca/spca561.c index a75bd90bd9e3..f389a8d0937d 100644 --- a/drivers/media/usb/gspca/spca561.c +++ b/drivers/media/usb/gspca/spca561.c @@ -290,7 +290,8 @@ static void reg_w_val(struct gspca_dev *gspca_dev, __u16 index, __u8 value) 0, /* request */ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, index, NULL, 0, 500); - PDEBUG(D_USBO, "reg write: 0x%02x:0x%02x", index, value); + gspca_dbg(gspca_dev, D_USBO, "reg write: 0x%02x:0x%02x\n", + index, value); if (ret < 0) pr_err("reg write: error %d\n", ret); } @@ -420,7 +421,7 @@ static int sd_config(struct gspca_dev *gspca_dev, data2 = gspca_dev->usb_buf[0]; product = (data2 << 8) | data1; if (vendor != id->idVendor || product != id->idProduct) { - PDEBUG(D_PROBE, "Bad vendor / product from device"); + gspca_dbg(gspca_dev, D_PROBE, "Bad vendor / product from device\n"); return -EINVAL; } @@ -442,13 +443,13 @@ static int sd_config(struct gspca_dev *gspca_dev, /* this function is called at probe and resume time */ static int sd_init_12a(struct gspca_dev *gspca_dev) { - PDEBUG(D_STREAM, "Chip revision: 012a"); + gspca_dbg(gspca_dev, D_STREAM, "Chip revision: 012a\n"); init_161rev12A(gspca_dev); return 0; } static int sd_init_72a(struct gspca_dev *gspca_dev) { - PDEBUG(D_STREAM, "Chip revision: 072a"); + gspca_dbg(gspca_dev, D_STREAM, "Chip revision: 072a\n"); write_vector(gspca_dev, rev72a_reset); msleep(200); write_vector(gspca_dev, rev72a_init_data1); @@ -679,25 +680,16 @@ static void do_autogain(struct gspca_dev *gspca_dev) y = (77 * R + 75 * (Gr + Gb) + 29 * B) >> 8; /* u= (128*B-(43*(Gr+Gb+R))) >> 8; */ /* v= (128*R-(53*(Gr+Gb))-21*B) >> 8; */ - /* PDEBUG(D_CONF,"reading Y %d U %d V %d ",y,u,v); */ if (y < luma_mean - luma_delta || y > luma_mean + luma_delta) { expotimes = i2c_read(gspca_dev, 0x09, 0x10); pixelclk = 0x0800; expotimes = expotimes & 0x07ff; - /* PDEBUG(D_PACK, - "Exposition Times 0x%03X Clock 0x%04X ", - expotimes,pixelclk); */ gainG = i2c_read(gspca_dev, 0x35, 0x10); - /* PDEBUG(D_PACK, - "reading Gain register %d", gainG); */ expotimes += (luma_mean - y) >> spring; gainG += (luma_mean - y) / 50; - /* PDEBUG(D_PACK, - "compute expotimes %d gain %d", - expotimes,gainG); */ if (gainG > 0x3f) gainG = 0x3f; @@ -728,7 +720,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, /* This should never happen */ if (len < 2) { - gspca_err(gspca_dev, "Short SOF packet, ignoring\n"); + gspca_err(gspca_dev, "Short SOF packet, ignoring\n\n\n\n\n"); 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 948808305a6a..cc8ff41b8ab3 100644 --- a/drivers/media/usb/gspca/sq905.c +++ b/drivers/media/usb/gspca/sq905.c @@ -246,9 +246,9 @@ static void sq905_dostream(struct work_struct *work) ret = sq905_read_data(gspca_dev, buffer, data_len, 1); if (ret < 0) goto quit_stream; - PDEBUG(D_PACK, - "Got %d bytes out of %d for frame", - data_len, bytes_left); + gspca_dbg(gspca_dev, D_PACK, + "Got %d bytes out of %d for frame\n", + data_len, bytes_left); bytes_left -= data_len; data = buffer; if (!header_read) { @@ -345,7 +345,7 @@ static int sd_init(struct gspca_dev *gspca_dev) ret = sq905_command(gspca_dev, SQ905_CLEAR); if (ret < 0) return ret; - PDEBUG(D_CONF, "SQ905 camera ID %08x detected", ident); + gspca_dbg(gspca_dev, D_CONF, "SQ905 camera ID %08x detected\n", ident); gspca_dev->cam.cam_mode = sq905_mode; gspca_dev->cam.nmodes = ARRAY_SIZE(sq905_mode); if (!(ident & SQ905_HIRES_MASK)) @@ -369,15 +369,15 @@ static int sd_start(struct gspca_dev *gspca_dev) switch (gspca_dev->curr_mode) { default: /* case 2: */ - PDEBUG(D_STREAM, "Start streaming at high resolution"); + gspca_dbg(gspca_dev, D_STREAM, "Start streaming at high resolution\n"); ret = sq905_command(&dev->gspca_dev, SQ905_CAPTURE_HIGH); break; case 1: - PDEBUG(D_STREAM, "Start streaming at medium resolution"); + gspca_dbg(gspca_dev, D_STREAM, "Start streaming at medium resolution\n"); ret = sq905_command(&dev->gspca_dev, SQ905_CAPTURE_MED); break; case 0: - PDEBUG(D_STREAM, "Start streaming at low resolution"); + gspca_dbg(gspca_dev, D_STREAM, "Start streaming at low resolution\n"); ret = sq905_command(&dev->gspca_dev, SQ905_CAPTURE_LOW); } diff --git a/drivers/media/usb/gspca/sq905c.c b/drivers/media/usb/gspca/sq905c.c index 4fbfcf366f71..5e1269eb7c50 100644 --- a/drivers/media/usb/gspca/sq905c.c +++ b/drivers/media/usb/gspca/sq905c.c @@ -154,15 +154,16 @@ static void sq905c_dostream(struct work_struct *work) usb_rcvbulkpipe(gspca_dev->dev, 0x81), buffer, FRAME_HEADER_LEN, &act_len, SQ905C_DATA_TIMEOUT); - PDEBUG(D_STREAM, - "Got %d bytes out of %d for header", - act_len, FRAME_HEADER_LEN); + gspca_dbg(gspca_dev, D_STREAM, + "Got %d bytes out of %d for header\n", + act_len, FRAME_HEADER_LEN); if (ret < 0 || act_len < FRAME_HEADER_LEN) goto quit_stream; /* size is read from 4 bytes starting 0x40, little endian */ bytes_left = buffer[0x40]|(buffer[0x41]<<8)|(buffer[0x42]<<16) |(buffer[0x43]<<24); - PDEBUG(D_STREAM, "bytes_left = 0x%x", bytes_left); + gspca_dbg(gspca_dev, D_STREAM, "bytes_left = 0x%x\n", + bytes_left); /* We keep the header. It has other information, too. */ packet_type = FIRST_PACKET; gspca_frame_add(gspca_dev, packet_type, @@ -176,9 +177,9 @@ static void sq905c_dostream(struct work_struct *work) SQ905C_DATA_TIMEOUT); if (ret < 0 || act_len < data_len) goto quit_stream; - PDEBUG(D_STREAM, - "Got %d bytes out of %d for frame", - data_len, bytes_left); + gspca_dbg(gspca_dev, D_STREAM, + "Got %d bytes out of %d for frame\n", + data_len, bytes_left); bytes_left -= data_len; if (bytes_left == 0) packet_type = LAST_PACKET; @@ -205,9 +206,9 @@ static int sd_config(struct gspca_dev *gspca_dev, struct sd *dev = (struct sd *) gspca_dev; int ret; - PDEBUG(D_PROBE, - "SQ9050 camera detected (vid/pid 0x%04X:0x%04X)", - id->idVendor, id->idProduct); + gspca_dbg(gspca_dev, D_PROBE, + "SQ9050 camera detected (vid/pid 0x%04X:0x%04X)\n", + id->idVendor, id->idProduct); ret = sq905c_command(gspca_dev, SQ905C_GET_ID, 0); if (ret < 0) { @@ -221,9 +222,9 @@ static int sd_config(struct gspca_dev *gspca_dev, return ret; } /* Note we leave out the usb id and the manufacturing date */ - PDEBUG(D_PROBE, - "SQ9050 ID string: %02x - %*ph", - gspca_dev->usb_buf[3], 6, gspca_dev->usb_buf + 14); + gspca_dbg(gspca_dev, D_PROBE, + "SQ9050 ID string: %02x - %*ph\n", + gspca_dev->usb_buf[3], 6, gspca_dev->usb_buf + 14); cam->cam_mode = sq905c_mode; cam->nmodes = 2; @@ -267,13 +268,13 @@ static int sd_start(struct gspca_dev *gspca_dev) /* "Open the shutter" and set size, to start capture */ switch (gspca_dev->pixfmt.width) { case 640: - PDEBUG(D_STREAM, "Start streaming at high resolution"); + gspca_dbg(gspca_dev, D_STREAM, "Start streaming at high resolution\n"); dev->cap_mode++; ret = sq905c_command(gspca_dev, SQ905C_CAPTURE_HI, SQ905C_CAPTURE_INDEX); break; default: /* 320 */ - PDEBUG(D_STREAM, "Start streaming at medium resolution"); + gspca_dbg(gspca_dev, D_STREAM, "Start streaming at medium resolution\n"); ret = sq905c_command(gspca_dev, SQ905C_CAPTURE_MED, SQ905C_CAPTURE_INDEX); } diff --git a/drivers/media/usb/gspca/sq930x.c b/drivers/media/usb/gspca/sq930x.c index af48bd6dbe8c..d7cbcf2b3947 100644 --- a/drivers/media/usb/gspca/sq930x.c +++ b/drivers/media/usb/gspca/sq930x.c @@ -443,7 +443,7 @@ static void reg_w(struct gspca_dev *gspca_dev, u16 value, u16 index) if (gspca_dev->usb_err < 0) return; - PDEBUG(D_USBO, "reg_w v: %04x i: %04x", value, index); + gspca_dbg(gspca_dev, D_USBO, "reg_w v: %04x i: %04x\n", value, index); ret = usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), 0x0c, /* request */ @@ -464,8 +464,8 @@ static void reg_wb(struct gspca_dev *gspca_dev, u16 value, u16 index, if (gspca_dev->usb_err < 0) return; - PDEBUG(D_USBO, "reg_wb v: %04x i: %04x %02x...%02x", - value, index, *data, data[len - 1]); + gspca_dbg(gspca_dev, D_USBO, "reg_wb v: %04x i: %04x %02x...%02x\n", + value, index, *data, data[len - 1]); memcpy(gspca_dev->usb_buf, data, len); ret = usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), @@ -510,8 +510,8 @@ static void i2c_write(struct sd *sd, *buf++ = cmd->val; } - PDEBUG(D_USBO, "i2c_w v: %04x i: %04x %02x...%02x", - val, idx, gspca_dev->usb_buf[0], buf[-1]); + gspca_dbg(gspca_dev, D_USBO, "i2c_w v: %04x i: %04x %02x...%02x\n", + val, idx, gspca_dev->usb_buf[0], buf[-1]); ret = usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), 0x0c, /* request */ @@ -560,12 +560,12 @@ static void ucbus_write(struct gspca_dev *gspca_dev, *buf++ = cmd->bw_data; } if (buf != gspca_dev->usb_buf) - PDEBUG(D_USBO, "ucbus v: %04x i: %04x %02x...%02x", - val, idx, - gspca_dev->usb_buf[0], buf[-1]); + gspca_dbg(gspca_dev, D_USBO, "ucbus v: %04x i: %04x %02x...%02x\n", + val, idx, + gspca_dev->usb_buf[0], buf[-1]); else - PDEBUG(D_USBO, "ucbus v: %04x i: %04x", - val, idx); + gspca_dbg(gspca_dev, D_USBO, "ucbus v: %04x i: %04x\n", + val, idx); ret = usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), 0x0c, /* request */ @@ -691,7 +691,7 @@ static void mt9v111_init(struct gspca_dev *gspca_dev) || gspca_dev->usb_err != 0) break; if (--nwait < 0) { - PDEBUG(D_PROBE, "mt9v111_init timeout"); + gspca_dbg(gspca_dev, D_PROBE, "mt9v111_init timeout\n"); gspca_dev->usb_err = -ETIME; return; } @@ -857,7 +857,7 @@ static int sd_init(struct gspca_dev *gspca_dev) * 6: c8 / c9 / ca / cf = mode webcam?, sensor? webcam? * 7: 00 */ - PDEBUG(D_PROBE, "info: %*ph", 8, gspca_dev->usb_buf); + gspca_dbg(gspca_dev, D_PROBE, "info: %*ph\n", 8, gspca_dev->usb_buf); bridge_init(sd); @@ -870,7 +870,8 @@ static int sd_init(struct gspca_dev *gspca_dev) cmos_probe(gspca_dev); } if (gspca_dev->usb_err >= 0) { - PDEBUG(D_PROBE, "Sensor %s", sensor_tb[sd->sensor].name); + gspca_dbg(gspca_dev, D_PROBE, "Sensor %s\n", + sensor_tb[sd->sensor].name); global_init(sd, 1); } return gspca_dev->usb_err; diff --git a/drivers/media/usb/gspca/stk014.c b/drivers/media/usb/gspca/stk014.c index daf45db6c404..0d8f489ddef2 100644 --- a/drivers/media/usb/gspca/stk014.c +++ b/drivers/media/usb/gspca/stk014.c @@ -290,8 +290,8 @@ static int sd_start(struct gspca_dev *gspca_dev) set_par(gspca_dev, 0x01000000); set_par(gspca_dev, 0x01000000); if (gspca_dev->usb_err >= 0) - PDEBUG(D_STREAM, "camera started alt: 0x%02x", - gspca_dev->alt); + gspca_dbg(gspca_dev, D_STREAM, "camera started alt: 0x%02x\n", + gspca_dev->alt); out: return gspca_dev->usb_err; } @@ -312,7 +312,7 @@ static void sd_stopN(struct gspca_dev *gspca_dev) reg_w(gspca_dev, 0x0640, 0); reg_w(gspca_dev, 0x0650, 0); reg_w(gspca_dev, 0x0660, 0); - PDEBUG(D_STREAM, "camera stopped"); + gspca_dbg(gspca_dev, D_STREAM, "camera stopped\n"); } static void sd_pkt_scan(struct gspca_dev *gspca_dev, diff --git a/drivers/media/usb/gspca/stk1135.c b/drivers/media/usb/gspca/stk1135.c index 3ab5ec2ca4bd..6f52a480c2d8 100644 --- a/drivers/media/usb/gspca/stk1135.c +++ b/drivers/media/usb/gspca/stk1135.c @@ -67,7 +67,8 @@ static u8 reg_r(struct gspca_dev *gspca_dev, u16 index) gspca_dev->usb_buf, 1, 500); - PDEBUG(D_USBI, "reg_r 0x%x=0x%02x", index, gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_USBI, "reg_r 0x%x=0x%02x\n", + index, gspca_dev->usb_buf[0]); if (ret < 0) { pr_err("reg_r 0x%x err %d\n", index, ret); gspca_dev->usb_err = ret; @@ -93,7 +94,7 @@ static void reg_w(struct gspca_dev *gspca_dev, u16 index, u8 val) NULL, 0, 500); - PDEBUG(D_USBO, "reg_w 0x%x:=0x%02x", index, val); + gspca_dbg(gspca_dev, D_USBO, "reg_w 0x%x:=0x%02x\n", index, val); if (ret < 0) { pr_err("reg_w 0x%x err %d\n", index, ret); gspca_dev->usb_err = ret; @@ -468,8 +469,8 @@ static int sd_start(struct gspca_dev *gspca_dev) reg_w_mask(gspca_dev, STK1135_REG_SCTRL, 0x80, 0x80); if (gspca_dev->usb_err >= 0) - PDEBUG(D_STREAM, "camera started alt: 0x%02x", - gspca_dev->alt); + gspca_dbg(gspca_dev, D_STREAM, "camera started alt: 0x%02x\n", + gspca_dev->alt); sd->pkt_seq = 0; @@ -484,7 +485,7 @@ static void sd_stopN(struct gspca_dev *gspca_dev) stk1135_camera_disable(gspca_dev); - PDEBUG(D_STREAM, "camera stopped"); + gspca_dbg(gspca_dev, D_STREAM, "camera stopped\n"); } static void sd_pkt_scan(struct gspca_dev *gspca_dev, @@ -499,7 +500,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, u8 seq; if (len < 4) { - PDEBUG(D_PACK, "received short packet (less than 4 bytes)"); + gspca_dbg(gspca_dev, D_PACK, "received short packet (less than 4 bytes)\n"); return; } @@ -515,7 +516,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, if (!(hdr->flags & STK1135_HDR_FRAME_START)) { seq = hdr->seq & STK1135_HDR_SEQ_MASK; if (seq != sd->pkt_seq) { - PDEBUG(D_PACK, "received out-of-sequence packet"); + gspca_dbg(gspca_dev, D_PACK, "received out-of-sequence packet\n"); /* resync sequence and discard packet */ sd->pkt_seq = seq; gspca_dev->last_packet_type = DISCARD_PACKET; diff --git a/drivers/media/usb/gspca/stv0680.c b/drivers/media/usb/gspca/stv0680.c index 4ff6ae18d8dd..3ff5ed74bd9f 100644 --- a/drivers/media/usb/gspca/stv0680.c +++ b/drivers/media/usb/gspca/stv0680.c @@ -167,13 +167,13 @@ static int sd_config(struct gspca_dev *gspca_dev, return -ENODEV; } if (gspca_dev->usb_buf[7] & 0x01) - PDEBUG(D_PROBE, "Camera supports CIF mode"); + gspca_dbg(gspca_dev, D_PROBE, "Camera supports CIF mode\n"); if (gspca_dev->usb_buf[7] & 0x02) - PDEBUG(D_PROBE, "Camera supports VGA mode"); + gspca_dbg(gspca_dev, D_PROBE, "Camera supports VGA mode\n"); if (gspca_dev->usb_buf[7] & 0x04) - PDEBUG(D_PROBE, "Camera supports QCIF mode"); + gspca_dbg(gspca_dev, D_PROBE, "Camera supports QCIF mode\n"); if (gspca_dev->usb_buf[7] & 0x08) - PDEBUG(D_PROBE, "Camera supports QVGA mode"); + gspca_dbg(gspca_dev, D_PROBE, "Camera supports QVGA mode\n"); if (gspca_dev->usb_buf[7] & 0x01) sd->video_mode = 0x00; /* CIF */ @@ -181,12 +181,12 @@ static int sd_config(struct gspca_dev *gspca_dev, sd->video_mode = 0x03; /* QVGA */ /* FW rev, ASIC rev, sensor ID */ - PDEBUG(D_PROBE, "Firmware rev is %i.%i", - gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]); - PDEBUG(D_PROBE, "ASIC rev is %i.%i", - gspca_dev->usb_buf[2], gspca_dev->usb_buf[3]); - PDEBUG(D_PROBE, "Sensor ID is %i", - (gspca_dev->usb_buf[4]*16) + (gspca_dev->usb_buf[5]>>4)); + gspca_dbg(gspca_dev, D_PROBE, "Firmware rev is %i.%i\n", + gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]); + gspca_dbg(gspca_dev, D_PROBE, "ASIC rev is %i.%i", + gspca_dev->usb_buf[2], gspca_dev->usb_buf[3]); + gspca_dbg(gspca_dev, D_PROBE, "Sensor ID is %i", + (gspca_dev->usb_buf[4]*16) + (gspca_dev->usb_buf[5]>>4)); ret = stv0680_get_video_mode(gspca_dev); diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx.c b/drivers/media/usb/gspca/stv06xx/stv06xx.c index 3db1c24b3d6d..2715218fe436 100644 --- a/drivers/media/usb/gspca/stv06xx/stv06xx.c +++ b/drivers/media/usb/gspca/stv06xx/stv06xx.c @@ -51,8 +51,8 @@ int stv06xx_write_bridge(struct sd *sd, u16 address, u16 i2c_data) 0x04, 0x40, address, 0, buf, len, STV06XX_URB_MSG_TIMEOUT); - PDEBUG(D_CONF, "Written 0x%x to address 0x%x, status: %d", - i2c_data, address, err); + gspca_dbg(gspca_dev, D_CONF, "Written 0x%x to address 0x%x, status: %d\n", + i2c_data, address, err); return (err < 0) ? err : 0; } @@ -70,8 +70,8 @@ int stv06xx_read_bridge(struct sd *sd, u16 address, u8 *i2c_data) *i2c_data = buf[0]; - PDEBUG(D_CONF, "Reading 0x%x from address 0x%x, status %d", - *i2c_data, address, err); + gspca_dbg(gspca_dev, D_CONF, "Reading 0x%x from address 0x%x, status %d\n", + *i2c_data, address, err); return (err < 0) ? err : 0; } @@ -113,15 +113,16 @@ int stv06xx_write_sensor_bytes(struct sd *sd, const u8 *data, u8 len) struct usb_device *udev = sd->gspca_dev.dev; __u8 *buf = sd->gspca_dev.usb_buf; - PDEBUG(D_CONF, "I2C: Command buffer contains %d entries", len); + gspca_dbg(gspca_dev, D_CONF, "I2C: Command buffer contains %d entries\n", + len); for (i = 0; i < len;) { /* Build the command buffer */ memset(buf, 0, I2C_BUFFER_LENGTH); for (j = 0; j < I2C_MAX_BYTES && i < len; j++, i++) { buf[j] = data[2*i]; buf[0x10 + j] = data[2*i+1]; - PDEBUG(D_CONF, "I2C: Writing 0x%02x to reg 0x%02x", - data[2*i+1], data[2*i]); + gspca_dbg(gspca_dev, D_CONF, "I2C: Writing 0x%02x to reg 0x%02x\n", + data[2*i+1], data[2*i]); } buf[0x20] = sd->sensor->i2c_addr; buf[0x21] = j - 1; /* Number of commands to send - 1 */ @@ -143,7 +144,8 @@ int stv06xx_write_sensor_words(struct sd *sd, const u16 *data, u8 len) struct usb_device *udev = sd->gspca_dev.dev; __u8 *buf = sd->gspca_dev.usb_buf; - PDEBUG(D_CONF, "I2C: Command buffer contains %d entries", len); + gspca_dbg(gspca_dev, D_CONF, "I2C: Command buffer contains %d entries\n", + len); for (i = 0; i < len;) { /* Build the command buffer */ @@ -152,8 +154,8 @@ int stv06xx_write_sensor_words(struct sd *sd, const u16 *data, u8 len) buf[j] = data[2*i]; buf[0x10 + j * 2] = data[2*i+1]; buf[0x10 + j * 2 + 1] = data[2*i+1] >> 8; - PDEBUG(D_CONF, "I2C: Writing 0x%04x to reg 0x%02x", - data[2*i+1], data[2*i]); + gspca_dbg(gspca_dev, D_CONF, "I2C: Writing 0x%04x to reg 0x%02x\n", + data[2*i+1], data[2*i]); } buf[0x20] = sd->sensor->i2c_addr; buf[0x21] = j - 1; /* Number of commands to send - 1 */ @@ -205,8 +207,8 @@ int stv06xx_read_sensor(struct sd *sd, const u8 address, u16 *value) else *value = buf[0]; - PDEBUG(D_CONF, "I2C: Read 0x%x from address 0x%x, status: %d", - *value, address, err); + gspca_dbg(gspca_dev, D_CONF, "I2C: Read 0x%x from address 0x%x, status: %d\n", + *value, address, err); return (err < 0) ? err : 0; } @@ -249,7 +251,7 @@ static int stv06xx_init(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; int err; - PDEBUG(D_PROBE, "Initializing camera"); + gspca_dbg(gspca_dev, D_PROBE, "Initializing camera\n"); /* Let the usb init settle for a bit before performing the initialization */ @@ -268,7 +270,7 @@ static int stv06xx_init_controls(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - PDEBUG(D_PROBE, "Initializing controls"); + gspca_dbg(gspca_dev, D_PROBE, "Initializing controls\n"); gspca_dev->vdev.ctrl_handler = &gspca_dev->ctrl_handler; return sd->sensor->init_controls(sd); @@ -304,9 +306,9 @@ static int stv06xx_start(struct gspca_dev *gspca_dev) out: if (err < 0) - PDEBUG(D_STREAM, "Starting stream failed"); + gspca_dbg(gspca_dev, D_STREAM, "Starting stream failed\n"); else - PDEBUG(D_STREAM, "Started streaming"); + gspca_dbg(gspca_dev, D_STREAM, "Started streaming\n"); return (err < 0) ? err : 0; } @@ -362,9 +364,9 @@ static void stv06xx_stopN(struct gspca_dev *gspca_dev) out: if (err < 0) - PDEBUG(D_STREAM, "Failed to stop stream"); + gspca_dbg(gspca_dev, D_STREAM, "Failed to stop stream\n"); else - PDEBUG(D_STREAM, "Stopped streaming"); + gspca_dbg(gspca_dev, D_STREAM, "Stopped streaming\n"); } /* @@ -385,7 +387,7 @@ static void stv06xx_pkt_scan(struct gspca_dev *gspca_dev, { struct sd *sd = (struct sd *) gspca_dev; - PDEBUG(D_PACK, "Packet of length %d arrived", len); + gspca_dbg(gspca_dev, D_PACK, "Packet of length %d arrived\n", len); /* A packet may contain several frames loop until the whole packet is reached */ @@ -393,7 +395,7 @@ static void stv06xx_pkt_scan(struct gspca_dev *gspca_dev, int id, chunk_len; if (len < 4) { - PDEBUG(D_PACK, "Packet is smaller than 4 bytes"); + gspca_dbg(gspca_dev, D_PACK, "Packet is smaller than 4 bytes\n"); return; } @@ -402,7 +404,8 @@ static void stv06xx_pkt_scan(struct gspca_dev *gspca_dev, /* Capture the chunk length */ chunk_len = (data[2] << 8) | data[3]; - PDEBUG(D_PACK, "Chunk id: %x, length: %d", id, chunk_len); + gspca_dbg(gspca_dev, D_PACK, "Chunk id: %x, length: %d\n", + id, chunk_len); data += 4; len -= 4; @@ -421,7 +424,7 @@ static void stv06xx_pkt_scan(struct gspca_dev *gspca_dev, case 0x0200: case 0x4200: frame_data: - PDEBUG(D_PACK, "Frame data packet detected"); + gspca_dbg(gspca_dev, D_PACK, "Frame data packet detected\n"); if (sd->to_skip) { int skip = (sd->to_skip < chunk_len) ? @@ -440,7 +443,7 @@ frame_data: case 0x8005: case 0xc001: case 0xc005: - PDEBUG(D_PACK, "Starting new frame"); + gspca_dbg(gspca_dev, D_PACK, "Starting new frame\n"); /* Create a new frame, chunk length should be zero */ gspca_frame_add(gspca_dev, FIRST_PACKET, @@ -456,7 +459,7 @@ frame_data: case 0x8002: case 0x8006: case 0xc002: - PDEBUG(D_PACK, "End of frame detected"); + gspca_dbg(gspca_dev, D_PACK, "End of frame detected\n"); /* Complete the last frame (if any) */ gspca_frame_add(gspca_dev, LAST_PACKET, @@ -467,23 +470,24 @@ frame_data: break; case 0x0005: - PDEBUG(D_PACK, "Chunk 0x005 detected"); + gspca_dbg(gspca_dev, D_PACK, "Chunk 0x005 detected\n"); /* Unknown chunk with 11 bytes of data, occurs just before end of each frame in compressed mode */ break; case 0x0100: - PDEBUG(D_PACK, "Chunk 0x0100 detected"); + gspca_dbg(gspca_dev, D_PACK, "Chunk 0x0100 detected\n"); /* Unknown chunk with 2 bytes of data, occurs 2-3 times per USB interrupt */ break; case 0x42ff: - PDEBUG(D_PACK, "Chunk 0x42ff detected"); + gspca_dbg(gspca_dev, D_PACK, "Chunk 0x42ff detected\n"); /* Special chunk seen sometimes on the ST6422 */ break; default: - PDEBUG(D_PACK, "Unknown chunk 0x%04x detected", id); + gspca_dbg(gspca_dev, D_PACK, "Unknown chunk 0x%04x detected\n", + id); /* Unknown chunk */ } data += chunk_len; @@ -539,7 +543,7 @@ static int stv06xx_config(struct gspca_dev *gspca_dev, { struct sd *sd = (struct sd *) gspca_dev; - PDEBUG(D_PROBE, "Configuring camera"); + gspca_dbg(gspca_dev, D_PROBE, "Configuring camera\n"); sd->bridge = id->driver_info; gspca_dev->sd_desc = &sd_desc; @@ -598,7 +602,7 @@ static void sd_disconnect(struct usb_interface *intf) struct gspca_dev *gspca_dev = usb_get_intfdata(intf); struct sd *sd = (struct sd *) gspca_dev; void *priv = sd->sensor_priv; - PDEBUG(D_PROBE, "Disconnecting the stv06xx device"); + gspca_dbg(gspca_dev, D_PROBE, "Disconnecting the stv06xx device\n"); sd->sensor = NULL; gspca_disconnect(intf); diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx_hdcs.c b/drivers/media/usb/gspca/stv06xx/stv06xx_hdcs.c index 28252f6c4afd..d8db2c89718f 100644 --- a/drivers/media/usb/gspca/stv06xx/stv06xx_hdcs.c +++ b/drivers/media/usb/gspca/stv06xx/stv06xx_hdcs.c @@ -251,8 +251,8 @@ static int hdcs_set_exposure(struct gspca_dev *gspca_dev, __s32 val) if (err < 0) return err; } - PDEBUG(D_CONF, "Writing exposure %d, rowexp %d, srowexp %d", - val, rowexp, srowexp); + gspca_dbg(gspca_dev, D_CONF, "Writing exposure %d, rowexp %d, srowexp %d\n", + val, rowexp, srowexp); return err; } @@ -276,7 +276,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_CONF, "Writing gain %d", val); + gspca_dbg(gspca_dev, D_CONF, "Writing gain %d\n", val); return hdcs_set_gains((struct sd *) gspca_dev, val & 0xff); } @@ -465,7 +465,7 @@ static int hdcs_start(struct sd *sd) { struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; - PDEBUG(D_STREAM, "Starting stream"); + gspca_dbg(gspca_dev, D_STREAM, "Starting stream\n"); return hdcs_set_state(sd, HDCS_STATE_RUN); } @@ -474,7 +474,7 @@ static int hdcs_stop(struct sd *sd) { struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; - PDEBUG(D_STREAM, "Halting stream"); + gspca_dbg(gspca_dev, D_STREAM, "Halting stream\n"); 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 e1ce96e9405f..7374aeb0a67a 100644 --- a/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c +++ b/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c @@ -229,7 +229,7 @@ static int pb0100_start(struct sd *sd) } err = stv06xx_write_sensor(sd, PB_CONTROL, BIT(5)|BIT(3)|BIT(1)); - PDEBUG(D_STREAM, "Started stream, status: %d", err); + gspca_dbg(gspca_dev, D_STREAM, "Started stream, status: %d\n", err); return (err < 0) ? err : 0; } @@ -247,7 +247,7 @@ static int pb0100_stop(struct sd *sd) /* Set bit 1 to zero */ err = stv06xx_write_sensor(sd, PB_CONTROL, BIT(5)|BIT(3)); - PDEBUG(D_STREAM, "Halting stream"); + gspca_dbg(gspca_dev, D_STREAM, "Halting stream\n"); out: return (err < 0) ? err : 0; } @@ -332,7 +332,8 @@ 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_CONF, "Set green gain to %d, status: %d", val, err); + gspca_dbg(gspca_dev, D_CONF, "Set green gain to %d, status: %d\n", + val, err); if (!err) err = pb0100_set_red_balance(gspca_dev, ctrls->red->val); @@ -355,7 +356,8 @@ 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_CONF, "Set red gain to %d, status: %d", val, err); + gspca_dbg(gspca_dev, D_CONF, "Set red gain to %d, status: %d\n", + val, err); return err; } @@ -373,7 +375,8 @@ 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_CONF, "Set blue gain to %d, status: %d", val, err); + gspca_dbg(gspca_dev, D_CONF, "Set blue gain to %d, status: %d\n", + val, err); return err; } @@ -384,7 +387,8 @@ static int pb0100_set_exposure(struct gspca_dev *gspca_dev, __s32 val) int err; err = stv06xx_write_sensor(sd, PB_RINTTIME, val); - PDEBUG(D_CONF, "Set exposure to %d, status: %d", val, err); + gspca_dbg(gspca_dev, D_CONF, "Set exposure to %d, status: %d\n", + val, err); return err; } @@ -404,8 +408,8 @@ static int pb0100_set_autogain(struct gspca_dev *gspca_dev, __s32 val) val = 0; err = stv06xx_write_sensor(sd, PB_EXPGAIN, val); - PDEBUG(D_CONF, "Set autogain to %d (natural: %d), status: %d", - val, ctrls->natural->val, err); + gspca_dbg(gspca_dev, D_CONF, "Set autogain to %d (natural: %d), status: %d\n", + val, ctrls->natural->val, err); return err; } @@ -426,7 +430,8 @@ 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_CONF, "Set autogain target to %d, status: %d", val, err); + gspca_dbg(gspca_dev, D_CONF, "Set autogain target to %d, status: %d\n", + 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 4b76070515b5..51a135c2f9f7 100644 --- a/drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c +++ b/drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c @@ -277,7 +277,7 @@ static int st6422_stop(struct sd *sd) { struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; - PDEBUG(D_STREAM, "Halting stream"); + gspca_dbg(gspca_dev, D_STREAM, "Halting stream\n"); return 0; } diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx_vv6410.c b/drivers/media/usb/gspca/stv06xx/stv06xx_vv6410.c index d265e6b00994..b2f16c2754fb 100644 --- a/drivers/media/usb/gspca/stv06xx/stv06xx_vv6410.c +++ b/drivers/media/usb/gspca/stv06xx/stv06xx_vv6410.c @@ -129,7 +129,7 @@ static int vv6410_start(struct sd *sd) u32 priv = cam->cam_mode[sd->gspca_dev.curr_mode].priv; if (priv & VV6410_SUBSAMPLE) { - PDEBUG(D_CONF, "Enabling subsampling"); + gspca_dbg(gspca_dev, D_CONF, "Enabling subsampling\n"); stv06xx_write_bridge(sd, STV_Y_CTRL, 0x02); stv06xx_write_bridge(sd, STV_X_CTRL, 0x06); @@ -150,7 +150,7 @@ static int vv6410_start(struct sd *sd) if (err < 0) return err; - PDEBUG(D_STREAM, "Starting stream"); + gspca_dbg(gspca_dev, D_STREAM, "Starting stream\n"); return 0; } @@ -169,7 +169,7 @@ static int vv6410_stop(struct sd *sd) if (err < 0) return err; - PDEBUG(D_STREAM, "Halting stream"); + gspca_dbg(gspca_dev, D_STREAM, "Halting stream\n"); return 0; } @@ -203,7 +203,7 @@ static int vv6410_set_hflip(struct gspca_dev *gspca_dev, __s32 val) else i2c_data &= ~VV6410_HFLIP; - PDEBUG(D_CONF, "Set horizontal flip to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set horizontal flip to %d\n", val); err = stv06xx_write_sensor(sd, VV6410_DATAFORMAT, i2c_data); return (err < 0) ? err : 0; @@ -224,7 +224,7 @@ static int vv6410_set_vflip(struct gspca_dev *gspca_dev, __s32 val) else i2c_data &= ~VV6410_VFLIP; - PDEBUG(D_CONF, "Set vertical flip to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set vertical flip to %d\n", val); err = stv06xx_write_sensor(sd, VV6410_DATAFORMAT, i2c_data); return (err < 0) ? err : 0; @@ -235,7 +235,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_CONF, "Set analog gain to %d", val); + gspca_dbg(gspca_dev, D_CONF, "Set analog gain to %d\n", val); err = stv06xx_write_sensor(sd, VV6410_ANALOGGAIN, 0xf0 | (val & 0xf)); return (err < 0) ? err : 0; @@ -252,8 +252,8 @@ 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_CONF, "Set coarse exposure to %d, fine exposure to %d", - coarse, fine); + gspca_dbg(gspca_dev, D_CONF, "Set coarse exposure to %d, fine exposure to %d\n", + coarse, fine); err = stv06xx_write_sensor(sd, VV6410_FINEH, fine >> 8); if (err < 0) diff --git a/drivers/media/usb/gspca/sunplus.c b/drivers/media/usb/gspca/sunplus.c index 44b07344f0f7..437a3367ab97 100644 --- a/drivers/media/usb/gspca/sunplus.c +++ b/drivers/media/usb/gspca/sunplus.c @@ -311,8 +311,8 @@ static void reg_w_riv(struct gspca_dev *gspca_dev, gspca_dev->usb_err = ret; return; } - PDEBUG(D_USBO, "reg_w_riv: 0x%02x,0x%04x:0x%04x", - req, index, value); + gspca_dbg(gspca_dev, D_USBO, "reg_w_riv: 0x%02x,0x%04x:0x%04x\n", + req, index, value); } static void write_vector(struct gspca_dev *gspca_dev, @@ -343,12 +343,14 @@ static void spca504_acknowledged_command(struct gspca_dev *gspca_dev, { reg_w_riv(gspca_dev, req, idx, val); reg_r(gspca_dev, 0x01, 0x0001, 1); - PDEBUG(D_FRAM, "before wait 0x%04x", gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_FRAM, "before wait 0x%04x\n", + gspca_dev->usb_buf[0]); reg_w_riv(gspca_dev, req, idx, val); msleep(200); reg_r(gspca_dev, 0x01, 0x0001, 1); - PDEBUG(D_FRAM, "after wait 0x%04x", gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_FRAM, "after wait 0x%04x\n", + gspca_dev->usb_buf[0]); } static void spca504_read_info(struct gspca_dev *gspca_dev) @@ -363,10 +365,10 @@ static void spca504_read_info(struct gspca_dev *gspca_dev) reg_r(gspca_dev, 0, i, 1); info[i] = gspca_dev->usb_buf[0]; } - PDEBUG(D_STREAM, - "Read info: %d %d %d %d %d %d. Should be 1,0,2,2,0,0", - info[0], info[1], info[2], - info[3], info[4], info[5]); + gspca_dbg(gspca_dev, D_STREAM, + "Read info: %d %d %d %d %d %d. Should be 1,0,2,2,0,0\n", + info[0], info[1], info[2], + info[3], info[4], info[5]); } static void spca504A_acknowledged_command(struct gspca_dev *gspca_dev, @@ -379,8 +381,8 @@ static void spca504A_acknowledged_command(struct gspca_dev *gspca_dev, reg_r(gspca_dev, 0x01, 0x0001, 1); if (gspca_dev->usb_err < 0) return; - PDEBUG(D_FRAM, "Status 0x%02x Need 0x%02x", - gspca_dev->usb_buf[0], endcode); + gspca_dbg(gspca_dev, D_FRAM, "Status 0x%02x Need 0x%02x\n", + gspca_dev->usb_buf[0], endcode); if (!count) return; count = 200; @@ -391,8 +393,8 @@ static void spca504A_acknowledged_command(struct gspca_dev *gspca_dev, reg_r(gspca_dev, 0x01, 0x0001, 1); status = gspca_dev->usb_buf[0]; if (status == endcode) { - PDEBUG(D_FRAM, "status 0x%04x after wait %d", - status, 200 - count); + gspca_dbg(gspca_dev, D_FRAM, "status 0x%04x after wait %d\n", + status, 200 - count); break; } } @@ -435,8 +437,8 @@ static void spca50x_GetFirmware(struct gspca_dev *gspca_dev) data = gspca_dev->usb_buf; reg_r(gspca_dev, 0x20, 0, 5); - PDEBUG(D_STREAM, "FirmWare: %d %d %d %d %d", - data[0], data[1], data[2], data[3], data[4]); + gspca_dbg(gspca_dev, D_STREAM, "FirmWare: %d %d %d %d %d\n", + data[0], data[1], data[2], data[3], data[4]); reg_r(gspca_dev, 0x23, 0, 64); reg_r(gspca_dev, 0x23, 1, 64); } @@ -651,7 +653,7 @@ static int sd_init(struct gspca_dev *gspca_dev) spca504B_WaitCmdStatus(gspca_dev); break; case BRIDGE_SPCA504C: /* pccam600 */ - PDEBUG(D_STREAM, "Opening SPCA504 (PC-CAM 600)"); + gspca_dbg(gspca_dev, D_STREAM, "Opening SPCA504 (PC-CAM 600)\n"); reg_w_riv(gspca_dev, 0xe0, 0x0000, 0x0000); reg_w_riv(gspca_dev, 0xe0, 0x0000, 0x0001); /* reset */ spca504_wait_status(gspca_dev); @@ -666,7 +668,7 @@ static int sd_init(struct gspca_dev *gspca_dev) break; default: /* case BRIDGE_SPCA504: */ - PDEBUG(D_STREAM, "Opening SPCA504"); + gspca_dbg(gspca_dev, D_STREAM, "Opening SPCA504\n"); if (sd->subtype == AiptekMiniPenCam13) { spca504_read_info(gspca_dev); diff --git a/drivers/media/usb/gspca/t613.c b/drivers/media/usb/gspca/t613.c index 46fb76349000..0ae557cd15ef 100644 --- a/drivers/media/usb/gspca/t613.c +++ b/drivers/media/usb/gspca/t613.c @@ -490,7 +490,7 @@ static void setcolors(struct gspca_dev *gspca_dev, s32 val) static void setgamma(struct gspca_dev *gspca_dev, s32 val) { - PDEBUG(D_CONF, "Gamma: %d", val); + gspca_dbg(gspca_dev, D_CONF, "Gamma: %d\n", val); reg_w_ixbuf(gspca_dev, 0x90, gamma_table[val], sizeof gamma_table[0]); } @@ -592,19 +592,19 @@ static int sd_init(struct gspca_dev *gspca_dev) | reg_r(gspca_dev, 0x07); switch (sensor_id & 0xff0f) { case 0x0801: - PDEBUG(D_PROBE, "sensor tas5130a"); + gspca_dbg(gspca_dev, D_PROBE, "sensor tas5130a\n"); sd->sensor = SENSOR_TAS5130A; break; case 0x0802: - PDEBUG(D_PROBE, "sensor lt168g"); + gspca_dbg(gspca_dev, D_PROBE, "sensor lt168g\n"); sd->sensor = SENSOR_LT168G; break; case 0x0803: - PDEBUG(D_PROBE, "sensor 'other'"); + gspca_dbg(gspca_dev, D_PROBE, "sensor 'other'\n"); sd->sensor = SENSOR_OTHER; break; case 0x0807: - PDEBUG(D_PROBE, "sensor om6802"); + gspca_dbg(gspca_dev, D_PROBE, "sensor om6802\n"); sd->sensor = SENSOR_OM6802; break; default: @@ -632,8 +632,8 @@ static int sd_init(struct gspca_dev *gspca_dev) i = 0; while (read_indexs[i] != 0x00) { test_byte = reg_r(gspca_dev, read_indexs[i]); - PDEBUG(D_STREAM, "Reg 0x%02x = 0x%02x", read_indexs[i], - test_byte); + gspca_dbg(gspca_dev, D_STREAM, "Reg 0x%02x = 0x%02x\n", + read_indexs[i], test_byte); i++; } @@ -643,8 +643,8 @@ static int sd_init(struct gspca_dev *gspca_dev) if (sd->sensor == SENSOR_LT168G) { test_byte = reg_r(gspca_dev, 0x80); - PDEBUG(D_STREAM, "Reg 0x%02x = 0x%02x", 0x80, - test_byte); + gspca_dbg(gspca_dev, D_STREAM, "Reg 0x%02x = 0x%02x\n", 0x80, + test_byte); reg_w(gspca_dev, 0x6c80); } @@ -665,8 +665,8 @@ static int sd_init(struct gspca_dev *gspca_dev) if (sd->sensor == SENSOR_LT168G) { test_byte = reg_r(gspca_dev, 0x80); - PDEBUG(D_STREAM, "Reg 0x%02x = 0x%02x", 0x80, - test_byte); + gspca_dbg(gspca_dev, D_STREAM, "Reg 0x%02x = 0x%02x\n", 0x80, + test_byte); reg_w(gspca_dev, 0x6c80); } @@ -737,7 +737,7 @@ static void poll_sensor(struct gspca_dev *gspca_dev) 0xa1, 0xb1, 0xda, 0x6b, 0xdb, 0x98, 0xdf, 0x0c, 0xc2, 0x80, 0xc3, 0x10}; - PDEBUG(D_STREAM, "[Sensor requires polling]"); + gspca_dbg(gspca_dev, D_STREAM, "[Sensor requires polling]\n"); reg_w_buf(gspca_dev, poll1, sizeof poll1); reg_w_buf(gspca_dev, poll2, sizeof poll2); reg_w_buf(gspca_dev, noise03, sizeof noise03); diff --git a/drivers/media/usb/gspca/topro.c b/drivers/media/usb/gspca/topro.c index 983fc6b500af..82e2be14cad8 100644 --- a/drivers/media/usb/gspca/topro.c +++ b/drivers/media/usb/gspca/topro.c @@ -1453,7 +1453,7 @@ static void set_dqt(struct gspca_dev *gspca_dev, u8 q) struct sd *sd = (struct sd *) gspca_dev; /* update the jpeg quantization tables */ - PDEBUG(D_STREAM, "q %d -> %d", sd->quality, q); + gspca_dbg(gspca_dev, D_STREAM, "q %d -> %d\n", sd->quality, q); sd->quality = q; if (q > 16) q = 16; @@ -4053,7 +4053,7 @@ static int sd_init(struct gspca_dev *gspca_dev) ARRAY_SIZE(tp6810_preinit)); msleep(15); reg_r(gspca_dev, TP6800_R18_GPIO_DATA); - PDEBUG(D_PROBE, "gpio: %02x", gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_PROBE, "gpio: %02x\n", gspca_dev->usb_buf[0]); /* values: * 0x80: snapshot button * 0x40: LED @@ -4627,7 +4627,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, if (*data == 0xaa || *data == 0x00) return; if (*data > 0xc0) { - PDEBUG(D_FRAM, "bad frame"); + gspca_dbg(gspca_dev, D_FRAM, "bad frame\n"); gspca_dev->last_packet_type = DISCARD_PACKET; return; } diff --git a/drivers/media/usb/gspca/touptek.c b/drivers/media/usb/gspca/touptek.c index a1bb1704d339..d1b9032d7863 100644 --- a/drivers/media/usb/gspca/touptek.c +++ b/drivers/media/usb/gspca/touptek.c @@ -214,12 +214,12 @@ static void reg_w(struct gspca_dev *gspca_dev, u16 value, u16 index) char *buff = gspca_dev->usb_buf; int rc; - PDEBUG(D_USBO, - "reg_w bReq=0x0B, bReqT=0xC0, wVal=0x%04X, wInd=0x%04X\n", - value, index); + gspca_dbg(gspca_dev, D_USBO, + "reg_w bReq=0x0B, bReqT=0xC0, wVal=0x%04X, wInd=0x%04X\n\n", + value, index); rc = usb_control_msg(gspca_dev->dev, usb_rcvctrlpipe(gspca_dev->dev, 0), 0x0B, 0xC0, value, index, buff, 1, 500); - PDEBUG(D_USBO, "rc=%d, ret={0x%02x}", rc, (int)buff[0]); + gspca_dbg(gspca_dev, D_USBO, "rc=%d, ret={0x%02x}\n", rc, (int)buff[0]); if (rc < 0) { gspca_err(gspca_dev, "Failed reg_w(0x0B, 0xC0, 0x%04X, 0x%04X) w/ rc %d\n", value, index, rc); @@ -258,7 +258,7 @@ static void setexposure(struct gspca_dev *gspca_dev, s32 val) gspca_dev->usb_err = -EINVAL; return; } - PDEBUG(D_STREAM, "exposure: 0x%04X ms\n", value); + gspca_dbg(gspca_dev, D_STREAM, "exposure: 0x%04X ms\n\n", value); /* Wonder if theres a good reason for sending it twice */ /* probably not but leave it in because...why not */ reg_w(gspca_dev, value, REG_COARSE_INTEGRATION_TIME_); @@ -286,9 +286,9 @@ static void setggain(struct gspca_dev *gspca_dev, u16 global_gain) u16 normalized; normalized = gainify(global_gain); - PDEBUG(D_STREAM, "gain G1/G2 (0x%04X): 0x%04X (src 0x%04X)\n", - REG_GREEN1_GAIN, - normalized, global_gain); + gspca_dbg(gspca_dev, D_STREAM, "gain G1/G2 (0x%04X): 0x%04X (src 0x%04X)\n\n", + REG_GREEN1_GAIN, + normalized, global_gain); reg_w(gspca_dev, normalized, REG_GREEN1_GAIN); reg_w(gspca_dev, normalized, REG_GREEN2_GAIN); @@ -302,13 +302,13 @@ static void setbgain(struct gspca_dev *gspca_dev, normalized = global_gain + ((u32)global_gain) * gain / GAIN_MAX; if (normalized > GAIN_MAX) { - PDEBUG(D_STREAM, "Truncating blue 0x%04X w/ value 0x%04X\n", - GAIN_MAX, normalized); + gspca_dbg(gspca_dev, D_STREAM, "Truncating blue 0x%04X w/ value 0x%04X\n\n", + GAIN_MAX, normalized); normalized = GAIN_MAX; } normalized = gainify(normalized); - PDEBUG(D_STREAM, "gain B (0x%04X): 0x%04X w/ source 0x%04X\n", - REG_BLUE_GAIN, normalized, gain); + gspca_dbg(gspca_dev, D_STREAM, "gain B (0x%04X): 0x%04X w/ source 0x%04X\n\n", + REG_BLUE_GAIN, normalized, gain); reg_w(gspca_dev, normalized, REG_BLUE_GAIN); } @@ -321,13 +321,13 @@ static void setrgain(struct gspca_dev *gspca_dev, normalized = global_gain + ((u32)global_gain) * gain / GAIN_MAX; if (normalized > GAIN_MAX) { - PDEBUG(D_STREAM, "Truncating gain 0x%04X w/ value 0x%04X\n", - GAIN_MAX, normalized); + gspca_dbg(gspca_dev, D_STREAM, "Truncating gain 0x%04X w/ value 0x%04X\n\n", + GAIN_MAX, normalized); normalized = GAIN_MAX; } normalized = gainify(normalized); - PDEBUG(D_STREAM, "gain R (0x%04X): 0x%04X w / source 0x%04X\n", - REG_RED_GAIN, normalized, gain); + gspca_dbg(gspca_dev, D_STREAM, "gain R (0x%04X): 0x%04X w / source 0x%04X\n\n", + REG_RED_GAIN, normalized, gain); reg_w(gspca_dev, normalized, REG_RED_GAIN); } @@ -336,7 +336,7 @@ static void configure_wh(struct gspca_dev *gspca_dev) { unsigned int w = gspca_dev->pixfmt.width; - PDEBUG(D_STREAM, "configure_wh\n"); + gspca_dbg(gspca_dev, D_STREAM, "configure_wh\n\n"); if (w == 800) { static const struct cmd reg_init_res[] = { @@ -425,14 +425,15 @@ static void configure_encrypted(struct gspca_dev *gspca_dev) {0x0100, REG_MODE_SELECT}, }; - PDEBUG(D_STREAM, "Encrypted begin, w = %u\n", gspca_dev->pixfmt.width); + gspca_dbg(gspca_dev, D_STREAM, "Encrypted begin, w = %u\n\n", + gspca_dev->pixfmt.width); reg_w_buf(gspca_dev, reg_init_begin, ARRAY_SIZE(reg_init_begin)); configure_wh(gspca_dev); reg_w_buf(gspca_dev, reg_init_end, ARRAY_SIZE(reg_init_end)); reg_w(gspca_dev, 0x0100, REG_GROUPED_PARAMETER_HOLD); reg_w(gspca_dev, 0x0000, REG_GROUPED_PARAMETER_HOLD); - PDEBUG(D_STREAM, "Encrypted end\n"); + gspca_dbg(gspca_dev, D_STREAM, "Encrypted end\n\n"); } static int configure(struct gspca_dev *gspca_dev) @@ -440,7 +441,7 @@ static int configure(struct gspca_dev *gspca_dev) int rc; char *buff = gspca_dev->usb_buf; - PDEBUG(D_STREAM, "configure()\n"); + gspca_dbg(gspca_dev, D_STREAM, "configure()\n\n"); /* * First driver sets a sort of encryption key @@ -519,7 +520,7 @@ static int configure(struct gspca_dev *gspca_dev) return rc; } - PDEBUG(D_STREAM, "Configure complete\n"); + gspca_dbg(gspca_dev, D_STREAM, "Configure complete\n\n"); return 0; } @@ -567,13 +568,13 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, /* can we finish a frame? */ if (sd->this_f + len == gspca_dev->pixfmt.sizeimage) { gspca_frame_add(gspca_dev, LAST_PACKET, data, len); - PDEBUG(D_FRAM, "finish frame sz %u/%u w/ len %u\n", - sd->this_f, gspca_dev->pixfmt.sizeimage, len); + gspca_dbg(gspca_dev, D_FRAM, "finish frame sz %u/%u w/ len %u\n\n", + sd->this_f, gspca_dev->pixfmt.sizeimage, len); /* lost some data, discard the frame */ } else { gspca_frame_add(gspca_dev, DISCARD_PACKET, NULL, 0); - PDEBUG(D_FRAM, "abort frame sz %u/%u w/ len %u\n", - sd->this_f, gspca_dev->pixfmt.sizeimage, len); + gspca_dbg(gspca_dev, D_FRAM, "abort frame sz %u/%u w/ len %u\n\n", + sd->this_f, gspca_dev->pixfmt.sizeimage, len); } sd->this_f = 0; } else { diff --git a/drivers/media/usb/gspca/vc032x.c b/drivers/media/usb/gspca/vc032x.c index b935febf7146..6b11597977c9 100644 --- a/drivers/media/usb/gspca/vc032x.c +++ b/drivers/media/usb/gspca/vc032x.c @@ -2926,11 +2926,12 @@ static void reg_r(struct gspca_dev *gspca_dev, if (gspca_dev->usb_err < 0) return; if (len == 1) - PDEBUG(D_USBI, "GET %02x 0001 %04x %02x", req, index, - gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_USBI, "GET %02x 0001 %04x %02x\n", + req, index, + gspca_dev->usb_buf[0]); else - PDEBUG(D_USBI, "GET %02x 0001 %04x %*ph", - req, index, 3, gspca_dev->usb_buf); + gspca_dbg(gspca_dev, D_USBI, "GET %02x 0001 %04x %*ph\n", + req, index, 3, gspca_dev->usb_buf); } static void reg_w_i(struct gspca_dev *gspca_dev, @@ -2960,7 +2961,7 @@ static void reg_w(struct gspca_dev *gspca_dev, { if (gspca_dev->usb_err < 0) return; - PDEBUG(D_USBO, "SET %02x %04x %04x", req, value, index); + gspca_dbg(gspca_dev, D_USBO, "SET %02x %04x %04x\n", req, value, index); reg_w_i(gspca_dev, req, value, index); } @@ -2992,8 +2993,8 @@ static u16 read_sensor_register(struct gspca_dev *gspca_dev, reg_r(gspca_dev, 0xa1, 0xb33c, 1); hdata = gspca_dev->usb_buf[0]; if (hdata != 0 && mdata != 0 && ldata != 0) - PDEBUG(D_PROBE, "Read Sensor %02x%02x %02x", - hdata, mdata, ldata); + gspca_dbg(gspca_dev, D_PROBE, "Read Sensor %02x%02x %02x\n", + hdata, mdata, ldata); reg_r(gspca_dev, 0xa1, 0xb334, 1); if (gspca_dev->usb_buf[0] == 0x02) return (hdata << 8) + mdata; @@ -3015,8 +3016,8 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev) } reg_r(gspca_dev, 0xa1, 0xbfcf, 1); - PDEBUG(D_PROBE, "vc032%d check sensor header %02x", - sd->bridge == BRIDGE_VC0321 ? 1 : 3, gspca_dev->usb_buf[0]); + gspca_dbg(gspca_dev, D_PROBE, "vc032%d check sensor header %02x\n", + sd->bridge == BRIDGE_VC0321 ? 1 : 3, gspca_dev->usb_buf[0]); if (sd->bridge == BRIDGE_VC0321) { ptsensor_info = vc0321_probe_data; n = ARRAY_SIZE(vc0321_probe_data); @@ -3036,7 +3037,8 @@ 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_PROBE, "Sensor ID %04x (%d)", value, i); + gspca_dbg(gspca_dev, D_PROBE, "Sensor ID %04x (%d)\n", + value, i); if (value == ptsensor_info->VpId) return ptsensor_info->sensorId; @@ -3063,9 +3065,10 @@ static void i2c_write(struct gspca_dev *gspca_dev, if (gspca_dev->usb_err < 0) return; if (size == 1) - PDEBUG(D_USBO, "i2c_w %02x %02x", reg, *val); + gspca_dbg(gspca_dev, D_USBO, "i2c_w %02x %02x\n", reg, *val); else - PDEBUG(D_USBO, "i2c_w %02x %02x%02x", reg, *val, val[1]); + gspca_dbg(gspca_dev, D_USBO, "i2c_w %02x %02x%02x\n", + reg, *val, val[1]); 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); @@ -3170,35 +3173,35 @@ static int sd_init(struct gspca_dev *gspca_dev) pr_err("Unknown sensor...\n"); return -EINVAL; case SENSOR_HV7131R: - PDEBUG(D_PROBE, "Find Sensor HV7131R"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor HV7131R\n"); break; case SENSOR_MI0360: - PDEBUG(D_PROBE, "Find Sensor MI0360"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor MI0360\n"); sd->bridge = BRIDGE_VC0323; break; case SENSOR_MI1310_SOC: - PDEBUG(D_PROBE, "Find Sensor MI1310_SOC"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor MI1310_SOC\n"); break; case SENSOR_MI1320: - PDEBUG(D_PROBE, "Find Sensor MI1320"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor MI1320\n"); break; case SENSOR_MI1320_SOC: - PDEBUG(D_PROBE, "Find Sensor MI1320_SOC"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor MI1320_SOC\n"); break; case SENSOR_OV7660: - PDEBUG(D_PROBE, "Find Sensor OV7660"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor OV7660\n"); break; case SENSOR_OV7670: - PDEBUG(D_PROBE, "Find Sensor OV7670"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor OV7670\n"); break; case SENSOR_PO1200: - PDEBUG(D_PROBE, "Find Sensor PO1200"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor PO1200\n"); break; case SENSOR_PO3130NC: - PDEBUG(D_PROBE, "Find Sensor PO3130NC"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor PO3130NC\n"); break; case SENSOR_POxxxx: - PDEBUG(D_PROBE, "Sensor POxxxx"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor POxxxx\n"); break; } sd->sensor = sensor; @@ -3624,8 +3627,8 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct sd *sd = (struct sd *) gspca_dev; if (data[0] == 0xff && data[1] == 0xd8) { - PDEBUG(D_PACK, - "vc032x header packet found len %d", len); + gspca_dbg(gspca_dev, D_PACK, + "vc032x header packet found len %d\n", len); gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); data += sd->image_offset; len -= sd->image_offset; diff --git a/drivers/media/usb/gspca/w996Xcf.c b/drivers/media/usb/gspca/w996Xcf.c index d149cb7f0019..abfab3de1866 100644 --- a/drivers/media/usb/gspca/w996Xcf.c +++ b/drivers/media/usb/gspca/w996Xcf.c @@ -245,7 +245,7 @@ static void w9968cf_smbus_read_ack(struct sd *sd) sda = w9968cf_read_sb(sd); w9968cf_write_sb(sd, 0x0012); /* SDE=1, SDA=1, SCL=0 */ if (sda >= 0 && (sda & 0x08)) { - PDEBUG(D_USBI, "Did not receive i2c ACK"); + gspca_dbg(gspca_dev, D_USBI, "Did not receive i2c ACK\n"); sd->gspca_dev.usb_err = -EIO; } } @@ -297,7 +297,7 @@ static void w9968cf_i2c_w(struct sd *sd, u8 reg, u8 value) w9968cf_write_fsb(sd, data); - PDEBUG(D_USBO, "i2c 0x%02x -> [0x%02x]", value, reg); + gspca_dbg(gspca_dev, D_USBO, "i2c 0x%02x -> [0x%02x]\n", value, reg); } /* SMBus protocol: S Addr Wr [A] Subaddr [A] P S Addr+1 Rd [A] [Value] NA P */ @@ -331,7 +331,8 @@ static int w9968cf_i2c_r(struct sd *sd, u8 reg) if (sd->gspca_dev.usb_err >= 0) { ret = value; - PDEBUG(D_USBI, "i2c [0x%02X] -> 0x%02X", reg, value); + gspca_dbg(gspca_dev, D_USBI, "i2c [0x%02X] -> 0x%02X\n", + reg, value); } else gspca_err(gspca_dev, "i2c read [0x%02x] failed\n", reg); diff --git a/drivers/media/usb/gspca/xirlink_cit.c b/drivers/media/usb/gspca/xirlink_cit.c index 68656e7986c7..58deb0c38826 100644 --- a/drivers/media/usb/gspca/xirlink_cit.c +++ b/drivers/media/usb/gspca/xirlink_cit.c @@ -704,7 +704,8 @@ static int cit_read_reg(struct gspca_dev *gspca_dev, u16 index, int verbose) } if (verbose) - PDEBUG(D_PROBE, "Register %04x value: %02x", index, buf[0]); + gspca_dbg(gspca_dev, D_PROBE, "Register %04x value: %02x\n", + index, buf[0]); return 0; } @@ -1471,10 +1472,11 @@ static int cit_get_clock_div(struct gspca_dev *gspca_dev) fps[clock_div - 1] * 3 / 2) clock_div--; - PDEBUG(D_PROBE, - "PacketSize: %d, res: %dx%d -> using clockdiv: %d (%d fps)", - packet_size, gspca_dev->pixfmt.width, gspca_dev->pixfmt.height, - clock_div, fps[clock_div]); + gspca_dbg(gspca_dev, D_PROBE, + "PacketSize: %d, res: %dx%d -> using clockdiv: %d (%d fps)\n", + packet_size, + gspca_dev->pixfmt.width, gspca_dev->pixfmt.height, + clock_div, fps[clock_div]); return clock_div; } @@ -2865,17 +2867,17 @@ static u8 *cit_find_sof(struct gspca_dev *gspca_dev, u8 *data, int len) sd->sof_read = 0; if (data[i] == 0xff) { if (i >= 4) - PDEBUG(D_FRAM, - "header found at offset: %d: %02x %02x 00 %3ph\n", - i - 1, - data[i - 4], - data[i - 3], - &data[i]); + gspca_dbg(gspca_dev, D_FRAM, + "header found at offset: %d: %02x %02x 00 %3ph\n\n", + i - 1, + data[i - 4], + data[i - 3], + &data[i]); else - PDEBUG(D_FRAM, - "header found at offset: %d: 00 %3ph\n", - i - 1, - &data[i]); + gspca_dbg(gspca_dev, D_FRAM, + "header found at offset: %d: 00 %3ph\n\n", + i - 1, + &data[i]); return data + i + (sd->sof_len - 1); } break; diff --git a/drivers/media/usb/gspca/zc3xx.c b/drivers/media/usb/gspca/zc3xx.c index e2d486bd8c28..25b4dbe8e049 100644 --- a/drivers/media/usb/gspca/zc3xx.c +++ b/drivers/media/usb/gspca/zc3xx.c @@ -6041,7 +6041,7 @@ static int sif_probe(struct gspca_dev *gspca_dev) msleep(150); checkword = ((i2c_read(gspca_dev, 0x00) & 0x0f) << 4) | ((i2c_read(gspca_dev, 0x01) & 0xf0) >> 4); - PDEBUG(D_PROBE, "probe sif 0x%04x", checkword); + gspca_dbg(gspca_dev, D_PROBE, "probe sif 0x%04x\n", checkword); if (checkword == 0x0007) { send_unknown(gspca_dev, SENSOR_PAS106); return 0x0f; /* PAS106 */ @@ -6129,7 +6129,7 @@ ov_check: i2c_write(gspca_dev, 0x12, 0x80, 0x00); /* sensor reset */ retword = i2c_read(gspca_dev, 0x0a) << 8; retword |= i2c_read(gspca_dev, 0x0b); - PDEBUG(D_PROBE, "probe 2wr ov vga 0x%04x", retword); + gspca_dbg(gspca_dev, D_PROBE, "probe 2wr ov vga 0x%04x\n", retword); switch (retword) { case 0x7631: /* OV7630C */ reg_w(gspca_dev, 0x06, 0x0010); @@ -6186,7 +6186,7 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev) reg_w(gspca_dev, 0x02, 0x0010); retword = reg_r(gspca_dev, 0x000b) << 8; retword |= reg_r(gspca_dev, 0x000a); - PDEBUG(D_PROBE, "probe 3wr vga 1 0x%04x", retword); + gspca_dbg(gspca_dev, D_PROBE, "probe 3wr vga 1 0x%04x\n", retword); reg_r(gspca_dev, 0x0010); if ((retword & 0xff00) == 0x6400) return 0x02; /* TAS5130C */ @@ -6206,7 +6206,7 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev) reg_w(gspca_dev, 0x01, 0x0012); retword = i2c_read(gspca_dev, 0x00); if (retword != 0) { - PDEBUG(D_PROBE, "probe 3wr vga type 0a"); + gspca_dbg(gspca_dev, D_PROBE, "probe 3wr vga type 0a\n"); return 0x0a; /* PB0330 */ } @@ -6220,7 +6220,8 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev) reg_w(gspca_dev, 0x01, 0x0012); retword = i2c_read(gspca_dev, 0x00); if (retword != 0) { - PDEBUG(D_PROBE, "probe 3wr vga type %02x", retword); + gspca_dbg(gspca_dev, D_PROBE, "probe 3wr vga type %02x\n", + retword); if (retword == 0x0011) /* gc0303 */ return 0x0303; if (retword == 0x0029) /* gc0305 */ @@ -6251,12 +6252,13 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev) reg_w(gspca_dev, 0x05, 0x0012); retword = i2c_read(gspca_dev, 0x00) << 8; /* ID 0 */ retword |= i2c_read(gspca_dev, 0x01); /* ID 1 */ - PDEBUG(D_PROBE, "probe 3wr vga 2 0x%04x", retword); + gspca_dbg(gspca_dev, D_PROBE, "probe 3wr vga 2 0x%04x\n", retword); if (retword == 0x2030) { u8 retbyte; retbyte = i2c_read(gspca_dev, 0x02); /* revision number */ - PDEBUG(D_PROBE, "sensor PO2030 rev 0x%02x", retbyte); + gspca_dbg(gspca_dev, D_PROBE, "sensor PO2030 rev 0x%02x\n", + retbyte); send_unknown(gspca_dev, SENSOR_PO2030); return retword; @@ -6272,7 +6274,8 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev) reg_w(gspca_dev, 0xd3, 0x008b); retword = i2c_read(gspca_dev, 0x01); if (retword != 0) { - PDEBUG(D_PROBE, "probe 3wr vga type 0a ? ret: %04x", retword); + gspca_dbg(gspca_dev, D_PROBE, "probe 3wr vga type 0a ? ret: %04x\n", + retword); return 0x16; /* adcm2700 (6100/6200) */ } return -1; @@ -6490,19 +6493,20 @@ static int sd_init(struct gspca_dev *gspca_dev) sensor = zcxx_probeSensor(gspca_dev); if (sensor >= 0) - PDEBUG(D_PROBE, "probe sensor -> %04x", sensor); + gspca_dbg(gspca_dev, D_PROBE, "probe sensor -> %04x\n", sensor); if ((unsigned) force_sensor < SENSOR_MAX) { sd->sensor = force_sensor; - PDEBUG(D_PROBE, "sensor forced to %d", force_sensor); + gspca_dbg(gspca_dev, D_PROBE, "sensor forced to %d\n", + force_sensor); } else { switch (sensor) { case -1: switch (sd->sensor) { case SENSOR_MC501CB: - PDEBUG(D_PROBE, "Sensor MC501CB"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor MC501CB\n"); break; case SENSOR_GC0303: - PDEBUG(D_PROBE, "Sensor GC0303"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor GC0303\n"); break; default: pr_warn("Unknown sensor - set to TAS5130C\n"); @@ -6512,100 +6516,101 @@ static int sd_init(struct gspca_dev *gspca_dev) case 0: /* check the sensor type */ sensor = i2c_read(gspca_dev, 0x00); - PDEBUG(D_PROBE, "Sensor hv7131 type %d", sensor); + gspca_dbg(gspca_dev, D_PROBE, "Sensor hv7131 type %d\n", + sensor); switch (sensor) { case 0: /* hv7131b */ case 1: /* hv7131e */ - PDEBUG(D_PROBE, "Find Sensor HV7131B"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor HV7131B\n"); sd->sensor = SENSOR_HV7131B; break; default: /* case 2: * hv7131r */ - PDEBUG(D_PROBE, "Find Sensor HV7131R"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor HV7131R\n"); sd->sensor = SENSOR_HV7131R; break; } break; case 0x02: - PDEBUG(D_PROBE, "Sensor TAS5130C"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor TAS5130C\n"); sd->sensor = SENSOR_TAS5130C; break; case 0x04: - PDEBUG(D_PROBE, "Find Sensor CS2102"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor CS2102\n"); sd->sensor = SENSOR_CS2102; break; case 0x08: - PDEBUG(D_PROBE, "Find Sensor HDCS2020"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor HDCS2020\n"); sd->sensor = SENSOR_HDCS2020; break; case 0x0a: - PDEBUG(D_PROBE, - "Find Sensor PB0330. Chip revision %x", - sd->chip_revision); + gspca_dbg(gspca_dev, D_PROBE, + "Find Sensor PB0330. Chip revision %x\n", + sd->chip_revision); sd->sensor = SENSOR_PB0330; break; case 0x0c: - PDEBUG(D_PROBE, "Find Sensor ICM105A"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor ICM105A\n"); sd->sensor = SENSOR_ICM105A; break; case 0x0e: - PDEBUG(D_PROBE, "Find Sensor PAS202B"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor PAS202B\n"); sd->sensor = SENSOR_PAS202B; break; case 0x0f: - PDEBUG(D_PROBE, "Find Sensor PAS106"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor PAS106\n"); sd->sensor = SENSOR_PAS106; break; case 0x10: case 0x12: - PDEBUG(D_PROBE, "Find Sensor TAS5130C"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor TAS5130C\n"); sd->sensor = SENSOR_TAS5130C; break; case 0x11: - PDEBUG(D_PROBE, "Find Sensor HV7131R"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor HV7131R\n"); sd->sensor = SENSOR_HV7131R; break; case 0x13: case 0x15: - PDEBUG(D_PROBE, - "Sensor MT9V111. Chip revision %04x", - sd->chip_revision); + gspca_dbg(gspca_dev, D_PROBE, + "Sensor MT9V111. Chip revision %04x\n", + sd->chip_revision); sd->sensor = sd->bridge == BRIDGE_ZC301 ? SENSOR_MT9V111_1 : SENSOR_MT9V111_3; break; case 0x14: - PDEBUG(D_PROBE, - "Find Sensor CS2102K?. Chip revision %x", - sd->chip_revision); + gspca_dbg(gspca_dev, D_PROBE, + "Find Sensor CS2102K?. Chip revision %x\n", + sd->chip_revision); sd->sensor = SENSOR_CS2102K; break; case 0x16: - PDEBUG(D_PROBE, "Find Sensor ADCM2700"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor ADCM2700\n"); sd->sensor = SENSOR_ADCM2700; break; case 0x29: - PDEBUG(D_PROBE, "Find Sensor GC0305"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor GC0305\n"); sd->sensor = SENSOR_GC0305; break; case 0x0303: - PDEBUG(D_PROBE, "Sensor GC0303"); + gspca_dbg(gspca_dev, D_PROBE, "Sensor GC0303\n"); sd->sensor = SENSOR_GC0303; break; case 0x2030: - PDEBUG(D_PROBE, "Find Sensor PO2030"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor PO2030\n"); sd->sensor = SENSOR_PO2030; break; case 0x7620: - PDEBUG(D_PROBE, "Find Sensor OV7620"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor OV7620\n"); sd->sensor = SENSOR_OV7620; break; case 0x7631: - PDEBUG(D_PROBE, "Find Sensor OV7630C"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor OV7630C\n"); sd->sensor = SENSOR_OV7630C; break; case 0x7648: - PDEBUG(D_PROBE, "Find Sensor OV7648"); + gspca_dbg(gspca_dev, D_PROBE, "Find Sensor OV7648\n"); sd->sensor = SENSOR_OV7620; /* same sensor (?) */ break; default: -- cgit v1.2.3 From e40d14a89760632238f67c1f96c852652a137f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lefaure?= Date: Sun, 1 Oct 2017 15:30:41 -0400 Subject: media: use ARRAY_SIZE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using the ARRAY_SIZE macro improves the readability of the code. Also, it is not always useful to use a variable to store this constant calculated at compile time. Found with Coccinelle with the following semantic patch: @r depends on (org || report)@ type T; T[] E; position p; @@ ( (sizeof(E)@p /sizeof(*E)) | (sizeof(E)@p /sizeof(E[...])) | (sizeof(E)@p /sizeof(T)) ) Signed-off-by: Jérémy Lefaure Reviewed-by: Michael Ira Krufky Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/cxusb.c | 3 ++- drivers/media/usb/dvb-usb/friio-fe.c | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c index 247dc164dd63..7109fc7ab74d 100644 --- a/drivers/media/usb/dvb-usb/cxusb.c +++ b/drivers/media/usb/dvb-usb/cxusb.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "cxusb.h" @@ -304,7 +305,7 @@ static int cxusb_aver_power_ctrl(struct dvb_usb_device *d, int onoff) 0x0e, 0x2, 0x47, 0x88, }; msleep(20); - for (i = 0; i < sizeof(bufs)/sizeof(u8); i += 4/sizeof(u8)) { + for (i = 0; i < ARRAY_SIZE(bufs); i += 4 / sizeof(u8)) { ret = cxusb_ctrl_msg(d, CMD_I2C_WRITE, bufs+i, 4, &buf, 1); if (ret) diff --git a/drivers/media/usb/dvb-usb/friio-fe.c b/drivers/media/usb/dvb-usb/friio-fe.c index b6046e0e07f6..b2830c157548 100644 --- a/drivers/media/usb/dvb-usb/friio-fe.c +++ b/drivers/media/usb/dvb-usb/friio-fe.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "friio.h" @@ -340,8 +341,6 @@ static u8 init_code[][2] = { {0x76, 0x0C}, }; -static const int init_code_len = sizeof(init_code) / sizeof(u8[2]); - static int jdvbt90502_init(struct dvb_frontend *fe) { int i = -1; @@ -355,7 +354,7 @@ static int jdvbt90502_init(struct dvb_frontend *fe) msg.addr = state->config.demod_address; msg.flags = 0; msg.len = 2; - for (i = 0; i < init_code_len; i++) { + for (i = 0; i < ARRAY_SIZE(init_code); i++) { msg.buf = init_code[i]; ret = i2c_transfer(state->i2c, &msg, 1); if (ret != 1) -- cgit v1.2.3 From fdda01090cc22312d83cba78def3668ec7ac6715 Mon Sep 17 00:00:00 2001 From: Romain Reignier Date: Sun, 19 Nov 2017 12:25:10 -0500 Subject: media: cx231xx: Add support for The Imaging Source DFG/USB2pro Note that the inputs for the Composite and S-Video are inverted in regard to most of the other boards using a cx231xx chip. Signed-off-by: Romain Reignier Signed-off-by: Hans Verkuil --- drivers/media/usb/cx231xx/cx231xx-cards.c | 28 ++++++++++++++++++++++++++++ drivers/media/usb/cx231xx/cx231xx.h | 1 + 2 files changed, 29 insertions(+) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index 54d9d0cb326f..99c8b1a47a0c 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -896,6 +896,32 @@ struct cx231xx_board cx231xx_boards[] = { }, }, }, + [CX231XX_BOARD_THE_IMAGING_SOURCE_DFG_USB2_PRO] = { + .name = "The Imaging Source DFG/USB2pro", + .tuner_type = TUNER_ABSENT, + .decoder = CX231XX_AVDECODER, + .output_mode = OUT_MODE_VIP11, + .demod_xfer_mode = 0, + .ctl_pin_status_mask = 0xFFFFFFC4, + .agc_analog_digital_select_gpio = 0x0c, + .gpio_pin_status_mask = 0x4001000, + .norm = V4L2_STD_PAL, + .no_alt_vanc = 1, + .external_av = 1, + .input = {{ + .type = CX231XX_VMUX_COMPOSITE1, + .vmux = CX231XX_VIN_1_1, + .amux = CX231XX_AMUX_LINE_IN, + .gpio = NULL, + }, { + .type = CX231XX_VMUX_SVIDEO, + .vmux = CX231XX_VIN_2_1 | + (CX231XX_VIN_2_2 << 8) | + CX25840_SVIDEO_ON, + .amux = CX231XX_AMUX_LINE_IN, + .gpio = NULL, + } }, + }, }; const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards); @@ -967,6 +993,8 @@ struct usb_device_id cx231xx_id_table[] = { .driver_info = CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD}, {USB_DEVICE(0x15f4, 0x0135), .driver_info = CX231XX_BOARD_ASTROMETA_T2HYBRID}, + {USB_DEVICE(0x199e, 0x8002), + .driver_info = CX231XX_BOARD_THE_IMAGING_SOURCE_DFG_USB2_PRO}, {}, }; diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h index 72d5937a087e..65b039cf80be 100644 --- a/drivers/media/usb/cx231xx/cx231xx.h +++ b/drivers/media/usb/cx231xx/cx231xx.h @@ -80,6 +80,7 @@ #define CX231XX_BOARD_TERRATEC_GRABBY 22 #define CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD 23 #define CX231XX_BOARD_ASTROMETA_T2HYBRID 24 +#define CX231XX_BOARD_THE_IMAGING_SOURCE_DFG_USB2_PRO 25 /* Limits minimum and default number of buffers */ #define CX231XX_MIN_BUF 4 -- cgit v1.2.3 From e2a067048d6263613cee8c5c36aa6f2d755ef425 Mon Sep 17 00:00:00 2001 From: Dean A Date: Fri, 3 Nov 2017 16:11:03 -0400 Subject: media: s2255drv: update firmware load fixes intermittent soft reboot issue with firmware load increases wait time of reset, as required by HW Signed-off-by: Dean Anderson Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/s2255/s2255drv.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index 7fee5766587a..8c2a86d71e8a 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -350,7 +350,7 @@ static void s2255_fillbuff(struct s2255_vc *vc, struct s2255_buffer *buf, int jpgsize); static int s2255_set_mode(struct s2255_vc *vc, struct s2255_mode *mode); static int s2255_board_shutdown(struct s2255_dev *dev); -static void s2255_fwload_start(struct s2255_dev *dev, int reset); +static void s2255_fwload_start(struct s2255_dev *dev); static void s2255_destroy(struct s2255_dev *dev); static long s2255_vendor_req(struct s2255_dev *dev, unsigned char req, u16 index, u16 value, void *buf, @@ -476,7 +476,7 @@ static void planar422p_to_yuv_packed(const unsigned char *in, static void s2255_reset_dsppower(struct s2255_dev *dev) { s2255_vendor_req(dev, 0x40, 0x0000, 0x0001, NULL, 0, 1); - msleep(20); + msleep(50); s2255_vendor_req(dev, 0x50, 0x0000, 0x0000, NULL, 0, 1); msleep(600); s2255_vendor_req(dev, 0x10, 0x0000, 0x0000, NULL, 0, 1); @@ -1450,7 +1450,7 @@ static int s2255_open(struct file *file) case S2255_FW_FAILED: s2255_dev_err(&dev->udev->dev, "firmware load failed. retrying.\n"); - s2255_fwload_start(dev, 1); + s2255_fwload_start(dev); wait_event_timeout(dev->fw_data->wait_fw, ((atomic_read(&dev->fw_data->fw_state) == S2255_FW_SUCCESS) || @@ -2209,10 +2209,9 @@ static void s2255_stop_readpipe(struct s2255_dev *dev) return; } -static void s2255_fwload_start(struct s2255_dev *dev, int reset) +static void s2255_fwload_start(struct s2255_dev *dev) { - if (reset) - s2255_reset_dsppower(dev); + s2255_reset_dsppower(dev); dev->fw_data->fw_size = dev->fw_data->fw->size; atomic_set(&dev->fw_data->fw_state, S2255_FW_NOTLOADED); memcpy(dev->fw_data->pfw_data, @@ -2337,7 +2336,7 @@ static int s2255_probe(struct usb_interface *interface, retval = s2255_board_init(dev); if (retval) goto errorBOARDINIT; - s2255_fwload_start(dev, 0); + s2255_fwload_start(dev); /* loads v4l specific */ retval = s2255_probe_v4l(dev); if (retval) -- cgit v1.2.3 From cc05c0ba23bbc05d34caeb4773b89e1dfc2598b8 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Fri, 10 Nov 2017 11:45:54 -0500 Subject: media: pulse8-cec: print time using time64_t The firmware timestamp is an unsigned 32-bit value, but we copy it into a signed 32-bit variable, so we can theoretically get an overflow in the calculation when the timestamp is between 2038 and 2106. This changes the temporary variable to time64_t and changes the deprecated time_to_tm() over to time64_to_tm() accordingly. There is still an overflow in y2106, but that is a limitation of the firmware interface, not a kernel problem. Signed-off-by: Arnd Bergmann Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/pulse8-cec/pulse8-cec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/pulse8-cec/pulse8-cec.c b/drivers/media/usb/pulse8-cec/pulse8-cec.c index 50146f263d90..350635826aae 100644 --- a/drivers/media/usb/pulse8-cec/pulse8-cec.c +++ b/drivers/media/usb/pulse8-cec/pulse8-cec.c @@ -329,7 +329,7 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio, u8 cmd[2]; int err; struct tm tm; - time_t date; + time64_t date; pulse8->vers = 0; @@ -349,7 +349,7 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio, if (err) return err; date = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; - time_to_tm(date, 0, &tm); + time64_to_tm(date, 0, &tm); dev_info(pulse8->dev, "Firmware build date %04ld.%02d.%02d %02d:%02d:%02d\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); -- cgit v1.2.3 From d5ac225c7d64c9c3ef821239edc035634e594ec9 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 9 Nov 2017 16:28:14 -0500 Subject: media: cpia2: Fix a couple off by one bugs The cam->buffers[] array has cam->num_frames elements so the > needs to be changed to >= to avoid going beyond the end of the array. The ->buffers[] array is allocated in cpia2_allocate_buffers() if you want to confirm. Fixes: ab33d5071de7 ("V4L/DVB (3376): Add cpia2 camera support") Signed-off-by: Dan Carpenter Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cpia2/cpia2_v4l.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c b/drivers/media/usb/cpia2/cpia2_v4l.c index 3dedd83f0b19..a1c59f19cf2d 100644 --- a/drivers/media/usb/cpia2/cpia2_v4l.c +++ b/drivers/media/usb/cpia2/cpia2_v4l.c @@ -808,7 +808,7 @@ static int cpia2_querybuf(struct file *file, void *fh, struct v4l2_buffer *buf) struct camera_data *cam = video_drvdata(file); if(buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || - buf->index > cam->num_frames) + buf->index >= cam->num_frames) return -EINVAL; buf->m.offset = cam->buffers[buf->index].data - cam->frame_buffer; @@ -859,7 +859,7 @@ static int cpia2_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) if(buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || buf->memory != V4L2_MEMORY_MMAP || - buf->index > cam->num_frames) + buf->index >= cam->num_frames) return -EINVAL; DBG("QBUF #%d\n", buf->index); -- cgit v1.2.3 From b627758489fddc8dbf5519092f4cf181d2b995ca Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 17 Nov 2017 09:18:26 -0500 Subject: media: usbvision: remove unneeded DRIVER_LICENSE #define There is no need to #define the license of the driver, just put it in the MODULE_LICENSE() line directly as a text string. This allows tools that check that the module license matches the source code license to work properly, as there is no need to unwind the unneeded dereference. Cc: Hans Verkuil Cc: Johan Hovold Cc: Davidlohr Bueso Cc: Sakari Ailus Reported-by: Philippe Ombredanne Signed-off-by: Greg Kroah-Hartman Reviewed-by: Philippe Ombredanne Acked-by: Mauro Carvalho Chehab Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/usbvision/usbvision-video.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/usb/usbvision/usbvision-video.c index 960272d3c924..0f5954a1fea2 100644 --- a/drivers/media/usb/usbvision/usbvision-video.c +++ b/drivers/media/usb/usbvision/usbvision-video.c @@ -72,7 +72,6 @@ #define DRIVER_NAME "usbvision" #define DRIVER_ALIAS "USBVision" #define DRIVER_DESC "USBVision USB Video Device Driver for Linux" -#define DRIVER_LICENSE "GPL" #define USBVISION_VERSION_STRING "0.9.11" #define ENABLE_HEXDUMP 0 /* Enable if you need it */ @@ -141,7 +140,7 @@ MODULE_PARM_DESC(radio_nr, "Set radio device number (/dev/radioX). Default: -1 /* Misc stuff */ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); -MODULE_LICENSE(DRIVER_LICENSE); +MODULE_LICENSE("GPL"); MODULE_VERSION(USBVISION_VERSION_STRING); MODULE_ALIAS(DRIVER_ALIAS); -- cgit v1.2.3 From e96cdc9a0aa2fcaa276a76e8ffa86fc10a1d3d99 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Mon, 6 Nov 2017 15:13:28 -0500 Subject: media: uvcvideo: Add D3DFMT_L8 support Microsoft HoloLense UVC sensor uses D3DFMT instead of FOURCC when exposing formats. This adds support for D3DFMT_L8 as exposed from the Acer Windows Mixed Reality Headset. Signed-off-by: Nicolas Dufresne Reviewed-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/uvc/uvc_driver.c | 5 +++++ drivers/media/usb/uvc/uvcvideo.h | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 28b91b7d756f..07e427d36516 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -93,6 +93,11 @@ static struct uvc_format_desc uvc_fmts[] = { .guid = UVC_GUID_FORMAT_Y8, .fcc = V4L2_PIX_FMT_GREY, }, + { + .name = "Greyscale 8-bit (D3DFMT_L8)", + .guid = UVC_GUID_FORMAT_D3DFMT_L8, + .fcc = V4L2_PIX_FMT_GREY, + }, { .name = "Greyscale 10-bit (Y10 )", .guid = UVC_GUID_FORMAT_Y10, diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h index 05398784d1c8..19e725e2bda5 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -154,6 +154,11 @@ { 'I', 'N', 'V', 'I', 0xdb, 0x57, 0x49, 0x5e, \ 0x8e, 0x3f, 0xf4, 0x79, 0x53, 0x2b, 0x94, 0x6f} +#define UVC_GUID_FORMAT_D3DFMT_L8 \ + {0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, \ + 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} + + /* ------------------------------------------------------------------------ * Driver specific constants. */ -- cgit v1.2.3 From 5ba3dff4f3f4b0a3c8775d6ea48c07b11a7ad790 Mon Sep 17 00:00:00 2001 From: Jaejoong Kim Date: Fri, 20 Oct 2017 03:25:27 -0400 Subject: media: uvcvideo: Remove duplicate & operation usb_endpoint_maxp() has an inline keyword and searches for bits[10:0] by & operation with 0x7ff. So, we can remove the duplicate & operation with 0x7ff. Signed-off-by: Jaejoong Kim Reviewed-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/uvc/uvc_video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index fb86d6af398d..f4ace6352520 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -1469,13 +1469,13 @@ static unsigned int uvc_endpoint_max_bpi(struct usb_device *dev, case USB_SPEED_HIGH: psize = usb_endpoint_maxp(&ep->desc); mult = usb_endpoint_maxp_mult(&ep->desc); - return (psize & 0x07ff) * mult; + return psize * mult; case USB_SPEED_WIRELESS: psize = usb_endpoint_maxp(&ep->desc); return psize; default: psize = usb_endpoint_maxp(&ep->desc); - return psize & 0x07ff; + return psize; } } -- cgit v1.2.3 From dfc1648c576719b5a2701805aab1e208789d5969 Mon Sep 17 00:00:00 2001 From: Baoyou Xie Date: Wed, 6 Sep 2017 22:59:48 -0400 Subject: media: uvcvideo: Mark buffer error where overflow Some cameras post inaccurate frame where next frame data overlap it. this results in screen flicker, and it need to be prevented. So this patch marks the buffer error to discard the frame where buffer overflow. Signed-off-by: Baoyou Xie Reviewed-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/uvc/uvc_video.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index f4ace6352520..73cd44e8bd81 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -1077,6 +1077,7 @@ static void uvc_video_decode_data(struct uvc_streaming *stream, /* Complete the current frame if the buffer size was exceeded. */ if (len > maxlen) { uvc_trace(UVC_TRACE_FRAME, "Frame complete (overflow).\n"); + buf->error = 1; buf->state = UVC_BUF_STATE_READY; } } -- cgit v1.2.3 From 0393e735649dc41358adb7b603bd57dad1ed3260 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 17 Oct 2017 13:15:54 -0400 Subject: media: uvcvideo: Stream error events carry no data According to the UVC specification, stream error events carry no data. Fix a buffer overflow (that should be harmless given data alignment) when reporting the stream error event by removing the data byte from the message. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/uvc/uvc_status.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c index f552ab997956..1ef20e74b7ac 100644 --- a/drivers/media/usb/uvc/uvc_status.c +++ b/drivers/media/usb/uvc/uvc_status.c @@ -93,8 +93,9 @@ static void uvc_event_streaming(struct uvc_device *dev, __u8 *data, int len) data[1], data[3] ? "pressed" : "released", len); uvc_input_report_key(dev, KEY_CAMERA, data[3]); } else { - uvc_trace(UVC_TRACE_STATUS, "Stream %u error event %02x %02x " - "len %d.\n", data[1], data[2], data[3], len); + uvc_trace(UVC_TRACE_STATUS, + "Stream %u error event %02x len %d.\n", + data[1], data[2], len); } } -- cgit v1.2.3 From 75d1e3ef9f98145acff7e558dfe2a175f1e4db9e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 1 Dec 2017 08:47:10 -0500 Subject: media: usb: add SPDX identifiers to some code I wrote As we're now using SPDX identifiers, on several media drivers I wrote, add the proper SPDX, identifying the license I meant. As we're now using the short license, it doesn't make sense to keep the original license text. Also, fix MODULE_LICENSE to properly identify GPL v2. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Philippe Ombredanne Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/au0828/au0828-input.c | 25 +++++++------------------ drivers/media/usb/cx231xx/cx231xx-input.c | 28 +++++++++------------------- drivers/media/usb/tm6000/tm6000-alsa.c | 18 ++++++------------ drivers/media/usb/tm6000/tm6000-cards.c | 20 +++++--------------- drivers/media/usb/tm6000/tm6000-core.c | 24 +++++++----------------- drivers/media/usb/tm6000/tm6000-i2c.c | 24 +++++++----------------- drivers/media/usb/tm6000/tm6000-regs.h | 18 ++++-------------- drivers/media/usb/tm6000/tm6000-stds.c | 18 ++++-------------- drivers/media/usb/tm6000/tm6000-usb-isoc.h | 18 ++++-------------- drivers/media/usb/tm6000/tm6000-video.c | 24 +++++++----------------- drivers/media/usb/tm6000/tm6000.h | 24 +++++++----------------- 11 files changed, 67 insertions(+), 174 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/au0828/au0828-input.c b/drivers/media/usb/au0828/au0828-input.c index af68afe085b5..832ed9f25784 100644 --- a/drivers/media/usb/au0828/au0828-input.c +++ b/drivers/media/usb/au0828/au0828-input.c @@ -1,21 +1,10 @@ -/* - handle au0828 IR remotes via linux kernel input layer. - - Copyright (C) 2014 Mauro Carvalho Chehab - Copyright (c) 2014 Samsung Electronics Co., Ltd. - - Based on em28xx-input.c. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - */ +// SPDX-License-Identifier: GPL-2.0+ +// handle au0828 IR remotes via linux kernel input layer. +// +// Copyright (c) 2014 Mauro Carvalho Chehab +// Copyright (c) 2014 Samsung Electronics Co., Ltd. +// +// Based on em28xx-input.c. #include "au0828.h" diff --git a/drivers/media/usb/cx231xx/cx231xx-input.c b/drivers/media/usb/cx231xx/cx231xx-input.c index 02ebeb16055f..3e9b73a6b7c9 100644 --- a/drivers/media/usb/cx231xx/cx231xx-input.c +++ b/drivers/media/usb/cx231xx/cx231xx-input.c @@ -1,22 +1,12 @@ -/* - * cx231xx IR glue driver - * - * Copyright (C) 2010 Mauro Carvalho Chehab - * - * Polaris (cx231xx) has its support for IR's with a design close to MCE. - * however, a few designs are using an external I2C chip for IR, instead - * of using the one provided by the chip. - * This driver provides support for those extra devices - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - */ +// SPDX-License-Identifier: GPL-2.0 +// cx231xx IR glue driver +// +// Copyright (c) 2010 Mauro Carvalho Chehab +// +// Polaris (cx231xx) has its support for IR's with a design close to MCE. +// however, a few designs are using an external I2C chip for IR, instead +// of using the one provided by the chip. +// This driver provides support for those extra devices #include "cx231xx.h" #include diff --git a/drivers/media/usb/tm6000/tm6000-alsa.c b/drivers/media/usb/tm6000/tm6000-alsa.c index 3717a6844ea8..f18cffae4c85 100644 --- a/drivers/media/usb/tm6000/tm6000-alsa.c +++ b/drivers/media/usb/tm6000/tm6000-alsa.c @@ -1,14 +1,8 @@ -/* - * - * Support for audio capture for tm5600/6000/6010 - * (c) 2007-2008 Mauro Carvalho Chehab - * - * Based on cx88-alsa.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ +// SPDX-License-Identifier: GPL-2.0 +// Support for audio capture for tm5600/6000/6010 +// Copyright (c) 2007-2008 Mauro Carvalho Chehab +// +// Based on cx88-alsa.c #include #include @@ -57,7 +51,7 @@ MODULE_PARM_DESC(index, "Index value for tm6000x capture interface(s)."); MODULE_DESCRIPTION("ALSA driver module for tm5600/tm6000/tm6010 based TV cards"); MODULE_AUTHOR("Mauro Carvalho Chehab"); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL v2"); MODULE_SUPPORTED_DEVICE("{{Trident,tm5600},{{Trident,tm6000},{{Trident,tm6010}"); static unsigned int debug; module_param(debug, int, 0644); diff --git a/drivers/media/usb/tm6000/tm6000-cards.c b/drivers/media/usb/tm6000/tm6000-cards.c index 77347541904d..8d2aa63f9b94 100644 --- a/drivers/media/usb/tm6000/tm6000-cards.c +++ b/drivers/media/usb/tm6000/tm6000-cards.c @@ -1,17 +1,7 @@ -/* - * tm6000-cards.c - driver for TM5600/TM6000/TM6010 USB video capture devices - * - * Copyright (C) 2006-2007 Mauro Carvalho Chehab - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ +// SPDX-License-Identifier: GPL-2.0 +// tm6000-cards.c - driver for TM5600/TM6000/TM6010 USB video capture devices +// +// Copyright (c) 2006-2007 Mauro Carvalho Chehab #include #include @@ -1405,4 +1395,4 @@ module_usb_driver(tm6000_usb_driver); MODULE_DESCRIPTION("Trident TVMaster TM5600/TM6000/TM6010 USB2 adapter"); MODULE_AUTHOR("Mauro Carvalho Chehab"); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/media/usb/tm6000/tm6000-core.c b/drivers/media/usb/tm6000/tm6000-core.c index 8c265bd80faa..23a1332d98e6 100644 --- a/drivers/media/usb/tm6000/tm6000-core.c +++ b/drivers/media/usb/tm6000/tm6000-core.c @@ -1,20 +1,10 @@ -/* - * tm6000-core.c - driver for TM5600/TM6000/TM6010 USB video capture devices - * - * Copyright (C) 2006-2007 Mauro Carvalho Chehab - * - * Copyright (C) 2007 Michel Ludwig - * - DVB-T support - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ +// SPDX-License-Identifier: GPL-2.0 +// tm6000-core.c - driver for TM5600/TM6000/TM6010 USB video capture devices +// +// Copyright (c) 2006-2007 Mauro Carvalho Chehab +// +// Copyright (c) 2007 Michel Ludwig +// - DVB-T support #include #include diff --git a/drivers/media/usb/tm6000/tm6000-i2c.c b/drivers/media/usb/tm6000/tm6000-i2c.c index cbcc1472f1c7..c9a62bbff27a 100644 --- a/drivers/media/usb/tm6000/tm6000-i2c.c +++ b/drivers/media/usb/tm6000/tm6000-i2c.c @@ -1,20 +1,10 @@ -/* - * tm6000-i2c.c - driver for TM5600/TM6000/TM6010 USB video capture devices - * - * Copyright (C) 2006-2007 Mauro Carvalho Chehab - * - * Copyright (C) 2007 Michel Ludwig - * - Fix SMBus Read Byte command - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ +// SPDX-License-Identifier: GPL-2.0 +// tm6000-i2c.c - driver for TM5600/TM6000/TM6010 USB video capture devices +// +// Copyright (c) 2006-2007 Mauro Carvalho Chehab +// +// Copyright (c) 2007 Michel Ludwig +// - Fix SMBus Read Byte command #include #include diff --git a/drivers/media/usb/tm6000/tm6000-regs.h b/drivers/media/usb/tm6000/tm6000-regs.h index ab3fb74c476c..6723e373fdc6 100644 --- a/drivers/media/usb/tm6000/tm6000-regs.h +++ b/drivers/media/usb/tm6000/tm6000-regs.h @@ -1,17 +1,7 @@ -/* - * tm6000-regs.h - driver for TM5600/TM6000/TM6010 USB video capture devices - * - * Copyright (C) 2006-2007 Mauro Carvalho Chehab - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ +// SPDX-License-Identifier: GPL-2.0 +// tm6000-regs.h - driver for TM5600/TM6000/TM6010 USB video capture devices +// +// Copyright (c) 2006-2007 Mauro Carvalho Chehab /* * Define TV Master TM5600/TM6000/TM6010 Request codes diff --git a/drivers/media/usb/tm6000/tm6000-stds.c b/drivers/media/usb/tm6000/tm6000-stds.c index aa43810d17f9..c0c75951246b 100644 --- a/drivers/media/usb/tm6000/tm6000-stds.c +++ b/drivers/media/usb/tm6000/tm6000-stds.c @@ -1,17 +1,7 @@ -/* - * tm6000-stds.c - driver for TM5600/TM6000/TM6010 USB video capture devices - * - * Copyright (C) 2007 Mauro Carvalho Chehab - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ +// SPDX-License-Identifier: GPL-2.0 +// tm6000-stds.c - driver for TM5600/TM6000/TM6010 USB video capture devices +// +// Copyright (c) 2007 Mauro Carvalho Chehab #include #include diff --git a/drivers/media/usb/tm6000/tm6000-usb-isoc.h b/drivers/media/usb/tm6000/tm6000-usb-isoc.h index 6a13a27c55d7..e69f5cf8fe9f 100644 --- a/drivers/media/usb/tm6000/tm6000-usb-isoc.h +++ b/drivers/media/usb/tm6000/tm6000-usb-isoc.h @@ -1,17 +1,7 @@ -/* - * tm6000-buf.c - driver for TM5600/TM6000/TM6010 USB video capture devices - * - * Copyright (C) 2006-2007 Mauro Carvalho Chehab - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ +// SPDX-License-Identifier: GPL-2.0 +// tm6000-buf.c - driver for TM5600/TM6000/TM6010 USB video capture devices +// +// Copyright (c) 2006-2007 Mauro Carvalho Chehab #include diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c index 9fa25de6b5a9..a95ea629b203 100644 --- a/drivers/media/usb/tm6000/tm6000-video.c +++ b/drivers/media/usb/tm6000/tm6000-video.c @@ -1,20 +1,10 @@ -/* - * tm6000-video.c - driver for TM5600/TM6000/TM6010 USB video capture devices - * - * Copyright (C) 2006-2007 Mauro Carvalho Chehab - * - * Copyright (C) 2007 Michel Ludwig - * - Fixed module load/unload - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ +// SPDX-License-Identifier: GPL-2.0 +// tm6000-video.c - driver for TM5600/TM6000/TM6010 USB video capture devices +// +// Copyright (c) 2006-2007 Mauro Carvalho Chehab +// +// Copyright (c) 2007 Michel Ludwig +// - Fixed module load/unload #include #include diff --git a/drivers/media/usb/tm6000/tm6000.h b/drivers/media/usb/tm6000/tm6000.h index 7ec478d75f55..d53c8e1068e8 100644 --- a/drivers/media/usb/tm6000/tm6000.h +++ b/drivers/media/usb/tm6000/tm6000.h @@ -1,20 +1,10 @@ -/* - * tm6000.h - driver for TM5600/TM6000/TM6010 USB video capture devices - * - * Copyright (C) 2006-2007 Mauro Carvalho Chehab - * - * Copyright (C) 2007 Michel Ludwig - * - DVB-T support - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ +// SPDX-License-Identifier: GPL-2.0 +// tm6000.h - driver for TM5600/TM6000/TM6010 USB video capture devices +// +// Copyright (c) 2006-2007 Mauro Carvalho Chehab +// +// Copyright (c) 2007 Michel Ludwig +// - DVB-T support #include #include -- cgit v1.2.3 From 3d932ee27e852e4904647f15b64dedca51187ad7 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Tue, 26 Sep 2017 17:10:20 -0400 Subject: media: dvb-usb-v2: lmedm04: Improve logic checking of warm start Warm start has no check as whether a genuine device has connected and proceeds to next execution path. Check device should read 0x47 at offset of 2 on USB descriptor read and it is the amount requested of 6 bytes. Fix for kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access as Reported-by: Andrey Konovalov Signed-off-by: Malcolm Priestley Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 5e320fa4a795..992f2011a6ba 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -494,18 +494,23 @@ static int lme2510_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, static int lme2510_return_status(struct dvb_usb_device *d) { - int ret = 0; + int ret; u8 *data; - data = kzalloc(10, GFP_KERNEL); + data = kzalloc(6, GFP_KERNEL); if (!data) return -ENOMEM; - ret |= usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), - 0x06, 0x80, 0x0302, 0x00, data, 0x0006, 200); - info("Firmware Status: %x (%x)", ret , data[2]); + ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), + 0x06, 0x80, 0x0302, 0x00, + data, 0x6, 200); + if (ret != 6) + ret = -EINVAL; + else + ret = data[2]; + + info("Firmware Status: %6ph", data); - ret = (ret < 0) ? -ENODEV : data[2]; kfree(data); return ret; } @@ -1189,6 +1194,7 @@ static int lme2510_get_adapter_count(struct dvb_usb_device *d) static int lme2510_identify_state(struct dvb_usb_device *d, const char **name) { struct lme2510_state *st = d->priv; + int status; usb_reset_configuration(d->udev); @@ -1197,12 +1203,16 @@ static int lme2510_identify_state(struct dvb_usb_device *d, const char **name) st->dvb_usb_lme2510_firmware = dvb_usb_lme2510_firmware; - if (lme2510_return_status(d) == 0x44) { + status = lme2510_return_status(d); + if (status == 0x44) { *name = lme_firmware_switch(d, 0); return COLD; } - return 0; + if (status != 0x47) + return -EINVAL; + + return WARM; } static int lme2510_get_stream_config(struct dvb_frontend *fe, u8 *ts_type, -- cgit v1.2.3 From 7bf7a7116ed313c601307f7e585419369926ab05 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Tue, 26 Sep 2017 17:10:21 -0400 Subject: media: dvb-usb-v2: lmedm04: move ts2020 attach to dm04_lme2510_tuner When the tuner was split from m88rs2000 the attach function is in wrong place. Move to dm04_lme2510_tuner to trap errors on failure and removing a call to lme_coldreset. Prevents driver starting up without any tuner connected. Fixes to trap for ts2020 fail. LME2510(C): FE Found M88RS2000 ts2020: probe of 0-0060 failed with error -11 ... LME2510(C): TUN Found RS2000 tuner kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access general protection fault: 0000 [#1] PREEMPT SMP KASAN Reported-by: Andrey Konovalov Signed-off-by: Malcolm Priestley Tested-by: Andrey Konovalov Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 992f2011a6ba..be26c029546b 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -1076,8 +1076,6 @@ static int dm04_lme2510_frontend_attach(struct dvb_usb_adapter *adap) if (adap->fe[0]) { info("FE Found M88RS2000"); - dvb_attach(ts2020_attach, adap->fe[0], &ts2020_config, - &d->i2c_adap); st->i2c_tuner_gate_w = 5; st->i2c_tuner_gate_r = 5; st->i2c_tuner_addr = 0x60; @@ -1143,17 +1141,18 @@ static int dm04_lme2510_tuner(struct dvb_usb_adapter *adap) ret = st->tuner_config; break; case TUNER_RS2000: - ret = st->tuner_config; + if (dvb_attach(ts2020_attach, adap->fe[0], + &ts2020_config, &d->i2c_adap)) + ret = st->tuner_config; break; default: break; } - if (ret) + if (ret) { info("TUN Found %s tuner", tun_msg[ret]); - else { - info("TUN No tuner found --- resetting device"); - lme_coldreset(d); + } else { + info("TUN No tuner found"); return -ENODEV; } -- cgit v1.2.3 From 910b0797fa9e8af09c44a3fa36cb310ba7a7218d Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Mon, 30 Oct 2017 06:07:29 -0400 Subject: media: em28xx: Fix use-after-free when disconnecting Fix bug by moving the i2c_unregister_device calls after deregistration of dvb frontend. The new style i2c drivers already destroys the frontend object at i2c_unregister_device time. When the dvb frontend is unregistered afterwards it leads to this oops: [ 6058.866459] BUG: unable to handle kernel NULL pointer dereference at 00000000000001f8 [ 6058.866578] IP: dvb_frontend_stop+0x30/0xd0 [dvb_core] [ 6058.866644] PGD 0 [ 6058.866646] P4D 0 [ 6058.866726] Oops: 0000 [#1] SMP [ 6058.866768] Modules linked in: rc_pinnacle_pctv_hd(O) em28xx_rc(O) si2157(O) si2168(O) em28xx_dvb(O) em28xx(O) si2165(O) a8293(O) tda10071(O) tea5767(O) tuner(O) cx23885(O) tda18271(O) videobuf2_dvb(O) videobuf2_dma_sg(O) m88ds3103(O) tveeprom(O) cx2341x(O) v4l2_common(O) dvb_core(O) rc_core(O) videobuf2_memops(O) videobuf2_v4l2(O) videobuf2_core(O) videodev(O) media(O) bluetooth ecdh_generic ums_realtek uas rtl8192cu rtl_usb rtl8192c_common rtlwifi usb_storage snd_hda_codec_realtek snd_hda_codec_hdmi snd_hda_codec_generic i2c_mux snd_hda_intel snd_hda_codec snd_hwdep x86_pkg_temp_thermal snd_hda_core kvm_intel kvm irqbypass [last unloaded: videobuf2_memops] [ 6058.867497] CPU: 2 PID: 7349 Comm: kworker/2:0 Tainted: G W O 4.13.9-gentoo #1 [ 6058.867595] Hardware name: MEDION E2050 2391/H81H3-EM2, BIOS H81EM2W08.308 08/25/2014 [ 6058.867692] Workqueue: usb_hub_wq hub_event [ 6058.867746] task: ffff88011a15e040 task.stack: ffffc90003074000 [ 6058.867825] RIP: 0010:dvb_frontend_stop+0x30/0xd0 [dvb_core] [ 6058.867896] RSP: 0018:ffffc90003077b58 EFLAGS: 00010293 [ 6058.867964] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 000000010040001f [ 6058.868056] RDX: ffff88011a15e040 RSI: ffffea000464e400 RDI: ffff88001cbe3028 [ 6058.868150] RBP: ffffc90003077b68 R08: ffff880119390380 R09: 000000010040001f [ 6058.868241] R10: ffffc90003077b18 R11: 000000000001e200 R12: ffff88001cbe3028 [ 6058.868330] R13: ffff88001cbe68d0 R14: ffff8800cf734000 R15: ffff8800cf734098 [ 6058.868419] FS: 0000000000000000(0000) GS:ffff88011fb00000(0000) knlGS:0000000000000000 [ 6058.868511] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 6058.868578] CR2: 00000000000001f8 CR3: 00000001113c5000 CR4: 00000000001406e0 [ 6058.868662] Call Trace: [ 6058.868705] dvb_unregister_frontend+0x2a/0x80 [dvb_core] [ 6058.868774] em28xx_dvb_fini+0x132/0x220 [em28xx_dvb] [ 6058.868840] em28xx_close_extension+0x34/0x90 [em28xx] [ 6058.868902] em28xx_usb_disconnect+0x4e/0x70 [em28xx] [ 6058.868968] usb_unbind_interface+0x6d/0x260 [ 6058.869025] device_release_driver_internal+0x150/0x210 [ 6058.869094] device_release_driver+0xd/0x10 [ 6058.869150] bus_remove_device+0xe4/0x160 [ 6058.869204] device_del+0x1ce/0x2f0 [ 6058.869253] usb_disable_device+0x99/0x270 [ 6058.869306] usb_disconnect+0x8d/0x260 [ 6058.869359] hub_event+0x93d/0x1520 [ 6058.869408] ? dequeue_task_fair+0xae5/0xd20 [ 6058.869467] process_one_work+0x1d9/0x3e0 [ 6058.869522] worker_thread+0x43/0x3e0 [ 6058.869576] kthread+0x104/0x140 [ 6058.869602] ? trace_event_raw_event_workqueue_work+0x80/0x80 [ 6058.869640] ? kthread_create_on_node+0x40/0x40 [ 6058.869673] ret_from_fork+0x22/0x30 [ 6058.869698] Code: 54 49 89 fc 53 48 8b 9f 18 03 00 00 0f 1f 44 00 00 41 83 bc 24 04 05 00 00 02 74 0c 41 c7 84 24 04 05 00 00 01 00 00 00 0f ae f0 <48> 8b bb f8 01 00 00 48 85 ff 74 5c e8 df 40 f0 e0 48 8b 93 f8 [ 6058.869850] RIP: dvb_frontend_stop+0x30/0xd0 [dvb_core] RSP: ffffc90003077b58 [ 6058.869894] CR2: 00000000000001f8 [ 6058.875880] ---[ end trace 717eecf7193b3fc6 ]--- Signed-off-by: Matthias Schwarzott Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/em28xx/em28xx-dvb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c index 9950a740e04e..c4abf516c4ff 100644 --- a/drivers/media/usb/em28xx/em28xx-dvb.c +++ b/drivers/media/usb/em28xx/em28xx-dvb.c @@ -2105,6 +2105,8 @@ static int em28xx_dvb_fini(struct em28xx *dev) } } + em28xx_unregister_dvb(dvb); + /* remove I2C SEC */ client = dvb->i2c_client_sec; if (client) { @@ -2126,7 +2128,6 @@ static int em28xx_dvb_fini(struct em28xx *dev) i2c_unregister_device(client); } - em28xx_unregister_dvb(dvb); kfree(dvb); dev->dvb = NULL; kref_put(&dev->ref, em28xx_free_device); -- cgit v1.2.3 From 021c01d3dc8291105338b455b994a48b807f26c3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 1 Nov 2017 17:05:55 -0400 Subject: media: dvbsky: shut up a bogus warning Smatch gives two bogus warnings on this driver: drivers/media/usb/dvb-usb-v2/dvbsky.c:336 dvbsky_s960_attach() error: uninitialized symbol 'i2c_adapter'. drivers/media/usb/dvb-usb-v2/dvbsky.c:459 dvbsky_s960c_attach() error: uninitialized symbol 'i2c_adapter'. Shut them up. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb-v2/dvbsky.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c index 131b6c08e199..f90540f947f8 100644 --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c @@ -309,7 +309,7 @@ static int dvbsky_s960_attach(struct dvb_usb_adapter *adap) struct dvb_usb_device *d = adap_to_d(adap); int ret = 0; /* demod I2C adapter */ - struct i2c_adapter *i2c_adapter; + struct i2c_adapter *i2c_adapter = NULL; struct i2c_client *client; struct i2c_board_info info; struct ts2020_config ts2020_config = {}; @@ -431,7 +431,7 @@ static int dvbsky_s960c_attach(struct dvb_usb_adapter *adap) struct dvb_usb_device *d = adap_to_d(adap); int ret = 0; /* demod I2C adapter */ - struct i2c_adapter *i2c_adapter; + struct i2c_adapter *i2c_adapter = NULL; struct i2c_client *client_tuner, *client_ci; struct i2c_board_info info; struct sp2_config sp2_config; -- cgit v1.2.3 From ad7b57d58d16666f607914bf9ff6950e1c5532a4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 1 Nov 2017 17:05:54 -0400 Subject: media: mxl111sf: improve error handling logic As reported by smatch: drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c:485 mxl111sf_demod_read_signal_strength() error: uninitialized symbol 'modulation'. The mxl111sf_demod_read_signal_strength() just ignores if something gets wrong while reading snr or modulation. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c b/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c index f0ed37da73d4..221cf46b4140 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c @@ -477,10 +477,15 @@ static int mxl111sf_demod_read_signal_strength(struct dvb_frontend *fe, { struct mxl111sf_demod_state *state = fe->demodulator_priv; enum fe_modulation modulation; + int ret; u16 snr; - mxl111sf_demod_calc_snr(state, &snr); - mxl1x1sf_demod_get_tps_modulation(state, &modulation); + ret = mxl111sf_demod_calc_snr(state, &snr); + if (ret < 0) + return ret; + ret = mxl1x1sf_demod_get_tps_modulation(state, &modulation); + if (ret < 0) + return ret; switch (modulation) { case QPSK: -- cgit v1.2.3 From 72c27a68a2a3f650f0dc7891ee98f02283fc11af Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Thu, 2 Nov 2017 09:52:27 -0400 Subject: media: pvrusb2: properly check endpoint types As syzkaller detected, pvrusb2 driver submits bulk urb withount checking the the endpoint type is actually blunk. Add a check. usb 1-1: BOGUS urb xfer, pipe 3 != type 1 ------------[ cut here ]------------ WARNING: CPU: 1 PID: 2713 at drivers/usb/core/urb.c:449 usb_submit_urb+0xf8a/0x11d0 Modules linked in: CPU: 1 PID: 2713 Comm: pvrusb2-context Not tainted 4.14.0-rc1-42251-gebb2c2437d80 #210 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 task: ffff88006b7a18c0 task.stack: ffff880069978000 RIP: 0010:usb_submit_urb+0xf8a/0x11d0 drivers/usb/core/urb.c:448 RSP: 0018:ffff88006997f990 EFLAGS: 00010286 RAX: 0000000000000029 RBX: ffff880063661900 RCX: 0000000000000000 RDX: 0000000000000029 RSI: ffffffff86876d60 RDI: ffffed000d32ff24 RBP: ffff88006997fa90 R08: 1ffff1000d32fdca R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 1ffff1000d32ff39 R13: 0000000000000001 R14: 0000000000000003 R15: ffff880068bbed68 FS: 0000000000000000(0000) GS:ffff88006c600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000001032000 CR3: 000000006a0ff000 CR4: 00000000000006f0 Call Trace: pvr2_send_request_ex+0xa57/0x1d80 drivers/media/usb/pvrusb2/pvrusb2-hdw.c:3645 pvr2_hdw_check_firmware drivers/media/usb/pvrusb2/pvrusb2-hdw.c:1812 pvr2_hdw_setup_low drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2107 pvr2_hdw_setup drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2250 pvr2_hdw_initialize+0x548/0x3c10 drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2327 pvr2_context_check drivers/media/usb/pvrusb2/pvrusb2-context.c:118 pvr2_context_thread_func+0x361/0x8c0 drivers/media/usb/pvrusb2/pvrusb2-context.c:167 kthread+0x3a1/0x470 kernel/kthread.c:231 ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431 Code: 48 8b 85 30 ff ff ff 48 8d b8 98 00 00 00 e8 ee 82 89 fe 45 89 e8 44 89 f1 4c 89 fa 48 89 c6 48 c7 c7 40 c0 ea 86 e8 30 1b dc fc <0f> ff e9 9b f7 ff ff e8 aa 95 25 fd e9 80 f7 ff ff e8 50 74 f3 ---[ end trace 6919030503719da6 ]--- Signed-off-by: Andrey Konovalov Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c index 8289ee482f49..09bd6c6c176c 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c @@ -3648,6 +3648,12 @@ static int pvr2_send_request_ex(struct pvr2_hdw *hdw, hdw); hdw->ctl_write_urb->actual_length = 0; hdw->ctl_write_pend_flag = !0; + if (usb_urb_ep_type_check(hdw->ctl_write_urb)) { + pvr2_trace( + PVR2_TRACE_ERROR_LEGS, + "Invalid write control endpoint"); + return -EINVAL; + } status = usb_submit_urb(hdw->ctl_write_urb,GFP_KERNEL); if (status < 0) { pvr2_trace(PVR2_TRACE_ERROR_LEGS, @@ -3672,6 +3678,12 @@ status); hdw); hdw->ctl_read_urb->actual_length = 0; hdw->ctl_read_pend_flag = !0; + if (usb_urb_ep_type_check(hdw->ctl_read_urb)) { + pvr2_trace( + PVR2_TRACE_ERROR_LEGS, + "Invalid read control endpoint"); + return -EINVAL; + } status = usb_submit_urb(hdw->ctl_read_urb,GFP_KERNEL); if (status < 0) { pvr2_trace(PVR2_TRACE_ERROR_LEGS, -- cgit v1.2.3 From 7dbbb4bf1e00bbd4612f84047906d781a370611d Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Sun, 5 Nov 2017 09:24:59 -0500 Subject: media: si2165: Make checkpatch happy Fix almost all of checkpatch --strict warnings. The remaining warnings are about: * macro REG16 (should be enclosed in parentheses) * macro REG16 (Macro argument reuse) Signed-off-by: Matthias Schwarzott Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-dvb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c index 54abc1a7c8e1..716c9e09f462 100644 --- a/drivers/media/usb/cx231xx/cx231xx-dvb.c +++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c @@ -763,7 +763,7 @@ static int dvb_init(struct cx231xx *dev) memset(&si2165_pdata, 0, sizeof(si2165_pdata)); si2165_pdata.fe = &dev->dvb->frontend; si2165_pdata.chip_mode = SI2165_MODE_PLL_XTAL, - si2165_pdata.ref_freq_Hz = 16000000, + si2165_pdata.ref_freq_hz = 16000000, memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2165", I2C_NAME_SIZE); @@ -810,7 +810,7 @@ static int dvb_init(struct cx231xx *dev) memset(&si2165_pdata, 0, sizeof(si2165_pdata)); si2165_pdata.fe = &dev->dvb->frontend; si2165_pdata.chip_mode = SI2165_MODE_PLL_EXT, - si2165_pdata.ref_freq_Hz = 24000000, + si2165_pdata.ref_freq_hz = 24000000, memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2165", I2C_NAME_SIZE); -- cgit v1.2.3 From 7e132dee584800e12f8d5539bdd02a08be98bdb4 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Sun, 5 Nov 2017 09:25:05 -0500 Subject: media: cx231xx: Use semicolon after assignment instead of comma End assignments by semicolon instead of comma. Signed-off-by: Matthias Schwarzott Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-dvb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c index 716c9e09f462..fb5654062b1a 100644 --- a/drivers/media/usb/cx231xx/cx231xx-dvb.c +++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c @@ -762,8 +762,8 @@ static int dvb_init(struct cx231xx *dev) /* attach demod */ memset(&si2165_pdata, 0, sizeof(si2165_pdata)); si2165_pdata.fe = &dev->dvb->frontend; - si2165_pdata.chip_mode = SI2165_MODE_PLL_XTAL, - si2165_pdata.ref_freq_hz = 16000000, + si2165_pdata.chip_mode = SI2165_MODE_PLL_XTAL; + si2165_pdata.ref_freq_hz = 16000000; memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2165", I2C_NAME_SIZE); @@ -809,8 +809,8 @@ static int dvb_init(struct cx231xx *dev) /* attach demod */ memset(&si2165_pdata, 0, sizeof(si2165_pdata)); si2165_pdata.fe = &dev->dvb->frontend; - si2165_pdata.chip_mode = SI2165_MODE_PLL_EXT, - si2165_pdata.ref_freq_hz = 24000000, + si2165_pdata.chip_mode = SI2165_MODE_PLL_EXT; + si2165_pdata.ref_freq_hz = 24000000; memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2165", I2C_NAME_SIZE); -- cgit v1.2.3 From c4d84547d5ae4fafe2dde649deaf10047ef34d00 Mon Sep 17 00:00:00 2001 From: Olli Salonen Date: Thu, 23 Nov 2017 03:24:46 -0500 Subject: media: dib0700: add support for Xbox One Digital TV Tuner Xbox One Digital TV Tuner is a low-cost USB 2.0 multistandard TV tuner. It supports DVB-T, DVB-T2 and DVB-C broadcast standards. USB bridge: DibCom 0700C Demodulator: Panasonic MN88472 Tuner: TDA18250BHN The demodulator requires firmware. Download one from here: http://palosaari.fi/linux/v4l-dvb/firmware/MN88472/02/latest/ Signed-off-by: Olli Salonen Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/Kconfig | 2 + drivers/media/usb/dvb-usb/dib0700.h | 2 + drivers/media/usb/dvb-usb/dib0700_core.c | 26 ++++++- drivers/media/usb/dvb-usb/dib0700_devices.c | 109 +++++++++++++++++++++++++++- 4 files changed, 137 insertions(+), 2 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/dvb-usb/Kconfig b/drivers/media/usb/dvb-usb/Kconfig index 959fa09dfd92..2651ae277347 100644 --- a/drivers/media/usb/dvb-usb/Kconfig +++ b/drivers/media/usb/dvb-usb/Kconfig @@ -86,6 +86,7 @@ config DVB_USB_DIB0700 select DVB_USB_DIB3000MC if MEDIA_SUBDRV_AUTOSELECT select DVB_S5H1411 if MEDIA_SUBDRV_AUTOSELECT select DVB_LGDT3305 if MEDIA_SUBDRV_AUTOSELECT + select DVB_MN88472 if MEDIA_SUBDRV_AUTOSELECT select DVB_TUNER_DIB0070 if MEDIA_SUBDRV_AUTOSELECT select DVB_TUNER_DIB0090 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT @@ -94,6 +95,7 @@ config DVB_USB_DIB0700 select MEDIA_TUNER_XC5000 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_XC4000 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_MXL5007T if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_TDA18250 if MEDIA_SUBDRV_AUTOSELECT help Support for USB2.0/1.1 DVB receivers based on the DiB0700 USB bridge. The USB bridge is also present in devices having the DiB7700 DVB-T-USB diff --git a/drivers/media/usb/dvb-usb/dib0700.h b/drivers/media/usb/dvb-usb/dib0700.h index f89ab3b5a6c4..3a9d4c288cc2 100644 --- a/drivers/media/usb/dvb-usb/dib0700.h +++ b/drivers/media/usb/dvb-usb/dib0700.h @@ -51,6 +51,8 @@ struct dib0700_state { int (*read_status)(struct dvb_frontend *, enum fe_status *); int (*sleep)(struct dvb_frontend* fe); u8 buf[255]; + struct i2c_client *i2c_client_demod; + struct i2c_client *i2c_client_tuner; }; extern int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion, diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c index 1ee7ec558293..94bd176104c1 100644 --- a/drivers/media/usb/dvb-usb/dib0700_core.c +++ b/drivers/media/usb/dvb-usb/dib0700_core.c @@ -911,10 +911,34 @@ static int dib0700_probe(struct usb_interface *intf, return -ENODEV; } +static void dib0700_disconnect(struct usb_interface *intf) +{ + struct dvb_usb_device *d = usb_get_intfdata(intf); + struct dib0700_state *st = d->priv; + struct i2c_client *client; + + /* remove I2C client for tuner */ + client = st->i2c_client_tuner; + if (client) { + module_put(client->dev.driver->owner); + i2c_unregister_device(client); + } + + /* remove I2C client for demodulator */ + client = st->i2c_client_demod; + if (client) { + module_put(client->dev.driver->owner); + i2c_unregister_device(client); + } + + dvb_usb_device_exit(intf); +} + + static struct usb_driver dib0700_driver = { .name = "dvb_usb_dib0700", .probe = dib0700_probe, - .disconnect = dvb_usb_device_exit, + .disconnect = dib0700_disconnect, .id_table = dib0700_usb_id_table, }; diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c index 366b05529915..470836a274dd 100644 --- a/drivers/media/usb/dvb-usb/dib0700_devices.c +++ b/drivers/media/usb/dvb-usb/dib0700_devices.c @@ -23,6 +23,9 @@ #include "dib0090.h" #include "lgdt3305.h" #include "mxl5007t.h" +#include "mn88472.h" +#include "tda18250.h" + static int force_lna_activation; module_param(force_lna_activation, int, 0644); @@ -3725,6 +3728,90 @@ static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap) &hcw_mxl5007t_config) == NULL ? -ENODEV : 0; } +static int xbox_one_attach(struct dvb_usb_adapter *adap) +{ + struct dib0700_state *st = adap->dev->priv; + struct i2c_client *client_demod, *client_tuner; + struct dvb_usb_device *d = adap->dev; + struct mn88472_config mn88472_config = { }; + struct tda18250_config tda18250_config; + struct i2c_board_info info; + + st->fw_use_new_i2c_api = 1; + st->disable_streaming_master_mode = 1; + + /* fe power enable */ + dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); + msleep(30); + dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); + msleep(30); + + /* demod reset */ + dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); + msleep(30); + dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); + msleep(30); + dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); + msleep(30); + + /* attach demod */ + mn88472_config.fe = &adap->fe_adap[0].fe; + mn88472_config.i2c_wr_max = 22; + mn88472_config.xtal = 20500000; + mn88472_config.ts_mode = PARALLEL_TS_MODE; + mn88472_config.ts_clock = FIXED_TS_CLOCK; + memset(&info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, "mn88472", I2C_NAME_SIZE); + info.addr = 0x18; + info.platform_data = &mn88472_config; + request_module(info.type); + client_demod = i2c_new_device(&d->i2c_adap, &info); + if (client_demod == NULL || client_demod->dev.driver == NULL) + goto fail_demod_device; + if (!try_module_get(client_demod->dev.driver->owner)) + goto fail_demod_module; + + st->i2c_client_demod = client_demod; + + adap->fe_adap[0].fe = mn88472_config.get_dvb_frontend(client_demod); + + /* attach tuner */ + memset(&tda18250_config, 0, sizeof(tda18250_config)); + tda18250_config.if_dvbt_6 = 3950; + tda18250_config.if_dvbt_7 = 4450; + tda18250_config.if_dvbt_8 = 4950; + tda18250_config.if_dvbc_6 = 4950; + tda18250_config.if_dvbc_8 = 4950; + tda18250_config.if_atsc = 4079; + tda18250_config.loopthrough = true; + tda18250_config.xtal_freq = TDA18250_XTAL_FREQ_27MHZ; + tda18250_config.fe = adap->fe_adap[0].fe; + + memset(&info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, "tda18250", I2C_NAME_SIZE); + info.addr = 0x60; + info.platform_data = &tda18250_config; + + request_module(info.type); + client_tuner = i2c_new_device(&adap->dev->i2c_adap, &info); + if (client_tuner == NULL || client_tuner->dev.driver == NULL) + goto fail_tuner_device; + if (!try_module_get(client_tuner->dev.driver->owner)) + goto fail_tuner_module; + + st->i2c_client_tuner = client_tuner; + return 0; + +fail_tuner_module: + i2c_unregister_device(client_tuner); +fail_tuner_device: + module_put(client_demod->dev.driver->owner); +fail_demod_module: + i2c_unregister_device(client_demod); +fail_demod_device: + return -ENODEV; +} + /* DVB-USB and USB stuff follows */ struct usb_device_id dib0700_usb_id_table[] = { @@ -3816,7 +3903,8 @@ struct usb_device_id dib0700_usb_id_table[] = { { USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_2002E_SE) }, { USB_DEVICE(USB_VID_PCTV, USB_PID_DIBCOM_STK8096PVR) }, { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096PVR) }, - { USB_DEVICE(USB_VID_HAMA, USB_PID_HAMA_DVBT_HYBRID) }, +/* 85 */{ USB_DEVICE(USB_VID_HAMA, USB_PID_HAMA_DVBT_HYBRID) }, + { USB_DEVICE(USB_VID_MICROSOFT, USB_PID_XBOX_ONE_TUNER) }, { 0 } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); @@ -5040,6 +5128,25 @@ struct dvb_usb_device_properties dib0700_devices[] = { RC_PROTO_BIT_NEC, .change_protocol = dib0700_change_protocol, }, + }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, + .num_adapters = 1, + .adapter = { + { + DIB0700_NUM_FRONTENDS(1), + .fe = {{ + .frontend_attach = xbox_one_attach, + + DIB0700_DEFAULT_STREAMING_CONFIG(0x82), + } }, + }, + }, + .num_device_descs = 1, + .devices = { + { "Microsoft Xbox One Digital TV Tuner", + { &dib0700_usb_id_table[86], NULL }, + { NULL }, + }, + }, }, }; -- cgit v1.2.3 From 6cdeaed3b1420bd2569891be0c4123ff59628e9e Mon Sep 17 00:00:00 2001 From: Wolfgang Rohdewald Date: Tue, 28 Nov 2017 06:33:52 -0500 Subject: media: dvb_usb_pctv452e: module refcount changes were unbalanced dvb_frontend will call dvb_detach for: - stb0899_detach in dvb_frontend_release and - stb0899_release in __dvb_frontend_free But we only do dvb_attach(stb0899_attach). Increment the module refcount instead. Signed-off-by: Wolfgang Rohdewald Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/pctv452e.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/dvb-usb/pctv452e.c b/drivers/media/usb/dvb-usb/pctv452e.c index 601ade7ca48d..3b7f8298b24d 100644 --- a/drivers/media/usb/dvb-usb/pctv452e.c +++ b/drivers/media/usb/dvb-usb/pctv452e.c @@ -913,6 +913,14 @@ static int pctv452e_frontend_attach(struct dvb_usb_adapter *a) &a->dev->i2c_adap); if (!a->fe_adap[0].fe) return -ENODEV; + + /* + * dvb_frontend will call dvb_detach for both stb0899_detach + * and stb0899_release but we only do dvb_attach(stb0899_attach). + * Increment the module refcount instead. + */ + symbol_get(stb0899_attach); + if ((dvb_attach(lnbp22_attach, a->fe_adap[0].fe, &a->dev->i2c_adap)) == NULL) err("Cannot attach lnbp22\n"); -- cgit v1.2.3 From 5742240577b6726104844a099598f284c75772e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Thu, 16 Feb 2017 19:55:33 -0500 Subject: media: dvbsky: MyGica T230C support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mygica T230 DVB-T/T2/C USB stick support. It uses the same FX2/Si2168 bridge/demodulator combo as the other devices supported by the driver, but uses the Si2141 tuner. Several DVB-T (MPEG2) and DVB-T2 (H.265) channels were tested, as well as the included remote control. Signed-off-by: Stefan Brüns Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb-v2/dvbsky.c | 88 +++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c index f90540f947f8..43eb82884555 100644 --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c @@ -661,6 +661,65 @@ fail_demod_device: return ret; } +static int dvbsky_mygica_t230c_attach(struct dvb_usb_adapter *adap) +{ + struct dvbsky_state *state = adap_to_priv(adap); + struct dvb_usb_device *d = adap_to_d(adap); + struct i2c_adapter *i2c_adapter; + struct i2c_client *client_demod, *client_tuner; + struct i2c_board_info info; + struct si2168_config si2168_config; + struct si2157_config si2157_config; + + /* attach demod */ + memset(&si2168_config, 0, sizeof(si2168_config)); + si2168_config.i2c_adapter = &i2c_adapter; + si2168_config.fe = &adap->fe[0]; + si2168_config.ts_mode = SI2168_TS_PARALLEL; + si2168_config.ts_clock_inv = 1; + memset(&info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, "si2168", sizeof(info.type)); + info.addr = 0x64; + info.platform_data = &si2168_config; + + request_module("si2168"); + client_demod = i2c_new_device(&d->i2c_adap, &info); + if (!client_demod || !client_demod->dev.driver) + goto fail_demod_device; + if (!try_module_get(client_demod->dev.driver->owner)) + goto fail_demod_module; + + /* attach tuner */ + memset(&si2157_config, 0, sizeof(si2157_config)); + si2157_config.fe = adap->fe[0]; + si2157_config.if_port = 0; + memset(&info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, "si2141", sizeof(info.type)); + info.addr = 0x60; + info.platform_data = &si2157_config; + + request_module("si2157"); + client_tuner = i2c_new_device(i2c_adapter, &info); + if (!client_tuner || !client_tuner->dev.driver) + goto fail_tuner_device; + if (!try_module_get(client_tuner->dev.driver->owner)) + goto fail_tuner_module; + + state->i2c_client_demod = client_demod; + state->i2c_client_tuner = client_tuner; + return 0; + +fail_tuner_module: + i2c_unregister_device(client_tuner); +fail_tuner_device: + module_put(client_demod->dev.driver->owner); +fail_demod_module: + i2c_unregister_device(client_demod); +fail_demod_device: + return -ENODEV; +} + + static int dvbsky_identify_state(struct dvb_usb_device *d, const char **name) { dvbsky_gpio_ctrl(d, 0x04, 1); @@ -826,6 +885,32 @@ static struct dvb_usb_device_properties dvbsky_t330_props = { } }; +static struct dvb_usb_device_properties mygica_t230c_props = { + .driver_name = KBUILD_MODNAME, + .owner = THIS_MODULE, + .adapter_nr = adapter_nr, + .size_of_priv = sizeof(struct dvbsky_state), + + .generic_bulk_ctrl_endpoint = 0x01, + .generic_bulk_ctrl_endpoint_response = 0x81, + .generic_bulk_ctrl_delay = DVBSKY_MSG_DELAY, + + .i2c_algo = &dvbsky_i2c_algo, + .frontend_attach = dvbsky_mygica_t230c_attach, + .init = dvbsky_init, + .get_rc_config = dvbsky_get_rc_config, + .streaming_ctrl = dvbsky_streaming_ctrl, + .identify_state = dvbsky_identify_state, + .exit = dvbsky_exit, + + .num_adapters = 1, + .adapter = { + { + .stream = DVB_USB_STREAM_BULK(0x82, 8, 4096), + } + } +}; + static const struct usb_device_id dvbsky_id_table[] = { { DVB_USB_DEVICE(0x0572, 0x6831, &dvbsky_s960_props, "DVBSky S960/S860", RC_MAP_DVBSKY) }, @@ -858,6 +943,9 @@ static const struct usb_device_id dvbsky_id_table[] = { { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_S2_R4, &dvbsky_s960_props, "Terratec Cinergy S2 Rev.4", RC_MAP_DVBSKY) }, + { DVB_USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230C, + &mygica_t230c_props, "MyGica Mini DVB-T2 USB Stick T230C", + RC_MAP_TOTAL_MEDIA_IN_HAND_02) }, { } }; MODULE_DEVICE_TABLE(usb, dvbsky_id_table); -- cgit v1.2.3 From ab5222ed1691b522b196624794a904c879033afb Mon Sep 17 00:00:00 2001 From: Sean Young Date: Thu, 12 Oct 2017 18:02:57 -0400 Subject: media: merge ir_tx_z8f0811_haup and ir_rx_z8f0811_haup i2c devices These two devices ids are really just one device with multiple addresses. Probing becomes much simpler if we simply fold this into one i2c device with two address. Note that this breaks the lirc_zilog driver, however we will teach ir-kbd-i2c to do what lirc_zilog does in a later commit. Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/hdpvr/hdpvr-core.c | 11 ++--------- drivers/media/usb/hdpvr/hdpvr-i2c.c | 23 +++++------------------ drivers/media/usb/hdpvr/hdpvr.h | 3 +-- drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c | 13 +++---------- 4 files changed, 11 insertions(+), 39 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c index 1e8cbaf36896..29ac7fc5b039 100644 --- a/drivers/media/usb/hdpvr/hdpvr-core.c +++ b/drivers/media/usb/hdpvr/hdpvr-core.c @@ -364,16 +364,9 @@ static int hdpvr_probe(struct usb_interface *interface, goto error_free_buffers; } - client = hdpvr_register_ir_rx_i2c(dev); + client = hdpvr_register_ir_i2c(dev); if (!client) { - v4l2_err(&dev->v4l2_dev, "i2c IR RX device register failed\n"); - retval = -ENODEV; - goto reg_fail; - } - - client = hdpvr_register_ir_tx_i2c(dev); - if (!client) { - v4l2_err(&dev->v4l2_dev, "i2c IR TX device register failed\n"); + v4l2_err(&dev->v4l2_dev, "i2c IR device register failed\n"); retval = -ENODEV; goto reg_fail; } diff --git a/drivers/media/usb/hdpvr/hdpvr-i2c.c b/drivers/media/usb/hdpvr/hdpvr-i2c.c index 1db49ed5eaf1..4720d79b0282 100644 --- a/drivers/media/usb/hdpvr/hdpvr-i2c.c +++ b/drivers/media/usb/hdpvr/hdpvr-i2c.c @@ -32,24 +32,11 @@ #define Z8F0811_IR_RX_I2C_ADDR 0x71 -struct i2c_client *hdpvr_register_ir_tx_i2c(struct hdpvr_device *dev) +struct i2c_client *hdpvr_register_ir_i2c(struct hdpvr_device *dev) { struct IR_i2c_init_data *init_data = &dev->ir_i2c_init_data; - struct i2c_board_info hdpvr_ir_tx_i2c_board_info = { - I2C_BOARD_INFO("ir_tx_z8f0811_hdpvr", Z8F0811_IR_TX_I2C_ADDR), - }; - - init_data->name = "HD-PVR"; - hdpvr_ir_tx_i2c_board_info.platform_data = init_data; - - return i2c_new_device(&dev->i2c_adapter, &hdpvr_ir_tx_i2c_board_info); -} - -struct i2c_client *hdpvr_register_ir_rx_i2c(struct hdpvr_device *dev) -{ - struct IR_i2c_init_data *init_data = &dev->ir_i2c_init_data; - struct i2c_board_info hdpvr_ir_rx_i2c_board_info = { - I2C_BOARD_INFO("ir_rx_z8f0811_hdpvr", Z8F0811_IR_RX_I2C_ADDR), + struct i2c_board_info info = { + I2C_BOARD_INFO("ir_z8f0811_hdpvr", Z8F0811_IR_RX_I2C_ADDR), }; /* Our default information for ir-kbd-i2c.c to use */ @@ -59,9 +46,9 @@ struct i2c_client *hdpvr_register_ir_rx_i2c(struct hdpvr_device *dev) RC_PROTO_BIT_RC6_6A_32; init_data->name = "HD-PVR"; init_data->polling_interval = 405; /* ms, duplicated from Windows */ - hdpvr_ir_rx_i2c_board_info.platform_data = init_data; + info.platform_data = init_data; - return i2c_new_device(&dev->i2c_adapter, &hdpvr_ir_rx_i2c_board_info); + return i2c_new_device(&dev->i2c_adapter, &info); } static int hdpvr_i2c_read(struct hdpvr_device *dev, int bus, diff --git a/drivers/media/usb/hdpvr/hdpvr.h b/drivers/media/usb/hdpvr/hdpvr.h index a12e0af1d4e1..96e36a8e5f43 100644 --- a/drivers/media/usb/hdpvr/hdpvr.h +++ b/drivers/media/usb/hdpvr/hdpvr.h @@ -320,8 +320,7 @@ int hdpvr_cancel_queue(struct hdpvr_device *dev); /* i2c adapter registration */ int hdpvr_register_i2c_adapter(struct hdpvr_device *dev); -struct i2c_client *hdpvr_register_ir_rx_i2c(struct hdpvr_device *dev); -struct i2c_client *hdpvr_register_ir_tx_i2c(struct hdpvr_device *dev); +struct i2c_client *hdpvr_register_ir_i2c(struct hdpvr_device *dev); /*========================================================================*/ /* buffer management */ diff --git a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c index ff7b4d1d385d..f3003ca05f4b 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c @@ -585,17 +585,10 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw) init_data->type = RC_PROTO_BIT_RC5 | RC_PROTO_BIT_RC6_MCE | RC_PROTO_BIT_RC6_6A_32; init_data->name = hdw->hdw_desc->description; - /* IR Receiver */ - info.addr = 0x71; - info.platform_data = init_data; - strlcpy(info.type, "ir_rx_z8f0811_haup", I2C_NAME_SIZE); - pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.", - info.type, info.addr); - i2c_new_device(&hdw->i2c_adap, &info); - /* IR Trasmitter */ - info.addr = 0x70; + /* IR Transceiver */ + info.addr = 0x71; info.platform_data = init_data; - strlcpy(info.type, "ir_tx_z8f0811_haup", I2C_NAME_SIZE); + strlcpy(info.type, "ir_z8f0811_haup", I2C_NAME_SIZE); pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.", info.type, info.addr); i2c_new_device(&hdw->i2c_adap, &info); -- cgit v1.2.3 From 4839c58f034ae41e2dfdd097240a69622cab4c73 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 28 Sep 2017 18:39:32 -0400 Subject: media: v4l2-dev: convert VFL_TYPE_* into an enum Using enums makes easier to document, as it can use kernel-doc markups. It also allows cross-referencing, with increases the kAPI readability. Please notice that now cx88_querycap() has to have a default for the VFL type, as there are more types than supported by the driver. Acked-By: Mike Isely Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-video.c | 2 ++ drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 2 ++ drivers/media/usb/tm6000/tm6000-video.c | 2 ++ 3 files changed, 6 insertions(+) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index 226059fc672b..936542cb059a 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -1756,6 +1756,8 @@ static int cx231xx_v4l2_open(struct file *filp) case VFL_TYPE_RADIO: radio = 1; break; + default: + return -EINVAL; } cx231xx_videodbg("open dev=%s type=%s users=%d\n", diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c index 4320bda9352d..864830d4c741 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c @@ -153,6 +153,8 @@ static int pvr2_querycap(struct file *file, void *priv, struct v4l2_capability * case VFL_TYPE_RADIO: cap->device_caps = V4L2_CAP_RADIO; break; + default: + return -EINVAL; } cap->device_caps |= V4L2_CAP_TUNER | V4L2_CAP_READWRITE; return 0; diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c index a95ea629b203..df040558997e 100644 --- a/drivers/media/usb/tm6000/tm6000-video.c +++ b/drivers/media/usb/tm6000/tm6000-video.c @@ -1313,6 +1313,8 @@ static int __tm6000_open(struct file *file) case VFL_TYPE_RADIO: radio = 1; break; + default: + return -EINVAL; } /* If more than one user, mutex should be added */ -- cgit v1.2.3 From 1ac051631a90b3062694c5ae6b85cf4d7699749d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 5 Oct 2017 09:56:39 -0400 Subject: media: get rid of i2c-addr.h In the past, the same I2C address were used on multiple places. After I2C rebinding changes, this is no longer needed. So, we can just get rid of this header, placing the I2C address where they belong, e. g. either at bttv driver or at tvtuner. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/em28xx/em28xx-cards.c | 1 - drivers/media/usb/tm6000/tm6000-cards.c | 1 - 2 files changed, 2 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 4c57fd7929cb..34e16f6ab4ac 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/media/usb/tm6000/tm6000-cards.c b/drivers/media/usb/tm6000/tm6000-cards.c index 8d2aa63f9b94..4d5f4cc4887e 100644 --- a/drivers/media/usb/tm6000/tm6000-cards.c +++ b/drivers/media/usb/tm6000/tm6000-cards.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include "tm6000.h" -- cgit v1.2.3 From c4b72ee8acce3d1e2a2fe7398aac9567deebf837 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Wed, 13 Dec 2017 18:44:42 -0500 Subject: media: pvrusb2: correctly return V4L2_PIX_FMT_MPEG in enum_fmt The pvrusb2 code appears to have a some old workaround code for xawtv that causes a WARN() due to an unrecognized pixelformat 0 in v4l2_ioctl.c. Since all other MPEG drivers fill this in correctly, it is a safe assumption that this particular problem no longer exists. While I'm at it, clean up the code a bit. Signed-off-by: Hans Verkuil Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c index 864830d4c741..bf01b7c94afc 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c @@ -78,18 +78,6 @@ static int vbi_nr[PVR_NUM] = {[0 ... PVR_NUM-1] = -1}; module_param_array(vbi_nr, int, NULL, 0444); MODULE_PARM_DESC(vbi_nr, "Offset for device's vbi dev minor"); -static struct v4l2_fmtdesc pvr_fmtdesc [] = { - { - .index = 0, - .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, - .flags = V4L2_FMT_FLAG_COMPRESSED, - .description = "MPEG1/2", - // This should really be V4L2_PIX_FMT_MPEG, but xawtv - // breaks when I do that. - .pixelformat = 0, // V4L2_PIX_FMT_MPEG, - } -}; - #define PVR_FORMAT_PIX 0 #define PVR_FORMAT_VBI 1 @@ -99,17 +87,11 @@ static struct v4l2_format pvr_format [] = { .fmt = { .pix = { .width = 720, - .height = 576, - // This should really be V4L2_PIX_FMT_MPEG, - // but xawtv breaks when I do that. - .pixelformat = 0, // V4L2_PIX_FMT_MPEG, + .height = 576, + .pixelformat = V4L2_PIX_FMT_MPEG, .field = V4L2_FIELD_INTERLACED, - .bytesperline = 0, // doesn't make sense - // here - //FIXME : Don't know what to put here... - .sizeimage = (32*1024), - .colorspace = 0, // doesn't make sense here - .priv = 0 + /* FIXME : Don't know what to put here... */ + .sizeimage = 32 * 1024, } } }, @@ -409,11 +391,11 @@ static int pvr2_g_frequency(struct file *file, void *priv, struct v4l2_frequency static int pvr2_enum_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fmtdesc *fd) { - /* Only one format is supported : mpeg.*/ - if (fd->index != 0) + /* Only one format is supported: MPEG. */ + if (fd->index) return -EINVAL; - memcpy(fd, pvr_fmtdesc, sizeof(struct v4l2_fmtdesc)); + fd->pixelformat = V4L2_PIX_FMT_MPEG; return 0; } -- cgit v1.2.3 From c3a3d1d6b8b363a02234e5564692db3647f183e6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 18 Dec 2017 15:15:53 -0500 Subject: media: fix SPDX comment on some header files The agreed format is to use /* */ comments inside header files. Unfortunately, I ended by using // on a few ones. Reported-by: Andi Shyti Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/tm6000/tm6000-regs.h | 10 ++++++---- drivers/media/usb/tm6000/tm6000-usb-isoc.h | 10 ++++++---- drivers/media/usb/tm6000/tm6000.h | 16 +++++++++------- 3 files changed, 21 insertions(+), 15 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/tm6000/tm6000-regs.h b/drivers/media/usb/tm6000/tm6000-regs.h index 6723e373fdc6..21587fcf11e3 100644 --- a/drivers/media/usb/tm6000/tm6000-regs.h +++ b/drivers/media/usb/tm6000/tm6000-regs.h @@ -1,7 +1,9 @@ -// SPDX-License-Identifier: GPL-2.0 -// tm6000-regs.h - driver for TM5600/TM6000/TM6010 USB video capture devices -// -// Copyright (c) 2006-2007 Mauro Carvalho Chehab +/* + * SPDX-License-Identifier: GPL-2.0 + * tm6000-regs.h - driver for TM5600/TM6000/TM6010 USB video capture devices + * + * Copyright (c) 2006-2007 Mauro Carvalho Chehab + */ /* * Define TV Master TM5600/TM6000/TM6010 Request codes diff --git a/drivers/media/usb/tm6000/tm6000-usb-isoc.h b/drivers/media/usb/tm6000/tm6000-usb-isoc.h index e69f5cf8fe9f..5c615b0a7a46 100644 --- a/drivers/media/usb/tm6000/tm6000-usb-isoc.h +++ b/drivers/media/usb/tm6000/tm6000-usb-isoc.h @@ -1,7 +1,9 @@ -// SPDX-License-Identifier: GPL-2.0 -// tm6000-buf.c - driver for TM5600/TM6000/TM6010 USB video capture devices -// -// Copyright (c) 2006-2007 Mauro Carvalho Chehab +/* + * SPDX-License-Identifier: GPL-2.0 + * tm6000-buf.c - driver for TM5600/TM6000/TM6010 USB video capture devices + * + * Copyright (c) 2006-2007 Mauro Carvalho Chehab + */ #include diff --git a/drivers/media/usb/tm6000/tm6000.h b/drivers/media/usb/tm6000/tm6000.h index d53c8e1068e8..16d3c81e4eb9 100644 --- a/drivers/media/usb/tm6000/tm6000.h +++ b/drivers/media/usb/tm6000/tm6000.h @@ -1,10 +1,12 @@ -// SPDX-License-Identifier: GPL-2.0 -// tm6000.h - driver for TM5600/TM6000/TM6010 USB video capture devices -// -// Copyright (c) 2006-2007 Mauro Carvalho Chehab -// -// Copyright (c) 2007 Michel Ludwig -// - DVB-T support +/* + * SPDX-License-Identifier: GPL-2.0 + * tm6000.h - driver for TM5600/TM6000/TM6010 USB video capture devices + * + * Copyright (c) 2006-2007 Mauro Carvalho Chehab + * + * Copyright (c) 2007 Michel Ludwig + * - DVB-T support + */ #include #include -- cgit v1.2.3 From fada1935590f66dc6784981e0d557ca09013c847 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 28 Dec 2017 13:03:51 -0500 Subject: media: move dvb kAPI headers to include/media Except for DVB, all media kAPI headers are at include/media. Move the headers to it. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/as102/Makefile | 1 - drivers/media/usb/as102/as102_drv.c | 2 +- drivers/media/usb/as102/as102_drv.h | 6 +++--- drivers/media/usb/au0828/Makefile | 1 - drivers/media/usb/au0828/au0828.h | 12 ++++++------ drivers/media/usb/b2c2/Makefile | 1 - drivers/media/usb/cx231xx/Makefile | 1 - drivers/media/usb/cx231xx/cx231xx-cards.c | 2 +- drivers/media/usb/cx231xx/cx231xx-video.c | 2 +- drivers/media/usb/dvb-usb-v2/Makefile | 1 - drivers/media/usb/dvb-usb-v2/anysee.h | 2 +- drivers/media/usb/dvb-usb-v2/az6007.c | 2 +- drivers/media/usb/dvb-usb-v2/dvb_usb.h | 10 +++++----- drivers/media/usb/dvb-usb-v2/mxl111sf-demod.h | 2 +- drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h | 2 +- drivers/media/usb/dvb-usb/Makefile | 1 - drivers/media/usb/dvb-usb/az6027.c | 2 +- drivers/media/usb/dvb-usb/dvb-usb.h | 10 +++++----- drivers/media/usb/dvb-usb/dw2102.c | 2 +- drivers/media/usb/dvb-usb/pctv452e.c | 2 +- drivers/media/usb/dvb-usb/ttusb2.c | 2 +- drivers/media/usb/em28xx/Makefile | 1 - drivers/media/usb/em28xx/em28xx-dvb.c | 6 +++--- drivers/media/usb/pvrusb2/Makefile | 1 - drivers/media/usb/pvrusb2/pvrusb2-dvb.c | 2 +- drivers/media/usb/pvrusb2/pvrusb2-dvb.h | 8 ++++---- drivers/media/usb/siano/Makefile | 1 - drivers/media/usb/tm6000/Makefile | 1 - drivers/media/usb/tm6000/tm6000.h | 6 +++--- drivers/media/usb/ttusb-budget/Makefile | 2 +- drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c | 8 ++++---- drivers/media/usb/ttusb-dec/Makefile | 2 -- drivers/media/usb/ttusb-dec/ttusb_dec.c | 8 ++++---- drivers/media/usb/ttusb-dec/ttusbdecfe.c | 2 +- 34 files changed, 51 insertions(+), 63 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/as102/Makefile b/drivers/media/usb/as102/Makefile index 56bd2d00b920..b0b319622edb 100644 --- a/drivers/media/usb/as102/Makefile +++ b/drivers/media/usb/as102/Makefile @@ -4,5 +4,4 @@ dvb-as102-objs := as102_drv.o as102_fw.o as10x_cmd.o as10x_cmd_stream.o \ obj-$(CONFIG_DVB_AS102) += dvb-as102.o -ccflags-y += -Idrivers/media/dvb-core ccflags-y += -Idrivers/media/dvb-frontends diff --git a/drivers/media/usb/as102/as102_drv.c b/drivers/media/usb/as102/as102_drv.c index 9dd7c7cb06b1..48b0c4e4dac1 100644 --- a/drivers/media/usb/as102/as102_drv.c +++ b/drivers/media/usb/as102/as102_drv.c @@ -27,7 +27,7 @@ #include "as10x_cmd.h" #include "as102_fe.h" #include "as102_fw.h" -#include "dvbdev.h" +#include int dual_tuner; module_param_named(dual_tuner, dual_tuner, int, 0644); diff --git a/drivers/media/usb/as102/as102_drv.h b/drivers/media/usb/as102/as102_drv.h index 8def19d9ab92..c92a1e4f6a20 100644 --- a/drivers/media/usb/as102/as102_drv.h +++ b/drivers/media/usb/as102/as102_drv.h @@ -16,9 +16,9 @@ #ifndef _AS102_DRV_H #define _AS102_DRV_H #include -#include -#include -#include +#include +#include +#include #include "as10x_handle.h" #include "as10x_cmd.h" #include "as102_usb_drv.h" diff --git a/drivers/media/usb/au0828/Makefile b/drivers/media/usb/au0828/Makefile index c06ef6601f2d..5691881c56c0 100644 --- a/drivers/media/usb/au0828/Makefile +++ b/drivers/media/usb/au0828/Makefile @@ -12,7 +12,6 @@ endif obj-$(CONFIG_VIDEO_AU0828) += au0828.o ccflags-y += -Idrivers/media/tuners -ccflags-y += -Idrivers/media/dvb-core ccflags-y += -Idrivers/media/dvb-frontends ccflags-y += $(extra-cflags-y) $(extra-cflags-m) diff --git a/drivers/media/usb/au0828/au0828.h b/drivers/media/usb/au0828/au0828.h index f6f37e8ef51d..9e3c1237a274 100644 --- a/drivers/media/usb/au0828/au0828.h +++ b/drivers/media/usb/au0828/au0828.h @@ -33,12 +33,12 @@ #include /* DVB */ -#include "demux.h" -#include "dmxdev.h" -#include "dvb_demux.h" -#include "dvb_frontend.h" -#include "dvb_net.h" -#include "dvbdev.h" +#include +#include +#include +#include +#include +#include #include "au0828-reg.h" #include "au0828-cards.h" diff --git a/drivers/media/usb/b2c2/Makefile b/drivers/media/usb/b2c2/Makefile index 2778c19a45eb..f3cef05f37b6 100644 --- a/drivers/media/usb/b2c2/Makefile +++ b/drivers/media/usb/b2c2/Makefile @@ -1,5 +1,4 @@ b2c2-flexcop-usb-objs := flexcop-usb.o obj-$(CONFIG_DVB_B2C2_FLEXCOP_USB) += b2c2-flexcop-usb.o -ccflags-y += -Idrivers/media/dvb-core/ ccflags-y += -Idrivers/media/common/b2c2/ diff --git a/drivers/media/usb/cx231xx/Makefile b/drivers/media/usb/cx231xx/Makefile index 19e8c35d6a77..79cf46eb151a 100644 --- a/drivers/media/usb/cx231xx/Makefile +++ b/drivers/media/usb/cx231xx/Makefile @@ -11,6 +11,5 @@ obj-$(CONFIG_VIDEO_CX231XX_DVB) += cx231xx-dvb.o ccflags-y += -Idrivers/media/i2c ccflags-y += -Idrivers/media/tuners -ccflags-y += -Idrivers/media/dvb-core ccflags-y += -Idrivers/media/dvb-frontends ccflags-y += -Idrivers/media/usb/dvb-usb diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index 99c8b1a47a0c..f9ec7fedcd5b 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -31,7 +31,7 @@ #include #include -#include "dvb-usb-ids.h" +#include #include "xc5000.h" #include "tda18271.h" diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index 936542cb059a..0b6ac509fdb1 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -39,7 +39,7 @@ #include #include -#include "dvb_frontend.h" +#include #include "cx231xx-vbi.h" diff --git a/drivers/media/usb/dvb-usb-v2/Makefile b/drivers/media/usb/dvb-usb-v2/Makefile index bed44601f324..58c0140e19de 100644 --- a/drivers/media/usb/dvb-usb-v2/Makefile +++ b/drivers/media/usb/dvb-usb-v2/Makefile @@ -44,7 +44,6 @@ obj-$(CONFIG_DVB_USB_DVBSKY) += dvb-usb-dvbsky.o dvb-usb-zd1301-objs := zd1301.o obj-$(CONFIG_DVB_USB_ZD1301) += zd1301.o -ccflags-y += -I$(srctree)/drivers/media/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb-frontends ccflags-y += -I$(srctree)/drivers/media/tuners ccflags-y += -I$(srctree)/drivers/media/common diff --git a/drivers/media/usb/dvb-usb-v2/anysee.h b/drivers/media/usb/dvb-usb-v2/anysee.h index 393e2fce2aed..2312c55619ca 100644 --- a/drivers/media/usb/dvb-usb-v2/anysee.h +++ b/drivers/media/usb/dvb-usb-v2/anysee.h @@ -32,7 +32,7 @@ #define DVB_USB_LOG_PREFIX "anysee" #include "dvb_usb.h" -#include "dvb_ca_en50221.h" +#include enum cmd { CMD_I2C_READ = 0x33, diff --git a/drivers/media/usb/dvb-usb-v2/az6007.c b/drivers/media/usb/dvb-usb-v2/az6007.c index 1414d59e85ba..746926364535 100644 --- a/drivers/media/usb/dvb-usb-v2/az6007.c +++ b/drivers/media/usb/dvb-usb-v2/az6007.c @@ -23,7 +23,7 @@ #include "drxk.h" #include "mt2063.h" -#include "dvb_ca_en50221.h" +#include #include "dvb_usb.h" #include "cypress_firmware.h" diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb.h b/drivers/media/usb/dvb-usb-v2/dvb_usb.h index 0005bdb2207d..d2e80537b2f7 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb.h +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb.h @@ -27,11 +27,11 @@ #include #include -#include "dvb_frontend.h" -#include "dvb_demux.h" -#include "dvb_net.h" -#include "dmxdev.h" -#include "dvb-usb-ids.h" +#include +#include +#include +#include +#include /* * device file: /dev/dvb/adapter[0-1]/frontend[0-2] diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.h b/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.h index 9cb4972ce7a3..95888b8885c4 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.h +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.h @@ -17,7 +17,7 @@ #ifndef __MXL111SF_DEMOD_H__ #define __MXL111SF_DEMOD_H__ -#include "dvb_frontend.h" +#include #include "mxl111sf.h" struct mxl111sf_demod_config { diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h b/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h index 11ea07a73271..87c1b1642115 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h @@ -17,7 +17,7 @@ #ifndef __MXL111SF_TUNER_H__ #define __MXL111SF_TUNER_H__ -#include "dvb_frontend.h" +#include #include "mxl111sf.h" enum mxl_if_freq { diff --git a/drivers/media/usb/dvb-usb/Makefile b/drivers/media/usb/dvb-usb/Makefile index 16de1e4f36a4..9ad2618408ef 100644 --- a/drivers/media/usb/dvb-usb/Makefile +++ b/drivers/media/usb/dvb-usb/Makefile @@ -80,7 +80,6 @@ obj-$(CONFIG_DVB_USB_AZ6027) += dvb-usb-az6027.o dvb-usb-technisat-usb2-objs := technisat-usb2.o obj-$(CONFIG_DVB_USB_TECHNISAT_USB2) += dvb-usb-technisat-usb2.o -ccflags-y += -I$(srctree)/drivers/media/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb-frontends/ # due to tuner-xc3028 ccflags-y += -I$(srctree)/drivers/media/tuners diff --git a/drivers/media/usb/dvb-usb/az6027.c b/drivers/media/usb/dvb-usb/az6027.c index 2e711362847e..96bbb53a4a91 100644 --- a/drivers/media/usb/dvb-usb/az6027.c +++ b/drivers/media/usb/dvb-usb/az6027.c @@ -17,7 +17,7 @@ #include "stb6100.h" #include "stb6100_cfg.h" -#include "dvb_ca_en50221.h" +#include int dvb_usb_az6027_debug; module_param_named(debug, dvb_usb_az6027_debug, int, 0644); diff --git a/drivers/media/usb/dvb-usb/dvb-usb.h b/drivers/media/usb/dvb-usb/dvb-usb.h index e71fc86b4fb2..317ed6a82d19 100644 --- a/drivers/media/usb/dvb-usb/dvb-usb.h +++ b/drivers/media/usb/dvb-usb/dvb-usb.h @@ -17,14 +17,14 @@ #include #include -#include "dvb_frontend.h" -#include "dvb_demux.h" -#include "dvb_net.h" -#include "dmxdev.h" +#include +#include +#include +#include #include "dvb-pll.h" -#include "dvb-usb-ids.h" +#include /* debug */ #ifdef CONFIG_DVB_USB_DEBUG diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c index b421329b21fa..346946f35b1a 100644 --- a/drivers/media/usb/dvb-usb/dw2102.c +++ b/drivers/media/usb/dvb-usb/dw2102.c @@ -13,7 +13,7 @@ * * see Documentation/dvb/README.dvb-usb for more information */ -#include "dvb-usb-ids.h" +#include #include "dw2102.h" #include "si21xx.h" #include "stv0299.h" diff --git a/drivers/media/usb/dvb-usb/pctv452e.c b/drivers/media/usb/dvb-usb/pctv452e.c index 3b7f8298b24d..0af74383083d 100644 --- a/drivers/media/usb/dvb-usb/pctv452e.c +++ b/drivers/media/usb/dvb-usb/pctv452e.c @@ -26,7 +26,7 @@ /* FE Power */ #include "lnbp22.h" -#include "dvb_ca_en50221.h" +#include #include "ttpci-eeprom.h" static int debug; diff --git a/drivers/media/usb/dvb-usb/ttusb2.c b/drivers/media/usb/dvb-usb/ttusb2.c index e7020f245f53..12de89665d60 100644 --- a/drivers/media/usb/dvb-usb/ttusb2.c +++ b/drivers/media/usb/dvb-usb/ttusb2.c @@ -34,7 +34,7 @@ #include "tda827x.h" #include "lnbp21.h" /* CA */ -#include "dvb_ca_en50221.h" +#include /* debug */ static int dvb_usb_ttusb2_debug; diff --git a/drivers/media/usb/em28xx/Makefile b/drivers/media/usb/em28xx/Makefile index 86bfc35e2ed4..c3d3570584e1 100644 --- a/drivers/media/usb/em28xx/Makefile +++ b/drivers/media/usb/em28xx/Makefile @@ -13,5 +13,4 @@ obj-$(CONFIG_VIDEO_EM28XX_RC) += em28xx-rc.o ccflags-y += -Idrivers/media/i2c ccflags-y += -Idrivers/media/tuners -ccflags-y += -Idrivers/media/dvb-core ccflags-y += -Idrivers/media/dvb-frontends diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c index c4abf516c4ff..8a81c94a8a27 100644 --- a/drivers/media/usb/em28xx/em28xx-dvb.c +++ b/drivers/media/usb/em28xx/em28xx-dvb.c @@ -28,9 +28,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include "tuner-simple.h" #include diff --git a/drivers/media/usb/pvrusb2/Makefile b/drivers/media/usb/pvrusb2/Makefile index 0d84064036b2..552e4f12c496 100644 --- a/drivers/media/usb/pvrusb2/Makefile +++ b/drivers/media/usb/pvrusb2/Makefile @@ -19,5 +19,4 @@ obj-$(CONFIG_VIDEO_PVRUSB2) += pvrusb2.o ccflags-y += -Idrivers/media/i2c ccflags-y += -Idrivers/media/tuners -ccflags-y += -Idrivers/media/dvb-core ccflags-y += -Idrivers/media/dvb-frontends diff --git a/drivers/media/usb/pvrusb2/pvrusb2-dvb.c b/drivers/media/usb/pvrusb2/pvrusb2-dvb.c index 56c750535ee7..4b32b2141169 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-dvb.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-dvb.c @@ -18,7 +18,7 @@ #include #include #include -#include "dvbdev.h" +#include #include "pvrusb2-debug.h" #include "pvrusb2-hdw-internal.h" #include "pvrusb2-hdw.h" diff --git a/drivers/media/usb/pvrusb2/pvrusb2-dvb.h b/drivers/media/usb/pvrusb2/pvrusb2-dvb.h index b500c86d4178..e7f71fb94a6e 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-dvb.h +++ b/drivers/media/usb/pvrusb2/pvrusb2-dvb.h @@ -2,10 +2,10 @@ #ifndef __PVRUSB2_DVB_H__ #define __PVRUSB2_DVB_H__ -#include "dvb_frontend.h" -#include "dvb_demux.h" -#include "dvb_net.h" -#include "dmxdev.h" +#include +#include +#include +#include #include "pvrusb2-context.h" #define PVR2_DVB_BUFFER_COUNT 32 diff --git a/drivers/media/usb/siano/Makefile b/drivers/media/usb/siano/Makefile index 758b6a090c59..7d48864e2782 100644 --- a/drivers/media/usb/siano/Makefile +++ b/drivers/media/usb/siano/Makefile @@ -1,6 +1,5 @@ obj-$(CONFIG_SMS_USB_DRV) += smsusb.o -ccflags-y += -Idrivers/media/dvb-core ccflags-y += -Idrivers/media/common/siano ccflags-y += $(extra-cflags-y) $(extra-cflags-m) diff --git a/drivers/media/usb/tm6000/Makefile b/drivers/media/usb/tm6000/Makefile index 05322a72e862..62f8528daef2 100644 --- a/drivers/media/usb/tm6000/Makefile +++ b/drivers/media/usb/tm6000/Makefile @@ -12,5 +12,4 @@ obj-$(CONFIG_VIDEO_TM6000_DVB) += tm6000-dvb.o ccflags-y += -Idrivers/media/i2c ccflags-y += -Idrivers/media/tuners -ccflags-y += -Idrivers/media/dvb-core ccflags-y += -Idrivers/media/dvb-frontends diff --git a/drivers/media/usb/tm6000/tm6000.h b/drivers/media/usb/tm6000/tm6000.h index 16d3c81e4eb9..23a0ceb4bfea 100644 --- a/drivers/media/usb/tm6000/tm6000.h +++ b/drivers/media/usb/tm6000/tm6000.h @@ -19,9 +19,9 @@ #include #include -#include "dvb_demux.h" -#include "dvb_frontend.h" -#include "dmxdev.h" +#include +#include +#include /* Inputs */ enum tm6000_itype { diff --git a/drivers/media/usb/ttusb-budget/Makefile b/drivers/media/usb/ttusb-budget/Makefile index f47bbf62dcde..fe4372dddd0e 100644 --- a/drivers/media/usb/ttusb-budget/Makefile +++ b/drivers/media/usb/ttusb-budget/Makefile @@ -1,3 +1,3 @@ obj-$(CONFIG_DVB_TTUSB_BUDGET) += dvb-ttusb-budget.o -ccflags-y += -Idrivers/media/dvb-core/ -Idrivers/media/dvb-frontends +ccflags-y += -Idrivers/media/dvb-frontends diff --git a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c index a142b9dc0feb..6cef56d0ecc9 100644 --- a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c @@ -22,10 +22,10 @@ #include #include -#include "dvb_frontend.h" -#include "dmxdev.h" -#include "dvb_demux.h" -#include "dvb_net.h" +#include +#include +#include +#include #include "ves1820.h" #include "cx22700.h" #include "tda1004x.h" diff --git a/drivers/media/usb/ttusb-dec/Makefile b/drivers/media/usb/ttusb-dec/Makefile index 5352740d2353..dde9168b5e5f 100644 --- a/drivers/media/usb/ttusb-dec/Makefile +++ b/drivers/media/usb/ttusb-dec/Makefile @@ -1,3 +1 @@ obj-$(CONFIG_DVB_TTUSB_DEC) += ttusb_dec.o ttusbdecfe.o - -ccflags-y += -Idrivers/media/dvb-core/ diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c b/drivers/media/usb/ttusb-dec/ttusb_dec.c index cdefb5dfbbdc..3d176883168d 100644 --- a/drivers/media/usb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c @@ -30,10 +30,10 @@ #include -#include "dmxdev.h" -#include "dvb_demux.h" -#include "dvb_frontend.h" -#include "dvb_net.h" +#include +#include +#include +#include #include "ttusbdecfe.h" static int debug; diff --git a/drivers/media/usb/ttusb-dec/ttusbdecfe.c b/drivers/media/usb/ttusb-dec/ttusbdecfe.c index 09693caa15e2..6ea05d909024 100644 --- a/drivers/media/usb/ttusb-dec/ttusbdecfe.c +++ b/drivers/media/usb/ttusb-dec/ttusbdecfe.c @@ -15,7 +15,7 @@ * */ -#include "dvb_frontend.h" +#include #include "ttusbdecfe.h" -- cgit v1.2.3 From ada795551aff6662d2322f63e55a853a58389eb5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 28 Dec 2017 14:06:30 -0500 Subject: media: don't include drivers/media/i2c at cflags Most of the I2C headers got moved a long time ago to include/media/i2c. Stop including them at the patch. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/Makefile | 1 - drivers/media/usb/em28xx/Makefile | 1 - drivers/media/usb/hdpvr/Makefile | 4 ---- drivers/media/usb/pvrusb2/Makefile | 1 - drivers/media/usb/stk1160/Makefile | 2 -- drivers/media/usb/tm6000/Makefile | 1 - drivers/media/usb/usbvision/Makefile | 1 - 7 files changed, 11 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/cx231xx/Makefile b/drivers/media/usb/cx231xx/Makefile index 79cf46eb151a..c023d97407de 100644 --- a/drivers/media/usb/cx231xx/Makefile +++ b/drivers/media/usb/cx231xx/Makefile @@ -9,7 +9,6 @@ obj-$(CONFIG_VIDEO_CX231XX) += cx231xx.o obj-$(CONFIG_VIDEO_CX231XX_ALSA) += cx231xx-alsa.o obj-$(CONFIG_VIDEO_CX231XX_DVB) += cx231xx-dvb.o -ccflags-y += -Idrivers/media/i2c ccflags-y += -Idrivers/media/tuners ccflags-y += -Idrivers/media/dvb-frontends ccflags-y += -Idrivers/media/usb/dvb-usb diff --git a/drivers/media/usb/em28xx/Makefile b/drivers/media/usb/em28xx/Makefile index c3d3570584e1..8a224007d755 100644 --- a/drivers/media/usb/em28xx/Makefile +++ b/drivers/media/usb/em28xx/Makefile @@ -11,6 +11,5 @@ obj-$(CONFIG_VIDEO_EM28XX_ALSA) += em28xx-alsa.o obj-$(CONFIG_VIDEO_EM28XX_DVB) += em28xx-dvb.o obj-$(CONFIG_VIDEO_EM28XX_RC) += em28xx-rc.o -ccflags-y += -Idrivers/media/i2c ccflags-y += -Idrivers/media/tuners ccflags-y += -Idrivers/media/dvb-frontends diff --git a/drivers/media/usb/hdpvr/Makefile b/drivers/media/usb/hdpvr/Makefile index 9b8d1463c526..644dd99ffce3 100644 --- a/drivers/media/usb/hdpvr/Makefile +++ b/drivers/media/usb/hdpvr/Makefile @@ -1,7 +1,3 @@ hdpvr-objs := hdpvr-control.o hdpvr-core.o hdpvr-video.o hdpvr-i2c.o obj-$(CONFIG_VIDEO_HDPVR) += hdpvr.o - -ccflags-y += -Idrivers/media/i2c - -ccflags-y += $(extra-cflags-y) $(extra-cflags-m) diff --git a/drivers/media/usb/pvrusb2/Makefile b/drivers/media/usb/pvrusb2/Makefile index 552e4f12c496..9facf6873404 100644 --- a/drivers/media/usb/pvrusb2/Makefile +++ b/drivers/media/usb/pvrusb2/Makefile @@ -17,6 +17,5 @@ pvrusb2-objs := pvrusb2-i2c-core.o \ obj-$(CONFIG_VIDEO_PVRUSB2) += pvrusb2.o -ccflags-y += -Idrivers/media/i2c ccflags-y += -Idrivers/media/tuners ccflags-y += -Idrivers/media/dvb-frontends diff --git a/drivers/media/usb/stk1160/Makefile b/drivers/media/usb/stk1160/Makefile index 613471528749..8e6c22fb1803 100644 --- a/drivers/media/usb/stk1160/Makefile +++ b/drivers/media/usb/stk1160/Makefile @@ -6,5 +6,3 @@ stk1160-y := stk1160-core.o \ stk1160-ac97.o obj-$(CONFIG_VIDEO_STK1160) += stk1160.o - -ccflags-y += -Idrivers/media/i2c diff --git a/drivers/media/usb/tm6000/Makefile b/drivers/media/usb/tm6000/Makefile index 62f8528daef2..744c039e621a 100644 --- a/drivers/media/usb/tm6000/Makefile +++ b/drivers/media/usb/tm6000/Makefile @@ -10,6 +10,5 @@ obj-$(CONFIG_VIDEO_TM6000) += tm6000.o obj-$(CONFIG_VIDEO_TM6000_ALSA) += tm6000-alsa.o obj-$(CONFIG_VIDEO_TM6000_DVB) += tm6000-dvb.o -ccflags-y += -Idrivers/media/i2c ccflags-y += -Idrivers/media/tuners ccflags-y += -Idrivers/media/dvb-frontends diff --git a/drivers/media/usb/usbvision/Makefile b/drivers/media/usb/usbvision/Makefile index 9b3a5581df42..494d030b4979 100644 --- a/drivers/media/usb/usbvision/Makefile +++ b/drivers/media/usb/usbvision/Makefile @@ -2,5 +2,4 @@ usbvision-objs := usbvision-core.o usbvision-video.o usbvision-i2c.o usbvision- obj-$(CONFIG_VIDEO_USBVISION) += usbvision.o -ccflags-y += -Idrivers/media/i2c ccflags-y += -Idrivers/media/tuners -- cgit v1.2.3 From 510bb91535f3a86b3ecc38c72693f2c34af81ffd Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Wed, 27 Dec 2017 09:51:42 -0500 Subject: media: pvrusb2: drop unneeded newline pvr2_trace prints a newline at the end of the message string, so the message string does not need to include a newline explicitly. Done using Coccinelle. Signed-off-by: Julia Lawall Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c index 09bd6c6c176c..e0353161ccd6 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c @@ -2351,7 +2351,8 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, if (hdw_desc == NULL) { pvr2_trace(PVR2_TRACE_INIT, "pvr2_hdw_create: No device description pointer, unable to continue."); - pvr2_trace(PVR2_TRACE_INIT, "If you have a new device type, please contact Mike Isely to get it included in the driver\n"); + pvr2_trace(PVR2_TRACE_INIT, + "If you have a new device type, please contact Mike Isely to get it included in the driver"); goto fail; } -- cgit v1.2.3 From a70b8b24e79dc8b4811c3179f8431346e98d1f8c Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 27 Nov 2017 08:19:53 -0500 Subject: media: uvcvideo: Use ktime_t for stats 'struct timespec' works fine here, but we try to migrate away from it in favor of ktime_t or timespec64. In this case, using ktime_t produces the simplest code. Signed-off-by: Arnd Bergmann Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/uvc/uvc_video.c | 11 ++++------- drivers/media/usb/uvc/uvcvideo.h | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index 73cd44e8bd81..d468332abe0d 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -725,7 +725,7 @@ static void uvc_video_stats_decode(struct uvc_streaming *stream, if (stream->stats.stream.nb_frames == 0 && stream->stats.frame.nb_packets == 0) - ktime_get_ts(&stream->stats.stream.start_ts); + stream->stats.stream.start_ts = ktime_get(); switch (data[1] & (UVC_STREAM_PTS | UVC_STREAM_SCR)) { case UVC_STREAM_PTS | UVC_STREAM_SCR: @@ -865,16 +865,13 @@ size_t uvc_video_stats_dump(struct uvc_streaming *stream, char *buf, { unsigned int scr_sof_freq; unsigned int duration; - struct timespec ts; size_t count = 0; - ts = timespec_sub(stream->stats.stream.stop_ts, - stream->stats.stream.start_ts); - /* Compute the SCR.SOF frequency estimate. At the nominal 1kHz SOF * frequency this will not overflow before more than 1h. */ - duration = ts.tv_sec * 1000 + ts.tv_nsec / 1000000; + duration = ktime_ms_delta(stream->stats.stream.stop_ts, + stream->stats.stream.start_ts); if (duration != 0) scr_sof_freq = stream->stats.stream.scr_sof_count * 1000 / duration; @@ -915,7 +912,7 @@ static void uvc_video_stats_start(struct uvc_streaming *stream) static void uvc_video_stats_stop(struct uvc_streaming *stream) { - ktime_get_ts(&stream->stats.stream.stop_ts); + stream->stats.stream.stop_ts = ktime_get(); } /* ------------------------------------------------------------------------ diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h index 19e725e2bda5..94392a3256e8 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -457,8 +457,8 @@ struct uvc_stats_frame { }; struct uvc_stats_stream { - struct timespec start_ts; /* Stream start timestamp */ - struct timespec stop_ts; /* Stream stop timestamp */ + ktime_t start_ts; /* Stream start timestamp */ + ktime_t stop_ts; /* Stream stop timestamp */ unsigned int nb_frames; /* Number of frames */ -- cgit v1.2.3 From 828ee8c719501551d4cdd1ace8425284951dfb82 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 27 Nov 2017 08:19:54 -0500 Subject: media: uvcvideo: Use ktime_t for timestamps uvc_video_get_ts() returns a 'struct timespec', but all its users really want a nanoseconds variable anyway. Changing the deprecated ktime_get_ts/ktime_get_real_ts to ktime_get and ktime_get_real simplifies the code noticeably, while keeping the resulting numbers unchanged. Signed-off-by: Arnd Bergmann Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/uvc/uvc_video.c | 37 ++++++++++++------------------------- drivers/media/usb/uvc/uvcvideo.h | 2 +- 2 files changed, 13 insertions(+), 26 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index d468332abe0d..13f459ea239c 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -369,12 +369,12 @@ static int uvc_commit_video(struct uvc_streaming *stream, * Clocks and timestamps */ -static inline void uvc_video_get_ts(struct timespec *ts) +static inline ktime_t uvc_video_get_time(void) { if (uvc_clock_param == CLOCK_MONOTONIC) - ktime_get_ts(ts); + return ktime_get(); else - ktime_get_real_ts(ts); + return ktime_get_real(); } static void @@ -386,7 +386,7 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf, bool has_pts = false; bool has_scr = false; unsigned long flags; - struct timespec ts; + ktime_t time; u16 host_sof; u16 dev_sof; @@ -436,7 +436,7 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf, stream->clock.last_sof = dev_sof; host_sof = usb_get_current_frame_number(stream->dev->udev); - uvc_video_get_ts(&ts); + time = uvc_video_get_time(); /* The UVC specification allows device implementations that can't obtain * the USB frame number to keep their own frame counters as long as they @@ -473,7 +473,7 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf, sample->dev_stc = get_unaligned_le32(&data[header_size - 6]); sample->dev_sof = dev_sof; sample->host_sof = host_sof; - sample->host_ts = ts; + sample->host_time = time; /* Update the sliding window head and count. */ stream->clock.head = (stream->clock.head + 1) % stream->clock.size; @@ -613,14 +613,12 @@ void uvc_video_clock_update(struct uvc_streaming *stream, struct uvc_clock_sample *first; struct uvc_clock_sample *last; unsigned long flags; - struct timespec ts; + u64 timestamp; u32 delta_stc; u32 y1, y2; u32 x1, x2; u32 mean; u32 sof; - u32 div; - u32 rem; u64 y; if (!uvc_hw_timestamps_param) @@ -667,9 +665,8 @@ void uvc_video_clock_update(struct uvc_streaming *stream, if (x1 == x2) goto done; - ts = timespec_sub(last->host_ts, first->host_ts); y1 = NSEC_PER_SEC; - y2 = (ts.tv_sec + 1) * NSEC_PER_SEC + ts.tv_nsec; + y2 = (u32)ktime_to_ns(ktime_sub(last->host_time, first->host_time)) + y1; /* Interpolated and host SOF timestamps can wrap around at slightly * different times. Handle this by adding or removing 2048 to or from @@ -686,24 +683,18 @@ void uvc_video_clock_update(struct uvc_streaming *stream, - (u64)y2 * (u64)x1; y = div_u64(y, x2 - x1); - div = div_u64_rem(y, NSEC_PER_SEC, &rem); - ts.tv_sec = first->host_ts.tv_sec - 1 + div; - ts.tv_nsec = first->host_ts.tv_nsec + rem; - if (ts.tv_nsec >= NSEC_PER_SEC) { - ts.tv_sec++; - ts.tv_nsec -= NSEC_PER_SEC; - } + timestamp = ktime_to_ns(first->host_time) + y - y1; uvc_trace(UVC_TRACE_CLOCK, "%s: SOF %u.%06llu y %llu ts %llu " "buf ts %llu (x1 %u/%u/%u x2 %u/%u/%u y1 %u y2 %u)\n", stream->dev->name, sof >> 16, div_u64(((u64)sof & 0xffff) * 1000000LLU, 65536), - y, timespec_to_ns(&ts), vbuf->vb2_buf.timestamp, + y, timestamp, vbuf->vb2_buf.timestamp, x1, first->host_sof, first->dev_sof, x2, last->host_sof, last->dev_sof, y1, y2); /* Update the V4L2 buffer. */ - vbuf->vb2_buf.timestamp = timespec_to_ns(&ts); + vbuf->vb2_buf.timestamp = timestamp; done: spin_unlock_irqrestore(&clock->lock, flags); @@ -1007,8 +998,6 @@ static int uvc_video_decode_start(struct uvc_streaming *stream, * when the EOF bit is set to force synchronisation on the next packet. */ if (buf->state != UVC_BUF_STATE_ACTIVE) { - struct timespec ts; - if (fid == stream->last_fid) { uvc_trace(UVC_TRACE_FRAME, "Dropping payload (out of " "sync).\n"); @@ -1018,11 +1007,9 @@ static int uvc_video_decode_start(struct uvc_streaming *stream, return -ENODATA; } - uvc_video_get_ts(&ts); - buf->buf.field = V4L2_FIELD_NONE; buf->buf.sequence = stream->sequence; - buf->buf.vb2_buf.timestamp = timespec_to_ns(&ts); + buf->buf.vb2_buf.timestamp = uvc_video_get_time(); /* TODO: Handle PTS and SCR. */ buf->state = UVC_BUF_STATE_ACTIVE; diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h index 94392a3256e8..dd9c79a92622 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -541,8 +541,8 @@ struct uvc_streaming { struct uvc_clock_sample { u32 dev_stc; u16 dev_sof; - struct timespec host_ts; u16 host_sof; + ktime_t host_time; } *samples; unsigned int head; -- cgit v1.2.3 From 31a96f4c872e8fb953c853630f69d5de6ec961c9 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 4 Dec 2017 18:05:17 -0500 Subject: media: uvcvideo: Factor out video device registration to a function The function will then be used to register the video device for metadata capture. Signed-off-by: Laurent Pinchart Reviewed-by: Guennadi Liakhovetski Tested-by: Guennadi Liakhovetski Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/uvc/uvc_driver.c | 68 ++++++++++++++++++++++++-------------- drivers/media/usb/uvc/uvcvideo.h | 8 +++++ 2 files changed, 51 insertions(+), 25 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 07e427d36516..f6fbfc122871 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -24,6 +24,7 @@ #include #include +#include #include "uvcvideo.h" @@ -1889,52 +1890,65 @@ static void uvc_unregister_video(struct uvc_device *dev) kref_put(&dev->ref, uvc_delete); } -static int uvc_register_video(struct uvc_device *dev, - struct uvc_streaming *stream) +int uvc_register_video_device(struct uvc_device *dev, + struct uvc_streaming *stream, + struct video_device *vdev, + struct uvc_video_queue *queue, + enum v4l2_buf_type type, + const struct v4l2_file_operations *fops, + const struct v4l2_ioctl_ops *ioctl_ops) { - struct video_device *vdev = &stream->vdev; int ret; /* Initialize the video buffers queue. */ - ret = uvc_queue_init(&stream->queue, stream->type, !uvc_no_drop_param); + ret = uvc_queue_init(queue, type, !uvc_no_drop_param); if (ret) return ret; - /* Initialize the streaming interface with default streaming - * parameters. - */ - ret = uvc_video_init(stream); - if (ret < 0) { - uvc_printk(KERN_ERR, "Failed to initialize the device " - "(%d).\n", ret); - return ret; - } - - uvc_debugfs_init_stream(stream); - /* Register the device with V4L. */ - /* We already hold a reference to dev->udev. The video device will be + /* + * We already hold a reference to dev->udev. The video device will be * unregistered before the reference is released, so we don't need to * get another one. */ vdev->v4l2_dev = &dev->vdev; - vdev->fops = &uvc_fops; - vdev->ioctl_ops = &uvc_ioctl_ops; + vdev->fops = fops; + vdev->ioctl_ops = ioctl_ops; vdev->release = uvc_release; vdev->prio = &stream->chain->prio; - if (stream->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) + if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT) vdev->vfl_dir = VFL_DIR_TX; + else + vdev->vfl_dir = VFL_DIR_RX; strlcpy(vdev->name, dev->name, sizeof vdev->name); - /* Set the driver data before calling video_register_device, otherwise - * uvc_v4l2_open might race us. + /* + * Set the driver data before calling video_register_device, otherwise + * the file open() handler might race us. */ video_set_drvdata(vdev, stream); ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1); if (ret < 0) { - uvc_printk(KERN_ERR, "Failed to register video device (%d).\n", + uvc_printk(KERN_ERR, "Failed to register %s device (%d).\n", + v4l2_type_names[type], ret); + return ret; + } + + kref_get(&dev->ref); + return 0; +} + +static int uvc_register_video(struct uvc_device *dev, + struct uvc_streaming *stream) +{ + int ret; + + /* Initialize the streaming interface with default parameters. */ + ret = uvc_video_init(stream); + if (ret < 0) { + uvc_printk(KERN_ERR, "Failed to initialize the device (%d).\n", ret); return ret; } @@ -1944,8 +1958,12 @@ static int uvc_register_video(struct uvc_device *dev, else stream->chain->caps |= V4L2_CAP_VIDEO_OUTPUT; - kref_get(&dev->ref); - return 0; + uvc_debugfs_init_stream(stream); + + /* Register the device with V4L. */ + return uvc_register_video_device(dev, stream, &stream->vdev, + &stream->queue, stream->type, + &uvc_fops, &uvc_ioctl_ops); } /* diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h index dd9c79a92622..c36fa0991141 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -716,6 +716,14 @@ void uvc_video_clock_update(struct uvc_streaming *stream, struct vb2_v4l2_buffer *vbuf, struct uvc_buffer *buf); +int uvc_register_video_device(struct uvc_device *dev, + struct uvc_streaming *stream, + struct video_device *vdev, + struct uvc_video_queue *queue, + enum v4l2_buf_type type, + const struct v4l2_file_operations *fops, + const struct v4l2_ioctl_ops *ioctl_ops); + /* Status */ extern int uvc_status_init(struct uvc_device *dev); extern void uvc_status_cleanup(struct uvc_device *dev); -- cgit v1.2.3 From 94c53e26dc74744cc4f9a8ddc593b7aef96ba764 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 4 Dec 2017 18:06:01 -0500 Subject: media: uvcvideo: Report V4L2 device caps through the video_device structure The V4L2 core populates the struct v4l2_capability device_caps field from the same field in video_device. There's no need to handle that manually in the driver. Signed-off-by: Laurent Pinchart Reviewed-by: Guennadi Liakhovetski Tested-by: Guennadi Liakhovetski Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/uvc/uvc_driver.c | 11 +++++++++++ drivers/media/usb/uvc/uvc_v4l2.c | 4 ---- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index f6fbfc122871..d63458539e03 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -1921,6 +1921,17 @@ int uvc_register_video_device(struct uvc_device *dev, vdev->vfl_dir = VFL_DIR_TX; else vdev->vfl_dir = VFL_DIR_RX; + + switch (type) { + case V4L2_BUF_TYPE_VIDEO_CAPTURE: + default: + vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; + break; + case V4L2_BUF_TYPE_VIDEO_OUTPUT: + vdev->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; + break; + } + strlcpy(vdev->name, dev->name, sizeof vdev->name); /* diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 3e7e283a44a8..5e0323982577 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -568,10 +568,6 @@ static int uvc_ioctl_querycap(struct file *file, void *fh, usb_make_path(stream->dev->udev, cap->bus_info, sizeof(cap->bus_info)); cap->capabilities = V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING | chain->caps; - if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) - cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; - else - cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; return 0; } -- cgit v1.2.3 From 3bc85817d7982ed53fbc9b150b0205beff68ca5c Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 8 Nov 2017 11:00:13 -0500 Subject: media: uvcvideo: Add extensible device information Currently the UVC driver assigns a quirk bitmask to the .driver_info field of struct usb_device_id. This patch instroduces a struct to store quirks and possibly other per-device parameters in the future. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/uvc/uvc_driver.c | 127 +++++++++++++++++++++++-------------- 1 file changed, 78 insertions(+), 49 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index d63458539e03..1509bbc77a2f 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -2035,11 +2035,18 @@ static int uvc_register_chains(struct uvc_device *dev) * USB probe, disconnect, suspend and resume */ +struct uvc_device_info { + u32 quirks; +}; + static int uvc_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct usb_device *udev = interface_to_usbdev(intf); struct uvc_device *dev; + const struct uvc_device_info *info = + (const struct uvc_device_info *)id->driver_info; + u32 quirks = info ? info->quirks : 0; int function; int ret; @@ -2066,7 +2073,7 @@ static int uvc_probe(struct usb_interface *intf, dev->intf = usb_get_intf(intf); dev->intfnum = intf->cur_altsetting->desc.bInterfaceNumber; dev->quirks = (uvc_quirks_param == -1) - ? id->driver_info : uvc_quirks_param; + ? quirks : uvc_quirks_param; if (udev->product != NULL) strlcpy(dev->name, udev->product, sizeof dev->name); @@ -2107,7 +2114,7 @@ static int uvc_probe(struct usb_interface *intf, le16_to_cpu(udev->descriptor.idVendor), le16_to_cpu(udev->descriptor.idProduct)); - if (dev->quirks != id->driver_info) { + if (dev->quirks != quirks) { uvc_printk(KERN_INFO, "Forcing device quirks to 0x%x by module " "parameter for testing purpose.\n", dev->quirks); uvc_printk(KERN_INFO, "Please report required quirks to the " @@ -2305,6 +2312,28 @@ MODULE_PARM_DESC(timeout, "Streaming control requests timeout"); * Driver initialization and cleanup */ +static const struct uvc_device_info uvc_quirk_probe_minmax = { + .quirks = UVC_QUIRK_PROBE_MINMAX, +}; + +static const struct uvc_device_info uvc_quirk_fix_bandwidth = { + .quirks = UVC_QUIRK_FIX_BANDWIDTH, +}; + +static const struct uvc_device_info uvc_quirk_probe_def = { + .quirks = UVC_QUIRK_PROBE_DEF, +}; + +static const struct uvc_device_info uvc_quirk_stream_no_fid = { + .quirks = UVC_QUIRK_STREAM_NO_FID, +}; + +static const struct uvc_device_info uvc_quirk_force_y8 = { + .quirks = UVC_QUIRK_FORCE_Y8, +}; + +#define UVC_QUIRK_INFO(q) (kernel_ulong_t)&(struct uvc_device_info){.quirks = q} + /* * The Logitech cameras listed below have their interface class set to * VENDOR_SPEC because they don't announce themselves as UVC devices, even @@ -2319,7 +2348,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_MINMAX }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax }, /* Genius eFace 2025 */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2328,7 +2357,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_MINMAX }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax }, /* Microsoft Lifecam NX-6000 */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2337,7 +2366,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_MINMAX }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax }, /* Microsoft Lifecam NX-3000 */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2346,7 +2375,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_DEF }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def }, /* Microsoft Lifecam VX-7000 */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2355,7 +2384,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_MINMAX }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax }, /* Logitech Quickcam Fusion */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2412,7 +2441,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_RESTORE_CTRLS_ON_INIT }, + .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_RESTORE_CTRLS_ON_INIT) }, /* Chicony CNF7129 (Asus EEE 100HE) */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2421,7 +2450,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_RESTRICT_FRAME_RATE }, + .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_RESTRICT_FRAME_RATE) }, /* Alcor Micro AU3820 (Future Boy PC USB Webcam) */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2430,7 +2459,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_MINMAX }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax }, /* Dell XPS m1530 */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2439,7 +2468,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_DEF }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def }, /* Dell SP2008WFP Monitor */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2448,7 +2477,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_DEF }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def }, /* Dell Alienware X51 */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2457,7 +2486,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_DEF }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def }, /* Dell Studio Hybrid 140g (OmniVision webcam) */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2466,7 +2495,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_DEF }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def }, /* Dell XPS M1330 (OmniVision OV7670 webcam) */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2475,7 +2504,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_DEF }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def }, /* Apple Built-In iSight */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2484,8 +2513,8 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_MINMAX - | UVC_QUIRK_BUILTIN_ISIGHT }, + .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_PROBE_MINMAX + | UVC_QUIRK_BUILTIN_ISIGHT) }, /* Apple Built-In iSight via iBridge */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2494,7 +2523,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_DEF }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def }, /* Foxlink ("HP Webcam" on HP Mini 5103) */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2503,7 +2532,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_FIX_BANDWIDTH }, + .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth }, /* Genesys Logic USB 2.0 PC Camera */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2512,7 +2541,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_STREAM_NO_FID }, + .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid }, /* Hercules Classic Silver */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2521,7 +2550,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_FIX_BANDWIDTH }, + .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth }, /* ViMicro Vega */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2530,7 +2559,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_FIX_BANDWIDTH }, + .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth }, /* ViMicro - Minoru3D */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2539,7 +2568,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_FIX_BANDWIDTH }, + .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth }, /* ViMicro Venus - Minoru3D */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2548,7 +2577,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_FIX_BANDWIDTH }, + .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth }, /* Ophir Optronics - SPCAM 620U */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2557,7 +2586,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_MINMAX }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax }, /* MT6227 */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2566,8 +2595,8 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_MINMAX - | UVC_QUIRK_PROBE_DEF }, + .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_PROBE_MINMAX + | UVC_QUIRK_PROBE_DEF) }, /* IMC Networks (Medion Akoya) */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2576,7 +2605,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_STREAM_NO_FID }, + .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid }, /* JMicron USB2.0 XGA WebCam */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2585,7 +2614,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_MINMAX }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax }, /* Syntek (HP Spartan) */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2594,7 +2623,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_STREAM_NO_FID }, + .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid }, /* Syntek (Samsung Q310) */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2603,7 +2632,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_STREAM_NO_FID }, + .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid }, /* Syntek (Packard Bell EasyNote MX52 */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2612,7 +2641,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_STREAM_NO_FID }, + .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid }, /* Syntek (Asus F9SG) */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2621,7 +2650,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_STREAM_NO_FID }, + .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid }, /* Syntek (Asus U3S) */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2630,7 +2659,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_STREAM_NO_FID }, + .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid }, /* Syntek (JAOtech Smart Terminal) */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2639,7 +2668,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_STREAM_NO_FID }, + .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid }, /* Miricle 307K */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2648,7 +2677,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_STREAM_NO_FID }, + .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid }, /* Lenovo Thinkpad SL400/SL500 */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2657,7 +2686,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_STREAM_NO_FID }, + .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid }, /* Aveo Technology USB 2.0 Camera */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2666,8 +2695,8 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_MINMAX - | UVC_QUIRK_PROBE_EXTRAFIELDS }, + .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_PROBE_MINMAX + | UVC_QUIRK_PROBE_EXTRAFIELDS) }, /* Aveo Technology USB 2.0 Camera (Tasco USB Microscope) */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2684,7 +2713,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_EXTRAFIELDS }, + .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_PROBE_EXTRAFIELDS) }, /* Manta MM-353 Plako */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2693,7 +2722,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_MINMAX }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax }, /* FSC WebCam V30S */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2702,7 +2731,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_MINMAX }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax }, /* Arkmicro unbranded */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2711,7 +2740,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_DEF }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def }, /* The Imaging Source USB CCD cameras */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2730,7 +2759,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_STATUS_INTERVAL }, + .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_STATUS_INTERVAL) }, /* MSI StarCam 370i */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2739,7 +2768,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_MINMAX }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax }, /* SiGma Micro USB Web Camera */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2748,8 +2777,8 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_PROBE_MINMAX - | UVC_QUIRK_IGNORE_SELECTOR_UNIT }, + .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_PROBE_MINMAX + | UVC_QUIRK_IGNORE_SELECTOR_UNIT) }, /* Oculus VR Positional Tracker DK2 */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2758,7 +2787,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_FORCE_Y8 }, + .driver_info = (kernel_ulong_t)&uvc_quirk_force_y8 }, /* Oculus VR Rift Sensor */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2767,7 +2796,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VENDOR_SPEC, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_FORCE_Y8 }, + .driver_info = (kernel_ulong_t)&uvc_quirk_force_y8 }, /* Generic USB Video Class */ { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_UNDEFINED) }, { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_15) }, -- cgit v1.2.3 From 088ead25524583e2200aa99111bea2f66a86545a Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 6 Dec 2017 10:15:40 -0500 Subject: media: uvcvideo: Add a metadata device node Some UVC video cameras contain metadata in their payload headers. This patch extracts that data, adding more clock synchronisation information, on both bulk and isochronous endpoints and makes it available to the user space on a separate video node, using the V4L2_CAP_META_CAPTURE capability and the V4L2_BUF_TYPE_META_CAPTURE buffer queue type. By default, only the V4L2_META_FMT_UVC pixel format is available from those nodes. However, cameras can be added to the device ID table to additionally specify their own metadata format, in which case that format will also become available from the metadata node. [Use put_unaligned instead of __put_unaligned_cpu64] [Use put_unaligned for the sof field as well] Signed-off-by: Guennadi Liakhovetski Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/uvc/Makefile | 2 +- drivers/media/usb/uvc/uvc_driver.c | 15 ++- drivers/media/usb/uvc/uvc_isight.c | 2 +- drivers/media/usb/uvc/uvc_metadata.c | 179 +++++++++++++++++++++++++++++++++++ drivers/media/usb/uvc/uvc_queue.c | 44 +++++++-- drivers/media/usb/uvc/uvc_video.c | 134 ++++++++++++++++++++++++-- drivers/media/usb/uvc/uvcvideo.h | 16 +++- 7 files changed, 370 insertions(+), 22 deletions(-) create mode 100644 drivers/media/usb/uvc/uvc_metadata.c (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/uvc/Makefile b/drivers/media/usb/uvc/Makefile index a4fe5b5d533f..4f9eee4f81ab 100644 --- a/drivers/media/usb/uvc/Makefile +++ b/drivers/media/usb/uvc/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 uvcvideo-objs := uvc_driver.o uvc_queue.o uvc_v4l2.o uvc_video.o uvc_ctrl.o \ - uvc_status.o uvc_isight.o uvc_debugfs.o + uvc_status.o uvc_isight.o uvc_debugfs.o uvc_metadata.o ifeq ($(CONFIG_MEDIA_CONTROLLER),y) uvcvideo-objs += uvc_entity.o endif diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 1509bbc77a2f..2886c100abf2 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -1883,6 +1883,7 @@ static void uvc_unregister_video(struct uvc_device *dev) continue; video_unregister_device(&stream->vdev); + video_unregister_device(&stream->meta.vdev); uvc_debugfs_cleanup_stream(stream); } @@ -1930,6 +1931,9 @@ int uvc_register_video_device(struct uvc_device *dev, case V4L2_BUF_TYPE_VIDEO_OUTPUT: vdev->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; break; + case V4L2_BUF_TYPE_META_CAPTURE: + vdev->device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING; + break; } strlcpy(vdev->name, dev->name, sizeof vdev->name); @@ -1965,7 +1969,8 @@ static int uvc_register_video(struct uvc_device *dev, } if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) - stream->chain->caps |= V4L2_CAP_VIDEO_CAPTURE; + stream->chain->caps |= V4L2_CAP_VIDEO_CAPTURE + | V4L2_CAP_META_CAPTURE; else stream->chain->caps |= V4L2_CAP_VIDEO_OUTPUT; @@ -2003,6 +2008,11 @@ static int uvc_register_terms(struct uvc_device *dev, if (ret < 0) return ret; + /* Register a metadata node, but ignore a possible failure, + * complete registration of video nodes anyway. + */ + uvc_meta_register(stream); + term->vdev = &stream->vdev; } @@ -2037,6 +2047,7 @@ static int uvc_register_chains(struct uvc_device *dev) struct uvc_device_info { u32 quirks; + u32 meta_format; }; static int uvc_probe(struct usb_interface *intf, @@ -2074,6 +2085,8 @@ static int uvc_probe(struct usb_interface *intf, dev->intfnum = intf->cur_altsetting->desc.bInterfaceNumber; dev->quirks = (uvc_quirks_param == -1) ? quirks : uvc_quirks_param; + if (info) + dev->meta_format = info->meta_format; if (udev->product != NULL) strlcpy(dev->name, udev->product, sizeof dev->name); diff --git a/drivers/media/usb/uvc/uvc_isight.c b/drivers/media/usb/uvc/uvc_isight.c index 8510e7259e76..fb940cfae575 100644 --- a/drivers/media/usb/uvc/uvc_isight.c +++ b/drivers/media/usb/uvc/uvc_isight.c @@ -100,7 +100,7 @@ static int isight_decode(struct uvc_video_queue *queue, struct uvc_buffer *buf, } void uvc_video_decode_isight(struct urb *urb, struct uvc_streaming *stream, - struct uvc_buffer *buf) + struct uvc_buffer *buf, struct uvc_buffer *meta_buf) { int ret, i; diff --git a/drivers/media/usb/uvc/uvc_metadata.c b/drivers/media/usb/uvc/uvc_metadata.c new file mode 100644 index 000000000000..cd1aec19cc5b --- /dev/null +++ b/drivers/media/usb/uvc/uvc_metadata.c @@ -0,0 +1,179 @@ +/* + * uvc_metadata.c -- USB Video Class driver - Metadata handling + * + * Copyright (C) 2016 + * Guennadi Liakhovetski (guennadi.liakhovetski@intel.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "uvcvideo.h" + +/* ----------------------------------------------------------------------------- + * V4L2 ioctls + */ + +static int uvc_meta_v4l2_querycap(struct file *file, void *fh, + struct v4l2_capability *cap) +{ + struct v4l2_fh *vfh = file->private_data; + struct uvc_streaming *stream = video_get_drvdata(vfh->vdev); + struct uvc_video_chain *chain = stream->chain; + + strlcpy(cap->driver, "uvcvideo", sizeof(cap->driver)); + strlcpy(cap->card, vfh->vdev->name, sizeof(cap->card)); + usb_make_path(stream->dev->udev, cap->bus_info, sizeof(cap->bus_info)); + cap->capabilities = V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING + | chain->caps; + + return 0; +} + +static int uvc_meta_v4l2_get_format(struct file *file, void *fh, + struct v4l2_format *format) +{ + struct v4l2_fh *vfh = file->private_data; + struct uvc_streaming *stream = video_get_drvdata(vfh->vdev); + struct v4l2_meta_format *fmt = &format->fmt.meta; + + if (format->type != vfh->vdev->queue->type) + return -EINVAL; + + memset(fmt, 0, sizeof(*fmt)); + + fmt->dataformat = stream->meta.format; + fmt->buffersize = UVC_METATADA_BUF_SIZE; + + return 0; +} + +static int uvc_meta_v4l2_try_format(struct file *file, void *fh, + struct v4l2_format *format) +{ + struct v4l2_fh *vfh = file->private_data; + struct uvc_streaming *stream = video_get_drvdata(vfh->vdev); + struct uvc_device *dev = stream->dev; + struct v4l2_meta_format *fmt = &format->fmt.meta; + u32 fmeta = fmt->dataformat; + + if (format->type != vfh->vdev->queue->type) + return -EINVAL; + + memset(fmt, 0, sizeof(*fmt)); + + fmt->dataformat = fmeta == dev->meta_format ? fmeta : V4L2_META_FMT_UVC; + fmt->buffersize = UVC_METATADA_BUF_SIZE; + + return 0; +} + +static int uvc_meta_v4l2_set_format(struct file *file, void *fh, + struct v4l2_format *format) +{ + struct v4l2_fh *vfh = file->private_data; + struct uvc_streaming *stream = video_get_drvdata(vfh->vdev); + struct v4l2_meta_format *fmt = &format->fmt.meta; + int ret; + + ret = uvc_meta_v4l2_try_format(file, fh, format); + if (ret < 0) + return ret; + + /* + * We could in principle switch at any time, also during streaming. + * Metadata buffers would still be perfectly parseable, but it's more + * consistent and cleaner to disallow that. + */ + mutex_lock(&stream->mutex); + + if (uvc_queue_allocated(&stream->queue)) + ret = -EBUSY; + else + stream->meta.format = fmt->dataformat; + + mutex_unlock(&stream->mutex); + + return ret; +} + +static int uvc_meta_v4l2_enum_formats(struct file *file, void *fh, + struct v4l2_fmtdesc *fdesc) +{ + struct v4l2_fh *vfh = file->private_data; + struct uvc_streaming *stream = video_get_drvdata(vfh->vdev); + struct uvc_device *dev = stream->dev; + u32 index = fdesc->index; + + if (fdesc->type != vfh->vdev->queue->type || + index > 1U || (index && !dev->meta_format)) + return -EINVAL; + + memset(fdesc, 0, sizeof(*fdesc)); + + fdesc->type = vfh->vdev->queue->type; + fdesc->index = index; + fdesc->pixelformat = index ? dev->meta_format : V4L2_META_FMT_UVC; + + return 0; +} + +static const struct v4l2_ioctl_ops uvc_meta_ioctl_ops = { + .vidioc_querycap = uvc_meta_v4l2_querycap, + .vidioc_g_fmt_meta_cap = uvc_meta_v4l2_get_format, + .vidioc_s_fmt_meta_cap = uvc_meta_v4l2_set_format, + .vidioc_try_fmt_meta_cap = uvc_meta_v4l2_try_format, + .vidioc_enum_fmt_meta_cap = uvc_meta_v4l2_enum_formats, + .vidioc_reqbufs = vb2_ioctl_reqbufs, + .vidioc_querybuf = vb2_ioctl_querybuf, + .vidioc_qbuf = vb2_ioctl_qbuf, + .vidioc_dqbuf = vb2_ioctl_dqbuf, + .vidioc_create_bufs = vb2_ioctl_create_bufs, + .vidioc_prepare_buf = vb2_ioctl_prepare_buf, + .vidioc_streamon = vb2_ioctl_streamon, + .vidioc_streamoff = vb2_ioctl_streamoff, +}; + +/* ----------------------------------------------------------------------------- + * V4L2 File Operations + */ + +static const struct v4l2_file_operations uvc_meta_fops = { + .owner = THIS_MODULE, + .unlocked_ioctl = video_ioctl2, + .open = v4l2_fh_open, + .release = vb2_fop_release, + .poll = vb2_fop_poll, + .mmap = vb2_fop_mmap, +}; + +int uvc_meta_register(struct uvc_streaming *stream) +{ + struct uvc_device *dev = stream->dev; + struct video_device *vdev = &stream->meta.vdev; + struct uvc_video_queue *queue = &stream->meta.queue; + + stream->meta.format = V4L2_META_FMT_UVC; + + /* + * The video interface queue uses manual locking and thus does not set + * the queue pointer. Set it manually here. + */ + vdev->queue = &queue->queue; + + return uvc_register_video_device(dev, stream, vdev, queue, + V4L2_BUF_TYPE_META_CAPTURE, + &uvc_meta_fops, &uvc_meta_ioctl_ops); +} diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c index c8d78b2f3de4..cd2ea5a23086 100644 --- a/drivers/media/usb/uvc/uvc_queue.c +++ b/drivers/media/usb/uvc/uvc_queue.c @@ -79,8 +79,19 @@ static int uvc_queue_setup(struct vb2_queue *vq, unsigned int sizes[], struct device *alloc_devs[]) { struct uvc_video_queue *queue = vb2_get_drv_priv(vq); - struct uvc_streaming *stream = uvc_queue_to_stream(queue); - unsigned size = stream->ctrl.dwMaxVideoFrameSize; + struct uvc_streaming *stream; + unsigned int size; + + switch (vq->type) { + case V4L2_BUF_TYPE_META_CAPTURE: + size = UVC_METATADA_BUF_SIZE; + break; + + default: + stream = uvc_queue_to_stream(queue); + size = stream->ctrl.dwMaxVideoFrameSize; + break; + } /* * When called with plane sizes, validate them. The driver supports @@ -114,7 +125,7 @@ static int uvc_buffer_prepare(struct vb2_buffer *vb) buf->error = 0; buf->mem = vb2_plane_vaddr(vb, 0); buf->length = vb2_plane_size(vb, 0); - if (vb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + if (vb->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) buf->bytesused = 0; else buf->bytesused = vb2_get_plane_payload(vb, 0); @@ -177,10 +188,10 @@ static int uvc_start_streaming(struct vb2_queue *vq, unsigned int count) static void uvc_stop_streaming(struct vb2_queue *vq) { struct uvc_video_queue *queue = vb2_get_drv_priv(vq); - struct uvc_streaming *stream = uvc_queue_to_stream(queue); unsigned long flags; - uvc_video_enable(stream, 0); + if (vq->type != V4L2_BUF_TYPE_META_CAPTURE) + uvc_video_enable(uvc_queue_to_stream(queue), 0); spin_lock_irqsave(&queue->irqlock, flags); uvc_queue_return_buffers(queue, UVC_BUF_STATE_ERROR); @@ -198,20 +209,39 @@ static const struct vb2_ops uvc_queue_qops = { .stop_streaming = uvc_stop_streaming, }; +static const struct vb2_ops uvc_meta_queue_qops = { + .queue_setup = uvc_queue_setup, + .buf_prepare = uvc_buffer_prepare, + .buf_queue = uvc_buffer_queue, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, + .stop_streaming = uvc_stop_streaming, +}; + int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type, int drop_corrupted) { int ret; queue->queue.type = type; - queue->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; + queue->queue.io_modes = VB2_MMAP | VB2_USERPTR; queue->queue.drv_priv = queue; queue->queue.buf_struct_size = sizeof(struct uvc_buffer); - queue->queue.ops = &uvc_queue_qops; queue->queue.mem_ops = &vb2_vmalloc_memops; queue->queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC | V4L2_BUF_FLAG_TSTAMP_SRC_SOE; queue->queue.lock = &queue->mutex; + + switch (type) { + case V4L2_BUF_TYPE_META_CAPTURE: + queue->queue.ops = &uvc_meta_queue_qops; + break; + default: + queue->queue.io_modes |= VB2_DMABUF; + queue->queue.ops = &uvc_queue_qops; + break; + } + ret = vb2_queue_init(&queue->queue); if (ret) return ret; diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index 13f459ea239c..5441553f74e1 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -1119,6 +1119,84 @@ static int uvc_video_encode_data(struct uvc_streaming *stream, return nbytes; } +/* ------------------------------------------------------------------------ + * Metadata + */ + +/* + * Additionally to the payload headers we also want to provide the user with USB + * Frame Numbers and system time values. The resulting buffer is thus composed + * of blocks, containing a 64-bit timestamp in nanoseconds, a 16-bit USB Frame + * Number, and a copy of the payload header. + * + * Ideally we want to capture all payload headers for each frame. However, their + * number is unknown and unbound. We thus drop headers that contain no vendor + * data and that either contain no SCR value or an SCR value identical to the + * previous header. + */ +static void uvc_video_decode_meta(struct uvc_streaming *stream, + struct uvc_buffer *meta_buf, + const u8 *mem, unsigned int length) +{ + struct uvc_meta_buf *meta; + size_t len_std = 2; + bool has_pts, has_scr; + unsigned long flags; + unsigned int sof; + ktime_t time; + const u8 *scr; + + if (!meta_buf || length == 2) + return; + + if (meta_buf->length - meta_buf->bytesused < + length + sizeof(meta->ns) + sizeof(meta->sof)) { + meta_buf->error = 1; + return; + } + + has_pts = mem[1] & UVC_STREAM_PTS; + has_scr = mem[1] & UVC_STREAM_SCR; + + if (has_pts) { + len_std += 4; + scr = mem + 6; + } else { + scr = mem + 2; + } + + if (has_scr) + len_std += 6; + + if (stream->meta.format == V4L2_META_FMT_UVC) + length = len_std; + + if (length == len_std && (!has_scr || + !memcmp(scr, stream->clock.last_scr, 6))) + return; + + meta = (struct uvc_meta_buf *)((u8 *)meta_buf->mem + meta_buf->bytesused); + local_irq_save(flags); + time = uvc_video_get_time(); + sof = usb_get_current_frame_number(stream->dev->udev); + local_irq_restore(flags); + put_unaligned(ktime_to_ns(time), &meta->ns); + put_unaligned(sof, &meta->sof); + + if (has_scr) + memcpy(stream->clock.last_scr, scr, 6); + + memcpy(&meta->length, mem, length); + meta_buf->bytesused += length + sizeof(meta->ns) + sizeof(meta->sof); + + uvc_trace(UVC_TRACE_FRAME, + "%s(): t-sys %lluns, SOF %u, len %u, flags 0x%x, PTS %u, STC %u frame SOF %u\n", + __func__, time, meta->sof, meta->length, meta->flags, + has_pts ? *(u32 *)meta->buf : 0, + has_scr ? *(u32 *)scr : 0, + has_scr ? *(u32 *)(scr + 4) & 0x7ff : 0); +} + /* ------------------------------------------------------------------------ * URB handling */ @@ -1137,8 +1215,29 @@ static void uvc_video_validate_buffer(const struct uvc_streaming *stream, /* * Completion handler for video URBs. */ + +static void uvc_video_next_buffers(struct uvc_streaming *stream, + struct uvc_buffer **video_buf, struct uvc_buffer **meta_buf) +{ + if (*meta_buf) { + struct vb2_v4l2_buffer *vb2_meta = &(*meta_buf)->buf; + const struct vb2_v4l2_buffer *vb2_video = &(*video_buf)->buf; + + vb2_meta->sequence = vb2_video->sequence; + vb2_meta->field = vb2_video->field; + vb2_meta->vb2_buf.timestamp = vb2_video->vb2_buf.timestamp; + + (*meta_buf)->state = UVC_BUF_STATE_READY; + if (!(*meta_buf)->error) + (*meta_buf)->error = (*video_buf)->error; + *meta_buf = uvc_queue_next_buffer(&stream->meta.queue, + *meta_buf); + } + *video_buf = uvc_queue_next_buffer(&stream->queue, *video_buf); +} + static void uvc_video_decode_isoc(struct urb *urb, struct uvc_streaming *stream, - struct uvc_buffer *buf) + struct uvc_buffer *buf, struct uvc_buffer *meta_buf) { u8 *mem; int ret, i; @@ -1160,14 +1259,15 @@ static void uvc_video_decode_isoc(struct urb *urb, struct uvc_streaming *stream, urb->iso_frame_desc[i].actual_length); if (ret == -EAGAIN) { uvc_video_validate_buffer(stream, buf); - buf = uvc_queue_next_buffer(&stream->queue, - buf); + uvc_video_next_buffers(stream, &buf, &meta_buf); } } while (ret == -EAGAIN); if (ret < 0) continue; + uvc_video_decode_meta(stream, meta_buf, mem, ret); + /* Decode the payload data. */ uvc_video_decode_data(stream, buf, mem + ret, urb->iso_frame_desc[i].actual_length - ret); @@ -1178,13 +1278,13 @@ static void uvc_video_decode_isoc(struct urb *urb, struct uvc_streaming *stream, if (buf->state == UVC_BUF_STATE_READY) { uvc_video_validate_buffer(stream, buf); - buf = uvc_queue_next_buffer(&stream->queue, buf); + uvc_video_next_buffers(stream, &buf, &meta_buf); } } } static void uvc_video_decode_bulk(struct urb *urb, struct uvc_streaming *stream, - struct uvc_buffer *buf) + struct uvc_buffer *buf, struct uvc_buffer *meta_buf) { u8 *mem; int len, ret; @@ -1207,8 +1307,7 @@ static void uvc_video_decode_bulk(struct urb *urb, struct uvc_streaming *stream, do { ret = uvc_video_decode_start(stream, buf, mem, len); if (ret == -EAGAIN) - buf = uvc_queue_next_buffer(&stream->queue, - buf); + uvc_video_next_buffers(stream, &buf, &meta_buf); } while (ret == -EAGAIN); /* If an error occurred skip the rest of the payload. */ @@ -1218,6 +1317,8 @@ static void uvc_video_decode_bulk(struct urb *urb, struct uvc_streaming *stream, memcpy(stream->bulk.header, mem, ret); stream->bulk.header_size = ret; + uvc_video_decode_meta(stream, meta_buf, mem, ret); + mem += ret; len -= ret; } @@ -1241,7 +1342,7 @@ static void uvc_video_decode_bulk(struct urb *urb, struct uvc_streaming *stream, uvc_video_decode_end(stream, buf, stream->bulk.header, stream->bulk.payload_size); if (buf->state == UVC_BUF_STATE_READY) - uvc_queue_next_buffer(&stream->queue, buf); + uvc_video_next_buffers(stream, &buf, &meta_buf); } stream->bulk.header_size = 0; @@ -1251,7 +1352,7 @@ static void uvc_video_decode_bulk(struct urb *urb, struct uvc_streaming *stream, } static void uvc_video_encode_bulk(struct urb *urb, struct uvc_streaming *stream, - struct uvc_buffer *buf) + struct uvc_buffer *buf, struct uvc_buffer *meta_buf) { u8 *mem = urb->transfer_buffer; int len = stream->urb_size, ret; @@ -1297,7 +1398,10 @@ static void uvc_video_complete(struct urb *urb) { struct uvc_streaming *stream = urb->context; struct uvc_video_queue *queue = &stream->queue; + struct uvc_video_queue *qmeta = &stream->meta.queue; + struct vb2_queue *vb2_qmeta = stream->meta.vdev.queue; struct uvc_buffer *buf = NULL; + struct uvc_buffer *buf_meta = NULL; unsigned long flags; int ret; @@ -1316,6 +1420,8 @@ static void uvc_video_complete(struct urb *urb) case -ECONNRESET: /* usb_unlink_urb() called. */ case -ESHUTDOWN: /* The endpoint is being disabled. */ uvc_queue_cancel(queue, urb->status == -ESHUTDOWN); + if (vb2_qmeta) + uvc_queue_cancel(qmeta, urb->status == -ESHUTDOWN); return; } @@ -1325,7 +1431,15 @@ static void uvc_video_complete(struct urb *urb) queue); spin_unlock_irqrestore(&queue->irqlock, flags); - stream->decode(urb, stream, buf); + if (vb2_qmeta) { + spin_lock_irqsave(&qmeta->irqlock, flags); + if (!list_empty(&qmeta->irqqueue)) + buf_meta = list_first_entry(&qmeta->irqqueue, + struct uvc_buffer, queue); + spin_unlock_irqrestore(&qmeta->irqlock, flags); + } + + stream->decode(urb, stream, buf, buf_meta); if ((ret = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { uvc_printk(KERN_ERR, "Failed to resubmit video URB (%d).\n", diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h index c36fa0991141..961d7c13b27b 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -479,6 +479,8 @@ struct uvc_stats_stream { unsigned int max_sof; /* Maximum STC.SOF value */ }; +#define UVC_METATADA_BUF_SIZE 1024 + struct uvc_streaming { struct list_head list; struct uvc_device *dev; @@ -510,7 +512,13 @@ struct uvc_streaming { unsigned int frozen : 1; struct uvc_video_queue queue; void (*decode) (struct urb *urb, struct uvc_streaming *video, - struct uvc_buffer *buf); + struct uvc_buffer *buf, struct uvc_buffer *meta_buf); + + struct { + struct video_device vdev; + struct uvc_video_queue queue; + __u32 format; + } meta; /* Context data used by the bulk completion handler. */ struct { @@ -552,6 +560,8 @@ struct uvc_streaming { u16 last_sof; u16 sof_offset; + u8 last_scr[6]; + spinlock_t lock; } clock; }; @@ -561,6 +571,7 @@ struct uvc_device { struct usb_interface *intf; unsigned long warnings; __u32 quirks; + __u32 meta_format; int intfnum; char name[32]; @@ -715,6 +726,7 @@ extern int uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit, void uvc_video_clock_update(struct uvc_streaming *stream, struct vb2_v4l2_buffer *vbuf, struct uvc_buffer *buf); +int uvc_meta_register(struct uvc_streaming *stream); int uvc_register_video_device(struct uvc_device *dev, struct uvc_streaming *stream, @@ -777,7 +789,7 @@ extern struct usb_host_endpoint *uvc_find_endpoint( /* Quirks support */ void uvc_video_decode_isight(struct urb *urb, struct uvc_streaming *stream, - struct uvc_buffer *buf); + struct uvc_buffer *buf, struct uvc_buffer *meta_buf); /* debugfs and statistics */ void uvc_debugfs_init(void); -- cgit v1.2.3 From 589266bdbf90527436fed95505522fd30d9a6d98 Mon Sep 17 00:00:00 2001 From: Neil Armstrong Date: Thu, 9 Feb 2017 08:26:46 -0500 Subject: media: uvcvideo: Add a quirk for Generalplus Technology Inc. 808 Camera As reported on [1], this device needs this quirk to be able to reliably initialise the webcam. [1] https://sourceforge.net/p/linux-uvc/mailman/message/33791098/ Signed-off-by: Neil Armstrong Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/uvc/uvc_driver.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 2886c100abf2..108577c50097 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -2782,6 +2782,15 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax }, + /* Generalplus Technology Inc. 808 Camera */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x1b3f, + .idProduct = 0x2002, + .bInterfaceClass = USB_CLASS_VIDEO, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax }, /* SiGma Micro USB Web Camera */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, -- cgit v1.2.3 From 4a3fad709bbc74c85fffff8903d17b5e35723365 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 4 Jan 2018 06:47:28 -0500 Subject: media: fix usage of whitespaces and on indentation On several places, whitespaces are being used for indentation, or even at the end of the line. Fix them. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/as102/as10x_cmd_cfg.c | 6 +++--- drivers/media/usb/cx231xx/cx231xx-avcore.c | 2 +- drivers/media/usb/em28xx/Kconfig | 14 +++++++------- drivers/media/usb/gspca/autogain_functions.c | 12 ++++++------ drivers/media/usb/gspca/cpia1.c | 2 +- drivers/media/usb/gspca/stv06xx/stv06xx.h | 2 +- drivers/media/usb/pvrusb2/pvrusb2-devattr.c | 12 ++++++------ drivers/media/usb/tm6000/tm6000.h | 2 +- drivers/media/usb/usbtv/Kconfig | 16 ++++++++-------- 9 files changed, 34 insertions(+), 34 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/as102/as10x_cmd_cfg.c b/drivers/media/usb/as102/as10x_cmd_cfg.c index c87f2ca223a2..fabbfead96d8 100644 --- a/drivers/media/usb/as102/as10x_cmd_cfg.c +++ b/drivers/media/usb/as102/as10x_cmd_cfg.c @@ -133,9 +133,9 @@ out: * as10x_cmd_eLNA_change_mode - send eLNA change mode command to AS10x * @adap: pointer to AS10x bus adapter * @mode: mode selected: - * - ON : 0x0 => eLNA always ON - * - OFF : 0x1 => eLNA always OFF - * - AUTO : 0x2 => eLNA follow hysteresis parameters + * - ON : 0x0 => eLNA always ON + * - OFF : 0x1 => eLNA always OFF + * - AUTO : 0x2 => eLNA follow hysteresis parameters * to be ON or OFF * * Return 0 on success or negative value in case of error. diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c b/drivers/media/usb/cx231xx/cx231xx-avcore.c index 2f52d66b4dae..0df62d3951cf 100644 --- a/drivers/media/usb/cx231xx/cx231xx-avcore.c +++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c @@ -105,7 +105,7 @@ void uninitGPIO(struct cx231xx *dev) /****************************************************************************** * A F E - B L O C K C O N T R O L functions * - * [ANALOG FRONT END] * + * [ANALOG FRONT END] * ******************************************************************************/ static int afe_write_byte(struct cx231xx *dev, u16 saddr, u8 data) { diff --git a/drivers/media/usb/em28xx/Kconfig b/drivers/media/usb/em28xx/Kconfig index 4cc029f18aa8..451e076525d3 100644 --- a/drivers/media/usb/em28xx/Kconfig +++ b/drivers/media/usb/em28xx/Kconfig @@ -71,10 +71,10 @@ config VIDEO_EM28XX_DVB Empiatech em28xx chips. config VIDEO_EM28XX_RC - tristate "EM28XX Remote Controller support" - depends on RC_CORE - depends on VIDEO_EM28XX - depends on !(RC_CORE=m && VIDEO_EM28XX=y) - default VIDEO_EM28XX - ---help--- - Enables Remote Controller support on em28xx driver. + tristate "EM28XX Remote Controller support" + depends on RC_CORE + depends on VIDEO_EM28XX + depends on !(RC_CORE=m && VIDEO_EM28XX=y) + default VIDEO_EM28XX + ---help--- + Enables Remote Controller support on em28xx driver. diff --git a/drivers/media/usb/gspca/autogain_functions.c b/drivers/media/usb/gspca/autogain_functions.c index f721e83596be..6dfab2b077f7 100644 --- a/drivers/media/usb/gspca/autogain_functions.c +++ b/drivers/media/usb/gspca/autogain_functions.c @@ -32,7 +32,7 @@ int gspca_expo_autogain( int i, steps, retval = 0; if (v4l2_ctrl_g_ctrl(gspca_dev->autogain) == 0) - return 0; + return 0; orig_gain = gain = v4l2_ctrl_g_ctrl(gspca_dev->gain); orig_exposure = exposure = v4l2_ctrl_g_ctrl(gspca_dev->exposure); @@ -75,11 +75,11 @@ int gspca_expo_autogain( } if (gain != orig_gain) { - v4l2_ctrl_s_ctrl(gspca_dev->gain, gain); + v4l2_ctrl_s_ctrl(gspca_dev->gain, gain); retval = 1; } if (exposure != orig_exposure) { - v4l2_ctrl_s_ctrl(gspca_dev->exposure, exposure); + v4l2_ctrl_s_ctrl(gspca_dev->exposure, exposure); retval = 1; } @@ -112,7 +112,7 @@ int gspca_coarse_grained_expo_autogain( int steps, retval = 0; if (v4l2_ctrl_g_ctrl(gspca_dev->autogain) == 0) - return 0; + return 0; orig_gain = gain = v4l2_ctrl_g_ctrl(gspca_dev->gain); orig_exposure = exposure = v4l2_ctrl_g_ctrl(gspca_dev->exposure); @@ -158,11 +158,11 @@ int gspca_coarse_grained_expo_autogain( } if (gain != orig_gain) { - v4l2_ctrl_s_ctrl(gspca_dev->gain, gain); + v4l2_ctrl_s_ctrl(gspca_dev->gain, gain); retval = 1; } if (exposure != orig_exposure) { - v4l2_ctrl_s_ctrl(gspca_dev->exposure, exposure); + v4l2_ctrl_s_ctrl(gspca_dev->exposure, exposure); retval = 1; } diff --git a/drivers/media/usb/gspca/cpia1.c b/drivers/media/usb/gspca/cpia1.c index 8d41cd46a79d..2b09af8865f4 100644 --- a/drivers/media/usb/gspca/cpia1.c +++ b/drivers/media/usb/gspca/cpia1.c @@ -543,7 +543,7 @@ static int do_command(struct gspca_dev *gspca_dev, u16 command, input_report_key(gspca_dev->input_dev, KEY_CAMERA, a); input_sync(gspca_dev->input_dev); #endif - sd->params.qx3.button = a; + sd->params.qx3.button = a; } if (sd->params.qx3.button) { /* button pressed - unlock the latch */ diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx.h b/drivers/media/usb/gspca/stv06xx/stv06xx.h index f9d74e4d7cf9..480186706bba 100644 --- a/drivers/media/usb/gspca/stv06xx/stv06xx.h +++ b/drivers/media/usb/gspca/stv06xx/stv06xx.h @@ -59,7 +59,7 @@ /* Refers to the CIF 352x288 and QCIF 176x144 */ /* 1: 288 lines, 2: 144 lines */ -#define STV_Y_CTRL 0x15c3 +#define STV_Y_CTRL 0x15c3 #define STV_RESET 0x1620 diff --git a/drivers/media/usb/pvrusb2/pvrusb2-devattr.c b/drivers/media/usb/pvrusb2/pvrusb2-devattr.c index 51b3312eaea1..71537097c13f 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-devattr.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-devattr.c @@ -319,12 +319,12 @@ static struct tda829x_config tda829x_no_probe = { }; static struct tda18271_std_map hauppauge_tda18271_dvbt_std_map = { - .dvbt_6 = { .if_freq = 3300, .agc_mode = 3, .std = 4, - .if_lvl = 1, .rfagc_top = 0x37, }, - .dvbt_7 = { .if_freq = 3800, .agc_mode = 3, .std = 5, - .if_lvl = 1, .rfagc_top = 0x37, }, - .dvbt_8 = { .if_freq = 4300, .agc_mode = 3, .std = 6, - .if_lvl = 1, .rfagc_top = 0x37, }, + .dvbt_6 = { .if_freq = 3300, .agc_mode = 3, .std = 4, + .if_lvl = 1, .rfagc_top = 0x37, }, + .dvbt_7 = { .if_freq = 3800, .agc_mode = 3, .std = 5, + .if_lvl = 1, .rfagc_top = 0x37, }, + .dvbt_8 = { .if_freq = 4300, .agc_mode = 3, .std = 6, + .if_lvl = 1, .rfagc_top = 0x37, }, }; static struct tda18271_config hauppauge_tda18271_dvb_config = { diff --git a/drivers/media/usb/tm6000/tm6000.h b/drivers/media/usb/tm6000/tm6000.h index 23a0ceb4bfea..e1e45770e28d 100644 --- a/drivers/media/usb/tm6000/tm6000.h +++ b/drivers/media/usb/tm6000/tm6000.h @@ -177,7 +177,7 @@ struct tm6000_core { struct tm6000_capabilities caps; /* Used to load alsa/dvb */ - struct work_struct request_module_wk; + struct work_struct request_module_wk; /* Tuner configuration */ int tuner_type; /* type of the tuner */ diff --git a/drivers/media/usb/usbtv/Kconfig b/drivers/media/usb/usbtv/Kconfig index b833c5b9094e..14a0941fa0d0 100644 --- a/drivers/media/usb/usbtv/Kconfig +++ b/drivers/media/usb/usbtv/Kconfig @@ -1,11 +1,11 @@ config VIDEO_USBTV - tristate "USBTV007 video capture support" - depends on VIDEO_V4L2 && SND - select SND_PCM - select VIDEOBUF2_VMALLOC + tristate "USBTV007 video capture support" + depends on VIDEO_V4L2 && SND + select SND_PCM + select VIDEOBUF2_VMALLOC - ---help--- - This is a video4linux2 driver for USBTV007 based video capture devices. + ---help--- + This is a video4linux2 driver for USBTV007 based video capture devices. - To compile this driver as a module, choose M here: the - module will be called usbtv + To compile this driver as a module, choose M here: the + module will be called usbtv -- cgit v1.2.3 From 6e6a8b5a38cb04d5ef35d4eb57836126b954e7c8 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 4 Jan 2018 13:08:56 -0500 Subject: media: replace all occurrences There are a lot of places where sequences of space/tabs are found. Get rid of all spaces before tabs. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/au0828/au0828-cards.h | 2 +- drivers/media/usb/au0828/au0828-video.c | 2 +- drivers/media/usb/au0828/au0828.h | 6 +- drivers/media/usb/cpia2/cpia2_usb.c | 14 +- drivers/media/usb/cx231xx/cx231xx-audio.c | 6 +- drivers/media/usb/cx231xx/cx231xx-avcore.c | 2 +- drivers/media/usb/cx231xx/cx231xx-core.c | 2 +- drivers/media/usb/cx231xx/cx231xx-i2c.c | 2 +- drivers/media/usb/cx231xx/cx231xx-pcb-cfg.h | 2 +- drivers/media/usb/cx231xx/cx231xx-reg.h | 20 +-- drivers/media/usb/dvb-usb/az6027.c | 216 ++++++++++++++-------------- drivers/media/usb/gspca/stv06xx/stv06xx.c | 2 +- drivers/media/usb/hdpvr/hdpvr-video.c | 26 ++-- drivers/media/usb/hdpvr/hdpvr.h | 18 +-- drivers/media/usb/pwc/pwc.h | 6 +- drivers/media/usb/siano/smsusb.c | 2 +- drivers/media/usb/stk1160/Makefile | 2 +- drivers/media/usb/stkwebcam/stk-sensor.c | 44 +++--- drivers/media/usb/uvc/uvc_driver.c | 14 +- drivers/media/usb/uvc/uvc_isight.c | 10 +- 20 files changed, 199 insertions(+), 199 deletions(-) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/au0828/au0828-cards.h b/drivers/media/usb/au0828/au0828-cards.h index 1f4412ee6da4..dbd8a90ee76f 100644 --- a/drivers/media/usb/au0828/au0828-cards.h +++ b/drivers/media/usb/au0828/au0828-cards.h @@ -17,7 +17,7 @@ #define AU0828_BOARD_UNKNOWN 0 #define AU0828_BOARD_HAUPPAUGE_HVR950Q 1 -#define AU0828_BOARD_HAUPPAUGE_HVR850 2 +#define AU0828_BOARD_HAUPPAUGE_HVR850 2 #define AU0828_BOARD_DVICO_FUSIONHDTV7 3 #define AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL 4 #define AU0828_BOARD_HAUPPAUGE_WOODBURY 5 diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c index a240153821e0..c765d546114d 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c @@ -1797,7 +1797,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { static const struct video_device au0828_video_template = { .fops = &au0828_v4l_fops, .release = video_device_release_empty, - .ioctl_ops = &video_ioctl_ops, + .ioctl_ops = &video_ioctl_ops, .tvnorms = V4L2_STD_NTSC_M | V4L2_STD_PAL_M, }; diff --git a/drivers/media/usb/au0828/au0828.h b/drivers/media/usb/au0828/au0828.h index 9e3c1237a274..004eadef55c7 100644 --- a/drivers/media/usb/au0828/au0828.h +++ b/drivers/media/usb/au0828/au0828.h @@ -190,7 +190,7 @@ struct au0828_dev { struct i2c_adapter i2c_adap; struct i2c_algorithm i2c_algo; struct i2c_client i2c_client; - u32 i2c_rc; + u32 i2c_rc; /* Digital */ struct au0828_dvb dvb; @@ -293,8 +293,8 @@ struct au0828_dev { /* ----------------------------------------------------------- */ #define au0828_read(dev, reg) au0828_readreg(dev, reg) #define au0828_write(dev, reg, value) au0828_writereg(dev, reg, value) -#define au0828_andor(dev, reg, mask, value) \ - au0828_writereg(dev, reg, \ +#define au0828_andor(dev, reg, mask, value) \ + au0828_writereg(dev, reg, \ (au0828_readreg(dev, reg) & ~(mask)) | ((value) & (mask))) #define au0828_set(dev, reg, bit) au0828_andor(dev, (reg), (bit), (bit)) diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c index 6089036049d9..f3a1e5b1e57c 100644 --- a/drivers/media/usb/cpia2/cpia2_usb.c +++ b/drivers/media/usb/cpia2/cpia2_usb.c @@ -33,13 +33,13 @@ static int frame_sizes[] = { 0, // USBIF_CMDONLY - 0, // USBIF_BULK - 128, // USBIF_ISO_1 - 384, // USBIF_ISO_2 - 640, // USBIF_ISO_3 - 768, // USBIF_ISO_4 - 896, // USBIF_ISO_5 - 1023, // USBIF_ISO_6 + 0, // USBIF_BULK + 128, // USBIF_ISO_1 + 384, // USBIF_ISO_2 + 640, // USBIF_ISO_3 + 768, // USBIF_ISO_4 + 896, // USBIF_ISO_5 + 1023, // USBIF_ISO_6 }; #define FRAMES_PER_DESC 10 diff --git a/drivers/media/usb/cx231xx/cx231xx-audio.c b/drivers/media/usb/cx231xx/cx231xx-audio.c index 06f10d7fc4b0..d96236d786d1 100644 --- a/drivers/media/usb/cx231xx/cx231xx-audio.c +++ b/drivers/media/usb/cx231xx/cx231xx-audio.c @@ -404,9 +404,9 @@ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, } static const struct snd_pcm_hardware snd_cx231xx_hw_capture = { - .info = SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP | - SNDRV_PCM_INFO_INTERLEAVED | + .info = SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP_VALID, .formats = SNDRV_PCM_FMTBIT_S16_LE, diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c b/drivers/media/usb/cx231xx/cx231xx-avcore.c index 0df62d3951cf..fdd3c221fa0d 100644 --- a/drivers/media/usb/cx231xx/cx231xx-avcore.c +++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c @@ -2168,7 +2168,7 @@ int cx231xx_tuner_post_channel_change(struct cx231xx *dev) } /****************************************************************************** - * I 2 S - B L O C K C O N T R O L functions * + * I 2 S - B L O C K C O N T R O L functions * ******************************************************************************/ int cx231xx_i2s_blk_initialize(struct cx231xx *dev) { diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c index f372ad3917a8..4f43668df15d 100644 --- a/drivers/media/usb/cx231xx/cx231xx-core.c +++ b/drivers/media/usb/cx231xx/cx231xx-core.c @@ -56,7 +56,7 @@ MODULE_PARM_DESC(alt, "alternate setting to use for video endpoint"); dev->name, __func__ , ##arg); } while (0) /***************************************************************** -* Device control list functions * +* Device control list functions * ******************************************************************/ LIST_HEAD(cx231xx_devlist); diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index 23648dab7be8..6e1bef2a45bb 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c @@ -51,7 +51,7 @@ do { \ if (i2c_debug >= lvl) { \ printk(KERN_DEBUG "%s at %s: " fmt, \ dev->name, __func__ , ##args); \ - } \ + } \ } while (0) static inline int get_real_i2c_port(struct cx231xx *dev, int bus_nr) diff --git a/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.h b/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.h index 4511dc5d199c..8f00b1d38277 100644 --- a/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.h +++ b/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.h @@ -144,7 +144,7 @@ enum AVDEC_STATUS{ #define SOURCE_EXTERNAL 0x8 #define SOURCE_TS_BDA 0x10 #define SOURCE_TS_ENCODE 0x20 -#define SOURCE_TS_EXTERNAL 0x40 +#define SOURCE_TS_EXTERNAL 0x40 /*************************************************************************** * interface information define * diff --git a/drivers/media/usb/cx231xx/cx231xx-reg.h b/drivers/media/usb/cx231xx/cx231xx-reg.h index 750c5d37d569..db5af8d51b61 100644 --- a/drivers/media/usb/cx231xx/cx231xx-reg.h +++ b/drivers/media/usb/cx231xx/cx231xx-reg.h @@ -1433,16 +1433,16 @@ #define FLD_AC97_SHUTDOWN 0x00000001 /* Cx231xx redefine */ -#define QPSK_IAGC_CTL1 0x94c -#define QPSK_IAGC_CTL2 0x950 -#define QPSK_FEPR_FREQ 0x954 -#define QPSK_BTL_CTL1 0x958 -#define QPSK_BTL_CTL2 0x95c -#define QPSK_CTL_CTL1 0x960 -#define QPSK_CTL_CTL2 0x964 -#define QPSK_MF_FAGC_CTL 0x968 -#define QPSK_EQ_CTL 0x96c -#define QPSK_LOCK_CTL 0x970 +#define QPSK_IAGC_CTL1 0x94c +#define QPSK_IAGC_CTL2 0x950 +#define QPSK_FEPR_FREQ 0x954 +#define QPSK_BTL_CTL1 0x958 +#define QPSK_BTL_CTL2 0x95c +#define QPSK_CTL_CTL1 0x960 +#define QPSK_CTL_CTL2 0x964 +#define QPSK_MF_FAGC_CTL 0x968 +#define QPSK_EQ_CTL 0x96c +#define QPSK_LOCK_CTL 0x970 /*****************************************************************************/ #define FM1_DFT_CTL 0x9a8 diff --git a/drivers/media/usb/dvb-usb/az6027.c b/drivers/media/usb/dvb-usb/az6027.c index 96bbb53a4a91..f0d10ac03a37 100644 --- a/drivers/media/usb/dvb-usb/az6027.c +++ b/drivers/media/usb/dvb-usb/az6027.c @@ -36,70 +36,70 @@ static const struct stb0899_s1_reg az6027_stb0899_s1_init_1[] = { /* 0x0000000b, SYSREG */ { STB0899_DEV_ID , 0x30 }, { STB0899_DISCNTRL1 , 0x32 }, - { STB0899_DISCNTRL2 , 0x80 }, - { STB0899_DISRX_ST0 , 0x04 }, - { STB0899_DISRX_ST1 , 0x00 }, - { STB0899_DISPARITY , 0x00 }, + { STB0899_DISCNTRL2 , 0x80 }, + { STB0899_DISRX_ST0 , 0x04 }, + { STB0899_DISRX_ST1 , 0x00 }, + { STB0899_DISPARITY , 0x00 }, { STB0899_DISSTATUS , 0x20 }, - { STB0899_DISF22 , 0x99 }, - { STB0899_DISF22RX , 0xa8 }, + { STB0899_DISF22 , 0x99 }, + { STB0899_DISF22RX , 0xa8 }, /* SYSREG ? */ - { STB0899_ACRPRESC , 0x11 }, - { STB0899_ACRDIV1 , 0x0a }, - { STB0899_ACRDIV2 , 0x05 }, - { STB0899_DACR1 , 0x00 }, - { STB0899_DACR2 , 0x00 }, - { STB0899_OUTCFG , 0x00 }, - { STB0899_MODECFG , 0x00 }, + { STB0899_ACRPRESC , 0x11 }, + { STB0899_ACRDIV1 , 0x0a }, + { STB0899_ACRDIV2 , 0x05 }, + { STB0899_DACR1 , 0x00 }, + { STB0899_DACR2 , 0x00 }, + { STB0899_OUTCFG , 0x00 }, + { STB0899_MODECFG , 0x00 }, { STB0899_IRQSTATUS_3 , 0xfe }, { STB0899_IRQSTATUS_2 , 0x03 }, { STB0899_IRQSTATUS_1 , 0x7c }, { STB0899_IRQSTATUS_0 , 0xf4 }, - { STB0899_IRQMSK_3 , 0xf3 }, - { STB0899_IRQMSK_2 , 0xfc }, - { STB0899_IRQMSK_1 , 0xff }, + { STB0899_IRQMSK_3 , 0xf3 }, + { STB0899_IRQMSK_2 , 0xfc }, + { STB0899_IRQMSK_1 , 0xff }, { STB0899_IRQMSK_0 , 0xff }, { STB0899_IRQCFG , 0x00 }, - { STB0899_I2CCFG , 0x88 }, - { STB0899_I2CRPT , 0x58 }, + { STB0899_I2CCFG , 0x88 }, + { STB0899_I2CRPT , 0x58 }, { STB0899_IOPVALUE5 , 0x00 }, { STB0899_IOPVALUE4 , 0x33 }, { STB0899_IOPVALUE3 , 0x6d }, { STB0899_IOPVALUE2 , 0x90 }, { STB0899_IOPVALUE1 , 0x60 }, { STB0899_IOPVALUE0 , 0x00 }, - { STB0899_GPIO00CFG , 0x82 }, - { STB0899_GPIO01CFG , 0x82 }, - { STB0899_GPIO02CFG , 0x82 }, - { STB0899_GPIO03CFG , 0x82 }, - { STB0899_GPIO04CFG , 0x82 }, - { STB0899_GPIO05CFG , 0x82 }, - { STB0899_GPIO06CFG , 0x82 }, - { STB0899_GPIO07CFG , 0x82 }, - { STB0899_GPIO08CFG , 0x82 }, - { STB0899_GPIO09CFG , 0x82 }, - { STB0899_GPIO10CFG , 0x82 }, - { STB0899_GPIO11CFG , 0x82 }, - { STB0899_GPIO12CFG , 0x82 }, - { STB0899_GPIO13CFG , 0x82 }, - { STB0899_GPIO14CFG , 0x82 }, - { STB0899_GPIO15CFG , 0x82 }, - { STB0899_GPIO16CFG , 0x82 }, - { STB0899_GPIO17CFG , 0x82 }, - { STB0899_GPIO18CFG , 0x82 }, - { STB0899_GPIO19CFG , 0x82 }, - { STB0899_GPIO20CFG , 0x82 }, - { STB0899_SDATCFG , 0xb8 }, - { STB0899_SCLTCFG , 0xba }, - { STB0899_AGCRFCFG , 0x1c }, /* 0x11 */ - { STB0899_GPIO22 , 0x82 }, /* AGCBB2CFG */ - { STB0899_GPIO21 , 0x91 }, /* AGCBB1CFG */ - { STB0899_DIRCLKCFG , 0x82 }, - { STB0899_CLKOUT27CFG , 0x7e }, - { STB0899_STDBYCFG , 0x82 }, - { STB0899_CS0CFG , 0x82 }, - { STB0899_CS1CFG , 0x82 }, - { STB0899_DISEQCOCFG , 0x20 }, + { STB0899_GPIO00CFG , 0x82 }, + { STB0899_GPIO01CFG , 0x82 }, + { STB0899_GPIO02CFG , 0x82 }, + { STB0899_GPIO03CFG , 0x82 }, + { STB0899_GPIO04CFG , 0x82 }, + { STB0899_GPIO05CFG , 0x82 }, + { STB0899_GPIO06CFG , 0x82 }, + { STB0899_GPIO07CFG , 0x82 }, + { STB0899_GPIO08CFG , 0x82 }, + { STB0899_GPIO09CFG , 0x82 }, + { STB0899_GPIO10CFG , 0x82 }, + { STB0899_GPIO11CFG , 0x82 }, + { STB0899_GPIO12CFG , 0x82 }, + { STB0899_GPIO13CFG , 0x82 }, + { STB0899_GPIO14CFG , 0x82 }, + { STB0899_GPIO15CFG , 0x82 }, + { STB0899_GPIO16CFG , 0x82 }, + { STB0899_GPIO17CFG , 0x82 }, + { STB0899_GPIO18CFG , 0x82 }, + { STB0899_GPIO19CFG , 0x82 }, + { STB0899_GPIO20CFG , 0x82 }, + { STB0899_SDATCFG , 0xb8 }, + { STB0899_SCLTCFG , 0xba }, + { STB0899_AGCRFCFG , 0x1c }, /* 0x11 */ + { STB0899_GPIO22 , 0x82 }, /* AGCBB2CFG */ + { STB0899_GPIO21 , 0x91 }, /* AGCBB1CFG */ + { STB0899_DIRCLKCFG , 0x82 }, + { STB0899_CLKOUT27CFG , 0x7e }, + { STB0899_STDBYCFG , 0x82 }, + { STB0899_CS0CFG , 0x82 }, + { STB0899_CS1CFG , 0x82 }, + { STB0899_DISEQCOCFG , 0x20 }, { STB0899_GPIO32CFG , 0x82 }, { STB0899_GPIO33CFG , 0x82 }, { STB0899_GPIO34CFG , 0x82 }, @@ -108,35 +108,35 @@ static const struct stb0899_s1_reg az6027_stb0899_s1_init_1[] = { { STB0899_GPIO37CFG , 0x82 }, { STB0899_GPIO38CFG , 0x82 }, { STB0899_GPIO39CFG , 0x82 }, - { STB0899_NCOARSE , 0x17 }, /* 0x15 = 27 Mhz Clock, F/3 = 198MHz, F/6 = 99MHz */ - { STB0899_SYNTCTRL , 0x02 }, /* 0x00 = CLK from CLKI, 0x02 = CLK from XTALI */ - { STB0899_FILTCTRL , 0x00 }, - { STB0899_SYSCTRL , 0x01 }, - { STB0899_STOPCLK1 , 0x20 }, - { STB0899_STOPCLK2 , 0x00 }, + { STB0899_NCOARSE , 0x17 }, /* 0x15 = 27 Mhz Clock, F/3 = 198MHz, F/6 = 99MHz */ + { STB0899_SYNTCTRL , 0x02 }, /* 0x00 = CLK from CLKI, 0x02 = CLK from XTALI */ + { STB0899_FILTCTRL , 0x00 }, + { STB0899_SYSCTRL , 0x01 }, + { STB0899_STOPCLK1 , 0x20 }, + { STB0899_STOPCLK2 , 0x00 }, { STB0899_INTBUFSTATUS , 0x00 }, - { STB0899_INTBUFCTRL , 0x0a }, + { STB0899_INTBUFCTRL , 0x0a }, { 0xffff , 0xff }, }; static const struct stb0899_s1_reg az6027_stb0899_s1_init_3[] = { - { STB0899_DEMOD , 0x00 }, - { STB0899_RCOMPC , 0xc9 }, - { STB0899_AGC1CN , 0x01 }, - { STB0899_AGC1REF , 0x10 }, + { STB0899_DEMOD , 0x00 }, + { STB0899_RCOMPC , 0xc9 }, + { STB0899_AGC1CN , 0x01 }, + { STB0899_AGC1REF , 0x10 }, { STB0899_RTC , 0x23 }, - { STB0899_TMGCFG , 0x4e }, - { STB0899_AGC2REF , 0x34 }, - { STB0899_TLSR , 0x84 }, - { STB0899_CFD , 0xf7 }, + { STB0899_TMGCFG , 0x4e }, + { STB0899_AGC2REF , 0x34 }, + { STB0899_TLSR , 0x84 }, + { STB0899_CFD , 0xf7 }, { STB0899_ACLC , 0x87 }, - { STB0899_BCLC , 0x94 }, - { STB0899_EQON , 0x41 }, - { STB0899_LDT , 0xf1 }, - { STB0899_LDT2 , 0xe3 }, - { STB0899_EQUALREF , 0xb4 }, - { STB0899_TMGRAMP , 0x10 }, - { STB0899_TMGTHD , 0x30 }, + { STB0899_BCLC , 0x94 }, + { STB0899_EQON , 0x41 }, + { STB0899_LDT , 0xf1 }, + { STB0899_LDT2 , 0xe3 }, + { STB0899_EQUALREF , 0xb4 }, + { STB0899_TMGRAMP , 0x10 }, + { STB0899_TMGTHD , 0x30 }, { STB0899_IDCCOMP , 0xfd }, { STB0899_QDCCOMP , 0xff }, { STB0899_POWERI , 0x0c }, @@ -155,12 +155,12 @@ static const struct stb0899_s1_reg az6027_stb0899_s1_init_3[] = { { STB0899_NIRL , 0x80 }, { STB0899_ISYMB , 0x1d }, { STB0899_QSYMB , 0xa6 }, - { STB0899_SFRH , 0x2f }, - { STB0899_SFRM , 0x68 }, - { STB0899_SFRL , 0x40 }, - { STB0899_SFRUPH , 0x2f }, - { STB0899_SFRUPM , 0x68 }, - { STB0899_SFRUPL , 0x40 }, + { STB0899_SFRH , 0x2f }, + { STB0899_SFRM , 0x68 }, + { STB0899_SFRL , 0x40 }, + { STB0899_SFRUPH , 0x2f }, + { STB0899_SFRUPM , 0x68 }, + { STB0899_SFRUPL , 0x40 }, { STB0899_EQUAI1 , 0x02 }, { STB0899_EQUAQ1 , 0xff }, { STB0899_EQUAI2 , 0x04 }, @@ -172,7 +172,7 @@ static const struct stb0899_s1_reg az6027_stb0899_s1_init_3[] = { { STB0899_EQUAI5 , 0x08 }, { STB0899_EQUAQ5 , 0xf5 }, { STB0899_DSTATUS2 , 0x00 }, - { STB0899_VSTATUS , 0x00 }, + { STB0899_VSTATUS , 0x00 }, { STB0899_VERROR , 0x86 }, { STB0899_IQSWAP , 0x2a }, { STB0899_ECNT1M , 0x00 }, @@ -181,26 +181,26 @@ static const struct stb0899_s1_reg az6027_stb0899_s1_init_3[] = { { STB0899_ECNT2L , 0x00 }, { STB0899_ECNT3M , 0x0a }, { STB0899_ECNT3L , 0xad }, - { STB0899_FECAUTO1 , 0x06 }, + { STB0899_FECAUTO1 , 0x06 }, { STB0899_FECM , 0x01 }, - { STB0899_VTH12 , 0xb0 }, - { STB0899_VTH23 , 0x7a }, + { STB0899_VTH12 , 0xb0 }, + { STB0899_VTH23 , 0x7a }, { STB0899_VTH34 , 0x58 }, - { STB0899_VTH56 , 0x38 }, - { STB0899_VTH67 , 0x34 }, - { STB0899_VTH78 , 0x24 }, - { STB0899_PRVIT , 0xff }, - { STB0899_VITSYNC , 0x19 }, - { STB0899_RSULC , 0xb1 }, /* DVB = 0xb1, DSS = 0xa1 */ - { STB0899_TSULC , 0x42 }, - { STB0899_RSLLC , 0x41 }, + { STB0899_VTH56 , 0x38 }, + { STB0899_VTH67 , 0x34 }, + { STB0899_VTH78 , 0x24 }, + { STB0899_PRVIT , 0xff }, + { STB0899_VITSYNC , 0x19 }, + { STB0899_RSULC , 0xb1 }, /* DVB = 0xb1, DSS = 0xa1 */ + { STB0899_TSULC , 0x42 }, + { STB0899_RSLLC , 0x41 }, { STB0899_TSLPL , 0x12 }, - { STB0899_TSCFGH , 0x0c }, - { STB0899_TSCFGM , 0x00 }, - { STB0899_TSCFGL , 0x00 }, + { STB0899_TSCFGH , 0x0c }, + { STB0899_TSCFGM , 0x00 }, + { STB0899_TSCFGL , 0x00 }, { STB0899_TSOUT , 0x69 }, /* 0x0d for CAM */ - { STB0899_RSSYNCDEL , 0x00 }, - { STB0899_TSINHDELH , 0x02 }, + { STB0899_RSSYNCDEL , 0x00 }, + { STB0899_TSINHDELH , 0x02 }, { STB0899_TSINHDELM , 0x00 }, { STB0899_TSINHDELL , 0x00 }, { STB0899_TSLLSTKM , 0x1b }, @@ -211,18 +211,18 @@ static const struct stb0899_s1_reg az6027_stb0899_s1_init_3[] = { { STB0899_PCKLENLL , 0xcc }, { STB0899_RSPCKLEN , 0xbd }, { STB0899_TSSTATUS , 0x90 }, - { STB0899_ERRCTRL1 , 0xb6 }, - { STB0899_ERRCTRL2 , 0x95 }, - { STB0899_ERRCTRL3 , 0x8d }, + { STB0899_ERRCTRL1 , 0xb6 }, + { STB0899_ERRCTRL2 , 0x95 }, + { STB0899_ERRCTRL3 , 0x8d }, { STB0899_DMONMSK1 , 0x27 }, { STB0899_DMONMSK0 , 0x03 }, - { STB0899_DEMAPVIT , 0x5c }, + { STB0899_DEMAPVIT , 0x5c }, { STB0899_PLPARM , 0x19 }, - { STB0899_PDELCTRL , 0x48 }, - { STB0899_PDELCTRL2 , 0x00 }, - { STB0899_BBHCTRL1 , 0x00 }, - { STB0899_BBHCTRL2 , 0x00 }, - { STB0899_HYSTTHRESH , 0x77 }, + { STB0899_PDELCTRL , 0x48 }, + { STB0899_PDELCTRL2 , 0x00 }, + { STB0899_BBHCTRL1 , 0x00 }, + { STB0899_BBHCTRL2 , 0x00 }, + { STB0899_HYSTTHRESH , 0x77 }, { STB0899_MATCSTM , 0x00 }, { STB0899_MATCSTL , 0x00 }, { STB0899_UPLCSTM , 0x00 }, @@ -261,7 +261,7 @@ static struct stb0899_config az6027_stb0899_config = { .init_s2_fec = stb0899_s2_init_4, .init_tst = stb0899_s1_init_5, - .demod_address = 0xd0, /* 0x68, 0xd0 >> 1 */ + .demod_address = 0xd0, /* 0x68, 0xd0 >> 1 */ .xtal_freq = 27000000, .inversion = IQ_SWAP_ON, @@ -1181,9 +1181,9 @@ static struct dvb_usb_device_properties az6027_properties = { /* usb specific object needed to register this driver with the usb subsystem */ static struct usb_driver az6027_usb_driver = { .name = "dvb_usb_az6027", - .probe = az6027_usb_probe, - .disconnect = az6027_usb_disconnect, - .id_table = az6027_usb_table, + .probe = az6027_usb_probe, + .disconnect = az6027_usb_disconnect, + .id_table = az6027_usb_table, }; module_usb_driver(az6027_usb_driver); diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx.c b/drivers/media/usb/gspca/stv06xx/stv06xx.c index 2715218fe436..6080a35310ca 100644 --- a/drivers/media/usb/gspca/stv06xx/stv06xx.c +++ b/drivers/media/usb/gspca/stv06xx/stv06xx.c @@ -579,7 +579,7 @@ static int stv06xx_config(struct gspca_dev *gspca_dev, /* -- module initialisation -- */ static const struct usb_device_id device_table[] = { - {USB_DEVICE(0x046d, 0x0840), .driver_info = BRIDGE_STV600 }, /* QuickCam Express */ + {USB_DEVICE(0x046d, 0x0840), .driver_info = BRIDGE_STV600 }, /* QuickCam Express */ {USB_DEVICE(0x046d, 0x0850), .driver_info = BRIDGE_STV610 }, /* LEGO cam / QuickCam Web */ {USB_DEVICE(0x046d, 0x0870), .driver_info = BRIDGE_STV602 }, /* Dexxa WebCam USB */ {USB_DEVICE(0x046D, 0x08F0), .driver_info = BRIDGE_ST6422 }, /* QuickCam Messenger */ diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c index 7fb036d6a86e..5e5f63f2652b 100644 --- a/drivers/media/usb/hdpvr/hdpvr-video.c +++ b/drivers/media/usb/hdpvr/hdpvr-video.c @@ -941,18 +941,18 @@ static int hdpvr_s_ctrl(struct v4l2_ctrl *ctrl) return 0; case V4L2_CID_MPEG_VIDEO_ENCODING: return 0; -/* case V4L2_CID_MPEG_VIDEO_B_FRAMES: */ -/* if (ctrl->value == 0 && !(opt->gop_mode & 0x2)) { */ -/* opt->gop_mode |= 0x2; */ -/* hdpvr_config_call(dev, CTRL_GOP_MODE_VALUE, */ -/* opt->gop_mode); */ -/* } */ -/* if (ctrl->value == 128 && opt->gop_mode & 0x2) { */ -/* opt->gop_mode &= ~0x2; */ -/* hdpvr_config_call(dev, CTRL_GOP_MODE_VALUE, */ -/* opt->gop_mode); */ -/* } */ -/* break; */ +/* case V4L2_CID_MPEG_VIDEO_B_FRAMES: */ +/* if (ctrl->value == 0 && !(opt->gop_mode & 0x2)) { */ +/* opt->gop_mode |= 0x2; */ +/* hdpvr_config_call(dev, CTRL_GOP_MODE_VALUE, */ +/* opt->gop_mode); */ +/* } */ +/* if (ctrl->value == 128 && opt->gop_mode & 0x2) { */ +/* opt->gop_mode &= ~0x2; */ +/* hdpvr_config_call(dev, CTRL_GOP_MODE_VALUE, */ +/* opt->gop_mode); */ +/* } */ +/* break; */ case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: { uint peak_bitrate = dev->video_bitrate_peak->val / 100000; uint bitrate = dev->video_bitrate->val / 100000; @@ -1154,7 +1154,7 @@ static void hdpvr_device_release(struct video_device *vdev) static const struct video_device hdpvr_video_template = { .fops = &hdpvr_fops, .release = hdpvr_device_release, - .ioctl_ops = &hdpvr_ioctl_ops, + .ioctl_ops = &hdpvr_ioctl_ops, .tvnorms = V4L2_STD_ALL, }; diff --git a/drivers/media/usb/hdpvr/hdpvr.h b/drivers/media/usb/hdpvr/hdpvr.h index 96e36a8e5f43..1d65b4185f57 100644 --- a/drivers/media/usb/hdpvr/hdpvr.h +++ b/drivers/media/usb/hdpvr/hdpvr.h @@ -232,15 +232,15 @@ enum { /* :0 s 38 d3 0000 0000 0001 1 = 00 */ -/* ret = usb_control_msg(dev->udev, */ -/* usb_sndctrlpipe(dev->udev, 0), */ -/* 0xd3, 0x38, */ -/* 0, 0, */ -/* "\0", 1, */ -/* 1000); */ - -/* info("control request returned %d", ret); */ -/* msleep(5000); */ +/* ret = usb_control_msg(dev->udev, */ +/* usb_sndctrlpipe(dev->udev, 0), */ +/* 0xd3, 0x38, */ +/* 0, 0, */ +/* "\0", 1, */ +/* 1000); */ + +/* info("control request returned %d", ret); */ +/* msleep(5000); */ /* :0 s b8 81 1400 0003 0005 5 < diff --git a/drivers/media/usb/pwc/pwc.h b/drivers/media/usb/pwc/pwc.h index 3c73bdaae450..67010010d2a2 100644 --- a/drivers/media/usb/pwc/pwc.h +++ b/drivers/media/usb/pwc/pwc.h @@ -50,7 +50,7 @@ /* Version block */ #define PWC_VERSION "10.0.15" -#define PWC_NAME "pwc" +#define PWC_NAME "pwc" #define PFX PWC_NAME ": " @@ -120,10 +120,10 @@ #define MAX_ISO_BUFS 3 #define ISO_FRAMES_PER_DESC 10 #define ISO_MAX_FRAME_SIZE 960 -#define ISO_BUFFER_SIZE (ISO_FRAMES_PER_DESC * ISO_MAX_FRAME_SIZE) +#define ISO_BUFFER_SIZE (ISO_FRAMES_PER_DESC * ISO_MAX_FRAME_SIZE) /* Maximum size after decompression is 640x480 YUV data, 1.5 * 640 * 480 */ -#define PWC_FRAME_SIZE (460800 + TOUCAM_HEADER_SIZE + TOUCAM_TRAILER_SIZE) +#define PWC_FRAME_SIZE (460800 + TOUCAM_HEADER_SIZE + TOUCAM_TRAILER_SIZE) /* Absolute minimum and maximum number of buffers available for mmap() */ #define MIN_FRAMES 2 diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c index d07349cf9489..f13e4b01b5a5 100644 --- a/drivers/media/usb/siano/smsusb.c +++ b/drivers/media/usb/siano/smsusb.c @@ -61,7 +61,7 @@ struct smsusb_device_t { struct usb_device *udev; struct smscore_device_t *coredev; - struct smsusb_urb_t surbs[MAX_URBS]; + struct smsusb_urb_t surbs[MAX_URBS]; int response_alignment; int buffer_size; diff --git a/drivers/media/usb/stk1160/Makefile b/drivers/media/usb/stk1160/Makefile index 8e6c22fb1803..b943db01ccf7 100644 --- a/drivers/media/usb/stk1160/Makefile +++ b/drivers/media/usb/stk1160/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -stk1160-y := stk1160-core.o \ +stk1160-y := stk1160-core.o \ stk1160-v4l.o \ stk1160-video.o \ stk1160-i2c.o \ diff --git a/drivers/media/usb/stkwebcam/stk-sensor.c b/drivers/media/usb/stkwebcam/stk-sensor.c index c1d4505f84ea..9a7dbeff1337 100644 --- a/drivers/media/usb/stkwebcam/stk-sensor.c +++ b/drivers/media/usb/stkwebcam/stk-sensor.c @@ -397,12 +397,12 @@ int stk_sensor_init(struct stk_camera *dev) /* V4L2_PIX_FMT_UYVY */ static struct regval ov_fmt_uyvy[] = { {REG_TSLB, TSLB_YLAST|0x08 }, - { 0x4f, 0x80 }, /* "matrix coefficient 1" */ - { 0x50, 0x80 }, /* "matrix coefficient 2" */ + { 0x4f, 0x80 }, /* "matrix coefficient 1" */ + { 0x50, 0x80 }, /* "matrix coefficient 2" */ { 0x51, 0 }, /* vb */ - { 0x52, 0x22 }, /* "matrix coefficient 4" */ - { 0x53, 0x5e }, /* "matrix coefficient 5" */ - { 0x54, 0x80 }, /* "matrix coefficient 6" */ + { 0x52, 0x22 }, /* "matrix coefficient 4" */ + { 0x53, 0x5e }, /* "matrix coefficient 5" */ + { 0x54, 0x80 }, /* "matrix coefficient 6" */ {REG_COM13, COM13_UVSAT|COM13_CMATRIX}, {REG_COM15, COM15_R00FF }, {0xff, 0xff}, /* END MARKER */ @@ -410,12 +410,12 @@ static struct regval ov_fmt_uyvy[] = { /* V4L2_PIX_FMT_YUYV */ static struct regval ov_fmt_yuyv[] = { {REG_TSLB, 0 }, - { 0x4f, 0x80 }, /* "matrix coefficient 1" */ - { 0x50, 0x80 }, /* "matrix coefficient 2" */ + { 0x4f, 0x80 }, /* "matrix coefficient 1" */ + { 0x50, 0x80 }, /* "matrix coefficient 2" */ { 0x51, 0 }, /* vb */ - { 0x52, 0x22 }, /* "matrix coefficient 4" */ - { 0x53, 0x5e }, /* "matrix coefficient 5" */ - { 0x54, 0x80 }, /* "matrix coefficient 6" */ + { 0x52, 0x22 }, /* "matrix coefficient 4" */ + { 0x53, 0x5e }, /* "matrix coefficient 5" */ + { 0x54, 0x80 }, /* "matrix coefficient 6" */ {REG_COM13, COM13_UVSAT|COM13_CMATRIX}, {REG_COM15, COM15_R00FF }, {0xff, 0xff}, /* END MARKER */ @@ -426,13 +426,13 @@ static struct regval ov_fmt_rgbr[] = { { REG_RGB444, 0 }, /* No RGB444 please */ {REG_TSLB, 0x00}, { REG_COM1, 0x0 }, - { REG_COM9, 0x38 }, /* 16x gain ceiling; 0x8 is reserved bit */ - { 0x4f, 0xb3 }, /* "matrix coefficient 1" */ - { 0x50, 0xb3 }, /* "matrix coefficient 2" */ + { REG_COM9, 0x38 }, /* 16x gain ceiling; 0x8 is reserved bit */ + { 0x4f, 0xb3 }, /* "matrix coefficient 1" */ + { 0x50, 0xb3 }, /* "matrix coefficient 2" */ { 0x51, 0 }, /* vb */ - { 0x52, 0x3d }, /* "matrix coefficient 4" */ - { 0x53, 0xa7 }, /* "matrix coefficient 5" */ - { 0x54, 0xe4 }, /* "matrix coefficient 6" */ + { 0x52, 0x3d }, /* "matrix coefficient 4" */ + { 0x53, 0xa7 }, /* "matrix coefficient 5" */ + { 0x54, 0xe4 }, /* "matrix coefficient 6" */ { REG_COM13, COM13_GAMMA }, { REG_COM15, COM15_RGB565|COM15_R00FF }, { 0xff, 0xff }, @@ -443,13 +443,13 @@ static struct regval ov_fmt_rgbp[] = { { REG_RGB444, 0 }, /* No RGB444 please */ {REG_TSLB, TSLB_BYTEORD }, { REG_COM1, 0x0 }, - { REG_COM9, 0x38 }, /* 16x gain ceiling; 0x8 is reserved bit */ - { 0x4f, 0xb3 }, /* "matrix coefficient 1" */ - { 0x50, 0xb3 }, /* "matrix coefficient 2" */ + { REG_COM9, 0x38 }, /* 16x gain ceiling; 0x8 is reserved bit */ + { 0x4f, 0xb3 }, /* "matrix coefficient 1" */ + { 0x50, 0xb3 }, /* "matrix coefficient 2" */ { 0x51, 0 }, /* vb */ - { 0x52, 0x3d }, /* "matrix coefficient 4" */ - { 0x53, 0xa7 }, /* "matrix coefficient 5" */ - { 0x54, 0xe4 }, /* "matrix coefficient 6" */ + { 0x52, 0x3d }, /* "matrix coefficient 4" */ + { 0x53, 0xa7 }, /* "matrix coefficient 5" */ + { 0x54, 0xe4 }, /* "matrix coefficient 6" */ { REG_COM13, COM13_GAMMA }, { REG_COM15, COM15_RGB565|COM15_R00FF }, { 0xff, 0xff }, diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 108577c50097..fd387bf3f02d 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -963,11 +963,11 @@ static int uvc_parse_vendor_control(struct uvc_device *dev, * Size of this descriptor, in bytes: 24+p+n*2 * ---------------------------------------------------------- * 23+p+n bmControlsType N Bitmap - * Individual bits in the set are defined: - * 0: Absolute - * 1: Relative + * Individual bits in the set are defined: + * 0: Absolute + * 1: Relative * - * This bitset is mapped exactly the same as bmControls. + * This bitset is mapped exactly the same as bmControls. * ---------------------------------------------------------- * 23+p+n*2 bReserved 1 Boolean * ---------------------------------------------------------- @@ -2481,7 +2481,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def }, /* Dell SP2008WFP Monitor */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2490,7 +2490,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def }, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def }, /* Dell Alienware X51 */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, @@ -2526,7 +2526,7 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, - .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_PROBE_MINMAX + .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_PROBE_MINMAX | UVC_QUIRK_BUILTIN_ISIGHT) }, /* Apple Built-In iSight via iBridge */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE diff --git a/drivers/media/usb/uvc/uvc_isight.c b/drivers/media/usb/uvc/uvc_isight.c index fb940cfae575..5059fbf41020 100644 --- a/drivers/media/usb/uvc/uvc_isight.c +++ b/drivers/media/usb/uvc/uvc_isight.c @@ -27,11 +27,11 @@ * * Offset Size (bytes) Description * ------------------------------------------------------------------ - * 0x00 1 Header length - * 0x01 1 Flags (UVC-compliant) - * 0x02 4 Always equal to '11223344' - * 0x06 8 Always equal to 'deadbeefdeadface' - * 0x0e 16 Unknown + * 0x00 1 Header length + * 0x01 1 Flags (UVC-compliant) + * 0x02 4 Always equal to '11223344' + * 0x06 8 Always equal to 'deadbeefdeadface' + * 0x0e 16 Unknown * * The header can be prefixed by an optional, unknown-purpose byte. */ -- cgit v1.2.3 From 9893b905e743ded332575ca04486bd586c0772f7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 24 Jan 2018 06:01:57 -0500 Subject: media: cxusb, dib0700: ignore XC2028_I2C_FLUSH The XC2028_I2C_FLUSH only needs to be implemented on a few devices. Others can safely ignore it. That prevents filling the dmesg with lots of messages like: dib0700: stk7700ph_xc3028_callback: unknown command 2, arg 0 Cc: stable@vger.kernel.org Fixes: 4d37ece757a8 ("[media] tuner/xc2028: Add I2C flush callback") Reported-by: Enrico Mioso Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/cxusb.c | 2 ++ drivers/media/usb/dvb-usb/dib0700_devices.c | 1 + 2 files changed, 3 insertions(+) (limited to 'drivers/media/usb') diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c index 7109fc7ab74d..2abd15c6df81 100644 --- a/drivers/media/usb/dvb-usb/cxusb.c +++ b/drivers/media/usb/dvb-usb/cxusb.c @@ -679,6 +679,8 @@ static int dvico_bluebird_xc2028_callback(void *ptr, int component, case XC2028_RESET_CLK: deb_info("%s: XC2028_RESET_CLK %d\n", __func__, arg); break; + case XC2028_I2C_FLUSH: + break; default: deb_info("%s: unknown command %d, arg %d\n", __func__, command, arg); diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c index 470836a274dd..3d99e141d566 100644 --- a/drivers/media/usb/dvb-usb/dib0700_devices.c +++ b/drivers/media/usb/dvb-usb/dib0700_devices.c @@ -433,6 +433,7 @@ static int stk7700ph_xc3028_callback(void *ptr, int component, state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1); break; case XC2028_RESET_CLK: + case XC2028_I2C_FLUSH: break; default: err("%s: unknown command %d, arg %d\n", __func__, -- cgit v1.2.3