@@ -1082,7 +1082,6 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot)
for (port = 0; port < felix->info->num_ports; port++) {
struct ocelot_port *ocelot_port = ocelot->ports[port];
struct phylink_pcs *phylink_pcs;
- struct mdio_device *mdio_device;
if (dsa_is_unused_port(felix->ds, port))
continue;
@@ -1036,7 +1036,6 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot)
for (port = 0; port < felix->info->num_ports; port++) {
struct ocelot_port *ocelot_port = ocelot->ports[port];
struct phylink_pcs *phylink_pcs;
- struct mdio_device *mdio_device;
int addr = port + 4;
if (dsa_is_unused_port(felix->ds, port))
@@ -2,6 +2,7 @@
/* Copyright 2019 NXP */
#include <linux/acpi.h>
+#include <linux/pcs.h>
#include <linux/pcs-lynx.h>
#include <linux/phy/phy.h>
#include <linux/property.h>
@@ -268,6 +269,7 @@ static int dpaa2_pcs_create(struct dpaa2_mac *mac,
return -EPROBE_DEFER;
mac->pcs = lynx_pcs_create(mdiodev);
+ mdio_device_free(mdiodev);
if (IS_ERR(mac->pcs)) {
netdev_err(mac->net_dev, "lynx_pcs_create() failed\n");
put_device(&mdiodev->dev);
@@ -279,16 +281,8 @@ static int dpaa2_pcs_create(struct dpaa2_mac *mac,
static void dpaa2_pcs_destroy(struct dpaa2_mac *mac)
{
- struct phylink_pcs *phylink_pcs = mac->pcs;
-
- if (phylink_pcs) {
- struct mdio_device *mdio = lynx_get_mdio_device(phylink_pcs);
- struct device *dev = &mdio->dev;
-
- lynx_pcs_destroy(phylink_pcs);
- put_device(dev);
- mac->pcs = NULL;
- }
+ pcs_put(mac->pcs);
+ mac->pcs = NULL;
}
static void dpaa2_mac_set_supported_interfaces(struct dpaa2_mac *mac)
@@ -40,14 +40,6 @@ enum sgmii_speed {
#define phylink_pcs_to_lynx(pl_pcs) container_of((pl_pcs), struct lynx_pcs, pcs)
#define lynx_to_phylink_pcs(lynx) (&(lynx)->pcs)
-struct mdio_device *lynx_get_mdio_device(struct phylink_pcs *pcs)
-{
- struct lynx_pcs *lynx = phylink_pcs_to_lynx(pcs);
-
- return lynx->mdio;
-}
-EXPORT_SYMBOL(lynx_get_mdio_device);
-
static void lynx_pcs_get_state_usxgmii(struct mdio_device *pcs,
struct phylink_link_state *state)
{
@@ -427,11 +419,5 @@ struct phylink_pcs *lynx_pcs_create_on_bus(struct mii_bus *bus, int addr)
}
EXPORT_SYMBOL(lynx_pcs_create_on_bus);
-void lynx_pcs_destroy(struct phylink_pcs *pcs)
-{
- pcs_put(pcs);
-}
-EXPORT_SYMBOL(lynx_pcs_destroy);
-
MODULE_DESCRIPTION("NXP Lynx 10G/28G PCS driver");
MODULE_LICENSE("GPL");
@@ -9,11 +9,7 @@
#include <linux/mdio.h>
#include <linux/phylink.h>
-struct mdio_device *lynx_get_mdio_device(struct phylink_pcs *pcs);
-
struct phylink_pcs *lynx_pcs_create(struct mdio_device *mdio);
struct phylink_pcs *lynx_pcs_create_on_bus(struct mii_bus *bus, int addr);
-void lynx_pcs_destroy(struct phylink_pcs *pcs);
-
#endif /* __LINUX_PCS_LYNX_H */
The PCS subsystem now manages getting/putting the PCS device. We can convert our manual cleanup with a call to pcs_put. This removes the last users of lynx_get_mdio_device lynx_pcs_destroy, so they can be removed. Signed-off-by: Sean Anderson <sean.anderson@seco.com> --- drivers/net/dsa/ocelot/felix_vsc9959.c | 1 - drivers/net/dsa/ocelot/seville_vsc9953.c | 1 - drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 14 ++++---------- drivers/net/pcs/pcs-lynx.c | 14 -------------- include/linux/pcs-lynx.h | 4 ---- 5 files changed, 4 insertions(+), 30 deletions(-)