[PATCH 05/11] Staging: comedi: fix printk warning issue in ni_at_a2150.c

Ravishankar karkala Mallikarjunayya ravishankar.km at greenturtles.in
Wed Jan 4 12:40:00 UTC 2012


This patch fixes a printk warning found by the checkpatch.pl tool.
Convert printk messages to dev_<levels> and removes useless printk
messages.

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankar.km at greenturtles.in>
---
 drivers/staging/comedi/drivers/ni_at_a2150.c |   51 ++++++--------------------
 1 files changed, 12 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c
index c25e44c..f1a15ed 100644
--- a/drivers/staging/comedi/drivers/ni_at_a2150.c
+++ b/drivers/staging/comedi/drivers/ni_at_a2150.c
@@ -215,9 +215,10 @@ module_exit(driver_a2150_cleanup_module);
 
 static void ni_dump_regs(struct comedi_device *dev)
 {
-	printk("config bits 0x%x\n", devpriv->config_bits);
-	printk("irq dma bits 0x%x\n", devpriv->irq_dma_bits);
-	printk("status bits 0x%x\n", inw(dev->iobase + STATUS_REG));
+	dev_dbg(dev->hw_dev, "config bits 0x%x\n", devpriv->config_bits);
+	dev_dbg(dev->hw_dev, "irq dma bits 0x%x\n", devpriv->irq_dma_bits);
+	dev_dbg(dev->hw_dev, "status bits 0x%x\n",
+		inw(dev->iobase + STATUS_REG));
 }
 
 #endif
@@ -347,61 +348,35 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	static const int timeout = 2000;
 	int i;
 
-	printk("comedi%d: %s: io 0x%lx", dev->minor, driver_a2150.driver_name,
-	       iobase);
-	if (irq) {
-		printk(", irq %u", irq);
-	} else {
-		printk(", no irq");
-	}
-	if (dma) {
-		printk(", dma %u", dma);
-	} else {
-		printk(", no dma");
-	}
-	printk("\n");
-
 	/* allocate and initialize dev->private */
 	if (alloc_private(dev, sizeof(struct a2150_private)) < 0)
 		return -ENOMEM;
 
-	if (iobase == 0) {
-		printk(" io base address required\n");
+	if (iobase == 0)
 		return -EINVAL;
-	}
 
 	/* check if io addresses are available */
-	if (!request_region(iobase, A2150_SIZE, driver_a2150.driver_name)) {
-		printk(" I/O port conflict\n");
+	if (!request_region(iobase, A2150_SIZE, driver_a2150.driver_name))
 		return -EIO;
-	}
 	dev->iobase = iobase;
 
 	/* grab our IRQ */
 	if (irq) {
-		/*  check that irq is supported */
-		if (irq < 3 || irq == 8 || irq == 13 || irq > 15) {
-			printk(" invalid irq line %u\n", irq);
+		/* check that irq is supported */
+		if (irq < 3 || irq == 8 || irq == 13 || irq > 15)
 			return -EINVAL;
-		}
 		if (request_irq(irq, a2150_interrupt, 0,
-				driver_a2150.driver_name, dev)) {
-			printk("unable to allocate irq %u\n", irq);
+				driver_a2150.driver_name, dev))
 			return -EINVAL;
-		}
 		devpriv->irq_dma_bits |= IRQ_LVL_BITS(irq);
 		dev->irq = irq;
 	}
 	/*  initialize dma */
 	if (dma) {
-		if (dma == 4 || dma > 7) {
-			printk(" invalid dma channel %u\n", dma);
+		if (dma == 4 || dma > 7)
 			return -EINVAL;
-		}
-		if (request_dma(dma, driver_a2150.driver_name)) {
-			printk(" failed to allocate dma channel %u\n", dma);
+		if (request_dma(dma, driver_a2150.driver_name))
 			return -EINVAL;
-		}
 		devpriv->dma = dma;
 		devpriv->dma_buffer =
 		    kmalloc(A2150_DMA_BUFFER_SIZE, GFP_KERNEL | GFP_DMA);
@@ -466,8 +441,6 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
 static int a2150_detach(struct comedi_device *dev)
 {
-	printk("comedi%d: %s: remove\n", dev->minor, driver_a2150.driver_name);
-
 	/* only free stuff if it has been allocated by _attach */
 	if (dev->iobase) {
 		/*  put board in power-down mode */
@@ -801,7 +774,7 @@ static int a2150_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
 #endif
 		data[n] = inw(dev->iobase + FIFO_DATA_REG);
 #ifdef A2150_DEBUG
-		printk(" data is %i\n", data[n]);
+		dev_dbg(dev->hw_dev "data is %i\n", data[n]);
 #endif
 		data[n] ^= 0x8000;
 	}
-- 
1.7.0.4




More information about the devel mailing list