diff options
author | Joe Perches <joe@perches.com> | 2011-08-21 19:56:44 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-09-03 20:54:14 -0300 |
commit | 44d0b80e5ff741d502a6ccc8685a18bda1ac9da4 (patch) | |
tree | b19473bcfeae86f0ab4ccc66e5bf18fea71fc896 /drivers/media/common | |
parent | 0b8bd83cf393832f1d00096b866d888b75b374c3 (diff) |
[media] saa7146: Use current logging styles
Standardize the mechanisms to emit logging messages.
A few other modules used an #include from saa7146,
convert those at the same time.
Add pr_fmt.
Convert printks to pr_<level>
Convert printks without KERN_<level> to appropriate pr_<level>.
Convert logging macros requiring multiple parentheses to normal style.
Removed embedded prefixes when pr_fmt was added.
Whitespace cleanups when around other conversions.
Use printf extension %pM to print mac address.
Coalesce format strings.
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Michael Hunold <michael@mihu.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/saa7146_core.c | 74 | ||||
-rw-r--r-- | drivers/media/common/saa7146_fops.c | 118 | ||||
-rw-r--r-- | drivers/media/common/saa7146_hlp.c | 14 | ||||
-rw-r--r-- | drivers/media/common/saa7146_i2c.c | 60 | ||||
-rw-r--r-- | drivers/media/common/saa7146_vbi.c | 48 | ||||
-rw-r--r-- | drivers/media/common/saa7146_video.c | 171 |
6 files changed, 257 insertions, 228 deletions
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c index 9af2140b57a4..f5d53a202344 100644 --- a/drivers/media/common/saa7146_core.c +++ b/drivers/media/common/saa7146_core.c @@ -18,6 +18,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <media/saa7146.h> LIST_HEAD(saa7146_devices); @@ -35,10 +37,9 @@ static void dump_registers(struct saa7146_dev* dev) { int i = 0; - INFO((" @ %li jiffies:\n",jiffies)); - for(i = 0; i <= 0x148; i+=4) { - printk("0x%03x: 0x%08x\n",i,saa7146_read(dev,i)); - } + pr_info(" @ %li jiffies:\n", jiffies); + for (i = 0; i <= 0x148; i += 4) + pr_info("0x%03x: 0x%08x\n", i, saa7146_read(dev, i)); } #endif @@ -72,9 +73,8 @@ static inline int saa7146_wait_for_debi_done_sleep(struct saa7146_dev *dev, if (saa7146_read(dev, MC2) & 2) break; if (err) { - printk(KERN_ERR "%s: %s timed out while waiting for " - "registers getting programmed\n", - dev->name, __func__); + pr_err("%s: %s timed out while waiting for registers getting programmed\n", + dev->name, __func__); return -ETIMEDOUT; } msleep(1); @@ -88,8 +88,8 @@ static inline int saa7146_wait_for_debi_done_sleep(struct saa7146_dev *dev, break; saa7146_read(dev, MC2); if (err) { - DEB_S(("%s: %s timed out while waiting for transfer " - "completion\n", dev->name, __func__)); + DEB_S("%s: %s timed out while waiting for transfer completion\n", + dev->name, __func__); return -ETIMEDOUT; } msleep(1); @@ -109,9 +109,8 @@ static inline int saa7146_wait_for_debi_done_busyloop(struct saa7146_dev *dev, if (saa7146_read(dev, MC2) & 2) break; if (!loops--) { - printk(KERN_ERR "%s: %s timed out while waiting for " - "registers getting programmed\n", - dev->name, __func__); + pr_err("%s: %s timed out while waiting for registers getting programmed\n", + dev->name, __func__); return -ETIMEDOUT; } udelay(1); @@ -124,8 +123,8 @@ static inline int saa7146_wait_for_debi_done_busyloop(struct saa7146_dev *dev, break; saa7146_read(dev, MC2); if (!loops--) { - DEB_S(("%s: %s timed out while waiting for transfer " - "completion\n", dev->name, __func__)); + DEB_S("%s: %s timed out while waiting for transfer completion\n", + dev->name, __func__); return -ETIMEDOUT; } udelay(5); @@ -264,7 +263,9 @@ int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt ptr = pt->cpu; for (i = 0; i < sglen; i++, list++) { /* - printk("i:%d, adr:0x%08x, len:%d, offset:%d\n", i,sg_dma_address(list), sg_dma_len(list), list->offset); + pr_debug("i:%d, adr:0x%08x, len:%d, offset:%d\n", + i, sg_dma_address(list), sg_dma_len(list), + list->offset); */ for (p = 0; p * 4096 < list->length; p++, ptr++) { *ptr = cpu_to_le32(sg_dma_address(list) + p * 4096); @@ -281,9 +282,9 @@ int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt /* ptr = pt->cpu; - printk("offset: %d\n",pt->offset); + pr_debug("offset: %d\n", pt->offset); for(i=0;i<5;i++) { - printk("ptr1 %d: 0x%08x\n",i,ptr[i]); + pr_debug("ptr1 %d: 0x%08x\n", i, ptr[i]); } */ return 0; @@ -314,7 +315,7 @@ static irqreturn_t interrupt_hw(int irq, void *dev_id) } } if (0 != (isr & (MASK_27))) { - DEB_INT(("irq: RPS0 (0x%08x).\n",isr)); + DEB_INT("irq: RPS0 (0x%08x)\n", isr); if (dev->vv_data && dev->vv_callback) dev->vv_callback(dev,isr); isr &= ~MASK_27; @@ -333,14 +334,15 @@ static irqreturn_t interrupt_hw(int irq, void *dev_id) } else { u32 psr = saa7146_read(dev, PSR); u32 ssr = saa7146_read(dev, SSR); - printk(KERN_WARNING "%s: unexpected i2c irq: isr %08x psr %08x ssr %08x\n", - dev->name, isr, psr, ssr); + pr_warn("%s: unexpected i2c irq: isr %08x psr %08x ssr %08x\n", + dev->name, isr, psr, ssr); } isr &= ~(MASK_16|MASK_17); } if( 0 != isr ) { - ERR(("warning: interrupt enabled, but not handled properly.(0x%08x)\n",isr)); - ERR(("disabling interrupt source(s)!\n")); + ERR("warning: interrupt enabled, but not handled properly.(0x%08x)\n", + isr); + ERR("disabling interrupt source(s)!\n"); SAA7146_IER_DISABLE(dev,isr); } saa7146_write(dev, ISR, ack_isr); @@ -360,15 +362,15 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent /* clear out mem for sure */ dev = kzalloc(sizeof(struct saa7146_dev), GFP_KERNEL); if (!dev) { - ERR(("out of memory.\n")); + ERR("out of memory\n"); goto out; } - DEB_EE(("pci:%p\n",pci)); + DEB_EE("pci:%p\n", pci); err = pci_enable_device(pci); if (err < 0) { - ERR(("pci_enable_device() failed.\n")); + ERR("pci_enable_device() failed\n"); goto err_free; } @@ -389,7 +391,7 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent dev->mem = ioremap(pci_resource_start(pci, 0), pci_resource_len(pci, 0)); if (!dev->mem) { - ERR(("ioremap() failed.\n")); + ERR("ioremap() failed\n"); err = -ENODEV; goto err_release; } @@ -414,7 +416,7 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent err = request_irq(pci->irq, interrupt_hw, IRQF_SHARED | IRQF_DISABLED, dev->name, dev); if (err < 0) { - ERR(("request_irq() failed.\n")); + ERR("request_irq() failed\n"); goto err_unmap; } @@ -444,7 +446,9 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent /* create a nice device name */ sprintf(dev->name, "saa7146 (%d)", saa7146_num); - INFO(("found saa7146 @ mem %p (revision %d, irq %d) (0x%04x,0x%04x).\n", dev->mem, dev->revision, pci->irq, pci->subsystem_vendor, pci->subsystem_device)); + pr_info("found saa7146 @ mem %p (revision %d, irq %d) (0x%04x,0x%04x)\n", + dev->mem, dev->revision, pci->irq, + pci->subsystem_vendor, pci->subsystem_device); dev->ext = ext; mutex_init(&dev->v4l2_lock); @@ -464,12 +468,12 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent err = -ENODEV; if (ext->probe && ext->probe(dev)) { - DEB_D(("ext->probe() failed for %p. skipping device.\n",dev)); + DEB_D("ext->probe() failed for %p. skipping device.\n", dev); goto err_free_i2c; } if (ext->attach(dev, pci_ext)) { - DEB_D(("ext->attach() failed for %p. skipping device.\n",dev)); + DEB_D("ext->attach() failed for %p. skipping device.\n", dev); goto err_free_i2c; } /* V4L extensions will set the pci drvdata to the v4l2_device in the @@ -521,7 +525,7 @@ static void saa7146_remove_one(struct pci_dev *pdev) { NULL, 0 } }, *p; - DEB_EE(("dev:%p\n",dev)); + DEB_EE("dev:%p\n", dev); dev->ext->detach(dev); /* Zero the PCI drvdata after use. */ @@ -552,21 +556,21 @@ static void saa7146_remove_one(struct pci_dev *pdev) int saa7146_register_extension(struct saa7146_extension* ext) { - DEB_EE(("ext:%p\n",ext)); + DEB_EE("ext:%p\n", ext); ext->driver.name = ext->name; ext->driver.id_table = ext->pci_tbl; ext->driver.probe = saa7146_init_one; ext->driver.remove = saa7146_remove_one; - printk("saa7146: register extension '%s'.\n",ext->name); + pr_info("register extension '%s'\n", ext->name); return pci_register_driver(&ext->driver); } int saa7146_unregister_extension(struct saa7146_extension* ext) { - DEB_EE(("ext:%p\n",ext)); - printk("saa7146: unregister extension '%s'.\n",ext->name); + DEB_EE("ext:%p\n", ext); + pr_info("unregister extension '%s'\n", ext->name); pci_unregister_driver(&ext->driver); return 0; } diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index 1bd3dd762c6b..a92546144eaa 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c @@ -1,3 +1,5 @@ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <media/saa7146_vv.h> /****************************************************************************/ @@ -9,21 +11,23 @@ int saa7146_res_get(struct saa7146_fh *fh, unsigned int bit) struct saa7146_vv *vv = dev->vv_data; if (fh->resources & bit) { - DEB_D(("already allocated! want: 0x%02x, cur:0x%02x\n",bit,vv->resources)); + DEB_D("already allocated! want: 0x%02x, cur:0x%02x\n", + bit, vv->resources); /* have it already allocated */ return 1; } /* is it free? */ if (vv->resources & bit) { - DEB_D(("locked! vv->resources:0x%02x, we want:0x%02x\n",vv->resources,bit)); + DEB_D("locked! vv->resources:0x%02x, we want:0x%02x\n", + vv->resources, bit); /* no, someone else uses it */ return 0; } /* it's free, grab it */ - fh->resources |= bit; + fh->resources |= bit; vv->resources |= bit; - DEB_D(("res: get 0x%02x, cur:0x%02x\n",bit,vv->resources)); + DEB_D("res: get 0x%02x, cur:0x%02x\n", bit, vv->resources); return 1; } @@ -34,9 +38,9 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits) BUG_ON((fh->resources & bits) != bits); - fh->resources &= ~bits; + fh->resources &= ~bits; vv->resources &= ~bits; - DEB_D(("res: put 0x%02x, cur:0x%02x\n",bits,vv->resources)); + DEB_D("res: put 0x%02x, cur:0x%02x\n", bits, vv->resources); } @@ -47,7 +51,7 @@ void saa7146_dma_free(struct saa7146_dev *dev,struct videobuf_queue *q, struct saa7146_buf *buf) { struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); - DEB_EE(("dev:%p, buf:%p\n",dev,buf)); + DEB_EE("dev:%p, buf:%p\n", dev, buf); BUG_ON(in_interrupt()); @@ -66,18 +70,19 @@ int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_buf *buf) { assert_spin_locked(&dev->slock); - DEB_EE(("dev:%p, dmaq:%p, buf:%p\n", dev, q, buf)); + DEB_EE("dev:%p, dmaq:%p, buf:%p\n", dev, q, buf); BUG_ON(!q); if (NULL == q->curr) { q->curr = buf; - DEB_D(("immediately activating buffer %p\n", buf)); + DEB_D("immediately activating buffer %p\n", buf); buf->activate(dev,buf,NULL); } else { list_add_tail(&buf->vb.queue,&q->queue); buf->vb.state = VIDEOBUF_QUEUED; - DEB_D(("adding buffer %p to queue. (active buffer present)\n", buf)); + DEB_D("adding buffer %p to queue. (active buffer present)\n", + buf); } return 0; } @@ -87,14 +92,14 @@ void saa7146_buffer_finish(struct saa7146_dev *dev, int state) { assert_spin_locked(&dev->slock); - DEB_EE(("dev:%p, dmaq:%p, state:%d\n", dev, q, state)); - DEB_EE(("q->curr:%p\n",q->curr)); + DEB_EE("dev:%p, dmaq:%p, state:%d\n", dev, q, state); + DEB_EE("q->curr:%p\n", q->curr); BUG_ON(!q->curr); /* finish current buffer */ if (NULL == q->curr) { - DEB_D(("aiii. no current buffer\n")); + DEB_D("aiii. no current buffer\n"); return; } @@ -112,7 +117,7 @@ void saa7146_buffer_next(struct saa7146_dev *dev, BUG_ON(!q); - DEB_INT(("dev:%p, dmaq:%p, vbi:%d\n", dev, q, vbi)); + DEB_INT("dev:%p, dmaq:%p, vbi:%d\n", dev, q, vbi); assert_spin_locked(&dev->slock); if (!list_empty(&q->queue)) { @@ -122,10 +127,11 @@ void saa7146_buffer_next(struct saa7146_dev *dev, if (!list_empty(&q->queue)) next = list_entry(q->queue.next,struct saa7146_buf, vb.queue); q->curr = buf; - DEB_INT(("next buffer: buf:%p, prev:%p, next:%p\n", buf, q->queue.prev,q->queue.next)); + DEB_INT("next buffer: buf:%p, prev:%p, next:%p\n", + buf, q->queue.prev, q->queue.next); buf->activate(dev,buf,next); } else { - DEB_INT(("no next buffer. stopping.\n")); + DEB_INT("no next buffer. stopping.\n"); if( 0 != vbi ) { /* turn off video-dma3 */ saa7146_write(dev,MC1, MASK_20); @@ -162,11 +168,11 @@ void saa7146_buffer_timeout(unsigned long data) struct saa7146_dev *dev = q->dev; unsigned long flags; - DEB_EE(("dev:%p, dmaq:%p\n", dev, q)); + DEB_EE("dev:%p, dmaq:%p\n", dev, q); spin_lock_irqsave(&dev->slock,flags); if (q->curr) { - DEB_D(("timeout on %p\n", q->curr)); + DEB_D("timeout on %p\n", q->curr); saa7146_buffer_finish(dev,q,VIDEOBUF_ERROR); } @@ -194,12 +200,12 @@ static int fops_open(struct file *file) enum v4l2_buf_type type; - DEB_EE(("file:%p, dev:%s\n", file, video_device_node_name(vdev))); + DEB_EE("file:%p, dev:%s\n", file, video_device_node_name(vdev)); if (mutex_lock_interruptible(&saa7146_devices_lock)) return -ERESTARTSYS; - DEB_D(("using: %p\n",dev)); + DEB_D("using: %p\n", dev); type = vdev->vfl_type == VFL_TYPE_GRABBER ? V4L2_BUF_TYPE_VIDEO_CAPTURE @@ -207,7 +213,7 @@ static int fops_open(struct file *file) /* check if an extension is registered */ if( NULL == dev->ext ) { - DEB_S(("no extension registered for this device.\n")); + DEB_S("no extension registered for this device\n"); result = -ENODEV; goto out; } @@ -215,7 +221,7 @@ static int fops_open(struct file *file) /* allocate per open data */ fh = kzalloc(sizeof(*fh),GFP_KERNEL); if (NULL == fh) { - DEB_S(("cannot allocate memory for per open data.\n")); + DEB_S("cannot allocate memory for per open data\n"); result = -ENOMEM; goto out; } @@ -225,13 +231,13 @@ static int fops_open(struct file *file) fh->type = type; if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { - DEB_S(("initializing vbi...\n")); + DEB_S("initializing vbi...\n"); if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) result = saa7146_vbi_uops.open(dev,file); if (dev->ext_vv_data->vbi_fops.open) dev->ext_vv_data->vbi_fops.open(file); } else { - DEB_S(("initializing video...\n")); + DEB_S("initializing video...\n"); result = saa7146_video_uops.open(dev,file); } @@ -259,7 +265,7 @@ static int fops_release(struct file *file) struct saa7146_fh *fh = file->private_data; struct saa7146_dev *dev = fh->dev; - DEB_EE(("file:%p\n", file)); + DEB_EE("file:%p\n", file); if (mutex_lock_interruptible(&saa7146_devices_lock)) return -ERESTARTSYS; @@ -289,12 +295,14 @@ static int fops_mmap(struct file *file, struct vm_area_struct * vma) switch (fh->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: { - DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, vma:%p\n",file, vma)); + DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, vma:%p\n", + file, vma); q = &fh->video_q; break; } case V4L2_BUF_TYPE_VBI_CAPTURE: { - DEB_EE(("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, vma:%p\n",file, vma)); + DEB_EE("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, vma:%p\n", + file, vma); q = &fh->vbi_q; break; } @@ -312,14 +320,14 @@ static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait) struct videobuf_buffer *buf = NULL; struct videobuf_queue *q; - DEB_EE(("file:%p, poll:%p\n",file, wait)); + DEB_EE("file:%p, poll:%p\n", file, wait); if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { if( 0 == fh->vbi_q.streaming ) return videobuf_poll_stream(file, &fh->vbi_q, wait); q = &fh->vbi_q; } else { - DEB_D(("using video queue.\n")); + DEB_D("using video queue\n"); q = &fh->video_q; } @@ -327,17 +335,17 @@ static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait) buf = list_entry(q->stream.next, struct videobuf_buffer, stream); if (!buf) { - DEB_D(("buf == NULL!\n")); + DEB_D("buf == NULL!\n"); return POLLERR; } poll_wait(file, &buf->done, wait); if (buf->state == VIDEOBUF_DONE || buf->state == VIDEOBUF_ERROR) { - DEB_D(("poll succeeded!\n")); + DEB_D("poll succeeded!\n"); return POLLIN|POLLRDNORM; } - DEB_D(("nothing to poll for, buf->state:%d\n",buf->state)); + DEB_D("nothing to poll for, buf->state:%d\n", buf->state); return 0; } @@ -346,18 +354,20 @@ static ssize_t fops_read(struct file *file, char __user *data, size_t count, lof struct saa7146_fh *fh = file->private_data; switch (fh->type) { - case V4L2_BUF_TYPE_VIDEO_CAPTURE: { -// DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, data:%p, count:%lun", file, data, (unsigned long)count)); + case V4L2_BUF_TYPE_VIDEO_CAPTURE: +/* + DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, data:%p, count:%lun", + file, data, (unsigned long)count); +*/ return saa7146_video_uops.read(file,data,count,ppos); - } - case V4L2_BUF_TYPE_VBI_CAPTURE: { -// DEB_EE(("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, data:%p, count:%lu\n", file, data, (unsigned long)count)); + case V4L2_BUF_TYPE_VBI_CAPTURE: +/* + DEB_EE("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, data:%p, count:%lu\n", + file, data, (unsigned long)count); +*/ if (fh->dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) return saa7146_vbi_uops.read(file,data,count,ppos); - else - return -EINVAL; - } - break; + return -EINVAL; default: BUG(); return 0; @@ -398,22 +408,22 @@ static void vv_callback(struct saa7146_dev *dev, unsigned long status) { u32 isr = status; - DEB_INT(("dev:%p, isr:0x%08x\n",dev,(u32)status)); + DEB_INT("dev:%p, isr:0x%08x\n", dev, (u32)status); if (0 != (isr & (MASK_27))) { - DEB_INT(("irq: RPS0 (0x%08x).\n",isr)); + DEB_INT("irq: RPS0 (0x%08x)\n", isr); saa7146_video_uops.irq_done(dev,isr); } if (0 != (isr & (MASK_28))) { u32 mc2 = saa7146_read(dev, MC2); if( 0 != (mc2 & MASK_15)) { - DEB_INT(("irq: RPS1 vbi workaround (0x%08x).\n",isr)); + DEB_INT("irq: RPS1 vbi workaround (0x%08x)\n", isr); wake_up(&dev->vv_data->vbi_wq); saa7146_write(dev,MC2, MASK_31); return; } - DEB_INT(("irq: RPS1 (0x%08x).\n",isr)); + DEB_INT("irq: RPS1 (0x%08x)\n", isr); saa7146_vbi_uops.irq_done(dev,isr); } } @@ -429,13 +439,13 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL); if (vv == NULL) { - ERR(("out of memory. aborting.\n")); + ERR("out of memory. aborting.\n"); return -ENOMEM; } ext_vv->ops = saa7146_video_ioctl_ops; ext_vv->core_ops = &saa7146_video_ioctl_ops; - DEB_EE(("dev:%p\n",dev)); + DEB_EE("dev:%p\n", dev); /* set default values for video parts of the saa7146 */ saa7146_write(dev, BCS_CTRL, 0x80400040); @@ -450,7 +460,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) vv->d_clipping.cpu_addr = pci_alloc_consistent(dev->pci, SAA7146_CLIPPING_MEM, &vv->d_clipping.dma_handle); if( NULL == vv->d_clipping.cpu_addr ) { - ERR(("out of memory. aborting.\n")); + ERR("out of memory. aborting.\n"); kfree(vv); return -1; } @@ -471,7 +481,7 @@ int saa7146_vv_release(struct saa7146_dev* dev) { struct saa7146_vv *vv = dev->vv_data; - DEB_EE(("dev:%p\n",dev)); + DEB_EE("dev:%p\n", dev); v4l2_device_unregister(&dev->v4l2_dev); pci_free_consistent(dev->pci, SAA7146_CLIPPING_MEM, vv->d_clipping.cpu_addr, vv->d_clipping.dma_handle); @@ -490,7 +500,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, int err; int i; - DEB_EE(("dev:%p, name:'%s', type:%d\n",dev,name,type)); + DEB_EE("dev:%p, name:'%s', type:%d\n", dev, name, type); // released by vfd->release vfd = video_device_alloc(); @@ -509,13 +519,13 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, err = video_register_device(vfd, type, -1); if (err < 0) { - ERR(("cannot register v4l2 device. skipping.\n")); + ERR("cannot register v4l2 device. skipping.\n"); video_device_release(vfd); return err; } - INFO(("%s: registered device %s [v4l2]\n", - dev->name, video_device_node_name(vfd))); + pr_info("%s: registered device %s [v4l2]\n", + dev->name, video_device_node_name(vfd)); *vid = vfd; return 0; @@ -524,7 +534,7 @@ EXPORT_SYMBOL_GPL(saa7146_register_device); int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev) { - DEB_EE(("dev:%p\n",dev)); + DEB_EE("dev:%p\n", dev); video_unregister_device(*vid); *vid = NULL; diff --git a/drivers/media/common/saa7146_hlp.c b/drivers/media/common/saa7146_hlp.c index 1d1d8d200755..79ad73accb27 100644 --- a/drivers/media/common/saa7146_hlp.c +++ b/drivers/media/common/saa7146_hlp.c @@ -1,3 +1,5 @@ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/kernel.h> #include <media/saa7146_vv.h> @@ -711,8 +713,8 @@ static int calculate_video_dma_grab_packed(struct saa7146_dev* dev, struct saa71 int depth = sfmt->depth; - DEB_CAP(("[size=%dx%d,fields=%s]\n", - width,height,v4l2_field_names[field])); + DEB_CAP("[size=%dx%d,fields=%s]\n", + width, height, v4l2_field_names[field]); if( bytesperline != 0) { vdma1.pitch = bytesperline*2; @@ -837,8 +839,8 @@ static int calculate_video_dma_grab_planar(struct saa7146_dev* dev, struct saa71 BUG_ON(0 == buf->pt[1].dma); BUG_ON(0 == buf->pt[2].dma); - DEB_CAP(("[size=%dx%d,fields=%s]\n", - width,height,v4l2_field_names[field])); + DEB_CAP("[size=%dx%d,fields=%s]\n", + width, height, v4l2_field_names[field]); /* fixme: look at bytesperline! */ @@ -998,12 +1000,12 @@ void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struc struct saa7146_vv *vv = dev->vv_data; u32 vdma1_prot_addr; - DEB_CAP(("buf:%p, next:%p\n",buf,next)); + DEB_CAP("buf:%p, next:%p\n", buf, next); vdma1_prot_addr = saa7146_read(dev, PROT_ADDR1); if( 0 == vdma1_prot_addr ) { /* clear out beginning of streaming bit (rps register 0)*/ - DEB_CAP(("forcing sync to new frame\n")); + DEB_CAP("forcing sync to new frame\n"); saa7146_write(dev, MC2, MASK_27 ); } diff --git a/drivers/media/common/saa7146_i2c.c b/drivers/media/common/saa7146_i2c.c index b2ba9dc0dd6d..22027198129d 100644 --- a/drivers/media/common/saa7146_i2c.c +++ b/drivers/media/common/saa7146_i2c.c @@ -1,8 +1,10 @@ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <media/saa7146_vv.h> static u32 saa7146_i2c_func(struct i2c_adapter *adapter) { -//fm DEB_I2C(("'%s'.\n", adapter->name)); + /* DEB_I2C("'%s'\n", adapter->name); */ return I2C_FUNC_I2C | I2C_FUNC_SMBUS_QUICK @@ -14,9 +16,7 @@ static u32 saa7146_i2c_func(struct i2c_adapter *adapter) static inline u32 saa7146_i2c_status(struct saa7146_dev *dev) { u32 iicsta = saa7146_read(dev, I2C_STATUS); -/* - DEB_I2C(("status: 0x%08x\n",iicsta)); -*/ + /* DEB_I2C("status: 0x%08x\n", iicsta); */ return iicsta; } @@ -39,10 +39,11 @@ static int saa7146_i2c_msg_prepare(const struct i2c_msg *m, int num, __le32 *op) plus one extra byte to address the device */ mem = 1 + ((mem-1) / 3); - /* we assume that op points to a memory of at least SAA7146_I2C_MEM bytes - size. if we exceed this limit... */ - if ( (4*mem) > SAA7146_I2C_MEM ) { -//fm DEB_I2C(("cannot prepare i2c-message.\n")); + /* we assume that op points to a memory of at least + * SAA7146_I2C_MEM bytes size. if we exceed this limit... + */ + if ((4 * mem) > SAA7146_I2C_MEM) { + /* DEB_I2C("cannot prepare i2c-message\n"); */ return -ENOMEM; } @@ -123,7 +124,7 @@ static int saa7146_i2c_reset(struct saa7146_dev *dev) if ( 0 != ( status & SAA7146_I2C_BUSY) ) { /* yes, kill ongoing operation */ - DEB_I2C(("busy_state detected.\n")); + DEB_I2C("busy_state detected\n"); /* set "ABORT-OPERATION"-bit (bit 7)*/ saa7146_write(dev, I2C_STATUS, (dev->i2c_bitrate | MASK_07)); @@ -141,7 +142,7 @@ static int saa7146_i2c_reset(struct saa7146_dev *dev) if ( dev->i2c_bitrate != status ) { - DEB_I2C(("error_state detected. status:0x%08x\n",status)); + DEB_I2C("error_state detected. status:0x%08x\n", status); /* Repeat the abort operation. This seems to be necessary after serious protocol errors caused by e.g. the SAA7740 */ @@ -164,7 +165,7 @@ static int saa7146_i2c_reset(struct saa7146_dev *dev) /* if any error is still present, a fatal error has occurred ... */ status = saa7146_i2c_status(dev); if ( dev->i2c_bitrate != status ) { - DEB_I2C(("fatal error. status:0x%08x\n",status)); + DEB_I2C("fatal error. status:0x%08x\n", status); return -1; } @@ -181,7 +182,8 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, __le32 *dword, int shor unsigned long timeout; /* write out i2c-command */ - DEB_I2C(("before: 0x%08x (status: 0x%08x), %d\n",*dword,saa7146_read(dev, I2C_STATUS), dev->i2c_op)); + DEB_I2C("before: 0x%08x (status: 0x%08x), %d\n", + *dword, saa7146_read(dev, I2C_STATUS), dev->i2c_op); if( 0 != (SAA7146_USE_I2C_IRQ & dev->ext->flags)) { @@ -202,7 +204,7 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, __le32 *dword, int shor /* a signal arrived */ return -ERESTARTSYS; - printk(KERN_WARNING "%s %s [irq]: timed out waiting for end of xfer\n", + pr_warn("%s %s [irq]: timed out waiting for end of xfer\n", dev->name, __func__); return -EIO; } @@ -220,7 +222,7 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, __le32 *dword, int shor break; } if (time_after(jiffies,timeout)) { - printk(KERN_WARNING "%s %s: timed out waiting for MC2\n", + pr_warn("%s %s: timed out waiting for MC2\n", dev->name, __func__); return -EIO; } @@ -237,7 +239,7 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, __le32 *dword, int shor /* this is normal when probing the bus * (no answer from nonexisistant device...) */ - printk(KERN_WARNING "%s %s [poll]: timed out waiting for end of xfer\n", + pr_warn("%s %s [poll]: timed out waiting for end of xfer\n", dev->name, __func__); return -EIO; } @@ -257,24 +259,24 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, __le32 *dword, int shor if ( 0 == (status & SAA7146_I2C_ERR) || 0 == (status & SAA7146_I2C_BUSY) ) { /* it may take some time until ERR goes high - ignore */ - DEB_I2C(("unexpected i2c status %04x\n", status)); + DEB_I2C("unexpected i2c status %04x\n", status); } if( 0 != (status & SAA7146_I2C_SPERR) ) { - DEB_I2C(("error due to invalid start/stop condition.\n")); + DEB_I2C("error due to invalid start/stop condition\n"); } if( 0 != (status & SAA7146_I2C_DTERR) ) { - DEB_I2C(("error in data transmission.\n")); + DEB_I2C("error in data transmission\n"); } if( 0 != (status & SAA7146_I2C_DRERR) ) { - DEB_I2C(("error when receiving data.\n")); + DEB_I2C("error when receiving data\n"); } if( 0 != (status & SAA7146_I2C_AL) ) { - DEB_I2C(("error because arbitration lost.\n")); + DEB_I2C("error because arbitration lost\n"); } /* we handle address-errors here */ if( 0 != (status & SAA7146_I2C_APERR) ) { - DEB_I2C(("error in address phase.\n")); + DEB_I2C("error in address phase\n"); return -EREMOTEIO; } @@ -284,7 +286,7 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, __le32 *dword, int shor /* read back data, just in case we were reading ... */ *dword = cpu_to_le32(saa7146_read(dev, I2C_TRANSFER)); - DEB_I2C(("after: 0x%08x\n",*dword)); + DEB_I2C("after: 0x%08x\n", *dword); return 0; } @@ -299,7 +301,7 @@ static int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *m return -ERESTARTSYS; for(i=0;i<num;i++) { - DEB_I2C(("msg:%d/%d\n",i+1,num)); + DEB_I2C("msg:%d/%d\n", i+1, num); } /* prepare the message(s), get number of u32s to transfer */ @@ -316,7 +318,7 @@ static int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *m /* reset the i2c-device if necessary */ err = saa7146_i2c_reset(dev); if ( 0 > err ) { - DEB_I2C(("could not reset i2c-device.\n")); + DEB_I2C("could not reset i2c-device\n"); goto out; } @@ -336,7 +338,7 @@ static int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *m address error and trust the saa7146 address error detection. */ if (-EREMOTEIO == err && 0 != (SAA7146_USE_I2C_IRQ & dev->ext->flags)) goto out; - DEB_I2C(("error while sending message(s). starting again.\n")); + DEB_I2C("error while sending message(s). starting again\n"); break; } } @@ -356,13 +358,13 @@ static int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *m /* if any things had to be read, get the results */ if ( 0 != saa7146_i2c_msg_cleanup(msgs, num, buffer)) { - DEB_I2C(("could not cleanup i2c-message.\n")); + DEB_I2C("could not cleanup i2c-message\n"); err = -1; goto out; } /* return the number of delivered messages */ - DEB_I2C(("transmission successful. (msg:%d).\n",err)); + DEB_I2C("transmission successful. (msg:%d)\n", err); out: /* another bug in revision 0: the i2c-registers get uploaded randomly by other uploads, so we better clear them out before continuing */ @@ -370,7 +372,7 @@ out: __le32 zero = 0; saa7146_i2c_reset(dev); if( 0 != saa7146_i2c_writeout(dev, &zero, short_delay)) { - INFO(("revision 0 error. this should never happen.\n")); + pr_info("revision 0 error. this should never happen\n"); } } @@ -400,7 +402,7 @@ static struct i2c_algorithm saa7146_algo = { int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate) { - DEB_EE(("bitrate: 0x%08x\n",bitrate)); + DEB_EE("bitrate: 0x%08x\n", bitrate); /* enable i2c-port pins */ saa7146_write(dev, MC1, (MASK_08 | MASK_24)); diff --git a/drivers/media/common/saa7146_vbi.c b/drivers/media/common/saa7146_vbi.c index afe85801d6ca..b2e718343739 100644 --- a/drivers/media/common/saa7146_vbi.c +++ b/drivers/media/common/saa7146_vbi.c @@ -14,7 +14,7 @@ static int vbi_workaround(struct saa7146_dev *dev) DECLARE_WAITQUEUE(wait, current); - DEB_VBI(("dev:%p\n",dev)); + DEB_VBI("dev:%p\n", dev); /* once again, a bug in the saa7146: the brs acquisition is buggy and especially the BXO-counter does not work @@ -40,14 +40,14 @@ static int vbi_workaround(struct saa7146_dev *dev) WRITE_RPS1(0xc000008c); /* wait for vbi_a or vbi_b*/ if ( 0 != (SAA7146_USE_PORT_B_FOR_VBI & dev->ext_vv_data->flags)) { - DEB_D(("...using port b\n")); + DEB_D("...using port b\n"); WRITE_RPS1(CMD_PAUSE | CMD_OAN | CMD_SIG1 | CMD_E_FID_B); WRITE_RPS1(CMD_PAUSE | CMD_OAN | CMD_SIG1 | CMD_O_FID_B); /* WRITE_RPS1(CMD_PAUSE | MASK_09); */ } else { - DEB_D(("...using port a\n")); + DEB_D("...using port a\n"); WRITE_RPS1(CMD_PAUSE | MASK_10); } /* upload brs */ @@ -103,7 +103,7 @@ static int vbi_workaround(struct saa7146_dev *dev) schedule(); - DEB_VBI(("brs bug workaround %d/1.\n",i)); + DEB_VBI("brs bug workaround %d/1\n", i); remove_wait_queue(&vv->vbi_wq, &wait); current->state = TASK_RUNNING; @@ -116,7 +116,8 @@ static int vbi_workaround(struct saa7146_dev *dev) if(signal_pending(current)) { - DEB_VBI(("aborted (rps:0x%08x).\n",saa7146_read(dev,RPS_ADDR1))); + DEB_VBI("aborted (rps:0x%08x)\n", + saa7146_read(dev, RPS_ADDR1)); /* stop rps1 for sure */ saa7146_write(dev, MC1, MASK_29); @@ -207,7 +208,7 @@ static int buffer_activate(struct saa7146_dev *dev, struct saa7146_vv *vv = dev->vv_data; buf->vb.state = VIDEOBUF_ACTIVE; - DEB_VBI(("dev:%p, buf:%p, next:%p\n",dev,buf,next)); + DEB_VBI("dev:%p, buf:%p, next:%p\n", dev, buf, next); saa7146_set_vbi_capture(dev,buf,next); mod_timer(&vv->vbi_q.timeout, jiffies+BUFFER_TIMEOUT); @@ -228,10 +229,10 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e llength = vbi_pixel_to_capture; size = lines * llength; - DEB_VBI(("vb:%p\n",vb)); + DEB_VBI("vb:%p\n", vb); if (0 != buf->vb.baddr && buf->vb.bsize < size) { - DEB_VBI(("size mismatch.\n")); + DEB_VBI("size mismatch\n"); return -EINVAL; } @@ -263,7 +264,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e return 0; oops: - DEB_VBI(("error out.\n")); + DEB_VBI("error out\n"); saa7146_dma_free(dev,q,buf); return err; @@ -279,7 +280,7 @@ static int buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned *size = lines * llength; *count = 2; - DEB_VBI(("count:%d, size:%d\n",*count,*size)); + DEB_VBI("count:%d, size:%d\n", *count, *size); return 0; } @@ -292,7 +293,7 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) struct saa7146_vv *vv = dev->vv_data; struct saa7146_buf *buf = (struct saa7146_buf *)vb; - DEB_VBI(("vb:%p\n",vb)); + DEB_VBI("vb:%p\n", vb); saa7146_buffer_queue(dev,&vv->vbi_q,buf); } @@ -303,7 +304,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) struct saa7146_dev *dev = fh->dev; struct saa7146_buf *buf = (struct saa7146_buf *)vb; - DEB_VBI(("vb:%p\n",vb)); + DEB_VBI("vb:%p\n", vb); saa7146_dma_free(dev,q,buf); } @@ -321,7 +322,7 @@ static void vbi_stop(struct saa7146_fh *fh, struct file *file) struct saa7146_dev *dev = fh->dev; struct saa7146_vv *vv = dev->vv_data; unsigned long flags; - DEB_VBI(("dev:%p, fh:%p\n",dev, fh)); + DEB_VBI("dev:%p, fh:%p\n", dev, fh); spin_lock_irqsave(&dev->slock,flags); @@ -354,14 +355,14 @@ static void vbi_read_timeout(unsigned long data) struct saa7146_fh *fh = file->private_data; struct saa7146_dev *dev = fh->dev; - DEB_VBI(("dev:%p, fh:%p\n",dev, fh)); + DEB_VBI("dev:%p, fh:%p\n", dev, fh); vbi_stop(fh, file); } static void vbi_init(struct saa7146_dev *dev, struct saa7146_vv *vv) { - DEB_VBI(("dev:%p\n",dev)); + DEB_VBI("dev:%p\n", dev); INIT_LIST_HEAD(&vv->vbi_q.queue); @@ -380,11 +381,11 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file) u32 arbtr_ctrl = saa7146_read(dev, PCI_BT_V1); int ret = 0; - DEB_VBI(("dev:%p, fh:%p\n",dev,fh)); + DEB_VBI("dev:%p, fh:%p\n", dev, fh); ret = saa7146_res_get(fh, RESOURCE_DMA3_BRS); if (0 == ret) { - DEB_S(("cannot get vbi RESOURCE_DMA3_BRS resource\n")); + DEB_S("cannot get vbi RESOURCE_DMA3_BRS resource\n"); return -EBUSY; } @@ -425,7 +426,7 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file) saa7146_write(dev, BRS_CTRL, 0x00000001); if (0 != (ret = vbi_workaround(dev))) { - DEB_VBI(("vbi workaround failed!\n")); + DEB_VBI("vbi workaround failed!\n"); /* return ret;*/ } } @@ -439,7 +440,7 @@ static void vbi_close(struct saa7146_dev *dev, struct file *file) { struct saa7146_fh *fh = file->private_data; struct saa7146_vv *vv = dev->vv_data; - DEB_VBI(("dev:%p, fh:%p\n",dev,fh)); + DEB_VBI("dev:%p, fh:%p\n", dev, fh); if( fh == vv->vbi_streaming ) { vbi_stop(fh, file); @@ -453,13 +454,13 @@ static void vbi_irq_done(struct saa7146_dev *dev, unsigned long status) spin_lock(&dev->slock); if (vv->vbi_q.curr) { - DEB_VBI(("dev:%p, curr:%p\n",dev,vv->vbi_q.curr)); + DEB_VBI("dev:%p, curr:%p\n", dev, vv->vbi_q.curr); /* this must be += 2, one count for each field */ vv->vbi_fieldcount+=2; vv->vbi_q.curr->vb.field_count = vv->vbi_fieldcount; saa7146_buffer_finish(dev,&vv->vbi_q,VIDEOBUF_DONE); } else { - DEB_VBI(("dev:%p\n",dev)); + DEB_VBI("dev:%p\n", dev); } saa7146_buffer_next(dev,&vv->vbi_q,1); @@ -473,7 +474,7 @@ static ssize_t vbi_read(struct file *file, char __user *data, size_t count, loff struct saa7146_vv *vv = dev->vv_data; ssize_t ret = 0; - DEB_VBI(("dev:%p, fh:%p\n",dev,fh)); + DEB_VBI("dev:%p, fh:%p\n", dev, fh); if( NULL == vv->vbi_streaming ) { // fixme: check if dma3 is available @@ -482,7 +483,8 @@ static ssize_t vbi_read(struct file *file, char __user *data, size_t count, loff } if( fh != vv->vbi_streaming ) { - DEB_VBI(("open %p is already using vbi capture.",vv->vbi_streaming)); + DEB_VBI("open %p is already using vbi capture\n", + vv->vbi_streaming); return -EBUSY; } diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index 9aafa4e969a8..fcdf4a00546d 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c @@ -1,3 +1,5 @@ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <media/saa7146_vv.h> #include <media/v4l2-chip-ident.h> @@ -94,7 +96,7 @@ struct saa7146_format* saa7146_format_by_fourcc(struct saa7146_dev *dev, int fou } } - DEB_D(("unknown pixelformat:'%4.4s'\n",(char *)&fourcc)); + DEB_D("unknown pixelformat:'%4.4s'\n", (char *)&fourcc); return NULL; } @@ -107,32 +109,32 @@ int saa7146_start_preview(struct saa7146_fh *fh) struct v4l2_format fmt; int ret = 0, err = 0; - DEB_EE(("dev:%p, fh:%p\n",dev,fh)); + DEB_EE("dev:%p, fh:%p\n", dev, fh); /* check if we have overlay informations */ if( NULL == fh->ov.fh ) { - DEB_D(("no overlay data available. try S_FMT first.\n")); + DEB_D("no overlay data available. try S_FMT first.\n"); return -EAGAIN; } /* check if streaming capture is running */ if (IS_CAPTURE_ACTIVE(fh) != 0) { - DEB_D(("streaming capture is active.\n")); + DEB_D("streaming capture is active\n"); return -EBUSY; } /* check if overlay is running */ if (IS_OVERLAY_ACTIVE(fh) != 0) { if (vv->video_fh == fh) { - DEB_D(("overlay is already active.\n")); + DEB_D("overlay is already active\n"); return 0; } - DEB_D(("overlay is already active in another open.\n")); + DEB_D("overlay is already active in another open\n"); return -EBUSY; } if (0 == saa7146_res_get(fh, RESOURCE_DMA1_HPS|RESOURCE_DMA2_CLP)) { - DEB_D(("cannot get necessary overlay resources\n")); + DEB_D("cannot get necessary overlay resources\n"); return -EBUSY; } @@ -145,13 +147,13 @@ int saa7146_start_preview(struct saa7146_fh *fh) fh->ov.win = fmt.fmt.win; vv->ov_data = &fh->ov; - DEB_D(("%dx%d+%d+%d %s field=%s\n", - fh->ov.win.w.width,fh->ov.win.w.height, - fh->ov.win.w.left,fh->ov.win.w.top, - vv->ov_fmt->name,v4l2_field_names[fh->ov.win.field])); + DEB_D("%dx%d+%d+%d %s field=%s\n", + fh->ov.win.w.width, fh->ov.win.w.height, + fh->ov.win.w.left, fh->ov.win.w.top, + vv->ov_fmt->name, v4l2_field_names[fh->ov.win.field]); if (0 != (ret = saa7146_enable_overlay(fh))) { - DEB_D(("enabling overlay failed: %d\n",ret)); + DEB_D("enabling overlay failed: %d\n", ret); saa7146_res_free(vv->video_fh, RESOURCE_DMA1_HPS|RESOURCE_DMA2_CLP); return ret; } @@ -168,22 +170,22 @@ int saa7146_stop_preview(struct saa7146_fh *fh) struct saa7146_dev *dev = fh->dev; struct saa7146_vv *vv = dev->vv_data; - DEB_EE(("dev:%p, fh:%p\n",dev,fh)); + DEB_EE("dev:%p, fh:%p\n", dev, fh); /* check if streaming capture is running */ if (IS_CAPTURE_ACTIVE(fh) != 0) { - DEB_D(("streaming capture is active.\n")); + DEB_D("streaming capture is active\n"); return -EBUSY; } /* check if overlay is running at all */ if ((vv->video_status & STATUS_OVERLAY) == 0) { - DEB_D(("no active overlay.\n")); + DEB_D("no active overlay\n"); return 0; } if (vv->video_fh != fh) { - DEB_D(("overlay is active, but in another open.\n")); + DEB_D("overlay is active, but in another open\n"); return -EBUSY; } @@ -268,7 +270,7 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu int length = dma->sglen; struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); - DEB_EE(("dev:%p, buf:%p, sg_len:%d\n",dev,buf,length)); + DEB_EE("dev:%p, buf:%p, sg_len:%d\n", dev, buf, length); if( 0 != IS_PLANAR(sfmt->trans)) { struct saa7146_pgtable *pt1 = &buf->pt[0]; @@ -288,7 +290,8 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu m3 = ((size+(size/2)+PAGE_SIZE)/PAGE_SIZE)-1; o1 = size%PAGE_SIZE; o2 = (size+(size/4))%PAGE_SIZE; - DEB_CAP(("size:%d, m1:%d, m2:%d, m3:%d, o1:%d, o2:%d\n",size,m1,m2,m3,o1,o2)); + DEB_CAP("size:%d, m1:%d, m2:%d, m3:%d, o1:%d, o2:%d\n", + size, m1, m2, m3, o1, o2); break; } case 16: { @@ -298,7 +301,8 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu m3 = ((2*size+PAGE_SIZE)/PAGE_SIZE)-1; o1 = size%PAGE_SIZE; o2 = (size+(size/2))%PAGE_SIZE; - DEB_CAP(("size:%d, m1:%d, m2:%d, m3:%d, o1:%d, o2:%d\n",size,m1,m2,m3,o1,o2)); + DEB_CAP("size:%d, m1:%d, m2:%d, m3:%d, o1:%d, o2:%d\n", + size, m1, m2, m3, o1, o2); break; } default: { @@ -387,23 +391,23 @@ static int video_begin(struct saa7146_fh *fh) unsigned int resource; int ret = 0, err = 0; - DEB_EE(("dev:%p, fh:%p\n",dev,fh)); + DEB_EE("dev:%p, fh:%p\n", dev, fh); if ((vv->video_status & STATUS_CAPTURE) != 0) { if (vv->video_fh == fh) { - DEB_S(("already capturing.\n")); + DEB_S("already capturing\n"); return 0; } - DEB_S(("already capturing in another open.\n")); + DEB_S("already capturing in another open\n"); return -EBUSY; } if ((vv->video_status & STATUS_OVERLAY) != 0) { - DEB_S(("warning: suspending overlay video for streaming capture.\n")); + DEB_S("warning: suspending overlay video for streaming capture\n"); vv->ov_suspend = vv->video_fh; err = saa7146_stop_preview(vv->video_fh); /* side effect: video_status is now 0, video_fh is NULL */ if (0 != err) { - DEB_D(("suspending video failed. aborting\n")); + DEB_D("suspending video failed. aborting\n"); return err; } } @@ -420,7 +424,7 @@ static int video_begin(struct saa7146_fh *fh) ret = saa7146_res_get(fh, resource); if (0 == ret) { - DEB_S(("cannot get capture resource %d\n",resource)); + DEB_S("cannot get capture resource %d\n", resource); if (vv->ov_suspend != NULL) { saa7146_start_preview(vv->ov_suspend); vv->ov_suspend = NULL; @@ -448,15 +452,15 @@ static int video_end(struct saa7146_fh *fh, struct file *file) unsigned long flags; unsigned int resource; u32 dmas = 0; - DEB_EE(("dev:%p, fh:%p\n",dev,fh)); + DEB_EE("dev:%p, fh:%p\n", dev, fh); if ((vv->video_status & STATUS_CAPTURE) != STATUS_CAPTURE) { - DEB_S(("not capturing.\n")); + DEB_S("not capturing\n"); return 0; } if (vv->video_fh != fh) { - DEB_S(("capturing, but in another open.\n")); + DEB_S("capturing, but in another open\n"); return -EBUSY; } @@ -530,7 +534,7 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f struct saa7146_vv *vv = dev->vv_data; struct saa7146_format *fmt; - DEB_EE(("VIDIOC_S_FBUF\n")); + DEB_EE("VIDIOC_S_FBUF\n"); if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RAWIO)) return -EPERM; @@ -542,13 +546,13 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f /* planar formats are not allowed for overlay video, clipping and video dma would clash */ if (fmt->flags & FORMAT_IS_PLANAR) - DEB_S(("planar pixelformat '%4.4s' not allowed for overlay\n", - (char *)&fmt->pixelformat)); + DEB_S("planar pixelformat '%4.4s' not allowed for overlay\n", + (char *)&fmt->pixelformat); /* check if overlay is running */ if (IS_OVERLAY_ACTIVE(fh) != 0) { if (vv->video_fh != fh) { - DEB_D(("refusing to change framebuffer informations while overlay is active in another open.\n")); + DEB_D("refusing to change framebuffer informations while overlay is active in another open\n"); return -EBUSY; } } @@ -559,7 +563,7 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f if (vv->ov_fb.fmt.bytesperline < vv->ov_fb.fmt.width) { vv->ov_fb.fmt.bytesperline = vv->ov_fb.fmt.width * fmt->depth / 8; - DEB_D(("setting bytesperline to %d\n", vv->ov_fb.fmt.bytesperline)); + DEB_D("setting bytesperline to %d\n", vv->ov_fb.fmt.bytesperline); } return 0; } @@ -588,7 +592,7 @@ static int vidioc_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl * if (ctrl == NULL) return -EINVAL; - DEB_EE(("VIDIOC_QUERYCTRL: id:%d\n", c->id)); + DEB_EE("VIDIOC_QUERYCTRL: id:%d\n", c->id); *c = *ctrl; return 0; } @@ -607,25 +611,25 @@ static int vidioc_g_ctrl(struct file *file, void *fh, struct v4l2_control *c) case V4L2_CID_BRIGHTNESS: value = saa7146_read(dev, BCS_CTRL); c->value = 0xff & (value >> 24); - DEB_D(("V4L2_CID_BRIGHTNESS: %d\n", c->value)); + DEB_D("V4L2_CID_BRIGHTNESS: %d\n", c->value); break; case V4L2_CID_CONTRAST: value = saa7146_read(dev, BCS_CTRL); c->value = 0x7f & (value >> 16); - DEB_D(("V4L2_CID_CONTRAST: %d\n", c->value)); + DEB_D("V4L2_CID_CONTRAST: %d\n", c->value); break; case V4L2_CID_SATURATION: value = saa7146_read(dev, BCS_CTRL); c->value = 0x7f & (value >> 0); - DEB_D(("V4L2_CID_SATURATION: %d\n", c->value)); + DEB_D("V4L2_CID_SATURATION: %d\n", c->value); break; case V4L2_CID_VFLIP: c->value = vv->vflip; - DEB_D(("V4L2_CID_VFLIP: %d\n", c->value)); + DEB_D("V4L2_CID_VFLIP: %d\n", c->value); break; case V4L2_CID_HFLIP: c->value = vv->hflip; - DEB_D(("V4L2_CID_HFLIP: %d\n", c->value)); + DEB_D("V4L2_CID_HFLIP: %d\n", c->value); break; default: return -EINVAL; @@ -641,7 +645,7 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c) ctrl = ctrl_by_id(c->id); if (NULL == ctrl) { - DEB_D(("unknown control %d\n", c->id)); + DEB_D("unknown control %d\n", c->id); return -EINVAL; } @@ -686,14 +690,14 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c) case V4L2_CID_HFLIP: /* fixme: we can support changing VFLIP and HFLIP here... */ if (IS_CAPTURE_ACTIVE(fh) != 0) { - DEB_D(("V4L2_CID_HFLIP while active capture.\n")); + DEB_D("V4L2_CID_HFLIP while active capture\n"); return -EBUSY; } vv->hflip = c->value; break; case V4L2_CID_VFLIP: if (IS_CAPTURE_ACTIVE(fh) != 0) { - DEB_D(("V4L2_CID_VFLIP while active capture.\n")); + DEB_D("V4L2_CID_VFLIP while active capture\n"); return -EBUSY; } vv->vflip = c->value; @@ -748,7 +752,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma int maxw, maxh; int calc_bpl; - DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh)); + DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh); fmt = saa7146_format_by_fourcc(dev, f->fmt.pix.pixelformat); if (NULL == fmt) @@ -777,7 +781,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma vv->last_field = V4L2_FIELD_INTERLACED; break; default: - DEB_D(("no known field mode '%d'.\n", field)); + DEB_D("no known field mode '%d'\n", field); return -EINVAL; } @@ -796,8 +800,9 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma f->fmt.pix.bytesperline = calc_bpl; f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * f->fmt.pix.height; - DEB_D(("w:%d, h:%d, bytesperline:%d, sizeimage:%d\n", f->fmt.pix.width, - f->fmt.pix.height, f->fmt.pix.bytesperline, f->fmt.pix.sizeimage)); + DEB_D("w:%d, h:%d, bytesperline:%d, sizeimage:%d\n", + f->fmt.pix.width, f->fmt.pix.height, + f->fmt.pix.bytesperline, f->fmt.pix.sizeimage); return 0; } @@ -811,22 +816,23 @@ static int vidioc_try_fmt_vid_overlay(struct file *file, void *fh, struct v4l2_f enum v4l2_field field; int maxw, maxh; - DEB_EE(("dev:%p\n", dev)); + DEB_EE("dev:%p\n", dev); if (NULL == vv->ov_fb.base) { - DEB_D(("no fb base set.\n")); + DEB_D("no fb base set\n"); return -EINVAL; } if (NULL == vv->ov_fmt) { - DEB_D(("no fb fmt set.\n")); + DEB_D("no fb fmt set\n"); return -EINVAL; } if (win->w.width < 48 || win->w.height < 32) { - DEB_D(("min width/height. (%d,%d)\n", win->w.width, win->w.height)); + DEB_D("min width/height. (%d,%d)\n", + win->w.width, win->w.height); return -EINVAL; } if (win->clipcount > 16) { - DEB_D(("clipcount too big.\n")); + DEB_D("clipcount too big\n"); return -EINVAL; } @@ -848,7 +854,7 @@ static int vidioc_try_fmt_vid_overlay(struct file *file, void *fh, struct v4l2_f case V4L2_FIELD_INTERLACED: break; default: - DEB_D(("no known field mode '%d'.\n", field)); + DEB_D("no known field mode '%d'\n", field); return -EINVAL; } @@ -868,16 +874,17 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_forma struct saa7146_vv *vv = dev->vv_data; int err; - DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh)); + DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh); if (IS_CAPTURE_ACTIVE(fh) != 0) { - DEB_EE(("streaming capture is active\n")); + DEB_EE("streaming capture is active\n"); return -EBUSY; } err = vidioc_try_fmt_vid_cap(file, fh, f); if (0 != err) return err; fh->video_fmt = f->fmt.pix; - DEB_EE(("set to pixelformat '%4.4s'\n", (char *)&fh->video_fmt.pixelformat)); + DEB_EE("set to pixelformat '%4.4s'\n", + (char *)&fh->video_fmt.pixelformat); return 0; } @@ -888,7 +895,7 @@ static int vidioc_s_fmt_vid_overlay(struct file *file, void *__fh, struct v4l2_f struct saa7146_vv *vv = dev->vv_data; int err; - DEB_EE(("V4L2_BUF_TYPE_VIDEO_OVERLAY: dev:%p, fh:%p\n", dev, fh)); + DEB_EE("V4L2_BUF_TYPE_VIDEO_OVERLAY: dev:%p, fh:%p\n", dev, fh); err = vidioc_try_fmt_vid_overlay(file, fh, f); if (0 != err) return err; @@ -931,7 +938,7 @@ static int vidioc_g_std(struct file *file, void *fh, v4l2_std_id *norm) if (e->index < 0 ) return -EINVAL; if( e->index < dev->ext_vv_data->num_stds ) { - DEB_EE(("VIDIOC_ENUMSTD: index:%d\n",e->index)); + DEB_EE("VIDIOC_ENUMSTD: index:%d\n", e->index); v4l2_video_std_construct(e, dev->ext_vv_data->stds[e->index].id, dev->ext_vv_data->stds[e->index].name); return 0; } @@ -946,10 +953,10 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id) int found = 0; int err, i; - DEB_EE(("VIDIOC_S_STD\n")); + DEB_EE("VIDIOC_S_STD\n"); if ((vv->video_status & STATUS_CAPTURE) == STATUS_CAPTURE) { - DEB_D(("cannot change video standard while streaming capture is active\n")); + DEB_D("cannot change video standard while streaming capture is active\n"); return -EBUSY; } @@ -957,7 +964,7 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id) vv->ov_suspend = vv->video_fh; err = saa7146_stop_preview(vv->video_fh); /* side effect: video_status is now 0, video_fh is NULL */ if (0 != err) { - DEB_D(("suspending video failed. aborting\n")); + DEB_D("suspending video failed. aborting\n"); return err; } } @@ -978,11 +985,11 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id) } if (!found) { - DEB_EE(("VIDIOC_S_STD: standard not found.\n")); + DEB_EE("VIDIOC_S_STD: standard not found\n"); return -EINVAL; } - DEB_EE(("VIDIOC_S_STD: set to standard to '%s'\n", vv->standard->name)); + DEB_EE("VIDIOC_S_STD: set to standard to '%s'\n", vv->standard->name); return 0; } @@ -990,7 +997,7 @@ static int vidioc_overlay(struct file *file, void *fh, unsigned int on) { int err; - DEB_D(("VIDIOC_OVERLAY on:%d\n", on)); + DEB_D("VIDIOC_OVERLAY on:%d\n", on); if (on) err = saa7146_start_preview(fh); else @@ -1047,7 +1054,7 @@ static int vidioc_streamon(struct file *file, void *__fh, enum v4l2_buf_type typ struct saa7146_fh *fh = __fh; int err; - DEB_D(("VIDIOC_STREAMON, type:%d\n", type)); + DEB_D("VIDIOC_STREAMON, type:%d\n", type); err = video_begin(fh); if (err) @@ -1066,18 +1073,18 @@ static int vidioc_streamoff(struct file *file, void *__fh, enum v4l2_buf_type ty struct saa7146_vv *vv = dev->vv_data; int err; - DEB_D(("VIDIOC_STREAMOFF, type:%d\n", type)); + DEB_D("VIDIOC_STREAMOFF, type:%d\n", type); /* ugly: we need to copy some checks from video_end(), because videobuf_streamoff() relies on the capture running. check and fix this */ if ((vv->video_status & STATUS_CAPTURE) != STATUS_CAPTURE) { - DEB_S(("not capturing.\n")); + DEB_S("not capturing\n"); return 0; } if (vv->video_fh != fh) { - DEB_S(("capturing, but in another open.\n")); + DEB_S("capturing, but in another open\n"); return -EBUSY; } @@ -1087,7 +1094,7 @@ static int vidioc_streamoff(struct file *file, void *__fh, enum v4l2_buf_type ty else if (type == V4L2_BUF_TYPE_VBI_CAPTURE) err = videobuf_streamoff(&fh->vbi_q); if (0 != err) { - DEB_D(("warning: videobuf_streamoff() failed.\n")); + DEB_D("warning: videobuf_streamoff() failed\n"); video_end(fh, file); } else { err = video_end(fh, file); @@ -1174,25 +1181,27 @@ static int buffer_prepare(struct videobuf_queue *q, struct saa7146_buf *buf = (struct saa7146_buf *)vb; int size,err = 0; - DEB_CAP(("vbuf:%p\n",vb)); + DEB_CAP("vbuf:%p\n", vb); /* sanity checks */ if (fh->video_fmt.width < 48 || fh->video_fmt.height < 32 || fh->video_fmt.width > vv->standard->h_max_out || fh->video_fmt.height > vv->standard->v_max_out) { - DEB_D(("w (%d) / h (%d) out of bounds.\n",fh->video_fmt.width,fh->video_fmt.height)); + DEB_D("w (%d) / h (%d) out of bounds\n", + fh->video_fmt.width, fh->video_fmt.height); return -EINVAL; } size = fh->video_fmt.sizeimage; if (0 != buf->vb.baddr && buf->vb.bsize < size) { - DEB_D(("size mismatch.\n")); + DEB_D("size mismatch\n"); return -EINVAL; } - DEB_CAP(("buffer_prepare [size=%dx%d,bytes=%d,fields=%s]\n", - fh->video_fmt.width,fh->video_fmt.height,size,v4l2_field_names[fh->video_fmt.field])); + DEB_CAP("buffer_prepare [size=%dx%d,bytes=%d,fields=%s]\n", + fh->video_fmt.width, fh->video_fmt.height, + size, v4l2_field_names[fh->video_fmt.field]); if (buf->vb.width != fh->video_fmt.width || buf->vb.bytesperline != fh->video_fmt.bytesperline || buf->vb.height != fh->video_fmt.height || @@ -1238,7 +1247,7 @@ static int buffer_prepare(struct videobuf_queue *q, return 0; oops: - DEB_D(("error out.\n")); + DEB_D("error out\n"); saa7146_dma_free(dev,q,buf); return err; @@ -1259,7 +1268,7 @@ static int buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned *count = (max_memory*1048576) / *size; } - DEB_CAP(("%d buffers, %d bytes each.\n",*count,*size)); + DEB_CAP("%d buffers, %d bytes each\n", *count, *size); return 0; } @@ -1272,7 +1281,7 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) struct saa7146_vv *vv = dev->vv_data; struct saa7146_buf *buf = (struct saa7146_buf *)vb; - DEB_CAP(("vbuf:%p\n",vb)); + DEB_CAP("vbuf:%p\n", vb); saa7146_buffer_queue(fh->dev,&vv->video_q,buf); } @@ -1283,7 +1292,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) struct saa7146_dev *dev = fh->dev; struct saa7146_buf *buf = (struct saa7146_buf *)vb; - DEB_CAP(("vbuf:%p\n",vb)); + DEB_CAP("vbuf:%p\n", vb); saa7146_dma_free(dev,q,buf); @@ -1368,7 +1377,7 @@ static void video_irq_done(struct saa7146_dev *dev, unsigned long st) struct saa7146_dmaqueue *q = &vv->video_q; spin_lock(&dev->slock); - DEB_CAP(("called.\n")); + DEB_CAP("called\n"); /* only finish the buffer if we have one... */ if( NULL != q->curr ) { @@ -1386,15 +1395,15 @@ static ssize_t video_read(struct file *file, char __user *data, size_t count, lo struct saa7146_vv *vv = dev->vv_data; ssize_t ret = 0; - DEB_EE(("called.\n")); + DEB_EE("called\n"); if ((vv->video_status & STATUS_CAPTURE) != 0) { /* fixme: should we allow read() captures while streaming capture? */ if (vv->video_fh == fh) { - DEB_S(("already capturing.\n")); + DEB_S("already capturing\n"); return -EBUSY; } - DEB_S(("already capturing in another open.\n")); + DEB_S("already capturing in another open\n"); return -EBUSY; } |