diff options
author | Joe Perches <joe@perches.com> | 2017-09-22 21:20:33 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-12-08 16:10:15 +0100 |
commit | 37d5efb01910752d8d3846a2c4db0528c1dfa137 (patch) | |
tree | f47a9f8305b6de30b9be179f93f21b8d7ca962e8 /drivers/media/usb/gspca/gspca.c | |
parent | media: gspca: Convert PERR to gspca_err (diff) | |
download | linux-37d5efb01910752d8d3846a2c4db0528c1dfa137.tar.xz linux-37d5efb01910752d8d3846a2c4db0528c1dfa137.zip |
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 <joe@perches.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/usb/gspca/gspca.c')
-rw-r--r-- | drivers/media/usb/gspca/gspca.c | 127 |
1 files changed, 67 insertions, 60 deletions
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); |