]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[e1000] Remove unused variable when ICR register is simply cleared
authorMichael Brown <mcb30@ipxe.org>
Wed, 16 Mar 2011 18:58:52 +0000 (18:58 +0000)
committerMichael Brown <mcb30@ipxe.org>
Wed, 16 Mar 2011 19:32:23 +0000 (19:32 +0000)
On reset and close, the ICR register is read to clear any pending
interrupts, but the value is simply ignored.  Avoid assigning the
value to a variable, to inhibit a warning from gcc 4.6.

Also fix a potential race condition in reset routines which clear
interrupts before disabling them.

Reported-by: Ralph Giles <giles@thaumas.net>
Tested-by: Ralph Giles <giles@thaumas.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
12 files changed:
src/drivers/net/e1000/e1000_82540.c
src/drivers/net/e1000/e1000_82541.c
src/drivers/net/e1000/e1000_82542.c
src/drivers/net/e1000/e1000_82543.c
src/drivers/net/e1000/e1000_main.c
src/drivers/net/e1000e/e1000e_80003es2lan.c
src/drivers/net/e1000e/e1000e_82571.c
src/drivers/net/e1000e/e1000e_ich8lan.c
src/drivers/net/e1000e/e1000e_main.c
src/drivers/net/igb/igb_82575.c
src/drivers/net/igb/igb_main.c
src/drivers/net/igbvf/igbvf_main.c

index 935f0a336e23a16f093627e248118f5ad1cc8288..41f3f979fb0684feed51be53e0ca7227ef3bfeb5 100644 (file)
@@ -271,7 +271,7 @@ void e1000_init_function_pointers_82540(struct e1000_hw *hw)
  **/
 static s32 e1000_reset_hw_82540(struct e1000_hw *hw)
 {
-       u32 ctrl, icr, manc;
+       u32 ctrl, manc;
        s32 ret_val = E1000_SUCCESS;
 
        DEBUGFUNC("e1000_reset_hw_82540");
@@ -316,7 +316,7 @@ static s32 e1000_reset_hw_82540(struct e1000_hw *hw)
        E1000_WRITE_REG(hw, E1000_MANC, manc);
 
        E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
-       icr = E1000_READ_REG(hw, E1000_ICR);
+       E1000_READ_REG(hw, E1000_ICR);
 
        return ret_val;
 }
index f1080f686033b0e9b6c5368e841c5d6b219b258e..2d1aecc70f2912a9791e32ab4e5a3f85a6c87066 100644 (file)
@@ -304,7 +304,7 @@ void e1000_init_function_pointers_82541(struct e1000_hw *hw)
  **/
 static s32 e1000_reset_hw_82541(struct e1000_hw *hw)
 {
-       u32 ledctl, ctrl, icr, manc;
+       u32 ledctl, ctrl, manc;
 
        DEBUGFUNC("e1000_reset_hw_82541");
 
@@ -368,7 +368,7 @@ static s32 e1000_reset_hw_82541(struct e1000_hw *hw)
        E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF);
 
        /* Clear any pending interrupt events. */
-       icr = E1000_READ_REG(hw, E1000_ICR);
+       E1000_READ_REG(hw, E1000_ICR);
 
        return E1000_SUCCESS;
 }
