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


Groups > linux.kernel > #1256792 > unrolled thread

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

Started byNeil Armstrong <narmstrong@baylibre.com>
First post2015-10-27 15:50 +0100
Last post2015-10-27 16:50 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [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

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

FromNeil Armstrong <narmstrong@baylibre.com>
Date2015-10-27 15:50 +0100
Subject[PATCH 2/6] net: dsa: allow switch drivers to cleanup their resources
Message-ID<qodJv-6ns-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.

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/

[toc] | [next] | [standalone]


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

FromNeil Armstrong <narmstrong@baylibre.com>
Date2015-10-27 16:50 +0100
SubjectRe: [PATCH 2/6] net: dsa: allow switch drivers to cleanup their resources
Message-ID<qoeFA-6WP-1@gated-at.bofh.it>
In reply to#1256792
Hi,
On 10/27/2015 04:39 PM, Florian Fainelli wrote:
> On 27/10/15 07:48, Neil Armstrong wrote:
>> 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>
> 
> This should probably be a Signed-off-by tag, but there is nothing using
> this, so you would want to introduce an user of this function in the
> same patch series so we see how you intend to use it?
> 
>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>

Yes, I didn't know how to handle this since it was part of a larger patch.

I forgot to add this into the cover-letter but I wanted to send an RFC serie with
your bcm remove patch and a mv88e6xxx remove experimental code.

Yet, the mv88e6060 does not make usage of this.

Neil
--
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] | [next] | [standalone]


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

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2015-10-27 18:10 +0100
SubjectRe: [PATCH 2/6] net: dsa: allow switch drivers to cleanup their resources
Message-ID<qofV2-7TL-69@gated-at.bofh.it>
In reply to#1256859
On Oct. Tuesday 27 (44) 04:43 PM, Neil Armstrong wrote:
> Hi,
> On 10/27/2015 04:39 PM, Florian Fainelli wrote:
> > On 27/10/15 07:48, Neil Armstrong wrote:
> >> 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>
> > 
> > This should probably be a Signed-off-by tag, but there is nothing using
> > this, so you would want to introduce an user of this function in the
> > same patch series so we see how you intend to use it?
> > 
> >> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> 
> Yes, I didn't know how to handle this since it was part of a larger patch.
> 
> I forgot to add this into the cover-letter but I wanted to send an RFC serie with
> your bcm remove patch and a mv88e6xxx remove experimental code.
> 
> Yet, the mv88e6060 does not make usage of this.

So this patch must be part of your RFC for module removal instead of
this patchset.

Thanks,
-v
--
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] | [next] | [standalone]


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

FromNeil Armstrong <narmstrong@baylibre.com>
Date2015-10-28 15:10 +0100
SubjectRe: [PATCH 2/6] net: dsa: allow switch drivers to cleanup their resources
Message-ID<qozAp-3CV-75@gated-at.bofh.it>
In reply to#1256980
On 10/27/2015 05:59 PM, Vivien Didelot wrote:
> On Oct. Tuesday 27 (44) 04:43 PM, Neil Armstrong wrote:
>>
>> Yes, I didn't know how to handle this since it was part of a larger patch.
>>
>> I forgot to add this into the cover-letter but I wanted to send an RFC serie with
>> your bcm remove patch and a mv88e6xxx remove experimental code.
>>
>> Yet, the mv88e6060 does not make usage of this.
> 
> So this patch must be part of your RFC for module removal instead of
> this patchset.
> 
> Thanks,
> -v
> 

Vivien, Florian,

Thanks for the review, I will integrate it in the other RFC patchset with the correct Signed-off-by tag.

Neil
--
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] | [next] | [standalone]


#1256870

FromFlorian Fainelli <f.fainelli@gmail.com>
Date2015-10-27 16:50 +0100
Message-ID<qoeFA-6WP-3@gated-at.bofh.it>
In reply to#1256792
On 27/10/15 07:48, Neil Armstrong wrote:
> 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>

This should probably be a Signed-off-by tag, but there is nothing using
this, so you would want to introduce an user of this function in the
same patch series so we see how you intend to use it?

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


-- 
Florian
--
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