diff mbox series

HID: hidraw: replace printk() with corresponding pr_xx() variant

Message ID 1566492232-13590-1-git-send-email-gupt21@gmail.com (mailing list archive)
State Superseded
Delegated to: Jiri Kosina
Headers show
Series HID: hidraw: replace printk() with corresponding pr_xx() variant | expand

Commit Message

Rishi Gupta Aug. 22, 2019, 4:43 p.m. UTC
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(-)

Comments

Dmitry Torokhov Sept. 12, 2019, 8:31 p.m. UTC | #1
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.
diff mbox series

Patch

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;