Skip to contentSkip to conversation

staging/comedi: Use pr_ or dev_ printks in drivers/gsc_hdpi.c

PATCH In review YAMANE Toshiaki 3 participants 9 messages Oct 10, 2012 – Oct 26, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging/comedi: Use pr_ or dev_ printks in drivers/gsc_hdpi.c

fixed below checkpatch warning.
- WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...

and added pr_fmt.

---
 drivers/staging/comedi/drivers/gsc_hpdi.c |   31 +++++++++++++++--------------
 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/staging/comedi/drivers/gsc_hpdi.c +16 -15
index abff660..30a27fd 100644
@@ -45,6 +45,8 @@ support could be added to this driver.
 
 */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/interrupt.h>
 #include "../comedidev.h"
 #include <linux/delay.h>
@@ -107,8 +109,7 @@ enum hpdi_registers {
 int command_channel_valid(unsigned int channel)
 {
 	if (channel == 0 || channel > 6) {
-		printk(KERN_WARNING
-		       "gsc_hpdi: bug! invalid cable command channel\n");
+		pr_warn("bug! invalid cable command channel\n");
 		return 0;
 	}
 	return 1;
@@ -553,7 +554,7 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	int i;
 	int retval;
 
-	printk(KERN_WARNING "comedi%d: gsc_hpdi\n", dev->minor);
+	dev_warn(dev->class_dev, "gsc_hpdi\n");
 
 	if (alloc_private(dev, sizeof(struct hpdi_private)) < 0)
 		return -ENOMEM;
@@ -582,17 +583,17 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		} while (pcidev != NULL);
 	}
 	if (dev->board_ptr == NULL) {
-		printk(KERN_WARNING "gsc_hpdi: no hpdi card found\n");
+		dev_warn(dev->class_dev, "no hpdi card found\n");
 		return -EIO;
 	}
 
-	printk(KERN_WARNING
-	       "gsc_hpdi: found %s on bus %i, slot %i\n", board(dev)->name,
-	       pcidev->bus->number, PCI_SLOT(pcidev->devfn));
+	dev_warn(dev->class_dev,
+		 "found %s on bus %i, slot %i\n", board(dev)->name,
+		 pcidev->bus->number, PCI_SLOT(pcidev->devfn));
 
 	if (comedi_pci_enable(pcidev, dev->driver->driver_name)) {
-		printk(KERN_WARNING
-		       " failed enable PCI device and request regions\n");
+		dev_warn(dev->class_dev,
+			 " failed enable PCI device and request regions\n");
 		return -EIO;
 	}
 	pci_set_master(pcidev);
@@ -613,7 +614,7 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	    ioremap(priv(dev)->hpdi_phys_iobase,
 		    pci_resource_len(pcidev, HPDI_BADDRINDEX));
 	if (!priv(dev)->plx9080_iobase || !priv(dev)->hpdi_iobase) {
-		printk(KERN_WARNING " failed to remap io memory\n");
+		dev_warn(dev->class_dev, "failed to remap io memory\n");
 		return -ENOMEM;
 	}
 
@@ -625,13 +626,13 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	/*  get irq */
 	if (request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED,
 			dev->driver->driver_name, dev)) {
-		printk(KERN_WARNING
-		       " unable to allocate irq %u\n", pcidev->irq);
+		dev_warn(dev->class_dev,
+			 "unable to allocate irq %u\n", pcidev->irq);
 		return -EINVAL;
 	}
 	dev->irq = pcidev->irq;
 
-	printk(KERN_WARNING " irq %u\n", dev->irq);
+	dev_warn(dev->class_dev, "irq %u\n", dev->irq);
 
 	/*  allocate pci dma buffers */
 	for (i = 0; i < NUM_DMA_BUFFERS; i++) {
@@ -649,8 +650,8 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 						   &priv(dev)->
 						   dma_desc_phys_addr);
 	if (priv(dev)->dma_desc_phys_addr & 0xf) {
-		printk(KERN_WARNING
-		       " dma descriptors not quad-word aligned (bug)\n");
+		dev_warn(dev->class_dev,
+			 "dma descriptors not quad-word aligned (bug)\n");
 		return -EIO;
 	}
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 34 lines · YAMANE Toshiaki

fixed below checkpatch warning.
- WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...

