[PATCH 2/2] [RFC] NET: Convert several drivers to ndev_printk
With the generic ndev_printk macros, we can now convert network drivers to use this generic printk family for netdevices. Signed-off-by: Auke Kok [EMAIL PROTECTED] --- drivers/net/e100.c| 135 - drivers/net/e1000/e1000.h | 15 drivers/net/e1000/e1000_ethtool.c | 39 +++ drivers/net/e1000/e1000_main.c| 110 +++--- drivers/net/e1000/e1000_param.c | 67 +- drivers/net/ixgb/ixgb.h | 14 drivers/net/ixgb/ixgb_ethtool.c | 15 drivers/net/ixgb/ixgb_main.c | 50 ++ 8 files changed, 184 insertions(+), 261 deletions(-) diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 6169663..8c09c9e 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -172,19 +172,12 @@ MODULE_AUTHOR(DRV_COPYRIGHT); MODULE_LICENSE(GPL); MODULE_VERSION(DRV_VERSION); -static int debug = 3; static int eeprom_bad_csum_allow = 0; static int use_io = 0; -module_param(debug, int, 0); module_param(eeprom_bad_csum_allow, int, 0); module_param(use_io, int, 0); -MODULE_PARM_DESC(debug, Debug level (0=none,...,16=all)); MODULE_PARM_DESC(eeprom_bad_csum_allow, Allow bad eeprom checksums); MODULE_PARM_DESC(use_io, Force use of i/o access mode); -#define DPRINTK(nlevel, klevel, fmt, args...) \ - (void)((NETIF_MSG_##nlevel nic-msg_enable) \ - printk(KERN_##klevel PFX %s: %s: fmt, nic-netdev-name, \ - __FUNCTION__ , ## args)) #define INTEL_8255X_ETHERNET_DEVICE(device_id, ich) {\ PCI_VENDOR_ID_INTEL, device_id, PCI_ANY_ID, PCI_ANY_ID, \ @@ -645,12 +638,12 @@ static int e100_self_test(struct nic *nic) /* Check results of self-test */ if(nic-mem-selftest.result != 0) { - DPRINTK(HW, ERR, Self-test failed: result=0x%08X\n, + ndev_err(nic-netdev, HW, Self-test failed: result=0x%08X\n, nic-mem-selftest.result); return -ETIMEDOUT; } if(nic-mem-selftest.signature == 0) { - DPRINTK(HW, ERR, Self-test failed: timed out\n); + ndev_err(nic-netdev, HW, Self-test failed: timed out\n); return -ETIMEDOUT; } @@ -754,7 +747,7 @@ static int e100_eeprom_load(struct nic *nic) * the sum of words should be 0xBABA */ checksum = le16_to_cpu(0xBABA - checksum); if(checksum != nic-eeprom[nic-eeprom_wc - 1]) { - DPRINTK(PROBE, ERR, EEPROM corrupted\n); + ndev_err(nic-netdev, PROBE, EEPROM corrupted\n); if (!eeprom_bad_csum_allow) return -EAGAIN; } @@ -896,8 +889,7 @@ static u16 mdio_ctrl(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data) udelay(20); } if (unlikely(!i)) { - printk(e100.mdio_ctrl(%s) won't go Ready\n, - nic-netdev-name ); + dev_err(nic-pdev-dev, mdio_ctrl won't go Ready\n); spin_unlock_irqrestore(nic-mdio_lock, flags); return 0; /* No way to indicate timeout error */ } @@ -909,7 +901,7 @@ static u16 mdio_ctrl(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data) break; } spin_unlock_irqrestore(nic-mdio_lock, flags); - DPRINTK(HW, DEBUG, + ndev_dbg(nic-netdev, HW, %s:addr=%d, reg=%d, data_in=0x%04X, data_out=0x%04X\n, dir == mdi_read ? READ : WRITE, addr, reg, data, data_out); return (u16)data_out; @@ -962,8 +954,8 @@ static void e100_get_defaults(struct nic *nic) static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) { struct config *config = cb-u.config; - u8 *c = (u8 *)config; - + u8 *c; + cb-command = cpu_to_le16(cb_config); memset(config, 0, sizeof(struct config)); @@ -1023,12 +1015,16 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) config-standard_stat_counter = 0x0; } - DPRINTK(HW, DEBUG, [00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n, - c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]); - DPRINTK(HW, DEBUG, [08-15]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n, - c[8], c[9], c[10], c[11], c[12], c[13], c[14], c[15]); - DPRINTK(HW, DEBUG, [16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n, - c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); + c = (u8 *)config; + ndev_dbg(nic-netdev, HW, +[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n, +c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]); + ndev_dbg(nic-netdev, HW, +[08-15]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n, +c[8], c[9], c[10], c[11], c[12], c[13], c[14], c[15]); + ndev_dbg(nic-netdev, HW, +
[PATCH 2/2] [RFC] NET: Convert several drivers to ndev_printk
With the generic ndev_printk macros, we can now convert network drivers to use this generic printk family for netdevices. Signed-off-by: Auke Kok [EMAIL PROTECTED] --- drivers/net/e100.c| 121 +++-- drivers/net/e1000/e1000.h | 15 - drivers/net/e1000/e1000_ethtool.c | 39 drivers/net/e1000/e1000_main.c| 101 +++ drivers/net/e1000/e1000_param.c | 67 ++-- drivers/net/ixgb/ixgb.h | 14 drivers/net/ixgb/ixgb_ethtool.c | 15 - drivers/net/ixgb/ixgb_main.c | 46 ++ 8 files changed, 166 insertions(+), 252 deletions(-) diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 6ca0a08..56e7504 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -172,19 +172,12 @@ MODULE_AUTHOR(DRV_COPYRIGHT); MODULE_LICENSE(GPL); MODULE_VERSION(DRV_VERSION); -static int debug = 3; static int eeprom_bad_csum_allow = 0; static int use_io = 0; -module_param(debug, int, 0); module_param(eeprom_bad_csum_allow, int, 0); module_param(use_io, int, 0); -MODULE_PARM_DESC(debug, Debug level (0=none,...,16=all)); MODULE_PARM_DESC(eeprom_bad_csum_allow, Allow bad eeprom checksums); MODULE_PARM_DESC(use_io, Force use of i/o access mode); -#define DPRINTK(nlevel, klevel, fmt, args...) \ - (void)((NETIF_MSG_##nlevel nic-msg_enable) \ - printk(KERN_##klevel PFX %s: %s: fmt, nic-netdev-name, \ - __FUNCTION__ , ## args)) #define INTEL_8255X_ETHERNET_DEVICE(device_id, ich) {\ PCI_VENDOR_ID_INTEL, device_id, PCI_ANY_ID, PCI_ANY_ID, \ @@ -644,12 +637,12 @@ static int e100_self_test(struct nic *nic) /* Check results of self-test */ if(nic-mem-selftest.result != 0) { - DPRINTK(HW, ERR, Self-test failed: result=0x%08X\n, + ndev_err(HW, nic-netdev, Self-test failed: result=0x%08X\n, nic-mem-selftest.result); return -ETIMEDOUT; } if(nic-mem-selftest.signature == 0) { - DPRINTK(HW, ERR, Self-test failed: timed out\n); + ndev_err(HW, nic-netdev, Self-test failed: timed out\n); return -ETIMEDOUT; } @@ -753,7 +746,7 @@ static int e100_eeprom_load(struct nic *nic) * the sum of words should be 0xBABA */ checksum = le16_to_cpu(0xBABA - checksum); if(checksum != nic-eeprom[nic-eeprom_wc - 1]) { - DPRINTK(PROBE, ERR, EEPROM corrupted\n); + ndev_err(PROBE, nic-netdev, EEPROM corrupted\n); if (!eeprom_bad_csum_allow) return -EAGAIN; } @@ -908,7 +901,7 @@ static u16 mdio_ctrl(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data) break; } spin_unlock_irqrestore(nic-mdio_lock, flags); - DPRINTK(HW, DEBUG, + ndev_dbg(HW, nic-netdev, %s:addr=%d, reg=%d, data_in=0x%04X, data_out=0x%04X\n, dir == mdi_read ? READ : WRITE, addr, reg, data, data_out); return (u16)data_out; @@ -960,8 +953,8 @@ static void e100_get_defaults(struct nic *nic) static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) { struct config *config = cb-u.config; - u8 *c = (u8 *)config; - + u8 *c; + cb-command = cpu_to_le16(cb_config); memset(config, 0, sizeof(struct config)); @@ -1021,12 +1014,16 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) config-standard_stat_counter = 0x0; } - DPRINTK(HW, DEBUG, [00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n, - c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]); - DPRINTK(HW, DEBUG, [08-15]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n, - c[8], c[9], c[10], c[11], c[12], c[13], c[14], c[15]); - DPRINTK(HW, DEBUG, [16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n, - c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); + c = (u8 *)config; + ndev_dbg(HW, nic-netdev, +[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n, +c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]); + ndev_dbg(HW, nic-netdev, +[08-15]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n, +c[8], c[9], c[10], c[11], c[12], c[13], c[14], c[15]); + ndev_dbg(HW, nic-netdev, +[16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n, +c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); } // @@ -1296,7 +1293,7 @@ static inline int e100_exec_cb_wait(struct nic *nic, struct sk_buff *skb, struct cb *cb = nic-cb_to_clean; if ((err = e100_exec_cb(nic, NULL, e100_setup_ucode))) - DPRINTK(PROBE,ERR, ucode cmd failed with error %d\n, err); +