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