linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: hidraw: replace printk() with corresponding pr_xx() variant
@ 2019-08-22 16:43 Rishi Gupta
  2019-09-12 20:31 ` Dmitry Torokhov
  0 siblings, 1 reply; 6+ messages in thread
From: Rishi Gupta @ 2019-08-22 16:43 UTC (permalink / raw)
  To: jikos
  Cc: benjamin.tissoires, dmitry.torokhov, linux-input, linux-kernel,
	Rishi Gupta

This commit replaces direct invocations of printk with
their appropriate pr_info/warn() variant.

Signed-off-by: Rishi Gupta <gupt21@gmail.com>
---
 drivers/hid/hidraw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 006bd6f..67b652b 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -197,14 +197,14 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t
 	}
 
 	if (count > HID_MAX_BUFFER_SIZE) {
-		printk(KERN_WARNING "hidraw: pid %d passed too large report\n",
+		pr_warn("hidraw: pid %d passed too large report\n",
 				task_pid_nr(current));
 		ret = -EINVAL;
 		goto out;
 	}
 
 	if (count < 2) {
-		printk(KERN_WARNING "hidraw: pid %d passed too short report\n",
+		pr_warn("hidraw: pid %d passed too short report\n",
 				task_pid_nr(current));
 		ret = -EINVAL;
 		goto out;
@@ -597,7 +597,7 @@ int __init hidraw_init(void)
 	if (result < 0)
 		goto error_class;
 
-	printk(KERN_INFO "hidraw: raw HID events driver (C) Jiri Kosina\n");
+	pr_info("hidraw: raw HID events driver (C) Jiri Kosina\n");
 out:
 	return result;
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] HID: hidraw: replace printk() with corresponding pr_xx() variant
  2019-08-22 16:43 [PATCH] HID: hidraw: replace printk() with corresponding pr_xx() variant Rishi Gupta
@ 2019-09-12 20:31 ` Dmitry Torokhov
  2019-09-18 16:29   ` [PATCH v2] " Rishi Gupta
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2019-09-12 20:31 UTC (permalink / raw)
  To: Rishi Gupta; +Cc: jikos, benjamin.tissoires, linux-input, linux-kernel

Hi Rishi,

On Thu, Aug 22, 2019 at 10:13:52PM +0530, Rishi Gupta wrote:
> This commit replaces direct invocations of printk with
> their appropriate pr_info/warn() variant.
> 
> Signed-off-by: Rishi Gupta <gupt21@gmail.com>
> ---
>  drivers/hid/hidraw.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
> index 006bd6f..67b652b 100644
> --- a/drivers/hid/hidraw.c
> +++ b/drivers/hid/hidraw.c
> @@ -197,14 +197,14 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t
>  	}
>  
>  	if (count > HID_MAX_BUFFER_SIZE) {
> -		printk(KERN_WARNING "hidraw: pid %d passed too large report\n",
> +		pr_warn("hidraw: pid %d passed too large report\n",
>  				task_pid_nr(current));

If you are doing this, you should also look into pr_fmt() so that we do
not need to manually add "hidraw: " prefix to the messages.

>  		ret = -EINVAL;
>  		goto out;
>  	}
>  
>  	if (count < 2) {
> -		printk(KERN_WARNING "hidraw: pid %d passed too short report\n",
> +		pr_warn("hidraw: pid %d passed too short report\n",
>  				task_pid_nr(current));
>  		ret = -EINVAL;
>  		goto out;
> @@ -597,7 +597,7 @@ int __init hidraw_init(void)
>  	if (result < 0)
>  		goto error_class;
>  
> -	printk(KERN_INFO "hidraw: raw HID events driver (C) Jiri Kosina\n");
> +	pr_info("hidraw: raw HID events driver (C) Jiri Kosina\n");
>  out:
>  	return result;
>  
> -- 
> 2.7.4
> 

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] HID: hidraw: replace printk() with corresponding pr_xx() variant
  2019-09-12 20:31 ` Dmitry Torokhov
@ 2019-09-18 16:29   ` Rishi Gupta
  2019-09-19 16:16     ` Dmitry Torokhov
  0 siblings, 1 reply; 6+ messages in thread
From: Rishi Gupta @ 2019-09-18 16:29 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: jikos, benjamin.tissoires, linux-input, linux-kernel, Rishi Gupta

This commit replaces direct invocations of printk with
their appropriate pr_info/warn() variant.