and added pr_fmt.

---
 drivers/staging/comedi/drivers/gsc_hpdi.c |   31 +++++++++++++++--------------
 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/staging/comedi/drivers/gsc_hpdi.c +3 -2
index abff660..30a27fd 100644
@@ -45,6 +45,8 @@ support could be added to this driver.
 
 */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/interrupt.h>
 #include "../comedidev.h"
 #include <linux/delay.h>
@@ -107,8 +109,7 @@ enum hpdi_registers {
 int command_channel_valid(unsigned int channel)
 {
 	if (channel == 0 || channel > 6) {
-		printk(KERN_WARNING
-		       "gsc_hpdi: bug! invalid cable command channel\n");
+		pr_warn("bug! invalid cable command channel\n");
 		return 0;
 	}
 	return 1;

drivers/staging/comedi/drivers/gsc_hpdi.c static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 557

Quoted 5 lines
drivers/staging/comedi/drivers/gsc_hpdi.c +1 -1
@@ -553,7 +554,7 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	int i;
 	int retval;
 
-	printk(KERN_WARNING "comedi%d: gsc_hpdi\n", dev->minor);
+	dev_warn(dev->class_dev, "gsc_hpdi\n");

What is this warning about?

Quoted 40 lines
drivers/staging/comedi/drivers/gsc_hpdi.c +7 -7
 	if (alloc_private(dev, sizeof(struct hpdi_private)) < 0)
 		return -ENOMEM;
@@ -582,17 +583,17 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		} while (pcidev != NULL);
 	}
 	if (dev->board_ptr == NULL) {
-		printk(KERN_WARNING "gsc_hpdi: no hpdi card found\n");
+		dev_warn(dev->class_dev, "no hpdi card found\n");
 		return -EIO;
 	}
 
-	printk(KERN_WARNING
-	       "gsc_hpdi: found %s on bus %i, slot %i\n", board(dev)->name,
-	       pcidev->bus->number, PCI_SLOT(pcidev->devfn));
+	dev_warn(dev->class_dev,
+		 "found %s on bus %i, slot %i\n", board(dev)->name,
+		 pcidev->bus->number, PCI_SLOT(pcidev->devfn));
 
 	if (comedi_pci_enable(pcidev, dev->driver->driver_name)) {
-		printk(KERN_WARNING
-		       " failed enable PCI device and request regions\n");
+		dev_warn(dev->class_dev,
+			 " failed enable PCI device and request regions\n");
 		return -EIO;
 	}
 	pci_set_master(pcidev);
@@ -613,7 +614,7 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	    ioremap(priv(dev)->hpdi_phys_iobase,
 		    pci_resource_len(pcidev, HPDI_BADDRINDEX));
 	if (!priv(dev)->plx9080_iobase || !priv(dev)->hpdi_iobase) {
-		printk(KERN_WARNING " failed to remap io memory\n");
+		dev_warn(dev->class_dev, "failed to remap io memory\n");
 		return -ENOMEM;
 	}
 
@@ -625,13 +626,13 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	/*  get irq */
 	if (request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED,
 			dev->driver->driver_name, dev)) {

drivers/staging/comedi/drivers/gsc_hpdi.c static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 635

Quoted 10 lines
drivers/staging/comedi/drivers/gsc_hpdi.c +3 -3
-		printk(KERN_WARNING
-		       " unable to allocate irq %u\n", pcidev->irq);
+		dev_warn(dev->class_dev,
+			 "unable to allocate irq %u\n", pcidev->irq);
 		return -EINVAL;
 	}
 	dev->irq = pcidev->irq;
 
-	printk(KERN_WARNING " irq %u\n", dev->irq);
+	dev_warn(dev->class_dev, "irq %u\n", dev->irq);

Again a warning? Shouldn't most of these be debugging lines instead?

greg k-h

#2 lore raw

PATCH v2 1/1 staging/comedi: Use pr_ or dev_ printks in drivers/gsc_hdpi.c

fixed below checkpatch warning.
- WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...

some of them have been replaced by dev_dbg or pr_debug, and added pr_fmt.

---
 drivers/staging/comedi/drivers/gsc_hpdi.c |   31 +++++++++++++++--------------
 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/staging/comedi/drivers/gsc_hpdi.c +16 -15
