All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1 v2] Staging: comedi: fix printk issue in das6402.c
       [not found] <[PATCH]Staging: comedi: fix  printk() issue in das6402.c>
@ 2011-07-21 10:25 ` Ravishankr
  2011-07-21 23:15   ` Ryan Mallon
  0 siblings, 1 reply; 2+ messages in thread
From: Ravishankr @ 2011-07-21 10:25 UTC (permalink / raw)
  To: gregkh, wfp5p; +Cc: devel, linux-kernel, Ravishankar, Ravishankar

From: Ravishankar <ravi.shankar@greenturtles.in>

This is a patch to the das6402.c file that fixes up a printk() warning found by the checkpatch.pl tool

Signed-off-by: Ravishankar <ravishankarkm32@gmail.com>
---

Added define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Converted printks to pr_<level>

 drivers/staging/comedi/drivers/das6402.c |   35 ++++++++++++------------------
 1 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das6402.c b/drivers/staging/comedi/drivers/das6402.c
index 6328f52..facf173 100644
--- a/drivers/staging/comedi/drivers/das6402.c
+++ b/drivers/staging/comedi/drivers/das6402.c
@@ -38,6 +38,8 @@ Devices: [Keithley Metrabyte] DAS6402 (das6402)
 This driver has suffered bitrot.
 */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/interrupt.h>
 #include "../comedidev.h"
 
@@ -171,24 +173,20 @@ static irqreturn_t intr_handler(int irq, void *d)
 	struct comedi_subdevice *s = dev->subdevices;
 
 	if (!dev->attached || devpriv->das6402_ignoreirq) {
-		printk("das6402: BUG: spurious interrupt\n");
+		dev_warn(dev->hw_dev, "BUG: spurious interrupt\n");
 		return IRQ_HANDLED;
 	}
-#ifdef DEBUG
-	printk("das6402: interrupt! das6402_irqcount=%i\n",
-	       devpriv->das6402_irqcount);
-	printk("das6402: iobase+2=%i\n", inw_p(dev->iobase + 2));
-#endif
+	pr_debug("interrupt! das6402_irqcount=%i\n",
+			devpriv->das6402_irqcount);
+	pr_debug("iobase+2=%i\n", inw_p(dev->iobase + 2));
 
 	das6402_ai_fifo_dregs(dev, s);
 
 	if (s->async->buf_write_count >= devpriv->ai_bytes_to_read) {
 		outw_p(SCANL, dev->iobase + 2);	/* clears the fifo */
 		outb(0x07, dev->iobase + 8);	/* clears all flip-flops */
-#ifdef DEBUG
-		printk("das6402: Got %i samples\n\n",
-		       devpriv->das6402_wordsread - diff);
-#endif
+		pr_debug("Got %i samples\n\n",
+				devpriv->das6402_wordsread - diff);
 		s->async->events |= COMEDI_CB_EOA;
 		comedi_event(dev, s);
 	}
