]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
net: dsa: felix: perform teardown in reverse order of setup
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 15 Jan 2021 02:11:15 +0000 (04:11 +0200)
committerAndrea Righi <andrea.righi@canonical.com>
Mon, 15 Mar 2021 14:09:00 +0000 (15:09 +0100)
[ Upstream commit d19741b0f54487cf3a11307900f8633935cd2849 ]

In general it is desirable that cleanup is the reverse process of setup.
In this case I am not seeing any particular issue, but with the
introduction of devlink-sb for felix, a non-obvious decision had to be
made as to where to put its cleanup method. When there's a convention in
place, that decision becomes obvious.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
drivers/net/dsa/ocelot/felix.c

index 45fdb1256dbfeb6160e1e3f6aafddc657677b786..4aa81034347e29e639806d171ecd7b5519c25c2d 100644 (file)
@@ -654,14 +654,14 @@ static void felix_teardown(struct dsa_switch *ds)
        struct felix *felix = ocelot_to_felix(ocelot);
        int port;
 
-       if (felix->info->mdio_bus_free)
-               felix->info->mdio_bus_free(ocelot);
+       ocelot_deinit_timestamp(ocelot);
+       ocelot_deinit(ocelot);
 
        for (port = 0; port < ocelot->num_phys_ports; port++)
                ocelot_deinit_port(ocelot, port);
-       ocelot_deinit_timestamp(ocelot);
-       /* stop workqueue thread */
-       ocelot_deinit(ocelot);
+
+       if (felix->info->mdio_bus_free)
+               felix->info->mdio_bus_free(ocelot);
 }
 
 static int felix_hwtstamp_get(struct dsa_switch *ds, int port,