]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
net: dsa: seville: duplicate vsc9959_mdio_bus_free
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 18 Sep 2020 10:57:50 +0000 (13:57 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sat, 19 Sep 2020 00:52:40 +0000 (17:52 -0700)
While we don't plan on making any changes to this function, currently
this is the only remaining dependency between felix and seville, after
the PCS has been refactored out into pcs-lynx.c.

Duplicate this function in seville to break the dependency completely.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/ocelot/felix.h
drivers/net/dsa/ocelot/felix_vsc9959.c
drivers/net/dsa/ocelot/seville_vsc9953.c

index 807f18b748479abe09a1d157271d4686d6e2b54d..1d41eeda126e52e571b008e98c8f560deadded00 100644 (file)
@@ -55,6 +55,4 @@ struct felix {
        resource_size_t                 imdio_base;
 };
 
-void vsc9959_mdio_bus_free(struct ocelot *ocelot);
-
 #endif
index 4dbc3283f7ea25fa174fd1035497c1300f03358d..b198fe9cb62bc4839640540259c3f9ba33707368 100644 (file)
@@ -936,7 +936,7 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot)
        return 0;
 }
 
-void vsc9959_mdio_bus_free(struct ocelot *ocelot)
+static void vsc9959_mdio_bus_free(struct ocelot *ocelot)
 {
        struct felix *felix = ocelot_to_felix(ocelot);
        int port;
index 50a7dada8989804dfbfca7014abbf43586364769..fa05f1f2619e7ba96dc5eeddaf669f9d1c4653dc 100644 (file)
@@ -981,6 +981,23 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot)
        return 0;
 }
 
+static void vsc9953_mdio_bus_free(struct ocelot *ocelot)
+{
+       struct felix *felix = ocelot_to_felix(ocelot);
+       int port;
+
+       for (port = 0; port < ocelot->num_phys_ports; port++) {
+               struct lynx_pcs *pcs = felix->pcs[port];
+
+               if (!pcs)
+                       continue;
+
+               mdio_device_free(pcs->mdio);
+               lynx_pcs_destroy(pcs);
+       }
+       mdiobus_unregister(felix->imdio);
+}
+
 static void vsc9953_xmit_template_populate(struct ocelot *ocelot, int port)
 {
        struct ocelot_port *ocelot_port = ocelot->ports[port];
@@ -1014,7 +1031,7 @@ static const struct felix_info seville_info_vsc9953 = {
        .num_mact_rows          = 2048,
        .num_ports              = 10,
        .mdio_bus_alloc         = vsc9953_mdio_bus_alloc,
-       .mdio_bus_free          = vsc9959_mdio_bus_free,
+       .mdio_bus_free          = vsc9953_mdio_bus_free,
        .phylink_validate       = vsc9953_phylink_validate,
        .prevalidate_phy_mode   = vsc9953_prevalidate_phy_mode,
        .xmit_template_populate = vsc9953_xmit_template_populate,