net: dsa: allow switch drivers to cleanup their resources
Subsystems (3)
PATCH 2/6 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.
--- include/net/dsa.h | 1 + net/dsa/dsa.c | 4 ++++ 2 files changed, 5 insertions(+)
include/net/dsa.h +1 -0
@@ -211,6 +211,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
Quoted 4 lines · Neil Armstrong
Some switch drivers might request interrupts, remap register ranges, allow such drivers to implement a "remove" callback doing just that.
Suggested-by Florian Fainelli <[email protected]>
This should probably be a Signed-off-by tag, but there is nothing using this, so you would want to introduce an user of this function in the same patch series so we see how you intend to use it?
Quoted 34 lines
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@@ -211,6 +211,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
Florian
Hi,
Quoted 11 lines · Florian Fainelli
Quoted 4 lines · Neil Armstrong
Some switch drivers might request interrupts, remap register ranges, allow such drivers to implement a "remove" callback doing just that.
Suggested-by Florian Fainelli <[email protected]>This should probably be a Signed-off-by tag, but there is nothing using this, so you would want to introduce an user of this function in the same patch series so we see how you intend to use it?
Quoted 1 line
Signed-off-by Neil Armstrong <[email protected]>
Yes, I didn't know how to handle this since it was part of a larger patch.
I forgot to add this into the cover-letter but I wanted to send an RFC serie with your bcm remove patch and a mv88e6xxx remove experimental code.
Yet, the mv88e6060 does not make usage of this.
Neil
Quoted 12 lines · Neil Armstrong
Hi,
Quoted 10 lines · Florian Fainelli
Quoted 4 lines · Neil Armstrong
Some switch drivers might request interrupts, remap register ranges, allow such drivers to implement a "remove" callback doing just that.
Suggested-by Florian Fainelli <[email protected]>This should probably be a Signed-off-by tag, but there is nothing using this, so you would want to introduce an user of this function in the same patch series so we see how you intend to use it?
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Signed-off-by Neil Armstrong <[email protected]>Yes, I didn't know how to handle this since it was part of a larger patch.
I forgot to add this into the cover-letter but I wanted to send an RFC serie with your bcm remove patch and a mv88e6xxx remove experimental code.
Yet, the mv88e6060 does not make usage of this.
So this patch must be part of your RFC for module removal instead of this patchset.
Thanks,
-v
Quoted 7 lines · Vivien Didelot
Quoted 6 lines · Neil Armstrong
Yes, I didn't know how to handle this since it was part of a larger patch.
I forgot to add this into the cover-letter but I wanted to send an RFC serie with your bcm remove patch and a mv88e6xxx remove experimental code.
Quoted 8 lines
Quoted 1 line
Yet, the mv88e6060 does not make usage of this.
So this patch must be part of your RFC for module removal instead of this patchset.
Thanks,
-v
Vivien, Florian,
Thanks for the review, I will integrate it in the other RFC patchset with the correct Signed-off-by tag.
Neil