Skip to contentSkip to conversation

net: dsa: adjust_link removal

PATCH Superseded Florian Fainelli 3 participants 7 messages Apr 29, 2024 – Apr 30, 2024

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover net: dsa: adjust_link removal

Now that the last in-tree driver (b53) has been converted to PHYLINK, we can get rid of all of code that catered to working with drivers implementing only PHYLIB's adjust_link callback.

Changes in v2:

- remove a now unused phy_device pointer in
dsa_port_phylink_mac_link_down

Florian Fainelli (2):
net: dsa: Remove fixed_link_update member
net: dsa: Remove adjust_link paths

 include/net/dsa.h |  11 ----
 net/dsa/dsa.c     |   3 +-
 net/dsa/port.c    | 136 ++++------------------------------------------
 3 files changed, 12 insertions(+), 138 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/2 net: dsa: Remove fixed_link_update member

We have not had a switch driver use a fixed_link_update callback since 58d56fcc3964f9be0a9ca42fd126bcd9dc7afc90 ("net: dsa: bcm_sf2: Get rid of PHYLIB functions") remove this callback.

---
 include/net/dsa.h | 4 ----
 1 file changed, 4 deletions(-)
include/net/dsa.h +0 -4
index a6ef7e4c503f..678f1fd8b189 100644
@@ -25,7 +25,6 @@
 struct dsa_8021q_context;
 struct tc_action;
 struct phy_device;
-struct fixed_phy_status;
 struct phylink_link_state;
 
 #define DSA_TAG_PROTO_NONE_VALUE		0
@@ -873,9 +872,6 @@ struct dsa_switch_ops {
 	 */
 	void	(*adjust_link)(struct dsa_switch *ds, int port,
 				struct phy_device *phydev);
-	void	(*fixed_link_update)(struct dsa_switch *ds, int port,
-				struct fixed_phy_status *st);
-
 	/*
 	 * PHYLINK integration
 	 */
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/2 net: dsa: Remove adjust_link paths

In reply to Florian Fainelli

Now that we no longer any drivers using PHYLIB's adjust_link callback, remove all paths that made use of adjust_link as well as the associated functions.

---
 include/net/dsa.h |   7 ---
 net/dsa/dsa.c     |   3 +-
 net/dsa/port.c    | 136 ++++------------------------------------------
 3 files changed, 12 insertions(+), 134 deletions(-)
include/net/dsa.h +0 -7
index 678f1fd8b189..eef702dbea78 100644
@@ -24,8 +24,6 @@
 
 struct dsa_8021q_context;
 struct tc_action;
-struct phy_device;
-struct phylink_link_state;
 
 #define DSA_TAG_PROTO_NONE_VALUE		0
 #define DSA_TAG_PROTO_BRCM_VALUE		1
@@ -867,11 +865,6 @@ struct dsa_switch_ops {
 	int	(*phy_write)(struct dsa_switch *ds, int port,
 			     int regnum, u16 val);
 
-	/*
-	 * Link state adjustment (called from libphy)
-	 */
-	void	(*adjust_link)(struct dsa_switch *ds, int port,
-				struct phy_device *phydev);
 	/*
 	 * PHYLINK integration
 	 */
net/dsa/dsa.c +1 -2
index 2f347cd37316..12521a7d4048 100644
@@ -1511,8 +1511,7 @@ static int dsa_switch_probe(struct dsa_switch *ds)
 		    ds->ops->phylink_mac_config ||
 		    ds->ops->phylink_mac_finish ||
 		    ds->ops->phylink_mac_link_down ||
-		    ds->ops->phylink_mac_link_up ||
-		    ds->ops->adjust_link)
+		    ds->ops->phylink_mac_link_up)
 			return -EINVAL;
 	}
 
net/dsa/port.c +11 -125

186 lines not on this page · raw message

Signature · 1 line
2.34.1
reviewer
#3 lore raw

