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


Groups > linux.kernel > #1258114 > unrolled thread

[RFC PATCH v2 1/4] net: dsa: allow switch drivers to cleanup their resources

Started byNeil Armstrong <narmstrong@baylibre.com>
First post2015-10-28 15:20 +0100
Last post2015-10-28 15:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [RFC PATCH v2 1/4] net: dsa: allow switch drivers to cleanup their  resources Neil Armstrong <narmstrong@baylibre.com> - 2015-10-28 15:20 +0100
    Re: [RFC PATCH v2 1/4] net: dsa: allow switch drivers to cleanup  their resources Andrew Lunn <andrew@lunn.ch> - 2015-10-28 15:30 +0100

#1258114 — [RFC PATCH v2 1/4] net: dsa: allow switch drivers to cleanup their resources

FromNeil Armstrong <narmstrong@baylibre.com>
Date2015-10-28 15:20 +0100
Subject[RFC PATCH v2 1/4] net: dsa: allow switch drivers to cleanup their resources
Message-ID<qozK1-3GM-7@gated-at.bofh.it>
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@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 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 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/

[toc] | [next] | [standalone]


#1258168 — Re: [RFC PATCH v2 1/4] net: dsa: allow switch drivers to cleanup their resources

FromAndrew Lunn <andrew@lunn.ch>
Date2015-10-28 15:30 +0100
SubjectRe: [RFC PATCH v2 1/4] net: dsa: allow switch drivers to cleanup their resources
Message-ID<qozTK-3KE-57@gated-at.bofh.it>
In reply to#1258114
On Wed, Oct 28, 2015 at 03:12:57PM +0100, Neil Armstrong wrote:
> 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@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 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 */

A nitpick:

 /* Give the driver a chance to cleanup */

would be better English.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>


	    Andrew
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web