@@ -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);
}
@@ -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;
@@ -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 */
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(-)