[OPW,kernel] Staging: rts5139: Replacing printk with pr_warn
diff mbox

Message ID 20131018042130.GA5254@Ashvini
State Changes Requested
Headers show

Commit Message

Ashvini Varatharaj Oct. 18, 2013, 4:21 a.m. UTC
Fix checkpatch warning: WARNING: Prefer netdev_warn(netdev, ... then
dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...

Signed-off-by: Ashvini Varatharaj <ashvinivaratharaj@gmail.com>
---
 drivers/staging/rts5139/debug.h        |    3 ---
 drivers/staging/rts5139/rts51x.c       |   16 ++++++----------
 2 files changed, 7 insertions(+), 13 deletions(-)

Comments

Josh Triplett Oct. 18, 2013, 4:34 a.m. UTC | #1
On Fri, Oct 18, 2013 at 09:51:30AM +0530, Ashvini Varatharaj wrote:
> Fix checkpatch warning: WARNING: Prefer netdev_warn(netdev, ... then
> dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...
> 
> Signed-off-by: Ashvini Varatharaj <ashvinivaratharaj@gmail.com>

Two issues below.

>  drivers/staging/rts5139/debug.h        |    3 ---
>  drivers/staging/rts5139/rts51x.c       |   16 ++++++----------
>  2 files changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/staging/rts5139/debug.h b/drivers/staging/rts5139/debug.h
> index 73dec13..b529698 100644
> --- a/drivers/staging/rts5139/debug.h
> +++ b/drivers/staging/rts5139/debug.h
> @@ -32,9 +32,6 @@
>  #define RTS51X_TIP "rts51x: "
>  
>  #ifdef CONFIG_RTS5139_DEBUG
> -#define RTS51X_DEBUGP(x...) printk(KERN_DEBUG RTS51X_TIP x)
> -#define RTS51X_DEBUGPN(x...) printk(KERN_DEBUG x)
> -#define RTS51X_DEBUGPX(x...) printk(x)
>  #define RTS51X_DEBUG(x) x
>  #else
>  #define RTS51X_DEBUGP(x...)

It does make sense to delete these macros.  However, you should delete
*both* versions (these and the empty definitions when
!CONFIG_RTS5139_DEBUG), and you should do so in a separate commit.

> diff --git a/drivers/staging/rts5139/rts51x.c b/drivers/staging/rts5139/rts51x.c
> index 0421346..a859133 100644
> --- a/drivers/staging/rts5139/rts51x.c
> +++ b/drivers/staging/rts5139/rts51x.c
> @@ -369,7 +369,7 @@ static int rts51x_polling_thread(void *__chip)
>  
>  		/* if the device has disconnected, we are free to exit */
>  		/* if (kthread_should_stop()) {
> -			printk(KERN_INFO "Stop polling thread!\n");
> +			pr_warn("Stop polling thread!\n");

That's not the right replacement; this should be pr_info.
Ashvini Varatharaj Oct. 18, 2013, 5:48 a.m. UTC | #2
Okay will do the corrections and send it .
Thankyou.


*Ashvini Varatharaj *



On Fri, Oct 18, 2013 at 10:04 AM, Josh Triplett <josh@joshtriplett.org>wrote:

> On Fri, Oct 18, 2013 at 09:51:30AM +0530, Ashvini Varatharaj wrote:
> > Fix checkpatch warning: WARNING: Prefer netdev_warn(netdev, ... then
> > dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...
> >
> > Signed-off-by: Ashvini Varatharaj <ashvinivaratharaj@gmail.com>
>
> Two issues below.
>
> >  drivers/staging/rts5139/debug.h        |    3 ---
> >  drivers/staging/rts5139/rts51x.c       |   16 ++++++----------
> >  2 files changed, 7 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/staging/rts5139/debug.h
> b/drivers/staging/rts5139/debug.h
> > index 73dec13..b529698 100644
> > --- a/drivers/staging/rts5139/debug.h
> > +++ b/drivers/staging/rts5139/debug.h
> > @@ -32,9 +32,6 @@
> >  #define RTS51X_TIP "rts51x: "
> >
> >  #ifdef CONFIG_RTS5139_DEBUG
> > -#define RTS51X_DEBUGP(x...) printk(KERN_DEBUG RTS51X_TIP x)
> > -#define RTS51X_DEBUGPN(x...) printk(KERN_DEBUG x)
> > -#define RTS51X_DEBUGPX(x...) printk(x)
> >  #define RTS51X_DEBUG(x) x
> >  #else
> >  #define RTS51X_DEBUGP(x...)
>
> It does make sense to delete these macros.  However, you should delete
> *both* versions (these and the empty definitions when
> !CONFIG_RTS5139_DEBUG), and you should do so in a separate commit.
>
> > diff --git a/drivers/staging/rts5139/rts51x.c
> b/drivers/staging/rts5139/rts51x.c
> > index 0421346..a859133 100644
> > --- a/drivers/staging/rts5139/rts51x.c
> > +++ b/drivers/staging/rts5139/rts51x.c
> > @@ -369,7 +369,7 @@ static int rts51x_polling_thread(void *__chip)
> >
> >               /* if the device has disconnected, we are free to exit */
> >               /* if (kthread_should_stop()) {
> > -                     printk(KERN_INFO "Stop polling thread!\n");
> > +                     pr_warn("Stop polling thread!\n");
>
> That's not the right replacement; this should be pr_info.
>

Patch
diff mbox

diff --git a/drivers/staging/rts5139/debug.h b/drivers/staging/rts5139/debug.h
index 73dec13..b529698 100644
--- a/drivers/staging/rts5139/debug.h
+++ b/drivers/staging/rts5139/debug.h
@@ -32,9 +32,6 @@ 
 #define RTS51X_TIP "rts51x: "
 
 #ifdef CONFIG_RTS5139_DEBUG
-#define RTS51X_DEBUGP(x...) printk(KERN_DEBUG RTS51X_TIP x)
-#define RTS51X_DEBUGPN(x...) printk(KERN_DEBUG x)
-#define RTS51X_DEBUGPX(x...) printk(x)
 #define RTS51X_DEBUG(x) x
 #else
 #define RTS51X_DEBUGP(x...)
diff --git a/drivers/staging/rts5139/rts51x.c b/drivers/staging/rts5139/rts51x.c
index 0421346..a859133 100644
--- a/drivers/staging/rts5139/rts51x.c
+++ b/drivers/staging/rts5139/rts51x.c
@@ -369,7 +369,7 @@  static int rts51x_polling_thread(void *__chip)
 
 		/* if the device has disconnected, we are free to exit */
 		/* if (kthread_should_stop()) {
-			printk(KERN_INFO "Stop polling thread!\n");
+			pr_warn("Stop polling thread!\n");
 			break;
 		} */
 
@@ -726,8 +726,7 @@  static int rts51x_probe(struct usb_interface *intf,
 
 	rts51x = kzalloc(sizeof(struct rts51x_usb), GFP_KERNEL);
 	if (!rts51x) {
-		printk(KERN_WARNING RTS51X_TIP
-		       "Unable to allocate rts51x_usb\n");
+		pr_warn("Unable to allocate rts51x_usb\n");
 		return -ENOMEM;
 	}
 
@@ -737,8 +736,7 @@  static int rts51x_probe(struct usb_interface *intf,
 	 */
 	host = scsi_host_alloc(&rts51x_host_template, sizeof(*chip));
 	if (!host) {
-		printk(KERN_WARNING RTS51X_TIP
-		       "Unable to allocate the scsi host\n");
+		pr_warn("Unable to allocate the scsi host\n");
 		kfree(rts51x);
 		return -ENOMEM;
 	}
@@ -779,8 +777,7 @@  static int rts51x_probe(struct usb_interface *intf,
 	/* Start up our control thread */
 	th = kthread_run(rts51x_control_thread, chip, RTS51X_CTL_THREAD);
 	if (IS_ERR(th)) {
-		printk(KERN_WARNING RTS51X_TIP
-		       "Unable to start control thread\n");
+		pr_warn("Unable to start control thread\n");
 		result = PTR_ERR(th);
 		goto BadDevice;
 	}
@@ -788,7 +785,7 @@  static int rts51x_probe(struct usb_interface *intf,
 
 	result = scsi_add_host(rts51x_to_host(chip), &rts51x->pusb_intf->dev);
 	if (result) {
-		printk(KERN_WARNING RTS51X_TIP "Unable to add the scsi host\n");
+		pr_warn("Unable to add the scsi host\n");
 		goto BadDevice;
 	}
 	scsi_scan_host(rts51x_to_host(chip));
@@ -796,8 +793,7 @@  static int rts51x_probe(struct usb_interface *intf,
 	/* Start up our polling thread */
 	th = kthread_run(rts51x_polling_thread, chip, RTS51X_POLLING_THREAD);
 	if (IS_ERR(th)) {
-		printk(KERN_WARNING RTS51X_TIP
-		       "Unable to start polling thread\n");
+		pr_warn("Unable to start polling thread\n");
 		result = PTR_ERR(th);
 		goto BadDevice;
 	}