Introduce a wrapper over xpcs_create_fwnode() that doesn't return the specific dw_xpcs pointer type, but the generic phylink_pcs pointer type. For example, the NXP SJA1105 driver might use this if it has a pcs-handle - it is already a user of xpcs_create_pcs_mdiodev(). Signed-off-by: Vladimir Oltean --- v1->v2: none drivers/net/pcs/pcs-xpcs.c | 12 ++++++++++++ include/linux/pcs/pcs-xpcs.h | 1 + 2 files changed, 13 insertions(+) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 9679f2b35a44..910fd8b23d41 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -1707,6 +1707,18 @@ struct dw_xpcs *xpcs_create_fwnode(struct fwnode_handle *fwnode) } EXPORT_SYMBOL_GPL(xpcs_create_fwnode); +struct phylink_pcs *xpcs_create_pcs_fwnode(struct fwnode_handle *fwnode) +{ + struct dw_xpcs *xpcs; + + xpcs = xpcs_create_fwnode(fwnode); + if (IS_ERR(xpcs)) + return ERR_CAST(xpcs); + + return &xpcs->pcs; +} +EXPORT_SYMBOL_GPL(xpcs_create_pcs_fwnode); + void xpcs_destroy(struct dw_xpcs *xpcs) { if (!xpcs) diff --git a/include/linux/pcs/pcs-xpcs.h b/include/linux/pcs/pcs-xpcs.h index 36073f7b6bb4..9e450a356737 100644 --- a/include/linux/pcs/pcs-xpcs.h +++ b/include/linux/pcs/pcs-xpcs.h @@ -58,6 +58,7 @@ struct dw_xpcs *xpcs_create_fwnode(struct fwnode_handle *fwnode); void xpcs_destroy(struct dw_xpcs *xpcs); struct phylink_pcs *xpcs_create_pcs_mdiodev(struct mii_bus *bus, int addr); +struct phylink_pcs *xpcs_create_pcs_fwnode(struct fwnode_handle *fwnode); void xpcs_destroy_pcs(struct phylink_pcs *pcs); #endif /* __LINUX_PCS_XPCS_H */ -- 2.34.1