Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1256792

[PATCH 2/6] net: dsa: allow switch drivers to cleanup their resources

From Neil Armstrong <narmstrong@baylibre.com>
Newsgroups linux.kernel
Subject [PATCH 2/6] net: dsa: allow switch drivers to cleanup their resources
Date 2015-10-27 15:50 +0100
Message-ID <qodJv-6ns-7@gated-at.bofh.it> (permalink)
Organization Baylibre

Show all headers | View raw


Some switch drivers might request interrupts, remap register ranges,
allow such drivers to implement a "remove" callback doing just that.

Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.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 d4d13f7..725b11f 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -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);

diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index aeb6a7c..7c9914b 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 linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 2/6] net: dsa: allow switch drivers to cleanup their resources Neil Armstrong <narmstrong@baylibre.com> - 2015-10-27 15:50 +0100
  Re: [PATCH 2/6] net: dsa: allow switch drivers to cleanup their  resources Neil Armstrong <narmstrong@baylibre.com> - 2015-10-27 16:50 +0100
    Re: [PATCH 2/6] net: dsa: allow switch drivers to cleanup their  resources Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-10-27 18:10 +0100
      Re: [PATCH 2/6] net: dsa: allow switch drivers to cleanup their  resources Neil Armstrong <narmstrong@baylibre.com> - 2015-10-28 15:10 +0100
  Re: [PATCH 2/6] net: dsa: allow switch drivers to cleanup their resources Florian Fainelli <f.fainelli@gmail.com> - 2015-10-27 16:50 +0100

csiph-web