[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220711160519.741990-10-sean.anderson@seco.com>
Date: Mon, 11 Jul 2022 12:05:19 -0400
From: Sean Anderson <sean.anderson@...o.com>
To: Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>, netdev@...r.kernel.org
Cc: Jakub Kicinski <kuba@...nel.org>,
Madalin Bucur <madalin.bucur@....com>,
"David S . Miller" <davem@...emloft.net>,
Paolo Abeni <pabeni@...hat.com>,
Ioana Ciornei <ioana.ciornei@....com>,
linux-kernel@...r.kernel.org, Eric Dumazet <edumazet@...gle.com>,
Andrew Lunn <andrew@...n.ch>,
Sean Anderson <sean.anderson@...o.com>
Subject: [RFC PATCH net-next 9/9] net: pcs: lynx: Remove remaining users of lynx_pcs_create
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@...o.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(-)
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 */
--
2.35.1.1320.gc452695387.dirty
Powered by blists - more mailing lists