@@ -228,9 +226,7 @@ static int das6402_ai_cancel(struct comedi_device *dev,
 	 */
 
 	devpriv->das6402_ignoreirq = 1;
-#ifdef DEBUG
-	printk("das6402: Stopping acquisition\n");
-#endif
+	pr_debug("Stopping acquisition\n");
 	devpriv->das6402_ignoreirq = 1;
 	outb_p(0x02, dev->iobase + 10);	/* disable external trigging */
 	outw_p(SCANL, dev->iobase + 2);	/* resets the card fifo */
@@ -246,10 +242,7 @@ static int das6402_ai_mode2(struct comedi_device *dev,
 			    struct comedi_subdevice *s, comedi_trig * it)
 {
 	devpriv->das6402_ignoreirq = 1;
-
-#ifdef DEBUG
-	printk("das6402: Starting acquisition\n");
-#endif
+	pr_debug("Starting acquisition\n");
 	outb_p(0x03, dev->iobase + 10);	/* enable external trigging */
 	outw_p(SCANL, dev->iobase + 2);	/* resets the card fifo */
 	outb_p(IRQ | CONVSRC | BURSTEN | INTE, dev->iobase + 9);
@@ -329,10 +322,10 @@ static int das6402_attach(struct comedi_device *dev,
 	if (iobase == 0)
 		iobase = 0x300;
 
-	printk("comedi%d: das6402: 0x%04lx", dev->minor, iobase);
+	printk(KERN_INFO "comedi%d: das6402: 0x%04lx", dev->minor, iobase);
 
 	if (!request_region(iobase, DAS6402_SIZE, "das6402")) {
-		printk(" I/O port conflict\n");
+		printk(KERN_CONT " I/O port conflict\n");
 		return -EIO;
 	}
 	dev->iobase = iobase;
@@ -340,10 +333,10 @@ static int das6402_attach(struct comedi_device *dev,
 	/* should do a probe here */
 
 	irq = it->options[0];
-	printk(" ( irq = %u )", irq);
+	printk(KERN_CONT " ( irq = %u )", irq);
 	ret = request_irq(irq, intr_handler, 0, "das6402", dev);
 	if (ret < 0) {
-		printk("irq conflict\n");
+		printk(KERN_CONT "irq conflict\n");
 		return ret;
 	}
 	dev->irq = irq;
-- 
1.6.5.2


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

* Re: [PATCH 1/1 v2] Staging: comedi: fix printk issue in das6402.c
  2011-07-21 10:25 ` [PATCH 1/1 v2] Staging: comedi: fix printk issue in das6402.c Ravishankr
@ 2011-07-21 23:15   ` Ryan Mallon
  0 siblings, 0 replies; 2+ messages in thread
From: Ryan Mallon @ 2011-07-21 23:15 UTC (permalink / raw)
  To: Ravishankr; +Cc: gregkh, wfp5p, devel, linux-kernel, Ravishankar

On 21/07/11 20:25, Ravishankr wrote:
> From: Ravishankar<ravi.shankar@greenturtles.in>
>
> This is a patch to the das6402.c file that fixes up a printk() warning found by the checkpatch.pl tool
>
> Signed-off-by: Ravishankar<ravishankarkm32@gmail.com>

Hi Ravishankar,

Looks much better. Couple more comments below.

~Ryan

> ---
>
> Added define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> Converted printks to pr_<level>
>
>   drivers/staging/comedi/drivers/das6402.c |   35 ++++++++++++------------------
>   1 files changed, 14 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/das6402.c b/drivers/staging/comedi/drivers/das6402.c
> index 6328f52..facf173 100644
> --- a/drivers/staging/comedi/drivers/das6402.c
> +++ b/drivers/staging/comedi/drivers/das6402.c
> @@ -38,6 +38,8 @@ Devices: [Keithley Metrabyte] DAS6402 (das6402)
>   This driver has suffered bitrot.
>   */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>   #include<linux/interrupt.h>
>   #include "../comedidev.h"
>
> @@ -171,24 +173,20 @@ static irqreturn_t intr_handler(int irq, void *d)
>   	struct comedi_subdevice *s = dev->subdevices;
>
>   	if (!dev->attached || devpriv->das6402_ignoreirq) {
> -		printk("das6402: BUG: spurious interrupt\n");
> +		dev_warn(dev->hw_dev, "BUG: spurious interrupt\n");
>   		return IRQ_HANDLED;
>   	}
> -#ifdef DEBUG
> -	printk("das6402: interrupt! das6402_irqcount=%i\n",
> -	       devpriv->das6402_irqcount);
> -	printk("das6402: iobase+2=%i\n", inw_p(dev->iobase + 2));
> -#endif
> +	pr_debug("interrupt! das6402_irqcount=%i\n",
> +			devpriv->das6402_irqcount);
> +	pr_debug("iobase+2=%i\n", inw_p(dev->iobase + 2));
>
You can use dev_dbg for these two. Also changes other printk calls 
appropriately to use dev_ versions.

>   	das6402_ai_fifo_dregs(dev, s);
>
>   	if (s->async->buf_write_count>= devpriv->ai_bytes_to_read) {
>   		outw_p(SCANL, dev->iobase + 2);	/* clears the fifo */
>   		outb(0x07, dev->iobase + 8);	/* clears all flip-flops */
> -#ifdef DEBUG
> -		printk("das6402: Got %i samples\n\n",
> -		       devpriv->das6402_wordsread - diff);
> -#endif
> +		pr_debug("Got %i samples\n\n",
> +				devpriv->das6402_wordsread - diff);
>   		s->async->events |= COMEDI_CB_EOA;
>   		comedi_event(dev, s);
>   	}
> @@ -228,9 +226,7 @@ static int das6402_ai_cancel(struct comedi_device *dev,
>   	 */
>
>   	devpriv->das6402_ignoreirq = 1;
> -#ifdef DEBUG
> -	printk("das6402: Stopping acquisition\n");
> -#endif
> +	pr_debug("Stopping acquisition\n");
>   	devpriv->das6402_ignoreirq = 1;
>   	outb_p(0x02, dev->iobase + 10);	/* disable external trigging */
>   	outw_p(SCANL, dev->iobase + 2);	/* resets the card fifo */
> @@ -246,10 +242,7 @@ static int das6402_ai_mode2(struct comedi_device *dev,
>   			    struct comedi_subdevice *s, comedi_trig * it)
>   {
>   	devpriv->das6402_ignoreirq = 1;
> -
> -#ifdef DEBUG
> -	printk("das6402: Starting acquisition\n");
> -#endif
> +	pr_debug("Starting acquisition\n");
>   	outb_p(0x03, dev->iobase + 10);	/* enable external trigging */
>   	outw_p(SCANL, dev->iobase + 2);	/* resets the card fifo */
>   	outb_p(IRQ | CONVSRC | BURSTEN | INTE, dev->iobase + 9);
> @@ -329,10 +322,10 @@ static int das6402_attach(struct comedi_device *dev,
>   	if (iobase == 0)
>   		iobase = 0x300;
>
> -	printk("comedi%d: das6402: 0x%04lx", dev->minor, iobase);
> +	printk(KERN_INFO "comedi%d: das6402: 0x%04lx", dev->minor, iobase);

Use either pr_info/pr_cont here for consistency with other calls. You 
can probably use the dev_ versions here too.

>
>   	if (!request_region(iobase, DAS6402_SIZE, "das6402")) {
> -		printk(" I/O port conflict\n");
> +		printk(KERN_CONT " I/O port conflict\n");
>   		return -EIO;
>   	}
>   	dev->iobase = iobase;
> @@ -340,10 +333,10 @@ static int das6402_attach(struct comedi_device *dev,
>   	/* should do a probe here */
>
>   	irq = it->options[0];
> -	printk(" ( irq = %u )", irq);
> +	printk(KERN_CONT " ( irq = %u )", irq);
>   	ret = request_irq(irq, intr_handler, 0, "das6402", dev);
>   	if (ret<  0) {
> -		printk("irq conflict\n");
> +		printk(KERN_CONT "irq conflict\n");
>   		return ret;
>   	}
>   	dev->irq = irq;


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

end of thread, other threads:[~2011-07-21 23:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <[PATCH]Staging: comedi: fix  printk() issue in das6402.c>
2011-07-21 10:25 ` [PATCH 1/1 v2] Staging: comedi: fix printk issue in das6402.c Ravishankr
2011-07-21 23:15   ` Ryan Mallon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.