index 45f2429d3f0bf2876cc8b4cc8e5a0f41f4fc5457..b6d5202cc77786503b434fb1804f7900b8d5e72b 100644 (file)
@@ -186,7 +186,7 @@ static s32 e1000_reset_hw_82542(struct e1000_hw *hw)
 {
        struct e1000_bus_info *bus = &hw->bus;
        s32 ret_val = E1000_SUCCESS;
-       u32 ctrl, icr;
+       u32 ctrl;
 
        DEBUGFUNC("e1000_reset_hw_82542");
 
@@ -217,7 +217,7 @@ static s32 e1000_reset_hw_82542(struct e1000_hw *hw)
        msec_delay(2);
 
        E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
-       icr = E1000_READ_REG(hw, E1000_ICR);
+       E1000_READ_REG(hw, E1000_ICR);
 
        if (hw->revision_id == E1000_REVISION_2) {
                if (bus->pci_cmd_word & CMD_MEM_WRT_INVALIDATE)
index 56360944e7c41b49b3b7568d1e848475cb871aaa..848c99e76b49ca4162b8441d9e617800a1ec4113 100644 (file)
@@ -907,7 +907,7 @@ static s32 e1000_phy_hw_reset_82543(struct e1000_hw *hw)
  **/
 static s32 e1000_reset_hw_82543(struct e1000_hw *hw)
 {
-       u32 ctrl, icr;
+       u32 ctrl;
        s32 ret_val = E1000_SUCCESS;
 
        DEBUGFUNC("e1000_reset_hw_82543");
@@ -949,7 +949,7 @@ static s32 e1000_reset_hw_82543(struct e1000_hw *hw)
 
        /* Masking off and clearing any pending interrupts */
        E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
-       icr = E1000_READ_REG(hw, E1000_ICR);
+       E1000_READ_REG(hw, E1000_ICR);
 
        return ret_val;
 }
index 2708e63f0d8606b9c0403302d9ae32f5ee80eac6..653323b51b68f237ec7248a1c80294678bc20f66 100644 (file)
@@ -554,14 +554,12 @@ static void e1000_close ( struct net_device *netdev )
        struct e1000_adapter *adapter = netdev_priv ( netdev );
        struct e1000_hw *hw = &adapter->hw;
        uint32_t rctl;
-       uint32_t icr;
 
        DBG ( "e1000_close\n" );
 
-       /* Acknowledge interrupts */
-       icr = E1000_READ_REG ( hw, E1000_ICR );
-
+       /* Disable and acknowledge interrupts */
        e1000_irq_disable ( adapter );
+       E1000_READ_REG ( hw, E1000_ICR );
 
        /* disable receives */
        rctl = E1000_READ_REG ( hw, E1000_RCTL );
index a9ebc77e7ed1259e4d41ab27790ee5f749958084..a3eed9b731af6b79b0f90b6507e4964266c104e4 100644 (file)
@@ -841,7 +841,7 @@ static s32 e1000e_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed,
  **/
 static s32 e1000e_reset_hw_80003es2lan(struct e1000_hw *hw)
 {
-       u32 ctrl, icr;
+       u32 ctrl;
        s32 ret_val;
 
        /*
@@ -875,7 +875,7 @@ static s32 e1000e_reset_hw_80003es2lan(struct e1000_hw *hw)
 
        /* Clear any pending interrupt events. */
        ew32(IMC, 0xffffffff);
-       icr = er32(ICR);
+       er32(ICR);
 
        ret_val = e1000e_check_alt_mac_addr_generic(hw);
 
index 840e29b23703f00a509482b599a0f6dcf07c5668..a061d6d4959394f208bb73c566d38bf16c2f96be 100644 (file)
@@ -919,7 +919,7 @@ out:
  **/
 static s32 e1000e_reset_hw_82571(struct e1000_hw *hw)
 {
-       u32 ctrl, extcnf_ctrl, ctrl_ext, icr;
+       u32 ctrl, extcnf_ctrl, ctrl_ext;
        s32 ret_val;
        u16 i = 0;
 
@@ -1004,7 +1004,7 @@ static s32 e1000e_reset_hw_82571(struct e1000_hw *hw)
 
        /* Clear any pending interrupt events. */
        ew32(IMC, 0xffffffff);
-       icr = er32(ICR);
+       er32(ICR);
 
        /* Install any alternate MAC address into RAR0 */
        ret_val = e1000e_check_alt_mac_addr_generic(hw);
index 1f9b3c4d8de68788d31c8652a4dca84dbdea560e..7b9a49b98f1ed9585308730efbd67994efd19968 100644 (file)
@@ -2486,7 +2486,7 @@ static s32 e1000e_reset_hw_ich8lan(struct e1000_hw *hw)
 {
        struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
        u16 reg;
-       u32 ctrl, icr, kab;
+       u32 ctrl, kab;
        s32 ret_val;
 
        /*
@@ -2594,7 +2594,7 @@ static s32 e1000e_reset_hw_ich8lan(struct e1000_hw *hw)
                ew32(CRC_OFFSET, 0x65656565);
 
        ew32(IMC, 0xffffffff);
-       icr = er32(ICR);
+       er32(ICR);
 
        kab = er32(KABGTXD);
        kab |= E1000_KABGTXD_BGSQLBIAS;
index cfe114bdc74028708363ea146ebce611b1d4389a..e5cb2490a87d07094906cb5960ce9bce6e9ba55d 100644 (file)
@@ -873,14 +873,12 @@ static void e1000e_close ( struct net_device *netdev )
        struct e1000_adapter *adapter = netdev_priv ( netdev );
        struct e1000_hw *hw = &adapter->hw;
        uint32_t rctl;
-       uint32_t icr;
 
        DBGP ( "e1000_close\n" );
 
-       /* Acknowledge interrupts */
-       icr = E1000_READ_REG ( hw, E1000_ICR );
-
+       /* Disable and acknowledge interrupts */
        e1000e_irq_disable ( adapter );
+       E1000_READ_REG ( hw, E1000_ICR );
 
        /* disable receives */
        rctl = E1000_READ_REG ( hw, E1000_RCTL );
index fe25e2e7c84dff01e7c50c3fbbf24103e3494905..b5b615ad44adc25832aeceab38e3f88f768d7aab 100644 (file)
@@ -959,7 +959,7 @@ void igb_shutdown_serdes_link_82575(struct e1000_hw *hw)
  **/
 static s32 igb_reset_hw_82575(struct e1000_hw *hw)
 {
-       u32 ctrl, icr;
+       u32 ctrl;
        s32 ret_val;
 
        DEBUGFUNC("igb_reset_hw_82575");
@@ -1009,7 +1009,7 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw)
 
        /* Clear any pending interrupt events. */
        E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
-       icr = E1000_READ_REG(hw, E1000_ICR);
+       E1000_READ_REG(hw, E1000_ICR);
 
        /* Install any alternate MAC address into RAR0 */
        ret_val = igb_check_alt_mac_addr_generic(hw);
index 8d6415282f9a9b088185f5215308e1d75699feee..9295c2c8c994a65f22e162881c87ae06bb33f4cf 100644 (file)
@@ -639,14 +639,12 @@ static void igb_close ( struct net_device *netdev )
        struct igb_adapter *adapter = netdev_priv ( netdev );
        struct e1000_hw *hw = &adapter->hw;
        uint32_t rctl;
-       uint32_t icr;
 
        DBGP ( "igb_close\n" );
 
-       /* Acknowledge interrupts */
-       icr = E1000_READ_REG ( hw, E1000_ICR );
-
+       /* Disable and acknowledge interrupts */
        igb_irq_disable ( adapter );
+       E1000_READ_REG ( hw, E1000_ICR );
 
        /* disable receives */
        rctl = E1000_READ_REG ( hw, E1000_RCTL );
index da55805076380fe01a5f4bc45f89b7f6889d856e..1f7e1dfd9afb9aef15ba4ebc461e7a3944e3ca2f 100644 (file)
@@ -666,12 +666,12 @@ static void igbvf_close ( struct net_device *netdev )
        struct igbvf_adapter *adapter = netdev_priv ( netdev );
         struct e1000_hw *hw = &adapter->hw;
         uint32_t rxdctl;
-        uint32_t icr;
 
         DBG ( "igbvf_close\n" );
-        icr = er32(EICR);
 
+       /* Disable and acknowledge interrupts */
         igbvf_irq_disable ( adapter );
+        er32(EICR);
 
         /* disable receives */
         rxdctl = er32 ( RXDCTL(0) );