Signed-off-by: Rishi Gupta <gupt21@gmail.com>
---
Changes in v2:
- Removed manually adding prefix "hidraw:".

 drivers/hid/hidraw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 006bd6f..2d082f3 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -197,14 +197,14 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t
 	}
 
 	if (count > HID_MAX_BUFFER_SIZE) {
-		printk(KERN_WARNING "hidraw: pid %d passed too large report\n",
+		pr_warn("pid %d passed too large report\n",
 				task_pid_nr(current));
 		ret = -EINVAL;
 		goto out;
 	}
 
 	if (count < 2) {
-		printk(KERN_WARNING "hidraw: pid %d passed too short report\n",
+		pr_warn("pid %d passed too short report\n",
 				task_pid_nr(current));
 		ret = -EINVAL;
 		goto out;
@@ -597,7 +597,7 @@ int __init hidraw_init(void)
 	if (result < 0)
 		goto error_class;
 
-	printk(KERN_INFO "hidraw: raw HID events driver (C) Jiri Kosina\n");
+	pr_info("raw HID events driver (C) Jiri Kosina\n");
 out:
 	return result;
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] HID: hidraw: replace printk() with corresponding pr_xx() variant
  2019-09-18 16:29   ` [PATCH v2] " Rishi Gupta
@ 2019-09-19 16:16     ` Dmitry Torokhov
  2019-09-20  2:35       ` [PATCH v3] " Rishi Gupta
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2019-09-19 16:16 UTC (permalink / raw)
  To: Rishi Gupta; +Cc: jikos, benjamin.tissoires, linux-input, linux-kernel

Hi Rishi,

On Wed, Sep 18, 2019 at 09:59:11PM +0530, Rishi Gupta wrote:
> This commit replaces direct invocations of printk with
> their appropriate pr_info/warn() variant.
> 
> Signed-off-by: Rishi Gupta <gupt21@gmail.com>
> ---
> Changes in v2:
> - Removed manually adding prefix "hidraw:".
> 
>  drivers/hid/hidraw.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
> index 006bd6f..2d082f3 100644
> --- a/drivers/hid/hidraw.c
> +++ b/drivers/hid/hidraw.c
> @@ -197,14 +197,14 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t
>  	}
>  
>  	if (count > HID_MAX_BUFFER_SIZE) {
> -		printk(KERN_WARNING "hidraw: pid %d passed too large report\n",
> +		pr_warn("pid %d passed too large report\n",
>  				task_pid_nr(current));

It looks like here and in the instance below you actually have a hid
device, so you can use hid_warn() instead of pr_warn(), similarly to
hidraw_send_report().

The change to pr_info() in hidraw_init() is good.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3] HID: hidraw: replace printk() with corresponding pr_xx() variant
  2019-09-19 16:16     ` Dmitry Torokhov
@ 2019-09-20  2:35       ` Rishi Gupta
  2019-10-01 14:23         ` Jiri Kosina
  0 siblings, 1 reply; 6+ messages in thread
From: Rishi Gupta @ 2019-09-20  2:35 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: jikos, benjamin.tissoires, linux-input, linux-kernel, Rishi Gupta

This commit replaces direct invocations of printk with
their appropriate pr_info/warn() variant.

Signed-off-by: Rishi Gupta <gupt21@gmail.com>
---
Changes in v3:
* Use hid_warn() subsystem specific variant instead of pr_warn()

 drivers/hid/hidraw.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 006bd6f..a42f4b5 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -197,15 +197,15 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t
 	}
 
 	if (count > HID_MAX_BUFFER_SIZE) {
-		printk(KERN_WARNING "hidraw: pid %d passed too large report\n",
-				task_pid_nr(current));
+		hid_warn(dev, "pid %d passed too large report\n",
+			task_pid_nr(current));
 		ret = -EINVAL;
 		goto out;
 	}
 
 	if (count < 2) {
-		printk(KERN_WARNING "hidraw: pid %d passed too short report\n",
-				task_pid_nr(current));
+		hid_warn(dev, "pid %d passed too short report\n",
+			task_pid_nr(current));
 		ret = -EINVAL;
 		goto out;
 	}
@@ -597,7 +597,7 @@ int __init hidraw_init(void)
 	if (result < 0)
 		goto error_class;
 
-	printk(KERN_INFO "hidraw: raw HID events driver (C) Jiri Kosina\n");
+	pr_info("raw HID events driver (C) Jiri Kosina\n");
 out:
 	return result;
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] HID: hidraw: replace printk() with corresponding pr_xx() variant
  2019-09-20  2:35       ` [PATCH v3] " Rishi Gupta
@ 2019-10-01 14:23         ` Jiri Kosina
  0 siblings, 0 replies; 6+ messages in thread
From: Jiri Kosina @ 2019-10-01 14:23 UTC (permalink / raw)
  To: Rishi Gupta
  Cc: dmitry.torokhov, benjamin.tissoires, linux-input, linux-kernel

On Fri, 20 Sep 2019, Rishi Gupta wrote:

> This commit replaces direct invocations of printk with
> their appropriate pr_info/warn() variant.
> 
> Signed-off-by: Rishi Gupta <gupt21@gmail.com>
> ---
> Changes in v3:
> * Use hid_warn() subsystem specific variant instead of pr_warn()

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-10-01 14:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-22 16:43 [PATCH] HID: hidraw: replace printk() with corresponding pr_xx() variant Rishi Gupta
2019-09-12 20:31 ` Dmitry Torokhov
2019-09-18 16:29   ` [PATCH v2] " Rishi Gupta
2019-09-19 16:16     ` Dmitry Torokhov
2019-09-20  2:35       ` [PATCH v3] " Rishi Gupta
2019-10-01 14:23         ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).