Staging: hp: Use netdev_warn().
PATCH v3 1/1 Staging: hp: Use netdev_warn().
This replaces printk(KERN_WARNING ..) with netdev_warn(), as the use of printk(KERN_<LEVEL> ..) isn't preferred when a struct net_device is available.
---
Changes in v3:
- Update subject line and log message to be more clear and descriptive.
Changes in v2:
- Remove the " : " from 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
@@ -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
Quoted 3 lines · Sam Muhammed
This replaces
printk(KERN_WARNING ..)withnetdev_warn(), as the use ofprintk(KERN_<LEVEL> ..)isn't preferred when a structnet_deviceis available.
This is better, but it's printk that is not desirable in general, whether the KERN_WARNING is there or nor. So the log message could be simpler, thus making it easier for someone who is looking at to see the issue quickly.
julia
Quoted 47 lines
Signed-off-by Sam Muhammed <[email protected]>---
Changes in v3:
- Update subject line and log message to be more clear and descriptive.Changes in v2:
- Remove the " : " from 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@@ -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/20200322072424.3922-1-jane.pnx9%40gmail.com.
Quoted 12 lines · Julia Lawall
Quoted 3 lines · Sam Muhammed
This replaces
printk(KERN_WARNING ..)withnetdev_warn(), as the use ofprintk(KERN_<LEVEL> ..)isn't preferred when a structnet_deviceis available.This is better, but it's printk that is not desirable in general, whether the
KERN_WARNINGis there or nor. So the log message could be simpler, thus making it easier for someone who is looking at to see the issue quickly.
Okay, i thought id make it more specific, v4?
I have another question about kernel printing messages,
for messages not specific to a particular device we use pr_warn, ive
got a driver that made a _user-defined_ pr_warn macro in a "driver.h" and used it across the driver.
shouldn't #include <linux/printk.h> replace this _macro_ ? that including it in the "driver.h" will recursively include it _driver-wide_
or its more of "i use one macro and i want to load fast" so they prefer using their custom pr_warn?
Thank you.
Sam
Quoted 50 lines
julia
Quoted 48 lines
Signed-off-by Sam Muhammed <[email protected]>---
Changes in v3:
- Update subject line and log message to be more clear and descriptive.Changes in v2:
- Remove the " : " from 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@@ -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/20200322072424.3922-1-jane.pnx9%40gmail.com.
Quoted 8 lines · Sam Muhammed
Quoted 7 lines · Julia Lawall
Quoted 3 lines · Sam Muhammed
This replaces
printk(KERN_WARNING ..)withnetdev_warn(), as the use ofprintk(KERN_<LEVEL> ..)isn't preferred when a structnet_deviceis available.
Quoted 7 lines
Quoted 5 lines
This is better, but it's printk that is not desirable in general, whether the
KERN_WARNINGis there or nor. So the log message could be simpler, thus making it easier for someone who is looking at to see the issue quickly.Okay, i thought id make it more specific, v4?
Yes.
Quoted 6 lines
I have another question about kernel printing messages,
for messages not specific to a particular device we usepr_warn, ive
got a driver that made a _user-defined_pr_warnmacro in a "driver.h" and used it across the driver.
Quoted 6 lines
shouldn't #include <
linux/printk.h> replace this _macro_ ? that including it in the "driver.h" will recursively include it _driver-wide_or its more of "i use one macro and i want to load fast" so they prefer using their custom
pr_warn?
I think it would be better to use standard kernel functions, unless there is some strong reason not to do so. You could see what their macro does, and see whether similar functionality already exists.
julia
Quoted 56 lines
Thank you.
SamQuoted 50 lines
julia
Quoted 48 lines
Signed-off-by Sam Muhammed <[email protected]>---
Changes in v3:
- Update subject line and log message to be more clear and descriptive.Changes in v2:
- Remove the " : " from 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@@ -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/20200322072424.3922-1-jane.pnx9%40gmail.com.