Re: [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths

Quoted 5 lines · Florian Fainelli

Now that we no longer any drivers using PHYLIB's adjust_link callback, remove all paths that made use of adjust_link as well as the associated functions.

...

net/dsa/port.c static void dsa_port_phylink_mac_link_down(struct phylink_config *config, · line 1619

Quoted 5 lines
net/dsa/port.c +0 -1
@@ -1616,17 +1597,13 @@ static void dsa_port_phylink_mac_link_down(struct phylink_config *config,
 					   phy_interface_t interface)
 {
 	struct dsa_port *dp = dsa_phylink_to_port(config);
-	struct phy_device *phydev = NULL;

Hi Florian,

I'm wondering if some changes got lost somewhere.

phydev is removed here...

net/dsa/port.c static void dsa_port_phylink_mac_link_down(struct phylink_config *config, · line 1603

Quoted 4 lines
net/dsa/port.c +0 -0
 	struct dsa_switch *ds = dp->ds;
 
 	if (dsa_port_is_user(dp))
 		phydev = dp->user->phydev;

... assigned here, but not used.

Perhaps the three lines above should be removed?

Quoted 10 lines
net/dsa/port.c +1 -4
-	if (!ds->ops->phylink_mac_link_down) {
-		if (ds->ops->adjust_link && phydev)
-			ds->ops->adjust_link(ds, dp->index, phydev);
+	if (!ds->ops->phylink_mac_link_down)
 		return;
-	}
 
 	ds->ops->phylink_mac_link_down(ds, dp->index, mode, interface);
 }

...

Signature · 1 line
pw-client: changes-requested
#4 lore raw

Re: [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths

Quoted 21 lines · Simon Horman
Quoted 5 lines · Florian Fainelli

Now that we no longer any drivers using PHYLIB's adjust_link callback, remove all paths that made use of adjust_link as well as the associated functions.

...

net/dsa/port.c static void dsa_port_phylink_mac_link_down(struct phylink_config *config, · line 1619

Quoted 5 lines
net/dsa/port.c +0 -1
@@ -1616,17 +1597,13 @@ static void dsa_port_phylink_mac_link_down(struct phylink_config *config,
  					   phy_interface_t interface)
  {
  	struct dsa_port *dp = dsa_phylink_to_port(config);
-	struct phy_device *phydev = NULL;

Hi Florian,

I'm wondering if some changes got lost somewhere.

phydev is removed here...

Quoted 8 lines

net/dsa/port.c static void dsa_port_phylink_mac_link_down(struct phylink_config *config, · line 1603

Quoted 4 lines
net/dsa/port.c +0 -0
  	struct dsa_switch *ds = dp->ds;
 
  	if (dsa_port_is_user(dp))
  		phydev = dp->user->phydev;

... assigned here, but not used.

Perhaps the three lines above should be removed?

Yes, sorry about that, rebase gone wrong on my side.

Signature · 1 line
Florian
#5 lore raw

Re: [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths

In reply to Florian Fainelli
kernel test robot noticed the following build errors:

Hi Florian,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Florian-Fainelli/net-dsa-Remove-fixed_link_update-member/20240430-005631
base:   net-next/main
patch link:    https://lore.kernel.org/r/20240429165405.2298962-3-florian.fainelli%40broadcom.com
patch subject: [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20240430/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240430/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

net/dsa/port.c: In function 'dsa_port_phylink_mac_link_down':

>> net/dsa/port.c:1603:17: error: 'phydev' undeclared (first use in this function)
    1603 |                 phydev = dp->user->phydev;
         |                 ^~~~~~

net/dsa/port.c:1603:17: note: each undeclared identifier is reported only once for each function it appears in

vim +/phydev +1603 net/dsa/port.c

dd805cf3e80e03 Russell King (Oracle  2023-05-25  1594) 
8ae674964e67eb Florian Fainelli      2019-12-16  1595  static void dsa_port_phylink_mac_link_down(struct phylink_config *config,
77373d49de22e8 Ioana Ciornei         2019-05-28  1596  					   unsigned int mode,
77373d49de22e8 Ioana Ciornei         2019-05-28  1597  					   phy_interface_t interface)
77373d49de22e8 Ioana Ciornei         2019-05-28  1598  {
dd0c9855b41310 Russell King (Oracle  2024-04-10  1599) 	struct dsa_port *dp = dsa_phylink_to_port(config);
77373d49de22e8 Ioana Ciornei         2019-05-28  1600  	struct dsa_switch *ds = dp->ds;
77373d49de22e8 Ioana Ciornei         2019-05-28  1601  
57d77986e74287 Vladimir Oltean       2021-10-20  1602  	if (dsa_port_is_user(dp))
6ca80638b90cec Florian Fainelli      2023-10-23 @1603  		phydev = dp->user->phydev;
0e27921816ad99 Ioana Ciornei         2019-05-28  1604  
e9829e26ff2c61 Florian Fainelli      2024-04-29  1605  	if (!ds->ops->phylink_mac_link_down)
77373d49de22e8 Ioana Ciornei         2019-05-28  1606  		return;
77373d49de22e8 Ioana Ciornei         2019-05-28  1607  
77373d49de22e8 Ioana Ciornei         2019-05-28  1608  	ds->ops->phylink_mac_link_down(ds, dp->index, mode, interface);
77373d49de22e8 Ioana Ciornei         2019-05-28  1609  }
77373d49de22e8 Ioana Ciornei         2019-05-28  1610  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#6 lore raw

Re: [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths

In reply to Florian Fainelli
kernel test robot noticed the following build errors:

Hi Florian,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Florian-Fainelli/net-dsa-Remove-fixed_link_update-member/20240430-005631
base:   net-next/main
patch link:    https://lore.kernel.org/r/20240429165405.2298962-3-florian.fainelli%40broadcom.com
patch subject: [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths
config: arm-defconfig (https://download.01.org/0day-ci/archive/20240430/[email protected]/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240430/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> net/dsa/port.c:1603:3: error: use of undeclared identifier 'phydev'
                   phydev = dp->user->phydev;
                   ^

1 error generated.

vim +/phydev +1603 net/dsa/port.c

dd805cf3e80e03 Russell King (Oracle  2023-05-25  1594) 
8ae674964e67eb Florian Fainelli      2019-12-16  1595  static void dsa_port_phylink_mac_link_down(struct phylink_config *config,
77373d49de22e8 Ioana Ciornei         2019-05-28  1596  					   unsigned int mode,
77373d49de22e8 Ioana Ciornei         2019-05-28  1597  					   phy_interface_t interface)
77373d49de22e8 Ioana Ciornei         2019-05-28  1598  {
dd0c9855b41310 Russell King (Oracle  2024-04-10  1599) 	struct dsa_port *dp = dsa_phylink_to_port(config);
77373d49de22e8 Ioana Ciornei         2019-05-28  1600  	struct dsa_switch *ds = dp->ds;
77373d49de22e8 Ioana Ciornei         2019-05-28  1601  
57d77986e74287 Vladimir Oltean       2021-10-20  1602  	if (dsa_port_is_user(dp))
6ca80638b90cec Florian Fainelli      2023-10-23 @1603  		phydev = dp->user->phydev;
0e27921816ad99 Ioana Ciornei         2019-05-28  1604  
e9829e26ff2c61 Florian Fainelli      2024-04-29  1605  	if (!ds->ops->phylink_mac_link_down)
77373d49de22e8 Ioana Ciornei         2019-05-28  1606  		return;
77373d49de22e8 Ioana Ciornei         2019-05-28  1607  
77373d49de22e8 Ioana Ciornei         2019-05-28  1608  	ds->ops->phylink_mac_link_down(ds, dp->index, mode, interface);
77373d49de22e8 Ioana Ciornei         2019-05-28  1609  }
77373d49de22e8 Ioana Ciornei         2019-05-28  1610  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki