Commit 44defeb3 authored by Jeff Kirsher's avatar Jeff Kirsher Committed by Jeff Garzik

e1000e: convert ndev_ printks to something smaller

The ndev_* printk's are too lenghty and we don't need to specify
the adapter/netdev struct at all, making this a lot more readable.
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarAuke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 77970ea5
...@@ -41,24 +41,25 @@ ...@@ -41,24 +41,25 @@
struct e1000_info; struct e1000_info;
#define ndev_printk(level, netdev, format, arg...) \ #define e_printk(level, adapter, format, arg...) \
printk(level "%s: " format, (netdev)->name, ## arg) printk(level "%s: %s: " format, pci_name(adapter->pdev), \
adapter->netdev->name, ## arg)
#ifdef DEBUG #ifdef DEBUG
#define ndev_dbg(netdev, format, arg...) \ #define e_dbg(format, arg...) \
ndev_printk(KERN_DEBUG , netdev, format, ## arg) e_printk(KERN_DEBUG , adapter, format, ## arg)
#else #else
#define ndev_dbg(netdev, format, arg...) do { (void)(netdev); } while (0) #define e_dbg(format, arg...) do { (void)(adapter); } while (0)
#endif #endif
#define ndev_err(netdev, format, arg...) \ #define e_err(format, arg...) \
ndev_printk(KERN_ERR , netdev, format, ## arg) e_printk(KERN_ERR, adapter, format, ## arg)
#define ndev_info(netdev, format, arg...) \ #define e_info(format, arg...) \
ndev_printk(KERN_INFO , netdev, format, ## arg) e_printk(KERN_INFO, adapter, format, ## arg)
#define ndev_warn(netdev, format, arg...) \ #define e_warn(format, arg...) \
ndev_printk(KERN_WARNING , netdev, format, ## arg) e_printk(KERN_WARNING, adapter, format, ## arg)
#define ndev_notice(netdev, format, arg...) \ #define e_notice(format, arg...) \
ndev_printk(KERN_NOTICE , netdev, format, ## arg) e_printk(KERN_NOTICE, adapter, format, ## arg)
/* Tx/Rx descriptor defines */ /* Tx/Rx descriptor defines */
......
...@@ -189,8 +189,7 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx) ...@@ -189,8 +189,7 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
/* Fiber NICs only allow 1000 gbps Full duplex */ /* Fiber NICs only allow 1000 gbps Full duplex */
if ((adapter->hw.phy.media_type == e1000_media_type_fiber) && if ((adapter->hw.phy.media_type == e1000_media_type_fiber) &&
spddplx != (SPEED_1000 + DUPLEX_FULL)) { spddplx != (SPEED_1000 + DUPLEX_FULL)) {
ndev_err(adapter->netdev, "Unsupported Speed/Duplex " e_err("Unsupported Speed/Duplex configuration\n");
"configuration\n");
return -EINVAL; return -EINVAL;
} }
...@@ -213,8 +212,7 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx) ...@@ -213,8 +212,7 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
break; break;
case SPEED_1000 + DUPLEX_HALF: /* not supported */ case SPEED_1000 + DUPLEX_HALF: /* not supported */
default: default:
ndev_err(adapter->netdev, "Unsupported Speed/Duplex " e_err("Unsupported Speed/Duplex configuration\n");
"configuration\n");
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
...@@ -231,8 +229,8 @@ static int e1000_set_settings(struct net_device *netdev, ...@@ -231,8 +229,8 @@ static int e1000_set_settings(struct net_device *netdev,
* cannot be changed * cannot be changed
*/ */
if (e1000_check_reset_block(hw)) { if (e1000_check_reset_block(hw)) {
ndev_err(netdev, "Cannot change link " e_err("Cannot change link characteristics when SoL/IDER is "
"characteristics when SoL/IDER is active.\n"); "active.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -380,8 +378,7 @@ static int e1000_set_tso(struct net_device *netdev, u32 data) ...@@ -380,8 +378,7 @@ static int e1000_set_tso(struct net_device *netdev, u32 data)
netdev->features &= ~NETIF_F_TSO6; netdev->features &= ~NETIF_F_TSO6;
} }
ndev_info(netdev, "TSO is %s\n", e_info("TSO is %s\n", data ? "Enabled" : "Disabled");
data ? "Enabled" : "Disabled");
adapter->flags |= FLAG_TSO_FORCE; adapter->flags |= FLAG_TSO_FORCE;
return 0; return 0;
} }
...@@ -722,10 +719,9 @@ static bool reg_pattern_test(struct e1000_adapter *adapter, u64 *data, ...@@ -722,10 +719,9 @@ static bool reg_pattern_test(struct e1000_adapter *adapter, u64 *data,
(test[pat] & write)); (test[pat] & write));
val = E1000_READ_REG_ARRAY(&adapter->hw, reg, offset); val = E1000_READ_REG_ARRAY(&adapter->hw, reg, offset);
if (val != (test[pat] & write & mask)) { if (val != (test[pat] & write & mask)) {
ndev_err(adapter->netdev, "pattern test reg %04X " e_err("pattern test reg %04X failed: got 0x%08X "
"failed: got 0x%08X expected 0x%08X\n", "expected 0x%08X\n", reg + offset, val,
reg + offset, (test[pat] & write & mask));
val, (test[pat] & write & mask));
*data = reg; *data = reg;
return 1; return 1;
} }
...@@ -740,9 +736,8 @@ static bool reg_set_and_check(struct e1000_adapter *adapter, u64 *data, ...@@ -740,9 +736,8 @@ static bool reg_set_and_check(struct e1000_adapter *adapter, u64 *data,
__ew32(&adapter->hw, reg, write & mask); __ew32(&adapter->hw, reg, write & mask);
val = __er32(&adapter->hw, reg); val = __er32(&adapter->hw, reg);
if ((write & mask) != (val & mask)) { if ((write & mask) != (val & mask)) {
ndev_err(adapter->netdev, "set/check reg %04X test failed: " e_err("set/check reg %04X test failed: got 0x%08X "
"got 0x%08X expected 0x%08X\n", reg, (val & mask), "expected 0x%08X\n", reg, (val & mask), (write & mask));
(write & mask));
*data = reg; *data = reg;
return 1; return 1;
} }
...@@ -766,7 +761,6 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data) ...@@ -766,7 +761,6 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
struct e1000_mac_info *mac = &adapter->hw.mac; struct e1000_mac_info *mac = &adapter->hw.mac;
struct net_device *netdev = adapter->netdev;
u32 value; u32 value;
u32 before; u32 before;
u32 after; u32 after;
...@@ -799,8 +793,8 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data) ...@@ -799,8 +793,8 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
ew32(STATUS, toggle); ew32(STATUS, toggle);
after = er32(STATUS) & toggle; after = er32(STATUS) & toggle;
if (value != after) { if (value != after) {
ndev_err(netdev, "failed STATUS register test got: " e_err("failed STATUS register test got: 0x%08X expected: "
"0x%08X expected: 0x%08X\n", after, value); "0x%08X\n", after, value);
*data = 1; *data = 1;
return 1; return 1;
} }
...@@ -903,8 +897,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data) ...@@ -903,8 +897,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
*data = 1; *data = 1;
return -1; return -1;
} }
ndev_info(netdev, "testing %s interrupt\n", e_info("testing %s interrupt\n", (shared_int ? "shared" : "unshared"));
(shared_int ? "shared" : "unshared"));
/* Disable all the interrupts */ /* Disable all the interrupts */
ew32(IMC, 0xFFFFFFFF); ew32(IMC, 0xFFFFFFFF);
...@@ -1526,8 +1519,7 @@ static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data) ...@@ -1526,8 +1519,7 @@ static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data)
* sessions are active * sessions are active
*/ */
if (e1000_check_reset_block(&adapter->hw)) { if (e1000_check_reset_block(&adapter->hw)) {
ndev_err(adapter->netdev, "Cannot do PHY loopback test " e_err("Cannot do PHY loopback test when SoL/IDER is active.\n");
"when SoL/IDER is active.\n");
*data = 0; *data = 0;
goto out; goto out;
} }
...@@ -1612,7 +1604,7 @@ static void e1000_diag_test(struct net_device *netdev, ...@@ -1612,7 +1604,7 @@ static void e1000_diag_test(struct net_device *netdev,
forced_speed_duplex = adapter->hw.mac.forced_speed_duplex; forced_speed_duplex = adapter->hw.mac.forced_speed_duplex;
autoneg = adapter->hw.mac.autoneg; autoneg = adapter->hw.mac.autoneg;
ndev_info(netdev, "offline testing starting\n"); e_info("offline testing starting\n");
/* /*
* Link test performed before hardware reset so autoneg doesn't * Link test performed before hardware reset so autoneg doesn't
...@@ -1658,7 +1650,7 @@ static void e1000_diag_test(struct net_device *netdev, ...@@ -1658,7 +1650,7 @@ static void e1000_diag_test(struct net_device *netdev,
if (if_running) if (if_running)
dev_open(netdev); dev_open(netdev);
} else { } else {
ndev_info(netdev, "online testing starting\n"); e_info("online testing starting\n");
/* Online tests */ /* Online tests */
if (e1000_link_test(adapter, &data[4])) if (e1000_link_test(adapter, &data[4]))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
...@@ -1694,8 +1686,8 @@ static void e1000_get_wol(struct net_device *netdev, ...@@ -1694,8 +1686,8 @@ static void e1000_get_wol(struct net_device *netdev,
wol->supported &= ~WAKE_UCAST; wol->supported &= ~WAKE_UCAST;
if (adapter->wol & E1000_WUFC_EX) if (adapter->wol & E1000_WUFC_EX)
ndev_err(netdev, "Interface does not support " e_err("Interface does not support directed (unicast) "
"directed (unicast) frame wake-up packets\n"); "frame wake-up packets\n");
} }
if (adapter->wol & E1000_WUFC_EX) if (adapter->wol & E1000_WUFC_EX)
......
This diff is collapsed.
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
*******************************************************************************/ *******************************************************************************/
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/pci.h>
#include "e1000.h" #include "e1000.h"
...@@ -162,17 +163,16 @@ static int __devinit e1000_validate_option(unsigned int *value, ...@@ -162,17 +163,16 @@ static int __devinit e1000_validate_option(unsigned int *value,
case enable_option: case enable_option:
switch (*value) { switch (*value) {
case OPTION_ENABLED: case OPTION_ENABLED:
ndev_info(adapter->netdev, "%s Enabled\n", opt->name); e_info("%s Enabled\n", opt->name);
return 0; return 0;
case OPTION_DISABLED: case OPTION_DISABLED:
ndev_info(adapter->netdev, "%s Disabled\n", opt->name); e_info("%s Disabled\n", opt->name);
return 0; return 0;
} }
break; break;
case range_option: case range_option:
if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) { if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
ndev_info(adapter->netdev, e_info("%s set to %i\n", opt->name, *value);
"%s set to %i\n", opt->name, *value);
return 0; return 0;
} }
break; break;
...@@ -184,8 +184,7 @@ static int __devinit e1000_validate_option(unsigned int *value, ...@@ -184,8 +184,7 @@ static int __devinit e1000_validate_option(unsigned int *value,
ent = &opt->arg.l.p[i]; ent = &opt->arg.l.p[i];
if (*value == ent->i) { if (*value == ent->i) {
if (ent->str[0] != '\0') if (ent->str[0] != '\0')
ndev_info(adapter->netdev, "%s\n", e_info("%s\n", ent->str);
ent->str);
return 0; return 0;
} }
} }
...@@ -195,8 +194,8 @@ static int __devinit e1000_validate_option(unsigned int *value, ...@@ -195,8 +194,8 @@ static int __devinit e1000_validate_option(unsigned int *value,
BUG(); BUG();
} }
ndev_info(adapter->netdev, "Invalid %s value specified (%i) %s\n", e_info("Invalid %s value specified (%i) %s\n", opt->name, *value,
opt->name, *value, opt->err); opt->err);
*value = opt->def; *value = opt->def;
return -1; return -1;
} }
...@@ -213,13 +212,11 @@ static int __devinit e1000_validate_option(unsigned int *value, ...@@ -213,13 +212,11 @@ static int __devinit e1000_validate_option(unsigned int *value,
void __devinit e1000e_check_options(struct e1000_adapter *adapter) void __devinit e1000e_check_options(struct e1000_adapter *adapter)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
struct net_device *netdev = adapter->netdev;
int bd = adapter->bd_number; int bd = adapter->bd_number;
if (bd >= E1000_MAX_NIC) { if (bd >= E1000_MAX_NIC) {
ndev_notice(netdev, e_notice("Warning: no configuration for board #%i\n", bd);
"Warning: no configuration for board #%i\n", bd); e_notice("Using defaults for all values\n");
ndev_notice(netdev, "Using defaults for all values\n");
} }
{ /* Transmit Interrupt Delay */ { /* Transmit Interrupt Delay */
...@@ -313,19 +310,15 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) ...@@ -313,19 +310,15 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
adapter->itr = InterruptThrottleRate[bd]; adapter->itr = InterruptThrottleRate[bd];
switch (adapter->itr) { switch (adapter->itr) {
case 0: case 0:
ndev_info(netdev, "%s turned off\n", e_info("%s turned off\n", opt.name);
opt.name);
break; break;
case 1: case 1:
ndev_info(netdev, e_info("%s set to dynamic mode\n", opt.name);
"%s set to dynamic mode\n",
opt.name);
adapter->itr_setting = adapter->itr; adapter->itr_setting = adapter->itr;
adapter->itr = 20000; adapter->itr = 20000;
break; break;
case 3: case 3:
ndev_info(netdev, e_info("%s set to dynamic conservative mode\n",
"%s set to dynamic conservative mode\n",
opt.name); opt.name);
adapter->itr_setting = adapter->itr; adapter->itr_setting = adapter->itr;
adapter->itr = 20000; adapter->itr = 20000;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment