Skip to contentSkip to conversation

Staging: hp: Use netdev_warn().

PATCH Superseded Sam Muhammed 2 participants 6 messages Mar 22, 2020 Staging

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 Staging: hp: Use netdev_warn().

This replaces printk(KERN_WARNING ..) with netdev_warn(), as the use of printk() isn't preferred when
a struct net_device is available.

---
Changes in v4:
- Make log message more clear.

Changes in v3:
- Update subject line and log message to be more desriptive.

Changes in v2:
- Remove " : " from the printing 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 23 lines · Sam Muhammed

This replaces printk(KERN_WARNING ..) with netdev_warn(), as the use of printk() isn't preferred when
a struct net_device is available.

---
Changes in v4:
- Make log message more clear.

Changes in v3:
- Update subject line and log message to be more desriptive.

Changes in v2:
- Remove " : " from the printing 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 +0 -0
index b89c4dcf53f5..1afd511260d0 100644

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

Quoted 6 lines
drivers/staging/hp/hp100.c +1 -2
@@ -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);

After I apply the patch, I see this as 1 character over 80 characters. You could put ioaddr on another line.

julia

Quoted 24 lines
drivers/staging/hp/hp100.c +3 -4
 		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/20200322110035.2756-1-jane.pnx9%40gmail.com.

#2 lore raw
Quoted 27 lines · Julia Lawall
Quoted 24 lines · Sam Muhammed

This replaces printk(KERN_WARNING ..) with netdev_warn(), as the use of printk() isn't preferred when
a struct net_device is available.

---
Changes in v4:
- Make log message more clear.

Changes in v3:
- Update subject line and log message to be more desriptive.

Changes in v2:
- Remove " : " from the printing 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 +0 -0
index b89c4dcf53f5..1afd511260d0 100644
@@ -469,8 +469,7 @@ static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus,
 
Quoted 9 lines

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

Quoted 5 lines
drivers/staging/hp/hp100.c +1 -2
 	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);

After I apply the patch, I see this as 1 character over 80 characters. You could put ioaddr on another line.

Oh, is there a difference between Checkpatch.pl after applying the patch, and running checkpatch.pl on the file after changing it? because i didn't have any over 80 characters warning on the range of lines i modified

Sam

Quoted 26 lines

julia

Quoted 24 lines
drivers/staging/hp/hp100.c +3 -4
 		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/20200322110035.2756-1-jane.pnx9%40gmail.com.

#3 lore raw
Quoted 38 lines · Sam Muhammed
Quoted 27 lines · Julia Lawall
Quoted 24 lines · Sam Muhammed

This replaces printk(KERN_WARNING ..) with netdev_warn(), as the use of printk() isn't preferred when
a struct net_device is available.

---
Changes in v4:
- Make log message more clear.

Changes in v3:
- Update subject line and log message to be more desriptive.

Changes in v2:
- Remove " : " from the printing 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 +0 -0
index b89c4dcf53f5..1afd511260d0 100644
@@ -469,8 +469,7 @@ static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus,
 
Quoted 9 lines

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

Quoted 5 lines
drivers/staging/hp/hp100.c +1 -2
 	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);

After I apply the patch, I see this as 1 character over 80 characters. You could put ioaddr on another line.

Quoted 4 lines

Oh, is there a difference between Checkpatch.pl after applying the patch, and running checkpatch.pl on the file after changing it? because i didn't have any over 80 characters warning on the range of lines i modified

I don't know. I didn't run checkpatch. It's just one character and it's a line with a string, so one of these conditions might make checkpatch ignore the problem.

julia

Quoted 32 lines

Sam

Quoted 26 lines

julia

Quoted 24 lines
drivers/staging/hp/hp100.c +3 -4
 		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/20200322110035.2756-1-jane.pnx9%40gmail.com.

#4 lore raw
Quoted 41 lines · Julia Lawall
Quoted 38 lines · Sam Muhammed
Quoted 36 lines · Julia Lawall
Quoted 23 lines · Sam Muhammed

This replaces printk(KERN_WARNING ..) with netdev_warn(), as the use of printk() isn't preferred when
a struct net_device is available.

---
Changes in v4:
- Make log message more clear.

Changes in v3:
- Update subject line and log message to be more desriptive.

Changes in v2:
- Remove " : " from the printing 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 +0 -0
index b89c4dcf53f5..1afd511260d0 100644

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

Quoted 6 lines
drivers/staging/hp/hp100.c +1 -2
@@ -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);

After I apply the patch, I see this as 1 character over 80 characters. You could put ioaddr on another line.

Quoted 9 lines
Quoted 4 lines

Oh, is there a difference between Checkpatch.pl after applying the patch, and running checkpatch.pl on the file after changing it? because i didn't have any over 80 characters warning on the range of lines i modified

I don't know. I didn't run checkpatch. It's just one character and it's a line with a string, so one of these conditions might make checkpatch ignore the problem.

Sorry about the newbie questions, is there an action i should do about the <Acked-by> tag,
or it gets added automatically?

Sam

Quoted 34 lines

julia

Quoted 32 lines

Sam

Quoted 26 lines

julia

Quoted 24 lines
drivers/staging/hp/hp100.c +3 -4
 		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/20200322110035.2756-1-jane.pnx9%40gmail.com.

#5 lore raw
Quoted 47 lines · Sam Muhammed
Quoted 46 lines · Julia Lawall
Quoted 42 lines · Sam Muhammed
Quoted 27 lines · Julia Lawall
Quoted 24 lines · Sam Muhammed

This replaces printk(KERN_WARNING ..) with netdev_warn(), as the use of printk() isn't preferred when
a struct net_device is available.

---
Changes in v4:
- Make log message more clear.

Changes in v3:
- Update subject line and log message to be more desriptive.

Changes in v2:
- Remove " : " from the printing 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 +0 -0
index b89c4dcf53f5..1afd511260d0 100644
@@ -469,8 +469,7 @@ static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus,
 
Quoted 9 lines

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

Quoted 5 lines
drivers/staging/hp/hp100.c +1 -2
 	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);

After I apply the patch, I see this as 1 character over 80 characters. You could put ioaddr on another line.

Oh, is there a difference between Checkpatch.pl after applying the patch, and running checkpatch.pl on the file after changing it? because i didn't have any over 80 characters warning on the range of lines i modified

Quoted 8 lines
Quoted 4 lines

I don't know. I didn't run checkpatch. It's just one character and it's a line with a string, so one of these conditions might make checkpatch ignore the problem.

Sorry about the newbie questions, is there an action i should do about the <Acked-by> tag,
or it gets added automatically?

Greg will take care of it.

julia

Quoted 40 lines

Sam

Quoted 34 lines

julia

Quoted 32 lines

Sam

Quoted 26 lines

julia

Quoted 24 lines
drivers/staging/hp/hp100.c +3 -4
 		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/20200322110035.2756-1-jane.pnx9%40gmail.com.