linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Staging: comedi: drivers: replaced printk with dev_dbg
@ 2012-11-10  7:08 Arpith Easow Alexander
  2012-11-13 19:52 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Arpith Easow Alexander @ 2012-11-10  7:08 UTC (permalink / raw)
  To: abbotti, fmhess, gregkh, hsweeten, dan.carpenter, arpith99
  Cc: devel, linux-kernel

This is a patch to the vmk80xx.c file that replaces the printk with dev_dbg.
This fixes the warnings found by the checkpatch.pl tool.

Signed-off-by: Arpith Easow Alexander <arpith99@gmail.com>
---
 drivers/staging/comedi/drivers/vmk80xx.c |   30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c
index df277aa..6eb5361 100644
--- a/drivers/staging/comedi/drivers/vmk80xx.c
+++ b/drivers/staging/comedi/drivers/vmk80xx.c
@@ -131,10 +131,10 @@ static int dbgcm = 1;
 static int dbgcm;
 #endif
 
-#define dbgcm(fmt, arg...)                     \
+#define dbgcm(dev, fmt, arg...)                     \
 do {                                           \
 	if (dbgcm)                             \
-		printk(KERN_DEBUG fmt, ##arg); \
+		dev_dbg(dev, fmt, ##arg); \
 } while (0)
 
 enum vmk80xx_model {
@@ -213,8 +213,9 @@ static void vmk80xx_tx_callback(struct urb *urb)
 
 	if (stat && !(stat == -ENOENT
 		      || stat == -ECONNRESET || stat == -ESHUTDOWN))
-		dbgcm("comedi#: vmk80xx: %s - nonzero urb status (%d)\n",
-		      __func__, stat);
+		dbgcm(&(dev->udev->dev),
+			"comedi#: vmk80xx: %s - nonzero urb status (%d)\n",
+			__func__, stat);
 
 	if (!test_bit(TRANS_OUT_BUSY, &dev->flags))
 		return;
@@ -237,7 +238,8 @@ static void vmk80xx_rx_callback(struct urb *urb)
 	case -ESHUTDOWN:
 		break;
 	default:
-		dbgcm("comedi#: vmk80xx: %s - nonzero urb status (%d)\n",
+		dbgcm(&(dev->udev->dev),
+		      "comedi#: vmk80xx: %s - nonzero urb status (%d)\n",
 		      __func__, stat);
 		goto resubmit;
 	}
@@ -1371,14 +1373,16 @@ static int vmk80xx_usb_probe(struct usb_interface *intf,
 
 	if (dev->board.model == VMK8061_MODEL) {
 		vmk80xx_read_eeprom(dev, IC3_VERSION);
-		printk(KERN_INFO "comedi#: vmk80xx: %s\n", dev->fw.ic3_vers);
+		dev_dbg(&(dev->udev->dev),
+			"comedi#: vmk80xx: %s\n", dev->fw.ic3_vers);
 
 		if (vmk80xx_check_data_link(dev)) {
 			vmk80xx_read_eeprom(dev, IC6_VERSION);
-			printk(KERN_INFO "comedi#: vmk80xx: %s\n",
+			dev_dbg(&(dev->udev->dev), "comedi#: vmk80xx: %s\n",
 			       dev->fw.ic6_vers);
 		} else {
-			dbgcm("comedi#: vmk80xx: no conn. to CPU\n");
+			dbgcm(&(dev->udev->dev),
+				"comedi#: vmk80xx: no conn. to CPU\n");
 		}
 	}
 
@@ -1387,8 +1391,9 @@ static int vmk80xx_usb_probe(struct usb_interface *intf,
 
 	dev->probed = 1;
 
-	printk(KERN_INFO "comedi#: vmk80xx: board #%d [%s] now attached\n",
-	       dev->count, dev->board.name);
+	dev_dbg(&(dev->udev->dev),
+		"comedi#: vmk80xx: board #%d [%s] now attached\n",
+		dev->count, dev->board.name);
 
 	mutex_unlock(&glb_mutex);
 
@@ -1422,8 +1427,9 @@ static void vmk80xx_usb_disconnect(struct usb_interface *intf)
 	kfree(dev->usb_rx_buf);
 	kfree(dev->usb_tx_buf);
 
-	printk(KERN_INFO "comedi#: vmk80xx: board #%d [%s] now detached\n",
-	       dev->count, dev->board.name);
+	dev_dbg(&(dev->udev->dev),
+		"comedi#: vmk80xx: board #%d [%s] now detached\n",
+		dev->count, dev->board.name);
 
 	up(&dev->limit_sem);
 	mutex_unlock(&glb_mutex);
-- 
1.7.9.5


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

* Re: [PATCH] Staging: comedi: drivers: replaced printk with dev_dbg
  2012-11-10  7:08 [PATCH] Staging: comedi: drivers: replaced printk with dev_dbg Arpith Easow Alexander
@ 2012-11-13 19:52 ` Greg KH
  2012-11-15 16:27   ` Arpith Easow Alexander
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2012-11-13 19:52 UTC (permalink / raw)
  To: Arpith Easow Alexander
  Cc: abbotti, fmhess, hsweeten, dan.carpenter, devel, linux-kernel

On Sat, Nov 10, 2012 at 12:38:38PM +0530, Arpith Easow Alexander wrote:
> This is a patch to the vmk80xx.c file that replaces the printk with dev_dbg.
> This fixes the warnings found by the checkpatch.pl tool.
> 
> Signed-off-by: Arpith Easow Alexander <arpith99@gmail.com>
> ---
>  drivers/staging/comedi/drivers/vmk80xx.c |   30 ++++++++++++++++++------------
>  1 file changed, 18 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c
> index df277aa..6eb5361 100644
> --- a/drivers/staging/comedi/drivers/vmk80xx.c
> +++ b/drivers/staging/comedi/drivers/vmk80xx.c
> @@ -131,10 +131,10 @@ static int dbgcm = 1;
>  static int dbgcm;
>  #endif
>  
> -#define dbgcm(fmt, arg...)                     \
> +#define dbgcm(dev, fmt, arg...)                     \
>  do {                                           \
>  	if (dbgcm)                             \
> -		printk(KERN_DEBUG fmt, ##arg); \
> +		dev_dbg(dev, fmt, ##arg); \

So a macro called dbgcm tests a variable called dbgcm?  Gotta love c at
times...

Just delete the macro, and the variable, and call dev_dbg() directly
please.

thanks.

greg k-h

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

* Re: [PATCH] Staging: comedi: drivers: replaced printk with dev_dbg
  2012-11-13 19:52 ` Greg KH
@ 2012-11-15 16:27   ` Arpith Easow Alexander
  2012-11-15 16:34     ` H Hartley Sweeten
  2012-11-15 23:25     ` Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: Arpith Easow Alexander @ 2012-11-15 16:27 UTC (permalink / raw)
  To: Greg KH; +Cc: abbotti, fmhess, hsweeten, dan.carpenter, devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1332 bytes --]

On Tue, Nov 13, 2012 at 11:52:52AM -0800, Greg KH wrote:
> On Sat, Nov 10, 2012 at 12:38:38PM +0530, Arpith Easow Alexander wrote:
> > This is a patch to the vmk80xx.c file that replaces the printk with dev_dbg.
> > This fixes the warnings found by the checkpatch.pl tool.
> > 
> > Signed-off-by: Arpith Easow Alexander <arpith99@gmail.com>
> > ---
> >  drivers/staging/comedi/drivers/vmk80xx.c |   30 ++++++++++++++++++------------
> >  1 file changed, 18 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c
> > index df277aa..6eb5361 100644
> > --- a/drivers/staging/comedi/drivers/vmk80xx.c
> > +++ b/drivers/staging/comedi/drivers/vmk80xx.c
> > @@ -131,10 +131,10 @@ static int dbgcm = 1;
> >  static int dbgcm;
> >  #endif
> >  
> > -#define dbgcm(fmt, arg...)                     \
> > +#define dbgcm(dev, fmt, arg...)                     \
> >  do {                                           \
> >  	if (dbgcm)                             \
> > -		printk(KERN_DEBUG fmt, ##arg); \
> > +		dev_dbg(dev, fmt, ##arg); \
> 
> So a macro called dbgcm tests a variable called dbgcm?  Gotta love c at
> times...
> 
> Just delete the macro, and the variable, and call dev_dbg() directly
> please.

Ok. Done. (Attached both changes).

Thanks,
Arpith

[-- Attachment #2: 0001-Staging-comedi-drivers-replaced-printk-with-dev_dbg.patch --]
[-- Type: text/x-diff, Size: 3346 bytes --]

>From 35a1768b938fc6ba231d1aaa2e2a74f7b5380962 Mon Sep 17 00:00:00 2001
From: Arpith Easow Alexander <arpith99@gmail.com>
Date: Sat, 10 Nov 2012 11:55:26 +0530
Subject: [PATCH 1/2] Staging: comedi: drivers: replaced printk with dev_dbg

This is a patch to the vmk80xx.c file that replaces the printk with dev_dbg.
This fixes the warnings found by the checkpatch.pl tool.

Signed-off-by: Arpith Easow Alexander <arpith99@gmail.com>
---
 drivers/staging/comedi/drivers/vmk80xx.c |   30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c
index df277aa..6eb5361 100644
--- a/drivers/staging/comedi/drivers/vmk80xx.c
+++ b/drivers/staging/comedi/drivers/vmk80xx.c
@@ -131,10 +131,10 @@ static int dbgcm = 1;
 static int dbgcm;
 #endif
 
-#define dbgcm(fmt, arg...)                     \
+#define dbgcm(dev, fmt, arg...)                     \
 do {                                           \
 	if (dbgcm)                             \
-		printk(KERN_DEBUG fmt, ##arg); \
+		dev_dbg(dev, fmt, ##arg); \
 } while (0)
 
 enum vmk80xx_model {
@@ -213,8 +213,9 @@ static void vmk80xx_tx_callback(struct urb *urb)
 
 	if (stat && !(stat == -ENOENT
 		      || stat == -ECONNRESET || stat == -ESHUTDOWN))
-		dbgcm("comedi#: vmk80xx: %s - nonzero urb status (%d)\n",
-		      __func__, stat);
+		dbgcm(&(dev->udev->dev),
+			"comedi#: vmk80xx: %s - nonzero urb status (%d)\n",
+			__func__, stat);
 
 	if (!test_bit(TRANS_OUT_BUSY, &dev->flags))
 		return;
@@ -237,7 +238,8 @@ static void vmk80xx_rx_callback(struct urb *urb)
 	case -ESHUTDOWN:
 		break;
 	default:
-		dbgcm("comedi#: vmk80xx: %s - nonzero urb status (%d)\n",
+		dbgcm(&(dev->udev->dev),
+		      "comedi#: vmk80xx: %s - nonzero urb status (%d)\n",
 		      __func__, stat);
 		goto resubmit;
 	}
@@ -1371,14 +1373,16 @@ static int vmk80xx_usb_probe(struct usb_interface *intf,
 
 	if (dev->board.model == VMK8061_MODEL) {
 		vmk80xx_read_eeprom(dev, IC3_VERSION);
-		printk(KERN_INFO "comedi#: vmk80xx: %s\n", dev->fw.ic3_vers);
+		dev_dbg(&(dev->udev->dev),
+			"comedi#: vmk80xx: %s\n", dev->fw.ic3_vers);
 
 		if (vmk80xx_check_data_link(dev)) {
 			vmk80xx_read_eeprom(dev, IC6_VERSION);
-			printk(KERN_INFO "comedi#: vmk80xx: %s\n",
+			dev_dbg(&(dev->udev->dev), "comedi#: vmk80xx: %s\n",
 			       dev->fw.ic6_vers);
 		} else {
-			dbgcm("comedi#: vmk80xx: no conn. to CPU\n");
+			dbgcm(&(dev->udev->dev),
+				"comedi#: vmk80xx: no conn. to CPU\n");
 		}
 	}
 
@@ -1387,8 +1391,9 @@ static int vmk80xx_usb_probe(struct usb_interface *intf,
 
 	dev->probed = 1;
 
-	printk(KERN_INFO "comedi#: vmk80xx: board #%d [%s] now attached\n",
-	       dev->count, dev->board.name);
+	dev_dbg(&(dev->udev->dev),
+		"comedi#: vmk80xx: board #%d [%s] now attached\n",
+		dev->count, dev->board.name);
 
 	mutex_unlock(&glb_mutex);
 
@@ -1422,8 +1427,9 @@ static void vmk80xx_usb_disconnect(struct usb_interface *intf)
 	kfree(dev->usb_rx_buf);
 	kfree(dev->usb_tx_buf);
 
-	printk(KERN_INFO "comedi#: vmk80xx: board #%d [%s] now detached\n",
-	       dev->count, dev->board.name);
+	dev_dbg(&(dev->udev->dev),
+		"comedi#: vmk80xx: board #%d [%s] now detached\n",
+		dev->count, dev->board.name);
 
 	up(&dev->limit_sem);
 	mutex_unlock(&glb_mutex);
-- 
1.7.9.5


[-- Attachment #3: 0002-Staging-comedi-drivers-Replaced-macro-dbgcm-with-dir.patch --]
[-- Type: text/x-diff, Size: 2084 bytes --]

>From ca6624888fc6b817c353ccdd3c445cedd0c124e0 Mon Sep 17 00:00:00 2001
From: Arpith Easow Alexander <arpith99@gmail.com>
Date: Thu, 15 Nov 2012 21:18:44 +0530
Subject: [PATCH 2/2] Staging: comedi: drivers: Replaced macro dbgcm with
 direct call to dev_dbg.

Removed debug control variable and macro for printk statements.
Now using direct call to dev_dbg.

Signed-off-by: Arpith Easow Alexander <arpith99@gmail.com>
---
 drivers/staging/comedi/drivers/vmk80xx.c |   18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c
index 6eb5361..562f217 100644
--- a/drivers/staging/comedi/drivers/vmk80xx.c
+++ b/drivers/staging/comedi/drivers/vmk80xx.c
@@ -125,18 +125,6 @@ enum {
 #define URB_RCV_FLAG            (1 << 0)
 #define URB_SND_FLAG            (1 << 1)
 
-#ifdef CONFIG_COMEDI_DEBUG
-static int dbgcm = 1;
-#else
-static int dbgcm;
-#endif
-
-#define dbgcm(dev, fmt, arg...)                     \
-do {                                           \
-	if (dbgcm)                             \
-		dev_dbg(dev, fmt, ##arg); \
-} while (0)
-
 enum vmk80xx_model {
 	VMK8055_MODEL,
 	VMK8061_MODEL
@@ -213,7 +201,7 @@ static void vmk80xx_tx_callback(struct urb *urb)
 
 	if (stat && !(stat == -ENOENT
 		      || stat == -ECONNRESET || stat == -ESHUTDOWN))
-		dbgcm(&(dev->udev->dev),
+		dev_dbg(&(dev->udev->dev),
 			"comedi#: vmk80xx: %s - nonzero urb status (%d)\n",
 			__func__, stat);
 
@@ -238,7 +226,7 @@ static void vmk80xx_rx_callback(struct urb *urb)
 	case -ESHUTDOWN:
 		break;
 	default:
-		dbgcm(&(dev->udev->dev),
+		dev_dbg(&(dev->udev->dev),
 		      "comedi#: vmk80xx: %s - nonzero urb status (%d)\n",
 		      __func__, stat);
 		goto resubmit;
@@ -1381,7 +1369,7 @@ static int vmk80xx_usb_probe(struct usb_interface *intf,
 			dev_dbg(&(dev->udev->dev), "comedi#: vmk80xx: %s\n",
 			       dev->fw.ic6_vers);
 		} else {
-			dbgcm(&(dev->udev->dev),
+			dev_dbg(&(dev->udev->dev),
 				"comedi#: vmk80xx: no conn. to CPU\n");
 		}
 	}
-- 
1.7.9.5


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

* RE: [PATCH] Staging: comedi: drivers: replaced printk with dev_dbg
  2012-11-15 16:27   ` Arpith Easow Alexander
@ 2012-11-15 16:34     ` H Hartley Sweeten
  2012-11-15 23:25     ` Greg KH
  1 sibling, 0 replies; 5+ messages in thread
From: H Hartley Sweeten @ 2012-11-15 16:34 UTC (permalink / raw)
  To: Arpith Easow Alexander, Greg KH
  Cc: abbotti@mev.co.uk, fmhess@users.sourceforge.net,
	dan.carpenter@oracle.com, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org

On Thursday, November 15, 2012 9:28 AM, Arpith Easow Alexander wrote:
> On Tue, Nov 13, 2012 at 11:52:52AM -0800, Greg KH wrote:
>> So a macro called dbgcm tests a variable called dbgcm?  Gotta love c at
>> times...
>> 
>> Just delete the macro, and the variable, and call dev_dbg() directly
>> please.
>
> Ok. Done. (Attached both changes).

Arpith,

You have two patches attached to this message. Please repost them patch as 
[PATCH v2 1/2] and [PATCH v2 2/2] and include the patches inline. It makes
them easier to review and apply.

Thanks!
Hartley


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

* Re: [PATCH] Staging: comedi: drivers: replaced printk with dev_dbg
  2012-11-15 16:27   ` Arpith Easow Alexander
  2012-11-15 16:34     ` H Hartley Sweeten
@ 2012-11-15 23:25     ` Greg KH
  1 sibling, 0 replies; 5+ messages in thread
From: Greg KH @ 2012-11-15 23:25 UTC (permalink / raw)
  To: Arpith Easow Alexander
  Cc: abbotti, fmhess, hsweeten, dan.carpenter, devel, linux-kernel

On Thu, Nov 15, 2012 at 09:57:42PM +0530, Arpith Easow Alexander wrote:
> On Tue, Nov 13, 2012 at 11:52:52AM -0800, Greg KH wrote:
> > On Sat, Nov 10, 2012 at 12:38:38PM +0530, Arpith Easow Alexander wrote:
> > > This is a patch to the vmk80xx.c file that replaces the printk with dev_dbg.
> > > This fixes the warnings found by the checkpatch.pl tool.
> > > 
> > > Signed-off-by: Arpith Easow Alexander <arpith99@gmail.com>
> > > ---
> > >  drivers/staging/comedi/drivers/vmk80xx.c |   30 ++++++++++++++++++------------
> > >  1 file changed, 18 insertions(+), 12 deletions(-)
> > > 
> > > diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c
> > > index df277aa..6eb5361 100644
> > > --- a/drivers/staging/comedi/drivers/vmk80xx.c
> > > +++ b/drivers/staging/comedi/drivers/vmk80xx.c
> > > @@ -131,10 +131,10 @@ static int dbgcm = 1;
> > >  static int dbgcm;
> > >  #endif
> > >  
> > > -#define dbgcm(fmt, arg...)                     \
> > > +#define dbgcm(dev, fmt, arg...)                     \
> > >  do {                                           \
> > >  	if (dbgcm)                             \
> > > -		printk(KERN_DEBUG fmt, ##arg); \
> > > +		dev_dbg(dev, fmt, ##arg); \
> > 
> > So a macro called dbgcm tests a variable called dbgcm?  Gotta love c at
> > times...
> > 
> > Just delete the macro, and the variable, and call dev_dbg() directly
> > please.
> 
> Ok. Done. (Attached both changes).

As Hartley pointed out, I can't take patches as attachments, one per
email please.

thanks,

greg k-h

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

end of thread, other threads:[~2012-11-15 23:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-10  7:08 [PATCH] Staging: comedi: drivers: replaced printk with dev_dbg Arpith Easow Alexander
2012-11-13 19:52 ` Greg KH
2012-11-15 16:27   ` Arpith Easow Alexander
2012-11-15 16:34     ` H Hartley Sweeten
2012-11-15 23:25     ` Greg KH

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).