diff mbox series

[RFC,net-next,9/9] net: pcs: lynx: Remove remaining users of lynx_pcs_create

Message ID 20220711160519.741990-10-sean.anderson@seco.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series net: pcs: Add support for devices probed in the "usual" manner | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/apply fail Patch does not apply to net-next

Commit Message

Sean Anderson July 11, 2022, 4:05 p.m. UTC
Now that PCS devices have a compatible string, we no longer have to bind
the driver manually in lynx_pcs_create. Remove it, and convert the
remaining users to pcs_get_by_fwnode.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---
This requires that all PCSs have a compatible string. For a reasonable
window of compatibility, this should be applied one major release after
all compatible strings are added.

 .../net/ethernet/freescale/dpaa2/dpaa2-mac.c  | 27 ++-----------------
 drivers/net/pcs/pcs-lynx.c                    | 19 -------------
 include/linux/pcs-lynx.h                      |  1 -
 3 files changed, 2 insertions(+), 45 deletions(-)

Comments

Rob Herring (Arm) July 18, 2022, 7:44 p.m. UTC | #1
On Mon, Jul 11, 2022 at 12:05:19PM -0400, Sean Anderson wrote:
> Now that PCS devices have a compatible string, we no longer have to bind
> the driver manually in lynx_pcs_create. Remove it, and convert the
> remaining users to pcs_get_by_fwnode.
> 
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> ---
> This requires that all PCSs have a compatible string. For a reasonable
> window of compatibility, this should be applied one major release after
> all compatible strings are added.

These platforms are pretty stable. I don't think a 1 release window is 
sufficient. Maybe a 1 LTS release.

> 
>  .../net/ethernet/freescale/dpaa2/dpaa2-mac.c  | 27 ++-----------------
>  drivers/net/pcs/pcs-lynx.c                    | 19 -------------
>  include/linux/pcs-lynx.h                      |  1 -
>  3 files changed, 2 insertions(+), 45 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
index d8b491ffa4db..1c1cd935ec1d 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
@@ -247,32 +247,9 @@  static int dpaa2_pcs_create(struct dpaa2_mac *mac,
 			    struct fwnode_handle *dpmac_node,
 			    int id)
 {
-	struct mdio_device *mdiodev;
-	struct fwnode_handle *node;
-
-	node = fwnode_find_reference(dpmac_node, "pcs-handle", 0);
-	if (IS_ERR(node)) {
-		/* do not error out on old DTS files */
-		netdev_warn(mac->net_dev, "pcs-handle node not found\n");
-		return 0;
-	}
-
-	if (!fwnode_device_is_available(node)) {
-		netdev_err(mac->net_dev, "pcs-handle node not available\n");
-		fwnode_handle_put(node);
-		return -ENODEV;
-	}
-
-	mdiodev = fwnode_mdio_find_device(node);
-	fwnode_handle_put(node);
-	if (!mdiodev)
-		return -EPROBE_DEFER;
-
-	mac->pcs = lynx_pcs_create(mdiodev);
-	mdio_device_free(mdiodev);
+	mac->pcs = pcs_get_by_fwnode(dpmac_node, NULL);
 	if (IS_ERR(mac->pcs)) {
-		netdev_err(mac->net_dev, "lynx_pcs_create() failed\n");
-		put_device(&mdiodev->dev);
+		netdev_err(mac->net_dev, "pcs_get_by_fwnode() failed\n");
 		return PTR_ERR(mac->pcs);
 	}
 
diff --git a/drivers/net/pcs/pcs-lynx.c b/drivers/net/pcs/pcs-lynx.c
index bfa72d9cbcf9..f4a70a1a73fe 100644
--- a/drivers/net/pcs/pcs-lynx.c
+++ b/drivers/net/pcs/pcs-lynx.c
@@ -376,25 +376,6 @@  static struct mdio_driver lynx_pcs_driver = {
 };
 mdio_module_driver(lynx_pcs_driver);
 
-struct phylink_pcs *lynx_pcs_create(struct mdio_device *mdio)
-{
-	struct device *dev = &mdio->dev;
-	int err;
-
-	/* For compatibility with device trees lacking compatible strings, we
-	 * bind the device manually here.
-	 */
-	err = device_driver_attach(&lynx_pcs_driver.mdiodrv.driver, dev);
-	if (err && err != -EBUSY) {
-		if (err == -EAGAIN)
-			err = -EPROBE_DEFER;
-		return ERR_PTR(err);
-	}
-
-	return pcs_get_by_provider(&mdio->dev);
-}
-EXPORT_SYMBOL(lynx_pcs_create);
-
 struct phylink_pcs *lynx_pcs_create_on_bus(struct mii_bus *bus, int addr)
 {
 	struct mdio_device *mdio;
diff --git a/include/linux/pcs-lynx.h b/include/linux/pcs-lynx.h
index 61caa59a069c..54dacabc0884 100644
--- a/include/linux/pcs-lynx.h
+++ b/include/linux/pcs-lynx.h
@@ -9,7 +9,6 @@ 
 #include <linux/mdio.h>
 #include <linux/phylink.h>
 
-struct phylink_pcs *lynx_pcs_create(struct mdio_device *mdio);
 struct phylink_pcs *lynx_pcs_create_on_bus(struct mii_bus *bus, int addr);
 
 #endif /* __LINUX_PCS_LYNX_H */