Re: [PATCH] staging: most: replace function name to __func__

2018-01-22 Thread Greg Kroah-Hartman
On Sun, Jan 21, 2018 at 04:05:26PM +, Sidong Yang wrote:
> Fix checkpatch.pl warning message about logging code. Previous code
> contains hard coded function name. Fix this code by using __func__
> macro.
> 
> Signed-off-by: Sidong Yang 
> ---
>  drivers/staging/most/dim2/dim2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/most/dim2/dim2.c 
> b/drivers/staging/most/dim2/dim2.c
> index 21e3fb48bdb4..f9bc7dea75b8 100644
> --- a/drivers/staging/most/dim2/dim2.c
> +++ b/drivers/staging/most/dim2/dim2.c
> @@ -151,7 +151,7 @@ void dimcb_io_write(u32 __iomem *ptr32, u32 value)
>   */
>  void dimcb_on_error(u8 error_id, const char *error_message)
>  {
> - pr_err("dimcb_on_error: error_id - %d, error_message - %s\n", error_id,
> + pr_err("%s: error_id - %d, error_message - %s\n", __func__, error_id,
>  error_message);
>  }
>  

This is ok, but this function should really be removed and just use
dev_err() instead everywhere this is called.  And there's no need for
yet-another-wrapper-function dim_on_error() that does nothing but call
this function as well.  Too many levels of indirection for no reason...

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: most: replace function name to __func__

2018-01-21 Thread Sidong Yang
Fix checkpatch.pl warning message about logging code. Previous code
contains hard coded function name. Fix this code by using __func__
macro.

Signed-off-by: Sidong Yang 
---
 drivers/staging/most/dim2/dim2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index 21e3fb48bdb4..f9bc7dea75b8 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -151,7 +151,7 @@ void dimcb_io_write(u32 __iomem *ptr32, u32 value)
  */
 void dimcb_on_error(u8 error_id, const char *error_message)
 {
-   pr_err("dimcb_on_error: error_id - %d, error_message - %s\n", error_id,
+   pr_err("%s: error_id - %d, error_message - %s\n", __func__, error_id,
   error_message);
 }
 
-- 
2.11.0

Greg, 

You're right that other source with tracing code should be removed.
I sended my patch that only contains replace function name in 'pr_err'.

Thanks.

Sidong.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: most: replace function name to __func__

2018-01-17 Thread Greg Kroah-Hartman
On Tue, Jan 16, 2018 at 04:49:01PM +, Sidong Yang wrote:
> Fix checkpatch.pl warning message about logging code. Previous code
> contains hard coded function name. Fix this code by using __func__
> macro.
> 
> Signed-off-by: Sidong Yang 
> ---
>  drivers/staging/most/dim2/dim2.c   |  2 +-
>  drivers/staging/most/video/video.c | 24 
>  2 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/staging/most/dim2/dim2.c 
> b/drivers/staging/most/dim2/dim2.c
> index 21e3fb48bdb4..f9bc7dea75b8 100644
> --- a/drivers/staging/most/dim2/dim2.c
> +++ b/drivers/staging/most/dim2/dim2.c
> @@ -151,7 +151,7 @@ void dimcb_io_write(u32 __iomem *ptr32, u32 value)
>   */
>  void dimcb_on_error(u8 error_id, const char *error_message)
>  {
> - pr_err("dimcb_on_error: error_id - %d, error_message - %s\n", error_id,
> + pr_err("%s: error_id - %d, error_message - %s\n", __func__, error_id,
>  error_message);

This is fine, but:

>  }
>  
> diff --git a/drivers/staging/most/video/video.c 
> b/drivers/staging/most/video/video.c
> index 098873851646..22d9b1fc622f 100644
> --- a/drivers/staging/most/video/video.c
> +++ b/drivers/staging/most/video/video.c
> @@ -73,7 +73,7 @@ static int comp_vdev_open(struct file *filp)
>   struct most_video_dev *mdev = video_drvdata(filp);
>   struct comp_fh *fh;
>  
> - v4l2_info(>v4l2_dev, "comp_vdev_open()\n");
> + v4l2_info(>v4l2_dev, "%s()\n", __func__);

That should just be dropped entirely, right?  It's tracing code, and if
you really want to do that, just use ftrace instead.

So just remove these types of call that just has the function name.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: most: replace function name to __func__

2018-01-16 Thread Sidong Yang
Fix checkpatch.pl warning message about logging code. Previous code
contains hard coded function name. Fix this code by using __func__
macro.

Signed-off-by: Sidong Yang 
---
 drivers/staging/most/dim2/dim2.c   |  2 +-
 drivers/staging/most/video/video.c | 24 
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index 21e3fb48bdb4..f9bc7dea75b8 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -151,7 +151,7 @@ void dimcb_io_write(u32 __iomem *ptr32, u32 value)
  */
 void dimcb_on_error(u8 error_id, const char *error_message)
 {
-   pr_err("dimcb_on_error: error_id - %d, error_message - %s\n", error_id,
+   pr_err("%s: error_id - %d, error_message - %s\n", __func__, error_id,
   error_message);
 }
 
diff --git a/drivers/staging/most/video/video.c 
b/drivers/staging/most/video/video.c
index 098873851646..22d9b1fc622f 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -73,7 +73,7 @@ static int comp_vdev_open(struct file *filp)
struct most_video_dev *mdev = video_drvdata(filp);
struct comp_fh *fh;
 
-   v4l2_info(>v4l2_dev, "comp_vdev_open()\n");
+   v4l2_info(>v4l2_dev, "%s()\n", __func__);
 
switch (vdev->vfl_type) {
case VFL_TYPE_GRABBER:
@@ -122,7 +122,7 @@ static int comp_vdev_close(struct file *filp)
struct most_video_dev *mdev = fh->mdev;
struct mbo *mbo, *tmp;
 
-   v4l2_info(>v4l2_dev, "comp_vdev_close()\n");
+   v4l2_info(>v4l2_dev, "%s()\n", __func__);
 
/*
 * We need to put MBOs back before we call most_stop_channel()
@@ -250,7 +250,7 @@ static int vidioc_querycap(struct file *file, void *priv,
struct comp_fh *fh = priv;
struct most_video_dev *mdev = fh->mdev;
 
-   v4l2_info(>v4l2_dev, "vidioc_querycap()\n");
+   v4l2_info(>v4l2_dev, "%s()\n", __func__);
 
strlcpy(cap->driver, "v4l2_component", sizeof(cap->driver));
strlcpy(cap->card, "MOST", sizeof(cap->card));
@@ -270,7 +270,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void 
*priv,
struct comp_fh *fh = priv;
struct most_video_dev *mdev = fh->mdev;
 
-   v4l2_info(>v4l2_dev, "vidioc_enum_fmt_vid_cap() %d\n", f->index);
+   v4l2_info(>v4l2_dev, "%s() %d\n", __func__, f->index);
 
if (f->index)
return -EINVAL;
@@ -289,7 +289,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void 
*priv,
struct comp_fh *fh = priv;
struct most_video_dev *mdev = fh->mdev;
 
-   v4l2_info(>v4l2_dev, "vidioc_g_fmt_vid_cap()\n");
+   v4l2_info(>v4l2_dev, "%s()\n", __func__);
 
comp_set_format_struct(f);
return 0;
@@ -318,7 +318,7 @@ static int vidioc_g_std(struct file *file, void *priv, 
v4l2_std_id *norm)
struct comp_fh *fh = priv;
struct most_video_dev *mdev = fh->mdev;
 
-   v4l2_info(>v4l2_dev, "vidioc_g_std()\n");
+   v4l2_info(>v4l2_dev, "%s()\n", __func__);
 
*norm = V4L2_STD_UNKNOWN;
return 0;
@@ -355,7 +355,7 @@ static int vidioc_s_input(struct file *file, void *priv, 
unsigned int index)
struct comp_fh *fh = priv;
struct most_video_dev *mdev = fh->mdev;
 
-   v4l2_info(>v4l2_dev, "vidioc_s_input(%d)\n", index);
+   v4l2_info(>v4l2_dev, "%s(%d)\n", __func__, index);
 
if (index >= V4L2_CMP_MAX_INPUT)
return -EINVAL;
@@ -435,7 +435,7 @@ static int comp_register_videodev(struct most_video_dev 
*mdev)
 {
int ret;
 
-   v4l2_info(>v4l2_dev, "comp_register_videodev()\n");
+   v4l2_info(>v4l2_dev, "%s()\n", __func__);
 
init_waitqueue_head(>wait_data);
 
@@ -465,7 +465,7 @@ static int comp_register_videodev(struct most_video_dev 
*mdev)
 
 static void comp_unregister_videodev(struct most_video_dev *mdev)
 {
-   v4l2_info(>v4l2_dev, "comp_unregister_videodev()\n");
+   v4l2_info(>v4l2_dev, "%s()\n", __func__);
 
video_unregister_device(mdev->vdev);
 }
@@ -485,7 +485,7 @@ static int comp_probe_channel(struct most_interface *iface, 
int channel_idx,
int ret;
struct most_video_dev *mdev = get_comp_dev(iface, channel_idx);
 
-   pr_info("comp_probe_channel(%s)\n", name);
+   pr_info("%s(%s)\n", __func__, name);
 
if (mdev) {
pr_err("channel already linked\n");
@@ -531,7 +531,7 @@ static int comp_probe_channel(struct most_interface *iface, 
int channel_idx,
spin_lock_irq(_lock);
list_add(>list, _devices);
spin_unlock_irq(_lock);
-   v4l2_info(>v4l2_dev, "comp_probe_channel() done\n");
+   v4l2_info(>v4l2_dev, "%s() done\n", __func__);
return 0;
 
 err_unreg:
@@ -550,7 +550,7 @@ static int comp_disconnect_channel(struct most_interface 
*iface,
return -ENOENT;
}
 
-   v4l2_info(>v4l2_dev,