Skip to contentSkip to conversation

Staging: hp: Replace printk(KERN_WARNING ...) with netdev_warn().

PATCH In review Sam Muhammed 2 participants 3 messages Mar 21, 2020 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Staging: hp: Replace printk(KERN_WARNING ...) with netdev_warn().

Fixup the following checkpatch.pl WARNING:
WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...

---
Changes in v2:
- Removing " : " in the print message, netdev_warn() doesn't need it.

 drivers/staging/hp/hp100.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/staging/hp/hp100.c +4 -5
index b89c4dcf53f5..1afd511260d0 100644
@@ -469,8 +469,7 @@ static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus,
 
 	eid = hp100_read_id(ioaddr);
 	if (eid == NULL) {	/* bad checksum? */
-		printk(KERN_WARNING "%s: bad ID checksum at base port 0x%x\n",
-		       __func__, ioaddr);
+		netdev_warn(dev, "bad ID checksum at base port 0x%x\n", ioaddr);
 		goto out2;
 	}
 
@@ -478,9 +477,9 @@ static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus,
 	for (i = uc = 0; i < 7; i++)
 		uc += hp100_inb(LAN_ADDR + i);
 	if (uc != 0xff) {
-		printk(KERN_WARNING
-		       "%s: bad lan address checksum at port 0x%x)\n",
-		       __func__, ioaddr);
+		netdev_warn(dev,
+			    "bad lan address checksum at port 0x%x)\n",
+			    ioaddr);
 		err = -EIO;
 		goto out2;
 	}

---
2.20.1

#1 lore raw
Quoted 3 lines · Sam Muhammed

Fixup the following checkpatch.pl WARNING:
WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...

Sorry to complain some more, but the subject line and the log message are not really idea. The subject line should be concise and get the main point across, but doen't need a lot of detail. So "use netdev_warn" could be fine. The log message is where you should explain what you do and why. Your log message has a lot of words, but the only one that says what you do is "Fixup", which is not very descriptive, and there is no mention of why.

julia

Quoted 44 lines

---
Changes in v2:
- Removing " : " in the print message, netdev_warn() doesn't need it.

 drivers/staging/hp/hp100.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/staging/hp/hp100.c +4 -6
index b89c4dcf53f5..1afd511260d0 100644
@@ -469,8 +469,7 @@ static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus,
 
 	eid = hp100_read_id(ioaddr);
 	if (eid == NULL) {	/* bad checksum? */
-		printk(KERN_WARNING "%s: bad ID checksum at base port 0x%x\n",
-		       __func__, ioaddr);
+		netdev_warn(dev, "bad ID checksum at base port 0x%x\n", ioaddr);
 		goto out2;
 	}
 
@@ -478,9 +477,9 @@ static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus,
 	for (i = uc = 0; i < 7; i++)
 		uc += hp100_inb(LAN_ADDR + i);
 	if (uc != 0xff) {
-		printk(KERN_WARNING
-		       "%s: bad lan address checksum at port 0x%x)\n",
-		       __func__, ioaddr);
+		netdev_warn(dev,
+			    "bad lan address checksum at port 0x%x)\n",
+			    ioaddr);
 		err = -EIO;
 		goto out2;
 	}
---

2.20.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20200321184132.1908-1-jane.pnx9%40gmail.com.

#2 lore raw
Quoted 7 lines · Julia Lawall
Quoted 3 lines · Sam Muhammed

Fixup the following checkpatch.pl WARNING:
WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...

Quoted 8 lines

Sorry to complain some more, but the subject line and the log message are not really idea. The subject line should be concise and get the main point across, but doen't need a lot of detail. So "use netdev_warn" could be fine. The log message is where you should explain what you do and why. Your log message has a lot of words, but the only one that says what you do is "Fixup", which is not very descriptive, and there is no mention of why.

And I just thought it went smooth :D
Okay, v3 then.
Thank you!

Sam

Quoted 46 lines

julia

Quoted 44 lines

---
Changes in v2:
- Removing " : " in the print message, netdev_warn() doesn't need it.

 drivers/staging/hp/hp100.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/staging/hp/hp100.c +4 -6
index b89c4dcf53f5..1afd511260d0 100644
@@ -469,8 +469,7 @@ static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus,
 
 	eid = hp100_read_id(ioaddr);
 	if (eid == NULL) {	/* bad checksum? */
-		printk(KERN_WARNING "%s: bad ID checksum at base port 0x%x\n",
-		       __func__, ioaddr);
+		netdev_warn(dev, "bad ID checksum at base port 0x%x\n", ioaddr);
 		goto out2;
 	}
 
@@ -478,9 +477,9 @@ static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus,
 	for (i = uc = 0; i < 7; i++)
 		uc += hp100_inb(LAN_ADDR + i);
 	if (uc != 0xff) {
-		printk(KERN_WARNING
-		       "%s: bad lan address checksum at port 0x%x)\n",
-		       __func__, ioaddr);
+		netdev_warn(dev,
+			    "bad lan address checksum at port 0x%x)\n",
+			    ioaddr);
 		err = -EIO;
 		goto out2;
 	}
---

2.20.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20200321184132.1908-1-jane.pnx9%40gmail.com.