index abff660..31d89d5 100644
@@ -45,6 +45,8 @@ support could be added to this driver.
 
 */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/interrupt.h>
 #include "../comedidev.h"
 #include <linux/delay.h>
@@ -107,8 +109,7 @@ enum hpdi_registers {
 int command_channel_valid(unsigned int channel)
 {
 	if (channel == 0 || channel > 6) {
-		printk(KERN_WARNING
-		       "gsc_hpdi: bug! invalid cable command channel\n");
+		pr_debug("bug! invalid cable command channel\n");
 		return 0;
 	}
 	return 1;
@@ -553,7 +554,7 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	int i;
 	int retval;
 
-	printk(KERN_WARNING "comedi%d: gsc_hpdi\n", dev->minor);
+	dev_dbg(dev->class_dev, "gsc_hpdi\n");
 
 	if (alloc_private(dev, sizeof(struct hpdi_private)) < 0)
 		return -ENOMEM;
@@ -582,17 +583,17 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		} while (pcidev != NULL);
 	}
 	if (dev->board_ptr == NULL) {
-		printk(KERN_WARNING "gsc_hpdi: no hpdi card found\n");
+		dev_warn(dev->class_dev, "no hpdi card found\n");
 		return -EIO;
 	}
 
-	printk(KERN_WARNING
-	       "gsc_hpdi: found %s on bus %i, slot %i\n", board(dev)->name,
-	       pcidev->bus->number, PCI_SLOT(pcidev->devfn));
+	dev_dbg(dev->class_dev,
+		"found %s on bus %i, slot %i\n", board(dev)->name,
+		pcidev->bus->number, PCI_SLOT(pcidev->devfn));
 
 	if (comedi_pci_enable(pcidev, dev->driver->driver_name)) {
-		printk(KERN_WARNING
-		       " failed enable PCI device and request regions\n");
+		dev_warn(dev->class_dev,
+			 " failed enable PCI device and request regions\n");
 		return -EIO;
 	}
 	pci_set_master(pcidev);
@@ -613,7 +614,7 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	    ioremap(priv(dev)->hpdi_phys_iobase,
 		    pci_resource_len(pcidev, HPDI_BADDRINDEX));
 	if (!priv(dev)->plx9080_iobase || !priv(dev)->hpdi_iobase) {
-		printk(KERN_WARNING " failed to remap io memory\n");
+		dev_warn(dev->class_dev, "failed to remap io memory\n");
 		return -ENOMEM;
 	}
 
@@ -625,13 +626,13 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	/*  get irq */
 	if (request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED,
 			dev->driver->driver_name, dev)) {
-		printk(KERN_WARNING
-		       " unable to allocate irq %u\n", pcidev->irq);
+		dev_warn(dev->class_dev,
+			 "unable to allocate irq %u\n", pcidev->irq);
 		return -EINVAL;
 	}
 	dev->irq = pcidev->irq;
 
-	printk(KERN_WARNING " irq %u\n", dev->irq);
+	dev_dbg(dev->class_dev, "irq %u\n", dev->irq);
 
 	/*  allocate pci dma buffers */
 	for (i = 0; i < NUM_DMA_BUFFERS; i++) {
@@ -649,8 +650,8 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 						   &priv(dev)->
 						   dma_desc_phys_addr);
 	if (priv(dev)->dma_desc_phys_addr & 0xf) {
-		printk(KERN_WARNING
-		       " dma descriptors not quad-word aligned (bug)\n");
+		dev_warn(dev->class_dev,
+			 "dma descriptors not quad-word aligned (bug)\n");
 		return -EIO;
 	}
 
Signature · 1 line
1.7.9.5
#3 lore raw
Quoted 7 lines · YAMANE Toshiaki

fixed below checkpatch warning.
- WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...

some of them have been replaced by dev_dbg or pr_debug, and added pr_fmt.

This patch doesn't apply, can you redo it against the next linux-next release and resend it?

thanks,

greg k-h

#4 lore raw
Quoted 11 lines · Greg Kroah-Hartman
Quoted 7 lines · YAMANE Toshiaki

fixed below checkpatch warning.
- WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...

some of them have been replaced by dev_dbg or pr_debug, and added pr_fmt.

This patch doesn't apply, can you redo it against the next linux-next release and resend it?

Yes, thanks.

Signature · 3 lines
Regards,

YAMANE Toshiaki
#8 lore raw
In reply to Greg Kroah-Hartman
Quoted 91 lines · Greg Kroah-Hartman
Quoted 34 lines · YAMANE Toshiaki

fixed below checkpatch warning.
- WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...

and added pr_fmt.

---
 drivers/staging/comedi/drivers/gsc_hpdi.c |   31 +++++++++++++++--------------
 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/staging/comedi/drivers/gsc_hpdi.c +3 -2
index abff660..30a27fd 100644
@@ -45,6 +45,8 @@ support could be added to this driver.
 
 */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/interrupt.h>
 #include "../comedidev.h"
 #include <linux/delay.h>
@@ -107,8 +109,7 @@ enum hpdi_registers {
 int command_channel_valid(unsigned int channel)
 {
      if (channel == 0 || channel > 6) {
-             printk(KERN_WARNING
-                    "gsc_hpdi: bug! invalid cable command channel\n");
+             pr_warn("bug! invalid cable command channel\n");
              return 0;
      }
      return 1;

drivers/staging/comedi/drivers/gsc_hpdi.c static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 557

Quoted 5 lines
drivers/staging/comedi/drivers/gsc_hpdi.c +1 -1
@@ -553,7 +554,7 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
      int i;
      int retval;
 
-     printk(KERN_WARNING "comedi%d: gsc_hpdi\n", dev->minor);
+     dev_warn(dev->class_dev, "gsc_hpdi\n");

What is this warning about?

Quoted 48 lines
drivers/staging/comedi/drivers/gsc_hpdi.c +9 -9
      if (alloc_private(dev, sizeof(struct hpdi_private)) < 0)
              return -ENOMEM;
@@ -582,17 +583,17 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
              } while (pcidev != NULL);
      }
      if (dev->board_ptr == NULL) {
-             printk(KERN_WARNING "gsc_hpdi: no hpdi card found\n");
+             dev_warn(dev->class_dev, "no hpdi card found\n");
              return -EIO;
      }
 
-     printk(KERN_WARNING
-            "gsc_hpdi: found %s on bus %i, slot %i\n", board(dev)->name,
-            pcidev->bus->number, PCI_SLOT(pcidev->devfn));
+     dev_warn(dev->class_dev,
+              "found %s on bus %i, slot %i\n", board(dev)->name,
+              pcidev->bus->number, PCI_SLOT(pcidev->devfn));
 
      if (comedi_pci_enable(pcidev, dev->driver->driver_name)) {
-             printk(KERN_WARNING
-                    " failed enable PCI device and request regions\n");
+             dev_warn(dev->class_dev,
+                      " failed enable PCI device and request regions\n");
              return -EIO;
      }
      pci_set_master(pcidev);
@@ -613,7 +614,7 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
          ioremap(priv(dev)->hpdi_phys_iobase,
                  pci_resource_len(pcidev, HPDI_BADDRINDEX));
      if (!priv(dev)->plx9080_iobase || !priv(dev)->hpdi_iobase) {
-             printk(KERN_WARNING " failed to remap io memory\n");
+             dev_warn(dev->class_dev, "failed to remap io memory\n");
              return -ENOMEM;
      }
 
@@ -625,13 +626,13 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
      /*  get irq */
      if (request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED,
                      dev->driver->driver_name, dev)) {
-             printk(KERN_WARNING
-                    " unable to allocate irq %u\n", pcidev->irq);
+             dev_warn(dev->class_dev,
+                      "unable to allocate irq %u\n", pcidev->irq);
              return -EINVAL;
      }
      dev->irq = pcidev->irq;
 
Quoted 6 lines

drivers/staging/comedi/drivers/gsc_hpdi.c static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 635

Quoted 2 lines
drivers/staging/comedi/drivers/gsc_hpdi.c +1 -1
-     printk(KERN_WARNING " irq %u\n", dev->irq);
+     dev_warn(dev->class_dev, "irq %u\n", dev->irq);

Again a warning? Shouldn't most of these be debugging lines instead?

greg k-h

Only two points above should be in debugging line? Should it modify dev_dbg on 589 also?

Quoted 6 lines

drivers/staging/comedi/drivers/gsc_hpdi.c static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 592

Quoted 6 lines
drivers/staging/comedi/drivers/gsc_hpdi.c +3 -3
-     printk(KERN_WARNING
-            "gsc_hpdi: found %s on bus %i, slot %i\n", board(dev)->name,
-            pcidev->bus->number, PCI_SLOT(pcidev->devfn));
+     dev_warn(dev->class_dev,
+              "found %s on bus %i, slot %i\n", board(dev)->name,
+              pcidev->bus->number, PCI_SLOT(pcidev->devfn));

I am grad to tell me why.

And I will resend the patch only two points are in debugging line.

Signature · 3 lines
Regards,

YAMANE Toshiaki
#5 lore raw

PATCH v3 1/1 staging/comedi: Use pr_ or dev_ printks in drivers/gsc_hdpi.c

In reply to Greg Kroah-Hartman

fixed below checkpatch warning.
- WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...

some of them have been replaced by dev_dbg,
and added pr_fmt.

---
 drivers/staging/comedi/drivers/gsc_hpdi.c |   31 +++++++++++++++--------------
 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/staging/comedi/drivers/gsc_hpdi.c +16 -15
index abff660..a9d4372 100644
@@ -45,6 +45,8 @@ support could be added to this driver.
 
 */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/interrupt.h>
 #include "../comedidev.h"
 #include <linux/delay.h>
@@ -107,8 +109,7 @@ enum hpdi_registers {
 int command_channel_valid(unsigned int channel)
 {
 	if (channel == 0 || channel > 6) {
-		printk(KERN_WARNING
-		       "gsc_hpdi: bug! invalid cable command channel\n");
+		pr_warn("bug! invalid cable command channel\n");
 		return 0;
 	}
 	return 1;
@@ -553,7 +554,7 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	int i;
 	int retval;
 
-	printk(KERN_WARNING "comedi%d: gsc_hpdi\n", dev->minor);
+	dev_dbg(dev->class_dev, "gsc_hpdi\n");
 
 	if (alloc_private(dev, sizeof(struct hpdi_private)) < 0)
 		return -ENOMEM;
@@ -582,17 +583,17 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		} while (pcidev != NULL);
 	}
 	if (dev->board_ptr == NULL) {
-		printk(KERN_WARNING "gsc_hpdi: no hpdi card found\n");
+		dev_warn(dev->class_dev, "no hpdi card found\n");
 		return -EIO;
 	}
 
-	printk(KERN_WARNING
-	       "gsc_hpdi: found %s on bus %i, slot %i\n", board(dev)->name,
-	       pcidev->bus->number, PCI_SLOT(pcidev->devfn));
+	dev_warn(dev->class_dev,
+		 "found %s on bus %i, slot %i\n", board(dev)->name,
+		 pcidev->bus->number, PCI_SLOT(pcidev->devfn));
 
 	if (comedi_pci_enable(pcidev, dev->driver->driver_name)) {
-		printk(KERN_WARNING
-		       " failed enable PCI device and request regions\n");
+		dev_warn(dev->class_dev,
+			 " failed enable PCI device and request regions\n");
 		return -EIO;
 	}
 	pci_set_master(pcidev);
@@ -613,7 +614,7 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	    ioremap(priv(dev)->hpdi_phys_iobase,
 		    pci_resource_len(pcidev, HPDI_BADDRINDEX));
 	if (!priv(dev)->plx9080_iobase || !priv(dev)->hpdi_iobase) {
-		printk(KERN_WARNING " failed to remap io memory\n");
+		dev_warn(dev->class_dev, "failed to remap io memory\n");
 		return -ENOMEM;
 	}
 
@@ -625,13 +626,13 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	/*  get irq */
 	if (request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED,
 			dev->driver->driver_name, dev)) {
-		printk(KERN_WARNING
-		       " unable to allocate irq %u\n", pcidev->irq);
+		dev_warn(dev->class_dev,
+			 "unable to allocate irq %u\n", pcidev->irq);
 		return -EINVAL;
 	}
 	dev->irq = pcidev->irq;
 
