From: Neil Armstrong <narmstrong@baylibre.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Guenter Roeck <linux@roeck-us.net>,
vivien.didelot@savoirfairelinux.com,
Fabian Frederick <fabf@skynet.be>,
Pavel Nakonechny <pavel.nakonechny@skitlab.ru>,
Joe Perches <joe@perches.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Frode Isaksen <fisaksen@baylibre.com>
Subject: [PATCH 2/6] net: dsa: allow switch drivers to cleanup their resources
Date: Tue, 27 Oct 2015 15:48:55 +0100 [thread overview]
Message-ID: <562F8ED7.2000804@baylibre.com> (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
next reply other threads:[~2015-10-27 14:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-27 14:48 Neil Armstrong [this message]
2015-10-27 15:39 ` [PATCH 2/6] net: dsa: allow switch drivers to cleanup their resources Florian Fainelli
2015-10-27 15:43 ` Neil Armstrong
2015-10-27 16:59 ` Vivien Didelot
2015-10-28 13:56 ` Neil Armstrong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=562F8ED7.2000804@baylibre.com \
--to=narmstrong@baylibre.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=fabf@skynet.be \
--cc=fisaksen@baylibre.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=netdev@vger.kernel.org \
--cc=pavel.nakonechny@skitlab.ru \
--cc=vivien.didelot@savoirfairelinux.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).