aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e
diff options
context:
space:
mode:
authorBruce Allan <bruce.w.allan@intel.com>2011-01-06 02:02:53 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-01-24 03:13:56 -0500
commit90da06692532541a38f9857972e1fd6b1cdfb45a (patch)
treeb57994ef65c615e0cf34a57f692fed67b95f3dd1 /drivers/net/e1000e
parent67fd4fcb78a7ced369a6bd8a131ec8c65ebd2bbb (diff)
e1000e: reduce scope of some variables, remove unnecessary ones
Static analysis of the driver code found some variables for which the scope can be reduced, or remove the variable altogether. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r--drivers/net/e1000e/ethtool.c4
-rw-r--r--drivers/net/e1000e/ich8lan.c3
-rw-r--r--drivers/net/e1000e/lib.c4
-rw-r--r--drivers/net/e1000e/netdev.c45
-rw-r--r--drivers/net/e1000e/phy.c8
5 files changed, 31 insertions, 33 deletions
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index dfa44de9cf0d..323fd12c306b 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -1255,7 +1255,6 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1255{ 1255{
1256 struct e1000_hw *hw = &adapter->hw; 1256 struct e1000_hw *hw = &adapter->hw;
1257 u32 ctrl_reg = 0; 1257 u32 ctrl_reg = 0;
1258 u32 stat_reg = 0;
1259 u16 phy_reg = 0; 1258 u16 phy_reg = 0;
1260 s32 ret_val = 0; 1259 s32 ret_val = 0;
1261 1260
@@ -1363,8 +1362,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1363 * Set the ILOS bit on the fiber Nic if half duplex link is 1362 * Set the ILOS bit on the fiber Nic if half duplex link is
1364 * detected. 1363 * detected.
1365 */ 1364 */
1366 stat_reg = er32(STATUS); 1365 if ((er32(STATUS) & E1000_STATUS_FD) == 0)
1367 if ((stat_reg & E1000_STATUS_FD) == 0)
1368 ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU); 1366 ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU);
1369 } 1367 }
1370 1368
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index fb46974cfec1..232b42b7f7ce 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -2104,7 +2104,6 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw)
2104{ 2104{
2105 union ich8_hws_flash_status hsfsts; 2105 union ich8_hws_flash_status hsfsts;
2106 s32 ret_val = -E1000_ERR_NVM; 2106 s32 ret_val = -E1000_ERR_NVM;
2107 s32 i = 0;
2108 2107
2109 hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); 2108 hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2110 2109
@@ -2140,6 +2139,8 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw)
2140 ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval); 2139 ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval);
2141 ret_val = 0; 2140 ret_val = 0;
2142 } else { 2141 } else {
2142 s32 i = 0;
2143
2143 /* 2144 /*
2144 * Otherwise poll for sometime so the current 2145 * Otherwise poll for sometime so the current
2145 * cycle has a chance to end before giving up. 2146 * cycle has a chance to end before giving up.
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index 68aa1749bf66..96921de5df2e 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -1978,15 +1978,15 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw)
1978{ 1978{
1979 struct e1000_nvm_info *nvm = &hw->nvm; 1979 struct e1000_nvm_info *nvm = &hw->nvm;
1980 u32 eecd = er32(EECD); 1980 u32 eecd = er32(EECD);
1981 u16 timeout = 0;
1982 u8 spi_stat_reg; 1981 u8 spi_stat_reg;
1983 1982
1984 if (nvm->type == e1000_nvm_eeprom_spi) { 1983 if (nvm->type == e1000_nvm_eeprom_spi) {
1984 u16 timeout = NVM_MAX_RETRY_SPI;
1985
1985 /* Clear SK and CS */ 1986 /* Clear SK and CS */
1986 eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); 1987 eecd &= ~(E1000_EECD_CS | E1000_EECD_SK);
1987 ew32(EECD, eecd); 1988 ew32(EECD, eecd);
1988 udelay(1); 1989 udelay(1);
1989 timeout = NVM_MAX_RETRY_SPI;
1990 1990
1991 /* 1991 /*
1992 * Read "Status Register" repeatedly until the LSB is cleared. 1992 * Read "Status Register" repeatedly until the LSB is cleared.
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 1c2f33dd0633..5b916b01805f 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -2720,7 +2720,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
2720{ 2720{
2721 struct e1000_hw *hw = &adapter->hw; 2721 struct e1000_hw *hw = &adapter->hw;
2722 u32 rctl, rfctl; 2722 u32 rctl, rfctl;
2723 u32 psrctl = 0;
2724 u32 pages = 0; 2723 u32 pages = 0;
2725 2724
2726 /* Workaround Si errata on 82579 - configure jumbo frame flow */ 2725 /* Workaround Si errata on 82579 - configure jumbo frame flow */
@@ -2819,6 +2818,8 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
2819 adapter->rx_ps_pages = 0; 2818 adapter->rx_ps_pages = 0;
2820 2819
2821 if (adapter->rx_ps_pages) { 2820 if (adapter->rx_ps_pages) {
2821 u32 psrctl = 0;
2822
2822 /* Configure extra packet-split registers */ 2823 /* Configure extra packet-split registers */
2823 rfctl = er32(RFCTL); 2824 rfctl = er32(RFCTL);
2824 rfctl |= E1000_RFCTL_EXTEN; 2825 rfctl |= E1000_RFCTL_EXTEN;
@@ -3020,7 +3021,6 @@ static void e1000_set_multi(struct net_device *netdev)
3020 struct netdev_hw_addr *ha; 3021 struct netdev_hw_addr *ha;
3021 u8 *mta_list; 3022 u8 *mta_list;
3022 u32 rctl; 3023 u32 rctl;
3023 int i;
3024 3024
3025 /* Check for Promiscuous and All Multicast modes */ 3025 /* Check for Promiscuous and All Multicast modes */
3026 3026
@@ -3043,12 +3043,13 @@ static void e1000_set_multi(struct net_device *netdev)
3043 ew32(RCTL, rctl); 3043 ew32(RCTL, rctl);
3044 3044
3045 if (!netdev_mc_empty(netdev)) { 3045 if (!netdev_mc_empty(netdev)) {
3046 int i = 0;
3047
3046 mta_list = kmalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC); 3048 mta_list = kmalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC);
3047 if (!mta_list) 3049 if (!mta_list)
3048 return; 3050 return;
3049 3051
3050 /* prepare a packed array of only addresses. */ 3052 /* prepare a packed array of only addresses. */
3051 i = 0;
3052 netdev_for_each_mc_addr(ha, netdev) 3053 netdev_for_each_mc_addr(ha, netdev)
3053 memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN); 3054 memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN);
3054 3055
@@ -3999,10 +4000,11 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
3999{ 4000{
4000 struct e1000_hw *hw = &adapter->hw; 4001 struct e1000_hw *hw = &adapter->hw;
4001 struct e1000_phy_regs *phy = &adapter->phy_regs; 4002 struct e1000_phy_regs *phy = &adapter->phy_regs;
4002 int ret_val;
4003 4003
4004 if ((er32(STATUS) & E1000_STATUS_LU) && 4004 if ((er32(STATUS) & E1000_STATUS_LU) &&
4005 (adapter->hw.phy.media_type == e1000_media_type_copper)) { 4005 (adapter->hw.phy.media_type == e1000_media_type_copper)) {
4006 int ret_val;
4007
4006 ret_val = e1e_rphy(hw, PHY_CONTROL, &phy->bmcr); 4008 ret_val = e1e_rphy(hw, PHY_CONTROL, &phy->bmcr);
4007 ret_val |= e1e_rphy(hw, PHY_STATUS, &phy->bmsr); 4009 ret_val |= e1e_rphy(hw, PHY_STATUS, &phy->bmsr);
4008 ret_val |= e1e_rphy(hw, PHY_AUTONEG_ADV, &phy->advertise); 4010 ret_val |= e1e_rphy(hw, PHY_AUTONEG_ADV, &phy->advertise);
@@ -4148,7 +4150,6 @@ static void e1000_watchdog_task(struct work_struct *work)
4148 struct e1000_ring *tx_ring = adapter->tx_ring; 4150 struct e1000_ring *tx_ring = adapter->tx_ring;
4149 struct e1000_hw *hw = &adapter->hw; 4151 struct e1000_hw *hw = &adapter->hw;
4150 u32 link, tctl; 4152 u32 link, tctl;
4151 int tx_pending = 0;
4152 4153
4153 link = e1000e_has_link(adapter); 4154 link = e1000e_has_link(adapter);
4154 if ((netif_carrier_ok(netdev)) && link) { 4155 if ((netif_carrier_ok(netdev)) && link) {
@@ -4302,21 +4303,18 @@ link_up:
4302 4303
4303 e1000e_update_adaptive(&adapter->hw); 4304 e1000e_update_adaptive(&adapter->hw);
4304 4305
4305 if (!netif_carrier_ok(netdev)) { 4306 if (!netif_carrier_ok(netdev) &&
4306 tx_pending = (e1000_desc_unused(tx_ring) + 1 < 4307 (e1000_desc_unused(tx_ring) + 1 < tx_ring->count)) {
4307 tx_ring->count); 4308 /*
4308 if (tx_pending) { 4309 * We've lost link, so the controller stops DMA,
4309 /* 4310 * but we've got queued Tx work that's never going
4310 * We've lost link, so the controller stops DMA, 4311 * to get done, so reset controller to flush Tx.
4311 * but we've got queued Tx work that's never going 4312 * (Do the reset outside of interrupt context).
4312 * to get done, so reset controller to flush Tx. 4313 */
4313 * (Do the reset outside of interrupt context). 4314 adapter->tx_timeout_count++;
4314 */ 4315 schedule_work(&adapter->reset_task);
4315 adapter->tx_timeout_count++; 4316 /* return immediately since reset is imminent */
4316 schedule_work(&adapter->reset_task); 4317 return;
4317 /* return immediately since reset is imminent */
4318 return;
4319 }
4320 } 4318 }
4321 4319
4322 /* Simple mode for Interrupt Throttle Rate (ITR) */ 4320 /* Simple mode for Interrupt Throttle Rate (ITR) */
@@ -4387,13 +4385,13 @@ static int e1000_tso(struct e1000_adapter *adapter,
4387 u32 cmd_length = 0; 4385 u32 cmd_length = 0;
4388 u16 ipcse = 0, tucse, mss; 4386 u16 ipcse = 0, tucse, mss;
4389 u8 ipcss, ipcso, tucss, tucso, hdr_len; 4387 u8 ipcss, ipcso, tucss, tucso, hdr_len;
4390 int err;
4391 4388
4392 if (!skb_is_gso(skb)) 4389 if (!skb_is_gso(skb))
4393 return 0; 4390 return 0;
4394 4391
4395 if (skb_header_cloned(skb)) { 4392 if (skb_header_cloned(skb)) {
4396 err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); 4393 int err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
4394
4397 if (err) 4395 if (err)
4398 return err; 4396 return err;
4399 } 4397 }
@@ -5518,9 +5516,10 @@ static irqreturn_t e1000_intr_msix(int irq, void *data)
5518{ 5516{
5519 struct net_device *netdev = data; 5517 struct net_device *netdev = data;
5520 struct e1000_adapter *adapter = netdev_priv(netdev); 5518 struct e1000_adapter *adapter = netdev_priv(netdev);
5521 int vector, msix_irq;
5522 5519
5523 if (adapter->msix_entries) { 5520 if (adapter->msix_entries) {
5521 int vector, msix_irq;
5522
5524 vector = 0; 5523 vector = 0;
5525 msix_irq = adapter->msix_entries[vector].vector; 5524 msix_irq = adapter->msix_entries[vector].vector;
5526 disable_irq(msix_irq); 5525 disable_irq(msix_irq);
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 6bea051b134b..6ae31fcfb629 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -2409,9 +2409,7 @@ static u32 e1000_get_phy_addr_for_bm_page(u32 page, u32 reg)
2409s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) 2409s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data)
2410{ 2410{
2411 s32 ret_val; 2411 s32 ret_val;
2412 u32 page_select = 0;
2413 u32 page = offset >> IGP_PAGE_SHIFT; 2412 u32 page = offset >> IGP_PAGE_SHIFT;
2414 u32 page_shift = 0;
2415 2413
2416 ret_val = hw->phy.ops.acquire(hw); 2414 ret_val = hw->phy.ops.acquire(hw);
2417 if (ret_val) 2415 if (ret_val)
@@ -2427,6 +2425,8 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data)
2427 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); 2425 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset);
2428 2426
2429 if (offset > MAX_PHY_MULTI_PAGE_REG) { 2427 if (offset > MAX_PHY_MULTI_PAGE_REG) {
2428 u32 page_shift, page_select;
2429
2430 /* 2430 /*
2431 * Page select is register 31 for phy address 1 and 22 for 2431 * Page select is register 31 for phy address 1 and 22 for
2432 * phy address 2 and 3. Page select is shifted only for 2432 * phy address 2 and 3. Page select is shifted only for
@@ -2468,9 +2468,7 @@ out:
2468s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) 2468s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data)
2469{ 2469{
2470 s32 ret_val; 2470 s32 ret_val;
2471 u32 page_select = 0;
2472 u32 page = offset >> IGP_PAGE_SHIFT; 2471 u32 page = offset >> IGP_PAGE_SHIFT;
2473 u32 page_shift = 0;
2474 2472
2475 ret_val = hw->phy.ops.acquire(hw); 2473 ret_val = hw->phy.ops.acquire(hw);
2476 if (ret_val) 2474 if (ret_val)
@@ -2486,6 +2484,8 @@ s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data)
2486 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); 2484 hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset);
2487 2485
2488 if (offset > MAX_PHY_MULTI_PAGE_REG) { 2486 if (offset > MAX_PHY_MULTI_PAGE_REG) {
2487 u32 page_shift, page_select;
2488
2489 /* 2489 /*
2490 * Page select is register 31 for phy address 1 and 22 for 2490 * Page select is register 31 for phy address 1 and 22 for
2491 * phy address 2 and 3. Page select is shifted only for 2491 * phy address 2 and 3. Page select is shifted only for