-	printk(KERN_WARNING " irq %u\n", dev->irq);
+	dev_dbg(dev->class_dev, "irq %u\n", dev->irq);
 
 	/*  allocate pci dma buffers */
 	for (i = 0; i < NUM_DMA_BUFFERS; i++) {
@@ -649,8 +650,8 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 						   &priv(dev)->
 						   dma_desc_phys_addr);
 	if (priv(dev)->dma_desc_phys_addr & 0xf) {
-		printk(KERN_WARNING
-		       " dma descriptors not quad-word aligned (bug)\n");
+		dev_warn(dev->class_dev,
+			 "dma descriptors not quad-word aligned (bug)\n");
 		return -EIO;
 	}
 
Signature · 1 line
1.7.9.5
#6 lore raw
Quoted 10 lines · YAMANE Toshiaki

fixed below checkpatch warning.
- WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...

some of them have been replaced by dev_dbg,
and added pr_fmt.

---
 drivers/staging/comedi/drivers/gsc_hpdi.c |   31 +++++++++++++++--------------
 1 file changed, 16 insertions(+), 15 deletions(-)

This patch does not apply against my tree, can you please redo it against the latest linux-next release and resend it?

thanks,

greg k-h

#7 lore raw

PATCH v4 1/1 staging/comedi: Use pr_ or dev_ printks in drivers/gsc_hpdi.c

fixed below checkpatch warning.
- WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...

some of them have been replaced by dev_dbg.

---
 drivers/staging/comedi/drivers/gsc_hpdi.c |   26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/staging/comedi/drivers/gsc_hpdi.c +13 -13
index 17aec51..4809295 100644
@@ -479,7 +479,7 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	int i;
 	int retval;
 
-	printk(KERN_WARNING "comedi%d: gsc_hpdi\n", dev->minor);
+	dev_dbg(dev->class_dev, "gsc_hpdi\n");
 
 	devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
 	if (!devpriv)
@@ -510,17 +510,17 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		} while (pcidev != NULL);
 	}
 	if (dev->board_ptr == NULL) {
-		printk(KERN_WARNING "gsc_hpdi: no hpdi card found\n");
+		dev_warn(dev->class_dev, "no hpdi card found\n");
 		return -EIO;
 	}
 
-	printk(KERN_WARNING
-	       "gsc_hpdi: found %s on bus %i, slot %i\n", board(dev)->name,
-	       pcidev->bus->number, PCI_SLOT(pcidev->devfn));
+	dev_warn(dev->class_dev,
+		 "found %s on bus %i, slot %i\n", board(dev)->name,
+		 pcidev->bus->number, PCI_SLOT(pcidev->devfn));
 
 	if (comedi_pci_enable(pcidev, dev->driver->driver_name)) {
-		printk(KERN_WARNING
-		       " failed enable PCI device and request regions\n");
+		dev_warn(dev->class_dev,
+			 "failed enable PCI device and request regions\n");
 		return -EIO;
 	}
 	pci_set_master(pcidev);
@@ -541,7 +541,7 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	    ioremap(devpriv->hpdi_phys_iobase,
 		    pci_resource_len(pcidev, HPDI_BADDRINDEX));
 	if (!devpriv->plx9080_iobase || !devpriv->hpdi_iobase) {
-		printk(KERN_WARNING " failed to remap io memory\n");
+		dev_warn(dev->class_dev, "failed to remap io memory\n");
 		return -ENOMEM;
 	}
 
@@ -553,13 +553,13 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	/*  get irq */
 	if (request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED,
 			dev->driver->driver_name, dev)) {
-		printk(KERN_WARNING
-		       " unable to allocate irq %u\n", pcidev->irq);
+		dev_warn(dev->class_dev,
+			 "unable to allocate irq %u\n", pcidev->irq);
 		return -EINVAL;
 	}
 	dev->irq = pcidev->irq;
 
-	printk(KERN_WARNING " irq %u\n", dev->irq);
+	dev_dbg(dev->class_dev, " irq %u\n", dev->irq);
 
 	/*  allocate pci dma buffers */
 	for (i = 0; i < NUM_DMA_BUFFERS; i++) {
@@ -577,8 +577,8 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 						   &devpriv->
 						   dma_desc_phys_addr);
 	if (devpriv->dma_desc_phys_addr & 0xf) {
-		printk(KERN_WARNING
-		       " dma descriptors not quad-word aligned (bug)\n");
+		dev_warn(dev->class_dev,
+			 " dma descriptors not quad-word aligned (bug)\n");
 		return -EIO;
 	}
 
Signature · 1 line
1.7.9.5