hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/net/ethernet/intel/e1000/e1000_hw.c
....@@ -129,7 +129,6 @@
129129 */
130130 static void e1000_phy_init_script(struct e1000_hw *hw)
131131 {
132
- u32 ret_val;
133132 u16 phy_saved_data;
134133
135134 if (hw->phy_init_script) {
....@@ -138,7 +137,7 @@
138137 /* Save off the current value of register 0x2F5B to be restored
139138 * at the end of this routine.
140139 */
141
- ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data);
140
+ e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data);
142141
143142 /* Disabled the PHY transmitter */
144143 e1000_write_phy_reg(hw, 0x2F5B, 0x0003);
....@@ -377,7 +376,6 @@
377376 {
378377 u32 ctrl;
379378 u32 ctrl_ext;
380
- u32 icr;
381379 u32 manc;
382380 u32 led_ctrl;
383381 s32 ret_val;
....@@ -502,7 +500,7 @@
502500 ew32(IMC, 0xffffffff);
503501
504502 /* Clear any pending interrupt events. */
505
- icr = er32(ICR);
503
+ er32(ICR);
506504
507505 /* If MWI was previously enabled, reenable it. */
508506 if (hw->mac_type == e1000_82542_rev2_0) {
....@@ -1897,7 +1895,6 @@
18971895 /**
18981896 * e1000_config_mac_to_phy - sync phy and mac settings
18991897 * @hw: Struct containing variables accessed by shared code
1900
- * @mii_reg: data to write to the MII control register
19011898 *
19021899 * Sets MAC speed and duplex settings to reflect the those in the PHY
19031900 * The contents of the PHY register containing the needed information need to
....@@ -2370,16 +2367,13 @@
23702367 */
23712368 s32 e1000_check_for_link(struct e1000_hw *hw)
23722369 {
2373
- u32 rxcw = 0;
2374
- u32 ctrl;
23752370 u32 status;
23762371 u32 rctl;
23772372 u32 icr;
2378
- u32 signal = 0;
23792373 s32 ret_val;
23802374 u16 phy_data;
23812375
2382
- ctrl = er32(CTRL);
2376
+ er32(CTRL);
23832377 status = er32(STATUS);
23842378
23852379 /* On adapters with a MAC newer than 82544, SW Definable pin 1 will be
....@@ -2388,12 +2382,9 @@
23882382 */
23892383 if ((hw->media_type == e1000_media_type_fiber) ||
23902384 (hw->media_type == e1000_media_type_internal_serdes)) {
2391
- rxcw = er32(RXCW);
2385
+ er32(RXCW);
23922386
23932387 if (hw->media_type == e1000_media_type_fiber) {
2394
- signal =
2395
- (hw->mac_type >
2396
- e1000_82544) ? E1000_CTRL_SWDPIN1 : 0;
23972388 if (status & E1000_STATUS_LU)
23982389 hw->get_link_status = false;
23992390 }
....@@ -2922,7 +2913,7 @@
29222913 *
29232914 * @hw: Struct containing variables accessed by shared code
29242915 * @reg_addr: address of the PHY register to write
2925
- * @data: data to write to the PHY
2916
+ * @phy_data: data to write to the PHY
29262917 *
29272918 * Writes a value to a PHY register
29282919 */
....@@ -3960,7 +3951,7 @@
39603951 * @hw: Struct containing variables accessed by shared code
39613952 *
39623953 * Reads the first 64 16 bit words of the EEPROM and sums the values read.
3963
- * If the the sum of the 64 16 bit words is 0xBABA, the EEPROM's checksum is
3954
+ * If the sum of the 64 16 bit words is 0xBABA, the EEPROM's checksum is
39643955 * valid.
39653956 */
39663957 s32 e1000_validate_eeprom_checksum(struct e1000_hw *hw)
....@@ -4410,17 +4401,9 @@
44104401 static void e1000_clear_vfta(struct e1000_hw *hw)
44114402 {
44124403 u32 offset;
4413
- u32 vfta_value = 0;
4414
- u32 vfta_offset = 0;
4415
- u32 vfta_bit_in_reg = 0;
44164404
44174405 for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) {
4418
- /* If the offset we want to clear is the same offset of the
4419
- * manageability VLAN ID, then clear all bits except that of the
4420
- * manageability unit
4421
- */
4422
- vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0;
4423
- E1000_WRITE_REG_ARRAY(hw, VFTA, offset, vfta_value);
4406
+ E1000_WRITE_REG_ARRAY(hw, VFTA, offset, 0);
44244407 E1000_WRITE_FLUSH();
44254408 }
44264409 }
....@@ -4526,7 +4509,7 @@
45264509 ~IGP01E1000_GMII_SPD));
45274510 if (ret_val)
45284511 return ret_val;
4529
- /* Fall Through */
4512
+ fallthrough;
45304513 default:
45314514 if (hw->media_type == e1000_media_type_fiber) {
45324515 ledctl = er32(LEDCTL);
....@@ -4571,7 +4554,7 @@
45714554 hw->phy_spd_default);
45724555 if (ret_val)
45734556 return ret_val;
4574
- /* Fall Through */
4557
+ fallthrough;
45754558 default:
45764559 /* Restore LEDCTL settings */
45774560 ew32(LEDCTL, hw->ledctl_default);
....@@ -4675,78 +4658,76 @@
46754658 */
46764659 static void e1000_clear_hw_cntrs(struct e1000_hw *hw)
46774660 {
4678
- volatile u32 temp;
4661
+ er32(CRCERRS);
4662
+ er32(SYMERRS);
4663
+ er32(MPC);
4664
+ er32(SCC);
4665
+ er32(ECOL);
4666
+ er32(MCC);
4667
+ er32(LATECOL);
4668
+ er32(COLC);
4669
+ er32(DC);
4670
+ er32(SEC);
4671
+ er32(RLEC);
4672
+ er32(XONRXC);
4673
+ er32(XONTXC);
4674
+ er32(XOFFRXC);
4675
+ er32(XOFFTXC);
4676
+ er32(FCRUC);
46794677
4680
- temp = er32(CRCERRS);
4681
- temp = er32(SYMERRS);
4682
- temp = er32(MPC);
4683
- temp = er32(SCC);
4684
- temp = er32(ECOL);
4685
- temp = er32(MCC);
4686
- temp = er32(LATECOL);
4687
- temp = er32(COLC);
4688
- temp = er32(DC);
4689
- temp = er32(SEC);
4690
- temp = er32(RLEC);
4691
- temp = er32(XONRXC);
4692
- temp = er32(XONTXC);
4693
- temp = er32(XOFFRXC);
4694
- temp = er32(XOFFTXC);
4695
- temp = er32(FCRUC);
4678
+ er32(PRC64);
4679
+ er32(PRC127);
4680
+ er32(PRC255);
4681
+ er32(PRC511);
4682
+ er32(PRC1023);
4683
+ er32(PRC1522);
46964684
4697
- temp = er32(PRC64);
4698
- temp = er32(PRC127);
4699
- temp = er32(PRC255);
4700
- temp = er32(PRC511);
4701
- temp = er32(PRC1023);
4702
- temp = er32(PRC1522);
4685
+ er32(GPRC);
4686
+ er32(BPRC);
4687
+ er32(MPRC);
4688
+ er32(GPTC);
4689
+ er32(GORCL);
4690
+ er32(GORCH);
4691
+ er32(GOTCL);
4692
+ er32(GOTCH);
4693
+ er32(RNBC);
4694
+ er32(RUC);
4695
+ er32(RFC);
4696
+ er32(ROC);
4697
+ er32(RJC);
4698
+ er32(TORL);
4699
+ er32(TORH);
4700
+ er32(TOTL);
4701
+ er32(TOTH);
4702
+ er32(TPR);
4703
+ er32(TPT);
47034704
4704
- temp = er32(GPRC);
4705
- temp = er32(BPRC);
4706
- temp = er32(MPRC);
4707
- temp = er32(GPTC);
4708
- temp = er32(GORCL);
4709
- temp = er32(GORCH);
4710
- temp = er32(GOTCL);
4711
- temp = er32(GOTCH);
4712
- temp = er32(RNBC);
4713
- temp = er32(RUC);
4714
- temp = er32(RFC);
4715
- temp = er32(ROC);
4716
- temp = er32(RJC);
4717
- temp = er32(TORL);
4718
- temp = er32(TORH);
4719
- temp = er32(TOTL);
4720
- temp = er32(TOTH);
4721
- temp = er32(TPR);
4722
- temp = er32(TPT);
4705
+ er32(PTC64);
4706
+ er32(PTC127);
4707
+ er32(PTC255);
4708
+ er32(PTC511);
4709
+ er32(PTC1023);
4710
+ er32(PTC1522);
47234711
4724
- temp = er32(PTC64);
4725
- temp = er32(PTC127);
4726
- temp = er32(PTC255);
4727
- temp = er32(PTC511);
4728
- temp = er32(PTC1023);
4729
- temp = er32(PTC1522);
4730
-
4731
- temp = er32(MPTC);
4732
- temp = er32(BPTC);
4712
+ er32(MPTC);
4713
+ er32(BPTC);
47334714
47344715 if (hw->mac_type < e1000_82543)
47354716 return;
47364717
4737
- temp = er32(ALGNERRC);
4738
- temp = er32(RXERRC);
4739
- temp = er32(TNCRS);
4740
- temp = er32(CEXTERR);
4741
- temp = er32(TSCTC);
4742
- temp = er32(TSCTFC);
4718
+ er32(ALGNERRC);
4719
+ er32(RXERRC);
4720
+ er32(TNCRS);
4721
+ er32(CEXTERR);
4722
+ er32(TSCTC);
4723
+ er32(TSCTFC);
47434724
47444725 if (hw->mac_type <= e1000_82544)
47454726 return;
47464727
4747
- temp = er32(MGTPRC);
4748
- temp = er32(MGTPDC);
4749
- temp = er32(MGTPTC);
4728
+ er32(MGTPRC);
4729
+ er32(MGTPDC);
4730
+ er32(MGTPTC);
47504731 }
47514732
47524733 /**
....@@ -4778,8 +4759,6 @@
47784759 /**
47794760 * e1000_update_adaptive - update adaptive IFS
47804761 * @hw: Struct containing variables accessed by shared code
4781
- * @tx_packets: Number of transmits since last callback
4782
- * @total_collisions: Number of collisions since last callback
47834762 *
47844763 * Called during the callback/watchdog routine to update IFS value based on
47854764 * the ratio of transmits to collisions.
....@@ -5064,8 +5043,6 @@
50645043 /**
50655044 * e1000_check_downshift - Check if Downshift occurred
50665045 * @hw: Struct containing variables accessed by shared code
5067
- * @downshift: output parameter : 0 - No Downshift occurred.
5068
- * 1 - Downshift occurred.
50695046 *
50705047 * returns: - E1000_ERR_XXX
50715048 * E1000_SUCCESS