* [RFC PATCH 1/3] net: dsa: bcm_sf2: cleanup resources in remove callback
@ 2015-10-27 16:35 Neil Armstrong
2015-10-27 17:22 ` kbuild test robot
0 siblings, 1 reply; 2+ messages in thread
From: Neil Armstrong @ 2015-10-27 16:35 UTC (permalink / raw)
To: David S. Miller
Cc: Andrew Lunn, Florian Fainelli, Guenter Roeck, vivien.didelot,
Fabian Frederick, Pavel Nakonechny, Joe Perches, netdev,
linux-kernel
Implement a remove callback allowing the switch driver to cleanup
resources it used: interrupts and remapped register ranges.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
drivers/net/dsa/bcm_sf2.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 6f946fe..e0be318 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -1054,6 +1054,25 @@ out_unmap:
return ret;
}
+static void bcm_sf2_sw_remove(struct dsa_switch *ds)
+{
+ struct bcm_sf2_priv *priv = ds_to_priv(ds);
+ void __iomem **base;
+ unsigned int i;
+
+ /* Disable all interrupts and free them */
+ bcm_sf2_intr_disable(priv);
+
+ free_irq(priv->irq0, priv);
+ free_irq(priv->irq1, priv);
+
+ base = &priv->core;
+ for (i = 0; i < BCM_SF2_REGS_NUM; i++) {
+ iounmap(*base);
+ base++;
+ }
+}
+
static int bcm_sf2_sw_set_addr(struct dsa_switch *ds, u8 *addr)
{
return 0;
@@ -1367,6 +1386,7 @@ static struct dsa_switch_driver bcm_sf2_switch_driver = {
.tag_protocol = DSA_TAG_PROTO_BRCM,
.priv_size = sizeof(struct bcm_sf2_priv),
.probe = bcm_sf2_sw_probe,
+ .remove = bcm_sf2_sw_remove,
.setup = bcm_sf2_sw_setup,
.set_addr = bcm_sf2_sw_set_addr,
.get_phy_flags = bcm_sf2_sw_get_phy_flags,
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC PATCH 1/3] net: dsa: bcm_sf2: cleanup resources in remove callback
2015-10-27 16:35 [RFC PATCH 1/3] net: dsa: bcm_sf2: cleanup resources in remove callback Neil Armstrong
@ 2015-10-27 17:22 ` kbuild test robot
0 siblings, 0 replies; 2+ messages in thread
From: kbuild test robot @ 2015-10-27 17:22 UTC (permalink / raw)
To: Neil Armstrong
Cc: kbuild-all, David S. Miller, Andrew Lunn, Florian Fainelli,
Guenter Roeck, vivien.didelot, Fabian Frederick, Pavel Nakonechny,
Joe Perches, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1443 bytes --]
Hi Neil,
[auto build test ERROR on net/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/Neil-Armstrong/net-dsa-cleanup-dsa-driver/20151028-003842
config: x86_64-allmodconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All error/warnings (new ones prefixed by >>):
>> drivers/net/dsa/bcm_sf2.c:1077:2: error: unknown field 'remove' specified in initializer
.remove = bcm_sf2_sw_remove,
^
>> drivers/net/dsa/bcm_sf2.c:1077:14: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
.remove = bcm_sf2_sw_remove,
^
drivers/net/dsa/bcm_sf2.c:1077:14: note: (near initialization for 'bcm_sf2_switch_driver.setup')
vim +/remove +1077 drivers/net/dsa/bcm_sf2.c
1071 }
1072
1073 static struct dsa_switch_driver bcm_sf2_switch_driver = {
1074 .tag_protocol = DSA_TAG_PROTO_BRCM,
1075 .priv_size = sizeof(struct bcm_sf2_priv),
1076 .probe = bcm_sf2_sw_probe,
> 1077 .remove = bcm_sf2_sw_remove,
1078 .setup = bcm_sf2_sw_setup,
1079 .set_addr = bcm_sf2_sw_set_addr,
1080 .get_phy_flags = bcm_sf2_sw_get_phy_flags,
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 50058 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-27 17:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-27 16:35 [RFC PATCH 1/3] net: dsa: bcm_sf2: cleanup resources in remove callback Neil Armstrong
2015-10-27 17:22 ` kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox