Skip to contentSkip to conversation

staging/sbe-2t3e3: Use netdev_ printks in main.c

PATCH In review YAMANE Toshiaki 2 participants 9 messages Sep 27, 2012 – Oct 24, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 staging/sbe-2t3e3: Use netdev_ printks in main.c

fixed below checkpatch warning.
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...

---
 drivers/staging/sbe-2t3e3/main.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/sbe-2t3e3/main.c +4 -3
index f3dbef6..48d80eb 100644
@@ -135,9 +135,10 @@ void t3e3_read_card_serial_number(struct channel *sc)
 	for (i = 0; i < 3; i++)
 		sc->ether.card_serial_number[i] = t3e3_eeprom_read_word(sc, 10 + i);
 
-	printk(KERN_INFO "SBE wanPMC-2T3E3 serial number: %04X%04X%04X\n",
-	       sc->ether.card_serial_number[0], sc->ether.card_serial_number[1],
-	       sc->ether.card_serial_number[2]);
+	netdev_info(sc->dev, "SBE wanPMC-2T3E3 serial number: %04X%04X%04X\n",
+		    sc->ether.card_serial_number[0], 
+		    sc->ether.card_serial_number[1],
+		    sc->ether.card_serial_number[2]);
 }
 
 /*
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/3 staging/sbe-2t3e3: Use netdev_ or dev_ or pr_ printks in module.c

fixed below checkpatch warning.
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...

and add pr_fmt.

---
 drivers/staging/sbe-2t3e3/module.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/staging/sbe-2t3e3/module.c +8 -4
index cd778b3..4547137 100644
@@ -10,6 +10,8 @@
  * This code is based on a driver written by SBE Inc.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
@@ -66,7 +68,7 @@ static int __devinit t3e3_init_channel(struct channel *channel, struct pci_dev *
 
 	dev = alloc_hdlcdev(channel);
 	if (!dev) {
-		printk(KERN_ERR "SBE 2T3E3" ": Out of memory\n");
+		pr_err("SBE 2T3E3" ": Out of memory\n");
 		goto free_regions;
 	}
 
@@ -93,7 +95,8 @@ static int __devinit t3e3_init_channel(struct channel *channel, struct pci_dev *
 	t3e3_init(channel);
 
 	if (request_irq(dev->irq, &t3e3_intr, IRQF_SHARED, dev->name, dev)) {
-		printk(KERN_WARNING "%s: could not get irq: %d\n", dev->name, dev->irq);
+		netdev_warn(channel->dev, "%s: could not get irq: %d\n",
+			    dev->name, dev->irq);
 		goto free_regions;
 	}
 
@@ -137,7 +140,8 @@ static int __devinit t3e3_init_card(struct pci_dev *pdev, const struct pci_devic
 				break; /* found the second channel */
 
 		if (!pdev1) {
-			printk(KERN_ERR "SBE 2T3E3" ": Can't find the second channel\n");
+			dev_err(&pdev->dev,
+				"SBE 2T3E3" ": Can't find the second channel\n");
 			return -EFAULT;
 		}
 		channels = 2;
@@ -146,7 +150,7 @@ static int __devinit t3e3_init_card(struct pci_dev *pdev, const struct pci_devic
 
 	card = kzalloc(sizeof(struct card) + channels * sizeof(struct channel), GFP_KERNEL);
 	if (!card) {
-		printk(KERN_ERR "SBE 2T3E3" ": Out of memory\n");
+		dev_err(&pdev->dev, "SBE 2T3E3" ": Out of memory\n");
 		return -ENOBUFS;
 	}
 
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 2/3] staging/sbe-2t3e3: Use netdev_ or dev_ or pr_ printks in module.c

Quoted 43 lines · YAMANE Toshiaki

fixed below checkpatch warning.
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...

and add pr_fmt.

---
 drivers/staging/sbe-2t3e3/module.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/staging/sbe-2t3e3/module.c +5 -2
index cd778b3..4547137 100644
@@ -10,6 +10,8 @@
  * This code is based on a driver written by SBE Inc.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
