Skip to contentSkip to conversation

igc: Remove unused phy_type enum

PATCH Superseded Sasha Neftin 4 participants 5 messages Apr 13, 2022 – May 4, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igc: Remove unused phy_type enum

Complete to commit 8e153faf5827 ("igc: Remove unused phy type") i225 parts have only one phy. There is no point to use phy_type enum. Clean up the code accordingly, and get rid of the unused enum lines.

---
 drivers/net/ethernet/intel/igc/igc_base.c |  2 --
 drivers/net/ethernet/intel/igc/igc_hw.h   |  7 -------
 drivers/net/ethernet/intel/igc/igc_phy.c  | 10 +++-------
 3 files changed, 3 insertions(+), 16 deletions(-)
drivers/net/ethernet/intel/igc/igc_base.c +0 -2
index f068b66b8025..a15927e77272 100644
@@ -182,8 +182,6 @@ static s32 igc_init_phy_params_base(struct igc_hw *hw)
 
 	igc_check_for_copper_link(hw);
 
-	phy->type = igc_phy_i225;
-
 out:
 	return ret_val;
 }
drivers/net/ethernet/intel/igc/igc_hw.h +0 -7
index b1e72ec5f131..360644f33d5f 100644
@@ -53,11 +53,6 @@ enum igc_mac_type {
 	igc_num_macs  /* List is 1-based, so subtract 1 for true count. */
 };
 
-enum igc_phy_type {
-	igc_phy_unknown = 0,
-	igc_phy_i225,
-};
-
 enum igc_media_type {
 	igc_media_type_unknown = 0,
 	igc_media_type_copper = 1,
@@ -138,8 +133,6 @@ struct igc_nvm_info {
 struct igc_phy_info {
 	struct igc_phy_operations ops;
 
-	enum igc_phy_type type;
-
 	u32 addr;
 	u32 id;
 	u32 reset_delay_us; /* in usec */
drivers/net/ethernet/intel/igc/igc_phy.c +3 -7
index 6961f65d36b9..4f06e6bb68b1 100644
@@ -150,13 +150,9 @@ s32 igc_check_downshift(struct igc_hw *hw)
 	struct igc_phy_info *phy = &hw->phy;
 	s32 ret_val;
 
-	switch (phy->type) {
-	case igc_phy_i225:
-	default:
-		/* speed downshift not supported */
-		phy->speed_downgraded = false;
-		ret_val = 0;
-	}
+	/* speed downshift not supported */
+	phy->speed_downgraded = false;
+	ret_val = 0;
 
 	return ret_val;
 }
Signature · 1 line
2.30.2
maintainer
#1 lore raw

PATCH 1/1 igc: Remove unused phy_type enum

On 4/12/2022 10:33 PM, Sasha Neftin wrote:

<snip>

Quoted 10 lines
drivers/net/ethernet/intel/igc/igc_phy.c +0 -2
index 6961f65d36b9..4f06e6bb68b1 100644
@@ -150,13 +150,9 @@ s32 igc_check_downshift(struct igc_hw *hw)
  	struct igc_phy_info *phy = &hw->phy;
  	s32 ret_val;
 
-	switch (phy->type) {
-	case igc_phy_i225:

drivers/net/ethernet/intel/igc/igc_phy.c s32 igc_check_downshift(struct igc_hw *hw) · line 157

Quoted 10 lines
drivers/net/ethernet/intel/igc/igc_phy.c +3 -5
-	default:
-		/* speed downshift not supported */
-		phy->speed_downgraded = false;
-		ret_val = 0;
-	}
+	/* speed downshift not supported */
+	phy->speed_downgraded = false;
+	ret_val = 0;
 
  	return ret_val;

ret_val isn't needed since it's always returning 0 and could possibly be made a void function.

Thanks,

Tony

#2 lore raw

PATCH 1/1 igc: Remove unused phy_type enum

Quoted 18 lines · Tony Nguyen

On 4/12/2022 10:33 PM, Sasha Neftin wrote:

<snip>

Quoted 14 lines
drivers/net/ethernet/intel/igc/igc_phy.c +0 -6
index 6961f65d36b9..4f06e6bb68b1 100644
@@ -150,13 +150,9 @@ s32 igc_check_downshift(struct igc_hw *hw)
 ????? struct igc_phy_info *phy = &hw->phy;
 ????? s32 ret_val;
-??? switch (phy->type) {
-??? case igc_phy_i225:
-??? default:
-??????? /* speed downshift not supported */
-??????? phy->speed_downgraded = false;
-??????? ret_val = 0;
Quoted 8 lines

drivers/net/ethernet/intel/igc/igc_phy.c s32 igc_check_downshift(struct igc_hw *hw) · line 155

Quoted 5 lines
drivers/net/ethernet/intel/igc/igc_phy.c +3 -1
-??? }
+??? /* speed downshift not supported */
+??? phy->speed_downgraded = false;
+??? ret_val = 0;
 ????? return ret_val;

ret_val isn't needed since it's always returning 0 and could possibly be made a void function.

Thank you, Tony, right. I believe it is a minor logical change - it should be a different patch. I remember we have a few similar cases in igc. I plan (TODO) to fix them.

Quoted 5 lines

Thanks,

Tony

#3 lore raw

PATCH 1/1 igc: Remove unused phy_type enum

In reply to Sasha Neftin
Quoted 10 lines · Sasha Neftin

Complete to commit 8e153faf5827 ("igc: Remove unused phy type") i225 parts have only one phy. There is no point to use phy_type enum. Clean up the code accordingly, and get rid of the unused enum lines.

---
  drivers/net/ethernet/intel/igc/igc_base.c |  2 --
  drivers/net/ethernet/intel/igc/igc_hw.h   |  7 -------
  drivers/net/ethernet/intel/igc/igc_phy.c  | 10 +++-------
  3 files changed, 3 insertions(+), 16 deletions(-)
#4 lore raw

PATCH 1/1 igc: Remove unused phy_type enum

In reply to Sasha Neftin
Quoted 10 lines · Sasha Neftin

Complete to commit 8e153faf5827 ("igc: Remove unused phy type") i225 parts have only one phy. There is no point to use phy_type enum. Clean up the code accordingly, and get rid of the unused enum lines.

---
  drivers/net/ethernet/intel/igc/igc_base.c |  2 --
  drivers/net/ethernet/intel/igc/igc_hw.h   |  7 -------
  drivers/net/ethernet/intel/igc/igc_phy.c  | 10 +++-------
  3 files changed, 3 insertions(+), 16 deletions(-)