diff --git a/include/net/dsa.h b/include/net/dsa.h index 1131d9fac20b0a9f4231c01bd5ee18cdb3d4b014..82a2baa2dc48ee7e8d4df898a27f188c1b3ba75d 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -357,6 +357,7 @@ struct dsa_switch_ops { int port); int (*setup)(struct dsa_switch *ds); + void (*teardown)(struct dsa_switch *ds); u32 (*get_phy_flags)(struct dsa_switch *ds, int port); /* diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 38d11c863b57784768707023e56a72b19d0e49a5..3abd173ebacbd134d6e420f05ddee765f0c9fdd1 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -408,6 +408,9 @@ static void dsa_switch_teardown(struct dsa_switch *ds) dsa_switch_unregister_notifier(ds); + if (ds->ops->teardown) + ds->ops->teardown(ds); + if (ds->devlink) { devlink_unregister(ds->devlink); devlink_free(ds->devlink);