@@ -1039,6 +1039,7 @@ static inline int dsa_ndo_eth_ioctl(struct net_device *dev, struct ifreq *ifr,
}
#endif
+void dsa_tree_shutdown(struct dsa_switch_tree *dst);
void dsa_unregister_switch(struct dsa_switch *ds);
int dsa_register_switch(struct dsa_switch *ds);
struct dsa_switch *dsa_switch_find(int tree_index, int sw_index);
@@ -1066,6 +1066,14 @@ static void dsa_tree_teardown(struct dsa_switch_tree *dst)
dst->setup = false;
}
+void dsa_tree_shutdown(struct dsa_switch_tree *dst)
+{
+ mutex_lock(&dsa2_mutex);
+ dsa_tree_teardown(dst);
+ mutex_unlock(&dsa2_mutex);
+}
+EXPORT_SYMBOL_GPL(dsa_tree_shutdown);
+
/* Since the dsa/tagging sysfs device attribute is per master, the assumption
* is that all DSA switches within a tree share the same tagger, otherwise
* they would have formed disjoint trees (different "dsa,member" values).
Provide the function dsa_tree_shutdown() that can be called by DSA drivers to tear down the DSA tree. This is particularly useful for shutdown handlers to make sure that the DSA tree is torn down (and thus all references to the master device are released) before the master device is deregistered. Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de> --- include/net/dsa.h | 1 + net/dsa/dsa2.c | 8 ++++++++ 2 files changed, 9 insertions(+)