@@ -446,6 +446,19 @@ int ksz_switch_register(struct ksz_device *dev,
}
EXPORT_SYMBOL(ksz_switch_register);
+void ksz_switch_shutdown(struct ksz_device *dev)
+{
+ struct dsa_switch *ds = dev->ds;
+
+ /* timer started */
+ if (dev->mib_read_interval) {
+ cancel_delayed_work_sync(&dev->mib_read);
+ dev->mib_read_interval = 0;
+ }
+ dsa_tree_shutdown(ds->dst);
+}
+EXPORT_SYMBOL(ksz_switch_shutdown);
+
void ksz_switch_remove(struct ksz_device *dev)
{
/* timer started */
@@ -143,6 +143,7 @@ struct ksz_device *ksz_switch_alloc(struct device *base, void *priv);
int ksz_switch_register(struct ksz_device *dev,
const struct ksz_dev_ops *ops);
void ksz_switch_remove(struct ksz_device *dev);
+void ksz_switch_shutdown(struct ksz_device *dev);
int ksz8_switch_register(struct ksz_device *dev);
int ksz9477_switch_register(struct ksz_device *dev);
Provide a function ksz_switch_shutdown() which properly shuts down the KSZ switch by stopping the mib_read worker thread and then tearing down the DSA tree. Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de> --- drivers/net/dsa/microchip/ksz_common.c | 13 +++++++++++++ drivers/net/dsa/microchip/ksz_common.h | 1 + 2 files changed, 14 insertions(+)