From patchwork Thu Apr 5 10:34:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 10324357 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2AB2E60208 for ; Thu, 5 Apr 2018 10:34:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B65B28F27 for ; Thu, 5 Apr 2018 10:34:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEB7A29148; Thu, 5 Apr 2018 10:34:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 452CA28F27 for ; Thu, 5 Apr 2018 10:34:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751249AbeDEKep (ORCPT ); Thu, 5 Apr 2018 06:34:45 -0400 Received: from osg.samsung.com ([64.30.133.232]:60898 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751195AbeDEKeo (ORCPT ); Thu, 5 Apr 2018 06:34:44 -0400 Received: from localhost (localhost [127.0.0.1]) by osg.samsung.com (Postfix) with ESMTP id 069412EE15; Thu, 5 Apr 2018 03:34:44 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at dev.s-opensource.com Received: from osg.samsung.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Cn-fkX215U7H; Thu, 5 Apr 2018 03:34:42 -0700 (PDT) Received: from smtp.s-opensource.com (unknown [177.133.19.105]) by osg.samsung.com (Postfix) with ESMTPSA id A10662EE0A; Thu, 5 Apr 2018 03:34:42 -0700 (PDT) Received: from mchehab by smtp.s-opensource.com with local (Exim 4.90_1) (envelope-from ) id 1f42E4-0007kC-1p; Thu, 05 Apr 2018 07:34:40 -0300 From: Mauro Carvalho Chehab To: Linux Media Mailing List Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , Hans Verkuil , Al Viro , Laurent Pinchart , Sakari Ailus Subject: [PATCH] media: v4l2-dev: use pr_foo() for printing messages Date: Thu, 5 Apr 2018 07:34:39 -0300 Message-Id: <3cead57d0a484bf589f4da3b86f4470cde6a1480.1522924475.git.mchehab@s-opensource.com> X-Mailer: git-send-email 2.14.3 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of using printk() directly, use the pr_foo() macros. Signed-off-by: Mauro Carvalho Chehab Acked-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-dev.c | 45 ++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 1d0b2208e8fb..530db8e482fb 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -16,6 +16,8 @@ * - Added procfs support */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include @@ -34,6 +36,12 @@ #define VIDEO_NUM_DEVICES 256 #define VIDEO_NAME "video4linux" +#define dprintk(fmt, arg...) do { \ + printk(KERN_DEBUG pr_fmt("%s: " fmt), \ + __func__, ##arg); \ +} while (0) + + /* * sysfs stuff */ @@ -309,7 +317,7 @@ static ssize_t v4l2_read(struct file *filp, char __user *buf, ret = vdev->fops->read(filp, buf, sz, off); if ((vdev->dev_debug & V4L2_DEV_DEBUG_FOP) && (vdev->dev_debug & V4L2_DEV_DEBUG_STREAMING)) - printk(KERN_DEBUG "%s: read: %zd (%d)\n", + dprintk("%s: read: %zd (%d)\n", video_device_node_name(vdev), sz, ret); return ret; } @@ -326,7 +334,7 @@ static ssize_t v4l2_write(struct file *filp, const char __user *buf, ret = vdev->fops->write(filp, buf, sz, off); if ((vdev->dev_debug & V4L2_DEV_DEBUG_FOP) && (vdev->dev_debug & V4L2_DEV_DEBUG_STREAMING)) - printk(KERN_DEBUG "%s: write: %zd (%d)\n", + dprintk("%s: write: %zd (%d)\n", video_device_node_name(vdev), sz, ret); return ret; } @@ -341,7 +349,7 @@ static __poll_t v4l2_poll(struct file *filp, struct poll_table_struct *poll) if (video_is_registered(vdev)) res = vdev->fops->poll(filp, poll); if (vdev->dev_debug & V4L2_DEV_DEBUG_POLL) - printk(KERN_DEBUG "%s: poll: %08x\n", + dprintk("%s: poll: %08x\n", video_device_node_name(vdev), res); return res; } @@ -382,7 +390,7 @@ static unsigned long v4l2_get_unmapped_area(struct file *filp, return -ENODEV; ret = vdev->fops->get_unmapped_area(filp, addr, len, pgoff, flags); if (vdev->dev_debug & V4L2_DEV_DEBUG_FOP) - printk(KERN_DEBUG "%s: get_unmapped_area (%d)\n", + dprintk("%s: get_unmapped_area (%d)\n", video_device_node_name(vdev), ret); return ret; } @@ -398,7 +406,7 @@ static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm) if (video_is_registered(vdev)) ret = vdev->fops->mmap(filp, vm); if (vdev->dev_debug & V4L2_DEV_DEBUG_FOP) - printk(KERN_DEBUG "%s: mmap (%d)\n", + dprintk("%s: mmap (%d)\n", video_device_node_name(vdev), ret); return ret; } @@ -428,7 +436,7 @@ static int v4l2_open(struct inode *inode, struct file *filp) } if (vdev->dev_debug & V4L2_DEV_DEBUG_FOP) - printk(KERN_DEBUG "%s: open (%d)\n", + dprintk("%s: open (%d)\n", video_device_node_name(vdev), ret); /* decrease the refcount in case of an error */ if (ret) @@ -445,7 +453,7 @@ static int v4l2_release(struct inode *inode, struct file *filp) if (vdev->fops->release) ret = vdev->fops->release(filp); if (vdev->dev_debug & V4L2_DEV_DEBUG_FOP) - printk(KERN_DEBUG "%s: release\n", + dprintk("%s: release\n", video_device_node_name(vdev)); /* decrease the refcount unconditionally since the release() @@ -786,8 +794,7 @@ static int video_register_media_controller(struct video_device *vdev, int type) ret = media_device_register_entity(vdev->v4l2_dev->mdev, &vdev->entity); if (ret < 0) { - printk(KERN_WARNING - "%s: media_device_register_entity failed\n", + pr_warn("%s: media_device_register_entity failed\n", __func__); return ret; } @@ -869,7 +876,7 @@ int __video_register_device(struct video_device *vdev, name_base = "v4l-touch"; break; default: - printk(KERN_ERR "%s called with unknown type: %d\n", + pr_err("%s called with unknown type: %d\n", __func__, type); return -EINVAL; } @@ -918,7 +925,7 @@ int __video_register_device(struct video_device *vdev, if (nr == minor_cnt) nr = devnode_find(vdev, 0, minor_cnt); if (nr == minor_cnt) { - printk(KERN_ERR "could not get a free device node number\n"); + pr_err("could not get a free device node number\n"); mutex_unlock(&videodev_lock); return -ENFILE; } @@ -933,7 +940,7 @@ int __video_register_device(struct video_device *vdev, break; if (i == VIDEO_NUM_DEVICES) { mutex_unlock(&videodev_lock); - printk(KERN_ERR "could not get a free minor\n"); + pr_err("could not get a free minor\n"); return -ENFILE; } #endif @@ -943,7 +950,7 @@ int __video_register_device(struct video_device *vdev, /* Should not happen since we thought this minor was free */ if (WARN_ON(video_device[vdev->minor])) { mutex_unlock(&videodev_lock); - printk(KERN_ERR "video_device not empty!\n"); + pr_err("video_device not empty!\n"); return -ENFILE; } devnode_set(vdev); @@ -964,7 +971,7 @@ int __video_register_device(struct video_device *vdev, vdev->cdev->owner = owner; ret = cdev_add(vdev->cdev, MKDEV(VIDEO_MAJOR, vdev->minor), 1); if (ret < 0) { - printk(KERN_ERR "%s: cdev_add failed\n", __func__); + pr_err("%s: cdev_add failed\n", __func__); kfree(vdev->cdev); vdev->cdev = NULL; goto cleanup; @@ -977,7 +984,7 @@ int __video_register_device(struct video_device *vdev, dev_set_name(&vdev->dev, "%s%d", name_base, vdev->num); ret = device_register(&vdev->dev); if (ret < 0) { - printk(KERN_ERR "%s: device_register failed\n", __func__); + pr_err("%s: device_register failed\n", __func__); goto cleanup; } /* Register the release callback that will be called when the last @@ -985,7 +992,7 @@ int __video_register_device(struct video_device *vdev, vdev->dev.release = v4l2_device_release; if (nr != -1 && nr != vdev->num && warn_if_nr_in_use) - printk(KERN_WARNING "%s: requested %s%d, got %s\n", __func__, + pr_warn("%s: requested %s%d, got %s\n", __func__, name_base, nr, video_device_node_name(vdev)); /* Increase v4l2_device refcount */ @@ -1043,10 +1050,10 @@ static int __init videodev_init(void) dev_t dev = MKDEV(VIDEO_MAJOR, 0); int ret; - printk(KERN_INFO "Linux video capture interface: v2.00\n"); + pr_info("Linux video capture interface: v2.00\n"); ret = register_chrdev_region(dev, VIDEO_NUM_DEVICES, VIDEO_NAME); if (ret < 0) { - printk(KERN_WARNING "videodev: unable to get major %d\n", + pr_warn("videodev: unable to get major %d\n", VIDEO_MAJOR); return ret; } @@ -1054,7 +1061,7 @@ static int __init videodev_init(void) ret = class_register(&video_class); if (ret < 0) { unregister_chrdev_region(dev, VIDEO_NUM_DEVICES); - printk(KERN_WARNING "video_dev: class_register failed\n"); + pr_warn("video_dev: class_register failed\n"); return -EIO; }