netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v3 1/5] net: dsa: allow switch drivers to cleanup their resources
@ 2015-10-29 14:45 Neil Armstrong
  2015-10-29 14:50 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Neil Armstrong @ 2015-10-29 14:45 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

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH v3 1/5] net: dsa: allow switch drivers to cleanup their resources
  2015-10-29 14:45 [RFC PATCH v3 1/5] net: dsa: allow switch drivers to cleanup their resources Neil Armstrong
@ 2015-10-29 14:50 ` Andrew Lunn
  2015-10-29 14:56   ` Neil Armstrong
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2015-10-29 14:50 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: David S. Miller, Florian Fainelli, Guenter Roeck, vivien.didelot,
	Fabian Frederick, Pavel Nakonechny, Joe Perches, netdev,
	linux-kernel

On Thu, Oct 29, 2015 at 03:45:24PM +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 */
> +	if (ds->drv->remove)
> +		ds->drv->remove(ds);
>  }

https://lkml.org/lkml/2015/10/28/532 ???

     Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH v3 1/5] net: dsa: allow switch drivers to cleanup their resources
  2015-10-29 14:50 ` Andrew Lunn
@ 2015-10-29 14:56   ` Neil Armstrong
  0 siblings, 0 replies; 3+ messages in thread
From: Neil Armstrong @ 2015-10-29 14:56 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: David S. Miller, Florian Fainelli, Guenter Roeck, vivien.didelot,
	Fabian Frederick, Pavel Nakonechny, Joe Perches, netdev,
	linux-kernel

On 10/29/2015 03:50 PM, Andrew Lunn wrote:
> On Thu, Oct 29, 2015 at 03:45:24PM +0100, Neil Armstrong wrote:
>> --- 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);
>>  }
> 
> https://lkml.org/lkml/2015/10/28/532 ???
> 
>      Andrew
> 
Well, sorry, I did the change but it got lost when refactoring the ppu stuff.

Neil

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-29 14:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-29 14:45 [RFC PATCH v3 1/5] net: dsa: allow switch drivers to cleanup their resources Neil Armstrong
2015-10-29 14:50 ` Andrew Lunn
2015-10-29 14:56   ` Neil Armstrong

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).