aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e/netdev.c
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/netdev.c
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/netdev.c')
-rw-r--r--drivers/net/e1000e/netdev.c45
1 files changed, 22 insertions, 23 deletions
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);