@@ -66,7 +68,7 @@ static int __devinit t3e3_init_channel(struct channel *channel, struct pci_dev *
 
 	dev = alloc_hdlcdev(channel);
 	if (!dev) {
-		printk(KERN_ERR "SBE 2T3E3" ": Out of memory\n");
+		pr_err("SBE 2T3E3" ": Out of memory\n");
 		goto free_regions;
 	}
 
@@ -93,7 +95,8 @@ static int __devinit t3e3_init_channel(struct channel *channel, struct pci_dev *
 	t3e3_init(channel);
 
 	if (request_irq(dev->irq, &t3e3_intr, IRQF_SHARED, dev->name, dev)) {
-		printk(KERN_WARNING "%s: could not get irq: %d\n", dev->name, dev->irq);
+		netdev_warn(channel->dev, "%s: could not get irq: %d\n",
+			    dev->name, dev->irq);
 		goto free_regions;
 	}
 

drivers/staging/sbe-2t3e3/module.c static int __devinit t3e3_init_card(struct pci_dev *pdev, const struct pci_devic · line 144

Quoted 6 lines
drivers/staging/sbe-2t3e3/module.c +2 -1
@@ -137,7 +140,8 @@ static int __devinit t3e3_init_card(struct pci_dev *pdev, const struct pci_devic
 				break; /* found the second channel */
 
 		if (!pdev1) {
-			printk(KERN_ERR "SBE 2T3E3" ": Can't find the second channel\n");
+			dev_err(&pdev->dev,
+				"SBE 2T3E3" ": Can't find the second channel\n");

The "SBE 2T3E3" is no longer needed here, now that you set pr_info.

Care to fix this up and resend it?

thanks,

greg k-h

#3 lore raw

PATCH 2/3 staging/sbe-2t3e3: Use netdev_ or dev_ or pr_ printks in module.c

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

and add pr_fmt.

---
 drivers/staging/sbe-2t3e3/module.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/staging/sbe-2t3e3/module.c +7 -4
index 8adb178..8e1a043 100644
@@ -10,6 +10,8 @@
  * This code is based on a driver written by SBE Inc.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
@@ -66,7 +68,7 @@ static int __devinit t3e3_init_channel(struct channel *channel, struct pci_dev *
 
 	dev = alloc_hdlcdev(channel);
 	if (!dev) {
-		printk(KERN_ERR "SBE 2T3E3" ": Out of memory\n");
+		pr_err("Out of memory\n");
 		err = -ENOMEM;
 		goto free_regions;
 	}
@@ -96,7 +98,8 @@ static int __devinit t3e3_init_channel(struct channel *channel, struct pci_dev *
 
 	err = request_irq(dev->irq, &t3e3_intr, IRQF_SHARED, dev->name, dev);
 	if (err) {
-		printk(KERN_WARNING "%s: could not get irq: %d\n", dev->name, dev->irq);
+		netdev_warn(channel->dev, "%s: could not get irq: %d\n",
+			    dev->name, dev->irq);
 		goto unregister_dev;
 	}
 
@@ -144,7 +147,7 @@ static int __devinit t3e3_init_card(struct pci_dev *pdev, const struct pci_devic
 				break; /* found the second channel */
 
 		if (!pdev1) {
-			printk(KERN_ERR "SBE 2T3E3" ": Can't find the second channel\n");
+			dev_err(&pdev->dev, "Can't find the second channel\n");
 			return -EFAULT;
 		}
 		channels = 2;
@@ -153,7 +156,7 @@ static int __devinit t3e3_init_card(struct pci_dev *pdev, const struct pci_devic
 
 	card = kzalloc(sizeof(struct card) + channels * sizeof(struct channel), GFP_KERNEL);
 	if (!card) {
-		printk(KERN_ERR "SBE 2T3E3" ": Out of memory\n");
+		dev_err(&pdev->dev, "Out of memory\n");
 		return -ENOBUFS;
 	}
 
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 3/3 staging/sbe-2t3e3: Use netdev_ printks in cpld.c

In reply to YAMANE Toshiaki

fixed below checkpatch warning.
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...

---
 drivers/staging/sbe-2t3e3/cpld.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/sbe-2t3e3/cpld.c +1 -1
index cc2b54d..27365f9 100644
@@ -338,7 +338,7 @@ void cpld_set_fractional_mode(struct channel *sc, u32 mode,
 			   SBE_2T3E3_CPLD_VAL_FRACTIONAL_MODE_2);
 		break;
 	default:
-		printk(KERN_ERR "wrong mode in set_fractional_mode\n");
+		netdev_err(sc->dev, "wrong mode in set_fractional_mode\n");
 		return;
 	}
 
Signature · 1 line
1.7.9.5
#5 lore raw
In reply to YAMANE Toshiaki
Quoted 4 lines · YAMANE Toshiaki

fixed below checkpatch warning.
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...

Your coding style cleanup patch introduced more coding style errors, not good. Please always remember to use checkpatch.pl on your patches you create.

please fix up.

greg k-h

#6 lore raw

PATCH 1/3 staging/sbe-2t3e3: Use netdev_ printks in main.c

fixed below checkpatch warning.
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...

---
 drivers/staging/sbe-2t3e3/main.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/sbe-2t3e3/main.c +4 -3
index f3dbef6..c8e0398 100644
@@ -135,9 +135,10 @@ void t3e3_read_card_serial_number(struct channel *sc)
 	for (i = 0; i < 3; i++)
 		sc->ether.card_serial_number[i] = t3e3_eeprom_read_word(sc, 10 + i);
 
-	printk(KERN_INFO "SBE wanPMC-2T3E3 serial number: %04X%04X%04X\n",
-	       sc->ether.card_serial_number[0], sc->ether.card_serial_number[1],
-	       sc->ether.card_serial_number[2]);
+	netdev_info(sc->dev, "SBE wanPMC-2T3E3 serial number: %04X%04X%04X\n",
+		    sc->ether.card_serial_number[0],
+		    sc->ether.card_serial_number[1],
+		    sc->ether.card_serial_number[2]);
 }
 
 /*
Signature · 1 line
1.7.9.5
#7 lore raw
Quoted 4 lines · YAMANE Toshiaki

fixed below checkpatch warning.
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...

I never got the 3/3 patch in this series :(

greg k-h

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

fixed below checkpatch warning.
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...

I never got the 3/3 patch in this series :(

I know!
# thanks, I will learn more ways to send patch

Signature · 3 lines
Regards,

YAMANE Toshiaki