diff mbox series

[net-next,2/5] net: dsa: replace phylink_get_interfaces() with phylink_get_caps()

Message ID E1ms2tV-00ECJA-2v@rmk-PC.armlinux.org.uk (mailing list archive)
State Accepted
Commit 072eea6c22b2af680c3949e64f9adde278c71e68
Delegated to: Netdev Maintainers
Headers show
Series net: dsa: convert two drivers to phylink_generic_validate() | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 20 this patch: 20
netdev/cc_maintainers warning 1 maintainers not CCed: linux@armlinux.org.uk
netdev/build_clang success Errors and warnings before: 26 this patch: 26
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 11 this patch: 11
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 21 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Russell King (Oracle) Nov. 30, 2021, 1:10 p.m. UTC
Phylink needs slightly more information than phylink_get_interfaces()
allows us to get from the DSA drivers - we need the MAC capabilities.
Replace the phylink_get_interfaces() method with phylink_get_caps() to
allow DSA drivers to fill in the phylink_config MAC capabilities field
as well.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 include/net/dsa.h | 4 ++--
 net/dsa/port.c    | 5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)

Comments

Marek Behún Nov. 30, 2021, 3:42 p.m. UTC | #1
On Tue, 30 Nov 2021 13:10:01 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> Phylink needs slightly more information than phylink_get_interfaces()
> allows us to get from the DSA drivers - we need the MAC capabilities.
> Replace the phylink_get_interfaces() method with phylink_get_caps() to
> allow DSA drivers to fill in the phylink_config MAC capabilities field
> as well.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Marek Behún <kabel@kernel.org>
Andrew Lunn Nov. 30, 2021, 3:48 p.m. UTC | #2
On Tue, Nov 30, 2021 at 01:10:01PM +0000, Russell King (Oracle) wrote:
> Phylink needs slightly more information than phylink_get_interfaces()
> allows us to get from the DSA drivers - we need the MAC capabilities.
> Replace the phylink_get_interfaces() method with phylink_get_caps() to
> allow DSA drivers to fill in the phylink_config MAC capabilities field
> as well.

It would of been nice to say that phylink_get_interfaces() is
currently unused, and so this change does not break anything. I think
that was a discussion with the RFC?

But the code itself looks good.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
diff mbox series

Patch

diff --git a/include/net/dsa.h b/include/net/dsa.h
index eff5c44ba377..8ca9d50cbbc2 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -645,8 +645,8 @@  struct dsa_switch_ops {
 	/*
 	 * PHYLINK integration
 	 */
-	void	(*phylink_get_interfaces)(struct dsa_switch *ds, int port,
-					  unsigned long *supported_interfaces);
+	void	(*phylink_get_caps)(struct dsa_switch *ds, int port,
+				    struct phylink_config *config);
 	void	(*phylink_validate)(struct dsa_switch *ds, int port,
 				    unsigned long *supported,
 				    struct phylink_link_state *state);
diff --git a/net/dsa/port.c b/net/dsa/port.c
index eaa66114924b..ef0acf005f8f 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -1091,9 +1091,8 @@  int dsa_port_phylink_create(struct dsa_port *dp)
 	if (err)
 		mode = PHY_INTERFACE_MODE_NA;
 
-	if (ds->ops->phylink_get_interfaces)
-		ds->ops->phylink_get_interfaces(ds, dp->index,
-					dp->pl_config.supported_interfaces);
+	if (ds->ops->phylink_get_caps)
+		ds->ops->phylink_get_caps(ds, dp->index, &dp->pl_config);
 
 	dp->pl = phylink_create(&dp->pl_config, of_fwnode_handle(dp->dn),
 				mode, &dsa_port_phylink_mac_ops);