Browse Source

[e1000] Remove unused variable when ICR register is simply cleared

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>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
c018d57803

+ 2
- 2
src/drivers/net/e1000/e1000_82540.c View File

@@ -271,7 +271,7 @@ void e1000_init_function_pointers_82540(struct e1000_hw *hw)
271 271
  **/
272 272
 static s32 e1000_reset_hw_82540(struct e1000_hw *hw)
273 273
 {
274
-	u32 ctrl, icr, manc;
274
+	u32 ctrl, manc;
275 275
 	s32 ret_val = E1000_SUCCESS;
276 276
 
277 277
 	DEBUGFUNC("e1000_reset_hw_82540");
@@ -316,7 +316,7 @@ static s32 e1000_reset_hw_82540(struct e1000_hw *hw)
316 316
 	E1000_WRITE_REG(hw, E1000_MANC, manc);
317 317
 
318 318
 	E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
319
-	icr = E1000_READ_REG(hw, E1000_ICR);
319
+	E1000_READ_REG(hw, E1000_ICR);
320 320
 
321 321
 	return ret_val;
322 322
 }

+ 2
- 2
src/drivers/net/e1000/e1000_82541.c View File

@@ -304,7 +304,7 @@ void e1000_init_function_pointers_82541(struct e1000_hw *hw)
304 304
  **/
305 305
 static s32 e1000_reset_hw_82541(struct e1000_hw *hw)
306 306
 {
307
-	u32 ledctl, ctrl, icr, manc;
307
+	u32 ledctl, ctrl, manc;
308 308
 
309 309
 	DEBUGFUNC("e1000_reset_hw_82541");
310 310
 
@@ -368,7 +368,7 @@ static s32 e1000_reset_hw_82541(struct e1000_hw *hw)
368 368
 	E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF);
369 369
 
370 370
 	/* Clear any pending interrupt events. */
371
-	icr = E1000_READ_REG(hw, E1000_ICR);
371
+	E1000_READ_REG(hw, E1000_ICR);
372 372
 
373 373
 	return E1000_SUCCESS;
374 374
 }

+ 2
- 2
src/drivers/net/e1000/e1000_82542.c View File

@@ -186,7 +186,7 @@ static s32 e1000_reset_hw_82542(struct e1000_hw *hw)
186 186
 {
187 187
 	struct e1000_bus_info *bus = &hw->bus;
188 188
 	s32 ret_val = E1000_SUCCESS;
189
-	u32 ctrl, icr;
189
+	u32 ctrl;
190 190
 
191 191
 	DEBUGFUNC("e1000_reset_hw_82542");
192 192
 
@@ -217,7 +217,7 @@ static s32 e1000_reset_hw_82542(struct e1000_hw *hw)
217 217
 	msec_delay(2);
218 218
 
219 219
 	E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
220
-	icr = E1000_READ_REG(hw, E1000_ICR);
220
+	E1000_READ_REG(hw, E1000_ICR);
221 221
 
222 222
 	if (hw->revision_id == E1000_REVISION_2) {
223 223
 		if (bus->pci_cmd_word & CMD_MEM_WRT_INVALIDATE)

+ 2
- 2
src/drivers/net/e1000/e1000_82543.c View File

@@ -907,7 +907,7 @@ static s32 e1000_phy_hw_reset_82543(struct e1000_hw *hw)
907 907
  **/
908 908
 static s32 e1000_reset_hw_82543(struct e1000_hw *hw)
909 909
 {
910
-	u32 ctrl, icr;
910
+	u32 ctrl;
911 911
 	s32 ret_val = E1000_SUCCESS;
912 912
 
913 913
 	DEBUGFUNC("e1000_reset_hw_82543");
@@ -949,7 +949,7 @@ static s32 e1000_reset_hw_82543(struct e1000_hw *hw)
949 949
 
950 950
 	/* Masking off and clearing any pending interrupts */
951 951
 	E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
952
-	icr = E1000_READ_REG(hw, E1000_ICR);
952
+	E1000_READ_REG(hw, E1000_ICR);
953 953
 
954 954
 	return ret_val;
955 955
 }

+ 2
- 4
src/drivers/net/e1000/e1000_main.c View File

@@ -554,14 +554,12 @@ static void e1000_close ( struct net_device *netdev )
554 554
 	struct e1000_adapter *adapter = netdev_priv ( netdev );
555 555
 	struct e1000_hw *hw = &adapter->hw;
556 556
 	uint32_t rctl;
557
-	uint32_t icr;
558 557
 
559 558
 	DBG ( "e1000_close\n" );
560 559
 
561
-	/* Acknowledge interrupts */
562
-	icr = E1000_READ_REG ( hw, E1000_ICR );
563
-
560
+	/* Disable and acknowledge interrupts */
564 561
 	e1000_irq_disable ( adapter );
562
+	E1000_READ_REG ( hw, E1000_ICR );
565 563
 
566 564
 	/* disable receives */
567 565
 	rctl = E1000_READ_REG ( hw, E1000_RCTL );

+ 2
- 2
src/drivers/net/e1000e/e1000e_80003es2lan.c View File

@@ -841,7 +841,7 @@ static s32 e1000e_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed,
841 841
  **/
842 842
 static s32 e1000e_reset_hw_80003es2lan(struct e1000_hw *hw)
843 843
 {
844
-	u32 ctrl, icr;
844
+	u32 ctrl;
845 845
 	s32 ret_val;
846 846
 
847 847
 	/*
@@ -875,7 +875,7 @@ static s32 e1000e_reset_hw_80003es2lan(struct e1000_hw *hw)
875 875
 
876 876
 	/* Clear any pending interrupt events. */
877 877
 	ew32(IMC, 0xffffffff);
878
-	icr = er32(ICR);
878
+	er32(ICR);
879 879
 
880 880
 	ret_val = e1000e_check_alt_mac_addr_generic(hw);
881 881
 

+ 2
- 2
src/drivers/net/e1000e/e1000e_82571.c View File

@@ -919,7 +919,7 @@ out:
919 919
  **/
920 920
 static s32 e1000e_reset_hw_82571(struct e1000_hw *hw)
921 921
 {
922
-	u32 ctrl, extcnf_ctrl, ctrl_ext, icr;
922
+	u32 ctrl, extcnf_ctrl, ctrl_ext;
923 923
 	s32 ret_val;
924 924
 	u16 i = 0;
925 925
 
@@ -1004,7 +1004,7 @@ static s32 e1000e_reset_hw_82571(struct e1000_hw *hw)
1004 1004
 
1005 1005
 	/* Clear any pending interrupt events. */
1006 1006
 	ew32(IMC, 0xffffffff);
1007
-	icr = er32(ICR);
1007
+	er32(ICR);
1008 1008
 
1009 1009
 	/* Install any alternate MAC address into RAR0 */
1010 1010
 	ret_val = e1000e_check_alt_mac_addr_generic(hw);

+ 2
- 2
src/drivers/net/e1000e/e1000e_ich8lan.c View File

@@ -2486,7 +2486,7 @@ static s32 e1000e_reset_hw_ich8lan(struct e1000_hw *hw)
2486 2486
 {
2487 2487
 	struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
2488 2488
 	u16 reg;
2489
-	u32 ctrl, icr, kab;
2489
+	u32 ctrl, kab;
2490 2490
 	s32 ret_val;
2491 2491
 
2492 2492
 	/*
@@ -2594,7 +2594,7 @@ static s32 e1000e_reset_hw_ich8lan(struct e1000_hw *hw)
2594 2594
 		ew32(CRC_OFFSET, 0x65656565);
2595 2595
 
2596 2596
 	ew32(IMC, 0xffffffff);
2597
-	icr = er32(ICR);
2597
+	er32(ICR);
2598 2598
 
2599 2599
 	kab = er32(KABGTXD);
2600 2600
 	kab |= E1000_KABGTXD_BGSQLBIAS;

+ 2
- 4
src/drivers/net/e1000e/e1000e_main.c View File

@@ -873,14 +873,12 @@ static void e1000e_close ( struct net_device *netdev )
873 873
 	struct e1000_adapter *adapter = netdev_priv ( netdev );
874 874
 	struct e1000_hw *hw = &adapter->hw;
875 875
 	uint32_t rctl;
876
-	uint32_t icr;
877 876
 
878 877
 	DBGP ( "e1000_close\n" );
879 878
 
880
-	/* Acknowledge interrupts */
881
-	icr = E1000_READ_REG ( hw, E1000_ICR );
882
-
879
+	/* Disable and acknowledge interrupts */
883 880
 	e1000e_irq_disable ( adapter );
881
+	E1000_READ_REG ( hw, E1000_ICR );
884 882
 
885 883
 	/* disable receives */
886 884
 	rctl = E1000_READ_REG ( hw, E1000_RCTL );

+ 2
- 2
src/drivers/net/igb/igb_82575.c View File

@@ -959,7 +959,7 @@ void igb_shutdown_serdes_link_82575(struct e1000_hw *hw)
959 959
  **/
960 960
 static s32 igb_reset_hw_82575(struct e1000_hw *hw)
961 961
 {
962
-	u32 ctrl, icr;
962
+	u32 ctrl;
963 963
 	s32 ret_val;
964 964
 
965 965
 	DEBUGFUNC("igb_reset_hw_82575");
@@ -1009,7 +1009,7 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw)
1009 1009
 
1010 1010
 	/* Clear any pending interrupt events. */
1011 1011
 	E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
1012
-	icr = E1000_READ_REG(hw, E1000_ICR);
1012
+	E1000_READ_REG(hw, E1000_ICR);
1013 1013
 
1014 1014
 	/* Install any alternate MAC address into RAR0 */
1015 1015
 	ret_val = igb_check_alt_mac_addr_generic(hw);

+ 2
- 4
src/drivers/net/igb/igb_main.c View File

@@ -639,14 +639,12 @@ static void igb_close ( struct net_device *netdev )
639 639
 	struct igb_adapter *adapter = netdev_priv ( netdev );
640 640
 	struct e1000_hw *hw = &adapter->hw;
641 641
 	uint32_t rctl;
642
-	uint32_t icr;
643 642
 
644 643
 	DBGP ( "igb_close\n" );
645 644
 
646
-	/* Acknowledge interrupts */
647
-	icr = E1000_READ_REG ( hw, E1000_ICR );
648
-
645
+	/* Disable and acknowledge interrupts */
649 646
 	igb_irq_disable ( adapter );
647
+	E1000_READ_REG ( hw, E1000_ICR );
650 648
 
651 649
 	/* disable receives */
652 650
 	rctl = E1000_READ_REG ( hw, E1000_RCTL );

+ 2
- 2
src/drivers/net/igbvf/igbvf_main.c View File

@@ -666,12 +666,12 @@ static void igbvf_close ( struct net_device *netdev )
666 666
 	struct igbvf_adapter *adapter = netdev_priv ( netdev );
667 667
         struct e1000_hw *hw = &adapter->hw;
668 668
         uint32_t rxdctl;
669
-        uint32_t icr;
670 669
 
671 670
         DBG ( "igbvf_close\n" );
672
-        icr = er32(EICR);
673 671
 
672
+	/* Disable and acknowledge interrupts */
674 673
         igbvf_irq_disable ( adapter );
674
+        er32(EICR);
675 675
 
676 676
         /* disable receives */
677 677
         rxdctl = er32 ( RXDCTL(0) );

Loading…
Cancel
Save