net: dsa: allow switch drivers to cleanup their resources
Subsystems (3)
RFC PATCH v3 1/5 net: dsa: allow switch drivers to cleanup their resources
Some switch drivers might request interrupts, remap register ranges, allow such drivers to implement a "remove" callback doing just that.
Signed-off-by Florian Fainelli <[email protected]>
Signed-off-by Neil Armstrong <[email protected]>
--- include/net/dsa.h | 1 + net/dsa/dsa.c | 4 ++++ 2 files changed, 5 insertions(+)
include/net/dsa.h +1 -0
@@ -212,6 +212,7 @@ struct dsa_switch_driver {*/ char *(*probe)(struct device *host_dev,int sw_addr);int (*setup)(struct dsa_switch *ds); +void (*remove)(struct dsa_switch *ds);int (*set_addr)(struct dsa_switch *ds,u8 *addr);u32 (*get_phy_flags)(struct dsa_switch *ds,int port);
net/dsa/dsa.c +4 -0
@@ -459,6 +459,10 @@ static void dsa_switch_destroy(struct dsa_switch *ds) }mdiobus_unregister (ds->slave_mii_bus); + +/* Leave a chance to the driver to cleanup */ +if (ds->drv->remove) + ds->drv->remove (ds); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
1.9.1
Andrew Lunn
maintainerQuoted 27 lines · Neil Armstrong
Some switch drivers might request interrupts, remap register ranges, allow such drivers to implement a "remove" callback doing just that.
Signed-off-by Florian Fainelli <[email protected]>Signed-off-by Neil Armstrong <[email protected]>--- include/net/dsa.h | 1 + net/dsa/dsa.c | 4 ++++ 2 files changed, 5 insertions(+)include/net/dsa.h +1
-0@@ -212,6 +212,7 @@ struct dsa_switch_driver {*/ char *(*probe)(struct device *host_dev,int sw_addr);int (*setup)(struct dsa_switch *ds); +void (*remove)(struct dsa_switch *ds);int (*set_addr)(struct dsa_switch *ds,u8 *addr);u32 (*get_phy_flags)(struct dsa_switch *ds,int port);net/dsa/dsa.c +0
-0
net/dsa/dsa.c static void dsa_switch_destroy(struct dsa_switch *ds) · line 466
Quoted 8 lines
net/dsa/dsa.c +4
-0@@ -459,6 +459,10 @@ static void dsa_switch_destroy(struct dsa_switch *ds) }mdiobus_unregister (ds->slave_mii_bus); + +/* Leave a chance to the driver to cleanup */ +if (ds->drv->remove) + ds->drv->remove (ds); }
https://lkml.org/lkml/2015/10/28/532 ???
Andrew
Quoted 15 lines · Andrew Lunn
net/dsa/dsa.c static void dsa_switch_destroy(struct dsa_switch *ds) · line 466
Quoted 11 lines · Neil Armstrong
net/dsa/dsa.c +4
-0@@ -459,6 +459,10 @@ static void dsa_switch_destroy(struct dsa_switch *ds) }mdiobus_unregister (ds->slave_mii_bus); + +/* Leave a chance to the driver to cleanup */ +if (ds->drv->remove) + ds->drv->remove (ds); }
Quoted 2 lines
Andrew
Well, sorry, I did the change but it got lost when refactoring the ppu stuff.
Neil