Skip to contentSkip to conversation

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

PATCH Superseded Sam Muhammed 2 participants 4 messages Mar 21, 2020 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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 ...

---
 drivers/staging/hp/hp100.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/hp/hp100.c +5 -5
index b89c4dcf53f5..89af70571661 100644
@@ -469,8 +469,8 @@ 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 +478,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;
 	}
Signature · 1 line
2.20.1
#1 lore raw
Quoted 25 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 ...

---
 drivers/staging/hp/hp100.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/hp/hp100.c +2 -2
index b89c4dcf53f5..89af70571661 100644
@@ -469,8 +469,8 @@ 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;
 	}
 

drivers/staging/hp/hp100.c static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus, · line 483

Quoted 9 lines
drivers/staging/hp/hp100.c +3 -3
@@ -478,9 +478,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);

Other calls to netdev_warn don't have a string that starts with " : ", so you can probably drop that part as well.

julia

Quoted 11 lines
drivers/staging/hp/hp100.c +0 -1
 		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/20200321132919.27704-1-jane.pnx9%40gmail.com.

#2 lore raw
Quoted 27 lines · Julia Lawall
Quoted 24 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 ...

---
 drivers/staging/hp/hp100.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/hp/hp100.c +2 -2
index b89c4dcf53f5..89af70571661 100644
@@ -469,8 +469,8 @@ 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;
 	}
 
Quoted 14 lines

drivers/staging/hp/hp100.c static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus, · line 483

Quoted 10 lines
drivers/staging/hp/hp100.c +3 -3
@@ -478,9 +478,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);

Other calls to netdev_warn don't have a string that starts with " : ", so you can probably drop that part as well.

OK, thats a v2?

I have some questions about replacing printk in general, if its associated with KERN_<LEVEL>, i know which netdev_*/dev_* ..macro to replace it with, but when its just printk("some string"), with no other arg, its hard to know to which netdev_*/dev_* macro it should be replaced with (_dbg, _warn ...etc)

what indications can i use or refer to with this?

Sam

Quoted 14 lines

julia

Quoted 11 lines
drivers/staging/hp/hp100.c +0 -1
 		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/20200321132919.27704-1-jane.pnx9%40gmail.com.

#3 lore raw
Quoted 43 lines · Sam Muhammed
Quoted 27 lines · Julia Lawall
Quoted 24 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 ...

---
 drivers/staging/hp/hp100.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/hp/hp100.c +2 -2
index b89c4dcf53f5..89af70571661 100644
@@ -469,8 +469,8 @@ 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;
 	}
 
Quoted 14 lines

drivers/staging/hp/hp100.c static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus, · line 483

Quoted 10 lines
drivers/staging/hp/hp100.c +3 -3
@@ -478,9 +478,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);

Other calls to netdev_warn don't have a string that starts with " : ", so you can probably drop that part as well.

Quoted 1 line

OK, thats a v2?

Yes.

Quoted 8 lines

I have some questions about replacing printk in general, if its associated with KERN_<LEVEL>, i know which netdev_*/dev_* ..macro to replace it with, but when its just printk("some string"), with no other arg, its hard to know to which netdev_*/dev_* macro it should be replaced with (_dbg, _warn ...etc)

what indications can i use or refer to with this?

I think you would have to guess from the contents.

julia