Commit a1a753ed authored by Vladimir Oltean's avatar Vladimir Oltean Committed by David S. Miller

net: pcs: xpcs: export xpcs_validate

Calling a function pointer with a single implementation through
struct mdio_xpcs_ops is clunky, and the stmmac_do_callback system forces
this to return int, even though it always returns zero.

Simply remove the "validate" function pointer from struct mdio_xpcs_ops
and replace it with an exported xpcs_validate symbol which is called
directly by stmmac.

priv->hw->xpcs is of the type "const struct mdio_xpcs_ops *" and is used
as a placeholder/synonym for priv->plat->mdio_bus_data->has_xpcs. It is
done that way because the mdio_bus_data pointer might or might not be
populated in all stmmac instantiations.
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9900074e
...@@ -614,8 +614,6 @@ struct stmmac_mmc_ops { ...@@ -614,8 +614,6 @@ struct stmmac_mmc_ops {
stmmac_do_void_callback(__priv, mmc, read, __args) stmmac_do_void_callback(__priv, mmc, read, __args)
/* XPCS callbacks */ /* XPCS callbacks */
#define stmmac_xpcs_validate(__priv, __args...) \
stmmac_do_callback(__priv, xpcs, validate, __args)
#define stmmac_xpcs_config(__priv, __args...) \ #define stmmac_xpcs_config(__priv, __args...) \
stmmac_do_callback(__priv, xpcs, config, __args) stmmac_do_callback(__priv, xpcs, config, __args)
#define stmmac_xpcs_get_state(__priv, __args...) \ #define stmmac_xpcs_get_state(__priv, __args...) \
......
...@@ -996,7 +996,8 @@ static void stmmac_validate(struct phylink_config *config, ...@@ -996,7 +996,8 @@ static void stmmac_validate(struct phylink_config *config,
linkmode_andnot(state->advertising, state->advertising, mask); linkmode_andnot(state->advertising, state->advertising, mask);
/* If PCS is supported, check which modes it supports. */ /* If PCS is supported, check which modes it supports. */
stmmac_xpcs_validate(priv, &priv->hw->xpcs_args, supported, state); if (priv->hw->xpcs)
xpcs_validate(&priv->hw->xpcs_args, supported, state);
} }
static void stmmac_mac_pcs_get_state(struct phylink_config *config, static void stmmac_mac_pcs_get_state(struct phylink_config *config,
......
...@@ -685,9 +685,8 @@ static void xpcs_resolve_pma(struct mdio_xpcs_args *xpcs, ...@@ -685,9 +685,8 @@ static void xpcs_resolve_pma(struct mdio_xpcs_args *xpcs,
} }
} }
static int xpcs_validate(struct mdio_xpcs_args *xpcs, void xpcs_validate(struct mdio_xpcs_args *xpcs, unsigned long *supported,
unsigned long *supported, struct phylink_link_state *state)
struct phylink_link_state *state)
{ {
__ETHTOOL_DECLARE_LINK_MODE_MASK(xpcs_supported); __ETHTOOL_DECLARE_LINK_MODE_MASK(xpcs_supported);
const struct xpcs_compat *compat; const struct xpcs_compat *compat;
...@@ -698,7 +697,7 @@ static int xpcs_validate(struct mdio_xpcs_args *xpcs, ...@@ -698,7 +697,7 @@ static int xpcs_validate(struct mdio_xpcs_args *xpcs,
* advertising masks and exit. * advertising masks and exit.
*/ */
if (state->interface == PHY_INTERFACE_MODE_NA) if (state->interface == PHY_INTERFACE_MODE_NA)
return 0; return;
bitmap_zero(xpcs_supported, __ETHTOOL_LINK_MODE_MASK_NBITS); bitmap_zero(xpcs_supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
...@@ -713,9 +712,8 @@ static int xpcs_validate(struct mdio_xpcs_args *xpcs, ...@@ -713,9 +712,8 @@ static int xpcs_validate(struct mdio_xpcs_args *xpcs,
linkmode_and(supported, supported, xpcs_supported); linkmode_and(supported, supported, xpcs_supported);
linkmode_and(state->advertising, state->advertising, xpcs_supported); linkmode_and(state->advertising, state->advertising, xpcs_supported);
return 0;
} }
EXPORT_SYMBOL_GPL(xpcs_validate);
static int xpcs_config_eee(struct mdio_xpcs_args *xpcs, int mult_fact_100ns, static int xpcs_config_eee(struct mdio_xpcs_args *xpcs, int mult_fact_100ns,
int enable) int enable)
...@@ -1031,7 +1029,6 @@ static int xpcs_probe(struct mdio_xpcs_args *xpcs, phy_interface_t interface) ...@@ -1031,7 +1029,6 @@ static int xpcs_probe(struct mdio_xpcs_args *xpcs, phy_interface_t interface)
} }
static struct mdio_xpcs_ops xpcs_ops = { static struct mdio_xpcs_ops xpcs_ops = {
.validate = xpcs_validate,
.config = xpcs_config, .config = xpcs_config,
.get_state = xpcs_get_state, .get_state = xpcs_get_state,
.link_up = xpcs_link_up, .link_up = xpcs_link_up,
......
...@@ -23,9 +23,6 @@ struct mdio_xpcs_args { ...@@ -23,9 +23,6 @@ struct mdio_xpcs_args {
}; };
struct mdio_xpcs_ops { struct mdio_xpcs_ops {
int (*validate)(struct mdio_xpcs_args *xpcs,
unsigned long *supported,
struct phylink_link_state *state);
int (*config)(struct mdio_xpcs_args *xpcs, int (*config)(struct mdio_xpcs_args *xpcs,
const struct phylink_link_state *state); const struct phylink_link_state *state);
int (*get_state)(struct mdio_xpcs_args *xpcs, int (*get_state)(struct mdio_xpcs_args *xpcs,
...@@ -39,5 +36,7 @@ struct mdio_xpcs_ops { ...@@ -39,5 +36,7 @@ struct mdio_xpcs_ops {
int xpcs_get_an_mode(struct mdio_xpcs_args *xpcs, phy_interface_t interface); int xpcs_get_an_mode(struct mdio_xpcs_args *xpcs, phy_interface_t interface);
struct mdio_xpcs_ops *mdio_xpcs_get_ops(void); struct mdio_xpcs_ops *mdio_xpcs_get_ops(void);
void xpcs_validate(struct mdio_xpcs_args *xpcs, unsigned long *supported,
struct phylink_link_state *state);
#endif /* __LINUX_PCS_XPCS_H */ #endif /* __LINUX_PCS_XPCS_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment