[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5630D7E9.4020609@baylibre.com>
Date: Wed, 28 Oct 2015 15:12:57 +0100
From: Neil Armstrong <narmstrong@...libre.com>
To: "David S. Miller" <davem@...emloft.net>
Cc: Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Guenter Roeck <linux@...ck-us.net>,
vivien.didelot@...oirfairelinux.com,
Fabian Frederick <fabf@...net.be>,
Pavel Nakonechny <pavel.nakonechny@...tlab.ru>,
Joe Perches <joe@...ches.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [RFC PATCH v2 1/4] 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 <f.fainelli@...il.com>
Signed-off-by: Neil Armstrong <narmstrong@...libre.com>
---
include/net/dsa.h | 1 +
net/dsa/dsa.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 98ccbde..0e1502c 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -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);
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 1eba07f..f462fc5 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -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
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists