diff mbox series

[net-next,v2,04/10] net: pcs: xpcs: Convert xpcs_compat to dw_xpcs_compat

Message ID 20240602143636.5839-5-fancer.lancer@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: pcs: xpcs: Add memory-mapped device support | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 901 this patch: 901
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 905 this patch: 905
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 905 this patch: 905
netdev/checkpatch warning WARNING: line length of 82 exceeds 80 columns WARNING: line length of 85 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Serge Semin June 2, 2024, 2:36 p.m. UTC
The xpcs_compat structure has been left as the only dw-prefix-less
structure since the previous commit. Let's unify at least the structures
naming in the driver by adding the dw_-prefix to it.

Signed-off-by: Serge Semin <fancer.lancer@gmail.com>

---

Changelog v2:
- This is a new patch introduced on v2 stage of the review.
---
 drivers/net/pcs/pcs-xpcs.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

Comments

Abhishek Chauhan (ABC) June 5, 2024, 7:15 p.m. UTC | #1
> @@ -482,7 +482,7 @@ static int xpcs_config_aneg_c73(struct dw_xpcs *xpcs,
>  
>  static int xpcs_aneg_done_c73(struct dw_xpcs *xpcs,
>  			      struct phylink_link_state *state,
> -			      const struct xpcs_compat *compat, u16 an_stat1)
> +			      const struct dw_xpcs_compat *compat, u16 an_stat1)
>  {
>  	int ret;
>  
> @@ -607,7 +607,7 @@ static int xpcs_validate(struct phylink_pcs *pcs, unsigned long *supported,
>  			 const struct phylink_link_state *state)
>  {
>  	__ETHTOOL_DECLARE_LINK_MODE_MASK(xpcs_supported) = { 0, };
> -	const struct xpcs_compat *compat;
> +	const struct dw_xpcs_compat *compat;
>  	struct dw_xpcs *xpcs;
>  	int i;
>  
> @@ -633,7 +633,7 @@ void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces)
>  	int i, j;
>  
>  	for (i = 0; i < DW_XPCS_INTERFACE_MAX; i++) {
> -		const struct xpcs_compat *compat = &xpcs->desc->compat[i];
> +		const struct dw_xpcs_compat *compat = &xpcs->desc->compat[i];
>  
>  		for (j = 0; j < compat->num_interfaces; j++)
>  			__set_bit(compat->interface[j], interfaces);
> @@ -850,7 +850,7 @@ static int xpcs_config_2500basex(struct dw_xpcs *xpcs)
>  int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
>  		   const unsigned long *advertising, unsigned int neg_mode)
>  {
> -	const struct xpcs_compat *compat;
> +	const struct dw_xpcs_compat *compat;
>  	int ret;
>  
>  	compat = xpcs_find_compat(xpcs->desc, interface);
> @@ -915,7 +915,7 @@ static int xpcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
>  
>  static int xpcs_get_state_c73(struct dw_xpcs *xpcs,
>  			      struct phylink_link_state *state,
> -			      const struct xpcs_compat *compat)
> +			      const struct dw_xpcs_compat *compat)
>  {
>  	bool an_enabled;
>  	int pcs_stat1;
> @@ -1115,7 +1115,7 @@ static void xpcs_get_state(struct phylink_pcs *pcs,
>  			   struct phylink_link_state *state)
>  {
>  	struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);
> -	const struct xpcs_compat *compat;
> +	const struct dw_xpcs_compat *compat;
>  	int ret;
>  
>  	compat = xpcs_find_compat(xpcs->desc, state->interface);
> @@ -1269,7 +1269,7 @@ static u32 xpcs_get_id(struct dw_xpcs *xpcs)
>  	return 0xffffffff;
>  }
>  
> -static const struct xpcs_compat synopsys_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
> +static const struct dw_xpcs_compat synopsys_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
>  	[DW_XPCS_USXGMII] = {
>  		.supported = xpcs_usxgmii_features,
>  		.interface = xpcs_usxgmii_interfaces,
> @@ -1314,7 +1314,7 @@ static const struct xpcs_compat synopsys_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
>  	},
>  };
>  
Serge, Thank you for raising these patches. Minor comments which shows warning on my workspace. 

WARNING: line length of 82 exceeds 80 columns
#153: FILE: drivers/net/pcs/pcs-xpcs.c:1272:
+static const struct dw_xpcs_compat synopsys_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {

WARNING: line length of 85 exceeds 80 columns
#162: FILE: drivers/net/pcs/pcs-xpcs.c:1317:
+static const struct dw_xpcs_compat nxp_sja1105_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {

WARNING: line length of 85 exceeds 80 columns
#171: FILE: drivers/net/pcs/pcs-xpcs.c:1327:
+static const struct dw_xpcs_compat nxp_sja1110_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {

> -static const struct xpcs_compat nxp_sja1105_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
> +static const struct dw_xpcs_compat nxp_sja1105_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
>  	[DW_XPCS_SGMII] = {
>  		.supported = xpcs_sgmii_features,
>  		.interface = xpcs_sgmii_interfaces,
> @@ -1324,7 +1324,7 @@ static const struct xpcs_compat nxp_sja1105_xpcs_compat[DW_XPCS_INTERFACE_MAX] =
>  	},
>  };
>  
> -static const struct xpcs_compat nxp_sja1110_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
> +static const struct dw_xpcs_compat nxp_sja1110_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
>  	[DW_XPCS_SGMII] = {
>  		.supported = xpcs_sgmii_features,
>  		.interface = xpcs_sgmii_interfaces,
> @@ -1418,7 +1418,7 @@ static int xpcs_init_id(struct dw_xpcs *xpcs)
>  
>  static int xpcs_init_iface(struct dw_xpcs *xpcs, phy_interface_t interface)
>  {
> -	const struct xpcs_compat *compat;
> +	const struct dw_xpcs_compat *compat;
>  
>  	compat = xpcs_find_compat(xpcs->desc, interface);
>  	if (!compat)
Serge Semin June 6, 2024, 10:11 a.m. UTC | #2
Hi Abhishek

On Wed, Jun 05, 2024 at 12:15:54PM -0700, Abhishek Chauhan (ABC) wrote:
> 
> > @@ -482,7 +482,7 @@ static int xpcs_config_aneg_c73(struct dw_xpcs *xpcs,
> >  
> >  static int xpcs_aneg_done_c73(struct dw_xpcs *xpcs,
> >  			      struct phylink_link_state *state,
> > -			      const struct xpcs_compat *compat, u16 an_stat1)
> > +			      const struct dw_xpcs_compat *compat, u16 an_stat1)
> >  {
> >  	int ret;
> >  
> > @@ -607,7 +607,7 @@ static int xpcs_validate(struct phylink_pcs *pcs, unsigned long *supported,
> >  			 const struct phylink_link_state *state)
> >  {
> >  	__ETHTOOL_DECLARE_LINK_MODE_MASK(xpcs_supported) = { 0, };
> > -	const struct xpcs_compat *compat;
> > +	const struct dw_xpcs_compat *compat;
> >  	struct dw_xpcs *xpcs;
> >  	int i;
> >  
> > @@ -633,7 +633,7 @@ void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces)
> >  	int i, j;
> >  
> >  	for (i = 0; i < DW_XPCS_INTERFACE_MAX; i++) {
> > -		const struct xpcs_compat *compat = &xpcs->desc->compat[i];
> > +		const struct dw_xpcs_compat *compat = &xpcs->desc->compat[i];
> >  
> >  		for (j = 0; j < compat->num_interfaces; j++)
> >  			__set_bit(compat->interface[j], interfaces);
> > @@ -850,7 +850,7 @@ static int xpcs_config_2500basex(struct dw_xpcs *xpcs)
> >  int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
> >  		   const unsigned long *advertising, unsigned int neg_mode)
> >  {
> > -	const struct xpcs_compat *compat;
> > +	const struct dw_xpcs_compat *compat;
> >  	int ret;
> >  
> >  	compat = xpcs_find_compat(xpcs->desc, interface);
> > @@ -915,7 +915,7 @@ static int xpcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
> >  
> >  static int xpcs_get_state_c73(struct dw_xpcs *xpcs,
> >  			      struct phylink_link_state *state,
> > -			      const struct xpcs_compat *compat)
> > +			      const struct dw_xpcs_compat *compat)
> >  {
> >  	bool an_enabled;
> >  	int pcs_stat1;
> > @@ -1115,7 +1115,7 @@ static void xpcs_get_state(struct phylink_pcs *pcs,
> >  			   struct phylink_link_state *state)
> >  {
> >  	struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);
> > -	const struct xpcs_compat *compat;
> > +	const struct dw_xpcs_compat *compat;
> >  	int ret;
> >  
> >  	compat = xpcs_find_compat(xpcs->desc, state->interface);
> > @@ -1269,7 +1269,7 @@ static u32 xpcs_get_id(struct dw_xpcs *xpcs)
> >  	return 0xffffffff;
> >  }
> >  
> > -static const struct xpcs_compat synopsys_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
> > +static const struct dw_xpcs_compat synopsys_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
> >  	[DW_XPCS_USXGMII] = {
> >  		.supported = xpcs_usxgmii_features,
> >  		.interface = xpcs_usxgmii_interfaces,
> > @@ -1314,7 +1314,7 @@ static const struct xpcs_compat synopsys_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
> >  	},
> >  };
> >  
> Serge, Thank you for raising these patches. Minor comments which shows warning on my workspace. 
> 

> WARNING: line length of 82 exceeds 80 columns
> #153: FILE: drivers/net/pcs/pcs-xpcs.c:1272:
> +static const struct dw_xpcs_compat synopsys_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
> 
> WARNING: line length of 85 exceeds 80 columns
> #162: FILE: drivers/net/pcs/pcs-xpcs.c:1317:
> +static const struct dw_xpcs_compat nxp_sja1105_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
> 
> WARNING: line length of 85 exceeds 80 columns
> #171: FILE: drivers/net/pcs/pcs-xpcs.c:1327:
> +static const struct dw_xpcs_compat nxp_sja1110_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
> 

My checkpatch didn't warn about that even with the strict argument
specified.

Note there is just 3 and 6 characters over the preferable limit.
Splitting the lines will make the code less readable (in some extent).

So from that perspective it's ok to exceed 80 characters limit in this
case and not to break the generic kernel coding style convention.
Unless the networking subsystem has a more strict requirement in this
matter.

-Serge(y)

> > -static const struct xpcs_compat nxp_sja1105_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
> > +static const struct dw_xpcs_compat nxp_sja1105_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
> >  	[DW_XPCS_SGMII] = {
> >  		.supported = xpcs_sgmii_features,
> >  		.interface = xpcs_sgmii_interfaces,
> > @@ -1324,7 +1324,7 @@ static const struct xpcs_compat nxp_sja1105_xpcs_compat[DW_XPCS_INTERFACE_MAX] =
> >  	},
> >  };
> >  
> > -static const struct xpcs_compat nxp_sja1110_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
> > +static const struct dw_xpcs_compat nxp_sja1110_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
> >  	[DW_XPCS_SGMII] = {
> >  		.supported = xpcs_sgmii_features,
> >  		.interface = xpcs_sgmii_interfaces,
> > @@ -1418,7 +1418,7 @@ static int xpcs_init_id(struct dw_xpcs *xpcs)
> >  
> >  static int xpcs_init_iface(struct dw_xpcs *xpcs, phy_interface_t interface)
> >  {
> > -	const struct xpcs_compat *compat;
> > +	const struct dw_xpcs_compat *compat;
> >  
> >  	compat = xpcs_find_compat(xpcs->desc, interface);
> >  	if (!compat)
diff mbox series

Patch

diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
index 48c61975db22..0af6b5995113 100644
--- a/drivers/net/pcs/pcs-xpcs.c
+++ b/drivers/net/pcs/pcs-xpcs.c
@@ -143,7 +143,7 @@  enum {
 	DW_XPCS_INTERFACE_MAX,
 };
 
-struct xpcs_compat {
+struct dw_xpcs_compat {
 	const int *supported;
 	const phy_interface_t *interface;
 	int num_interfaces;
@@ -154,16 +154,16 @@  struct xpcs_compat {
 struct dw_xpcs_desc {
 	u32 id;
 	u32 mask;
-	const struct xpcs_compat *compat;
+	const struct dw_xpcs_compat *compat;
 };
 
-static const struct xpcs_compat *
+static const struct dw_xpcs_compat *
 xpcs_find_compat(const struct dw_xpcs_desc *desc, phy_interface_t interface)
 {
 	int i, j;
 
 	for (i = 0; i < DW_XPCS_INTERFACE_MAX; i++) {
-		const struct xpcs_compat *compat = &desc->compat[i];
+		const struct dw_xpcs_compat *compat = &desc->compat[i];
 
 		for (j = 0; j < compat->num_interfaces; j++)
 			if (compat->interface[j] == interface)
@@ -175,7 +175,7 @@  xpcs_find_compat(const struct dw_xpcs_desc *desc, phy_interface_t interface)
 
 int xpcs_get_an_mode(struct dw_xpcs *xpcs, phy_interface_t interface)
 {
-	const struct xpcs_compat *compat;
+	const struct dw_xpcs_compat *compat;
 
 	compat = xpcs_find_compat(xpcs->desc, interface);
 	if (!compat)
@@ -185,7 +185,7 @@  int xpcs_get_an_mode(struct dw_xpcs *xpcs, phy_interface_t interface)
 }
 EXPORT_SYMBOL_GPL(xpcs_get_an_mode);
 
-static bool __xpcs_linkmode_supported(const struct xpcs_compat *compat,
+static bool __xpcs_linkmode_supported(const struct dw_xpcs_compat *compat,
 				      enum ethtool_link_mode_bit_indices linkmode)
 {
 	int i;
@@ -277,7 +277,7 @@  static int xpcs_poll_reset(struct dw_xpcs *xpcs, int dev)
 }
 
 static int xpcs_soft_reset(struct dw_xpcs *xpcs,
-			   const struct xpcs_compat *compat)
+			   const struct dw_xpcs_compat *compat)
 {
 	int ret, dev;
 
@@ -418,7 +418,7 @@  static void xpcs_config_usxgmii(struct dw_xpcs *xpcs, int speed)
 }
 
 static int _xpcs_config_aneg_c73(struct dw_xpcs *xpcs,
-				 const struct xpcs_compat *compat)
+				 const struct dw_xpcs_compat *compat)
 {
 	int ret, adv;
 
@@ -463,7 +463,7 @@  static int _xpcs_config_aneg_c73(struct dw_xpcs *xpcs,
 }
 
 static int xpcs_config_aneg_c73(struct dw_xpcs *xpcs,
-				const struct xpcs_compat *compat)
+				const struct dw_xpcs_compat *compat)
 {
 	int ret;
 
@@ -482,7 +482,7 @@  static int xpcs_config_aneg_c73(struct dw_xpcs *xpcs,
 
 static int xpcs_aneg_done_c73(struct dw_xpcs *xpcs,
 			      struct phylink_link_state *state,
-			      const struct xpcs_compat *compat, u16 an_stat1)
+			      const struct dw_xpcs_compat *compat, u16 an_stat1)
 {
 	int ret;
 
@@ -607,7 +607,7 @@  static int xpcs_validate(struct phylink_pcs *pcs, unsigned long *supported,
 			 const struct phylink_link_state *state)
 {
 	__ETHTOOL_DECLARE_LINK_MODE_MASK(xpcs_supported) = { 0, };
-	const struct xpcs_compat *compat;
+	const struct dw_xpcs_compat *compat;
 	struct dw_xpcs *xpcs;
 	int i;
 
@@ -633,7 +633,7 @@  void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces)
 	int i, j;
 
 	for (i = 0; i < DW_XPCS_INTERFACE_MAX; i++) {
-		const struct xpcs_compat *compat = &xpcs->desc->compat[i];
+		const struct dw_xpcs_compat *compat = &xpcs->desc->compat[i];
 
 		for (j = 0; j < compat->num_interfaces; j++)
 			__set_bit(compat->interface[j], interfaces);
@@ -850,7 +850,7 @@  static int xpcs_config_2500basex(struct dw_xpcs *xpcs)
 int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
 		   const unsigned long *advertising, unsigned int neg_mode)
 {
-	const struct xpcs_compat *compat;
+	const struct dw_xpcs_compat *compat;
 	int ret;
 
 	compat = xpcs_find_compat(xpcs->desc, interface);
@@ -915,7 +915,7 @@  static int xpcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
 
 static int xpcs_get_state_c73(struct dw_xpcs *xpcs,
 			      struct phylink_link_state *state,
-			      const struct xpcs_compat *compat)
+			      const struct dw_xpcs_compat *compat)
 {
 	bool an_enabled;
 	int pcs_stat1;
@@ -1115,7 +1115,7 @@  static void xpcs_get_state(struct phylink_pcs *pcs,
 			   struct phylink_link_state *state)
 {
 	struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);
-	const struct xpcs_compat *compat;
+	const struct dw_xpcs_compat *compat;
 	int ret;
 
 	compat = xpcs_find_compat(xpcs->desc, state->interface);
@@ -1269,7 +1269,7 @@  static u32 xpcs_get_id(struct dw_xpcs *xpcs)
 	return 0xffffffff;
 }
 
-static const struct xpcs_compat synopsys_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
+static const struct dw_xpcs_compat synopsys_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
 	[DW_XPCS_USXGMII] = {
 		.supported = xpcs_usxgmii_features,
 		.interface = xpcs_usxgmii_interfaces,
@@ -1314,7 +1314,7 @@  static const struct xpcs_compat synopsys_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
 	},
 };
 
-static const struct xpcs_compat nxp_sja1105_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
+static const struct dw_xpcs_compat nxp_sja1105_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
 	[DW_XPCS_SGMII] = {
 		.supported = xpcs_sgmii_features,
 		.interface = xpcs_sgmii_interfaces,
@@ -1324,7 +1324,7 @@  static const struct xpcs_compat nxp_sja1105_xpcs_compat[DW_XPCS_INTERFACE_MAX] =
 	},
 };
 
-static const struct xpcs_compat nxp_sja1110_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
+static const struct dw_xpcs_compat nxp_sja1110_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
 	[DW_XPCS_SGMII] = {
 		.supported = xpcs_sgmii_features,
 		.interface = xpcs_sgmii_interfaces,
@@ -1418,7 +1418,7 @@  static int xpcs_init_id(struct dw_xpcs *xpcs)
 
 static int xpcs_init_iface(struct dw_xpcs *xpcs, phy_interface_t interface)
 {
-	const struct xpcs_compat *compat;
+	const struct dw_xpcs_compat *compat;
 
 	compat = xpcs_find_compat(xpcs->desc, interface);
 	if (!compat)