[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20151029151718.GW2307@lunn.ch>
Date: Thu, 29 Oct 2015 16:17:18 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Neil Armstrong <narmstrong@...libre.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Florian Fainelli <f.fainelli@...il.com>,
Guenter Roeck <linux@...ck-us.net>,
vivien.didelot@...oirfairelinux.com,
Fabian Frederick <fabf@...net.be>,
Pavel Nakonechny <pavel.nakonechny@...tlab.ru>,
Joe Perches <joe@...ches.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v3 2/5] net: dsa: bcm_sf2: cleanup resources in
remove callback
On Thu, Oct 29, 2015 at 03:45:30PM +0100, Neil Armstrong wrote:
> Implement a remove callback allowing the switch driver to cleanup
> resources it used: interrupts and remapped register ranges.
>
> Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
> Signed-off-by: Neil Armstrong <narmstrong@...libre.com>
> ---
> drivers/net/dsa/bcm_sf2.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
> index 6f946fe..e0be318 100644
> --- a/drivers/net/dsa/bcm_sf2.c
> +++ b/drivers/net/dsa/bcm_sf2.c
> @@ -1054,6 +1054,25 @@ out_unmap:
> return ret;
> }
>
> +static void bcm_sf2_sw_remove(struct dsa_switch *ds)
> +{
> + struct bcm_sf2_priv *priv = ds_to_priv(ds);
> + void __iomem **base;
> + unsigned int i;
> +
> + /* Disable all interrupts and free them */
> + bcm_sf2_intr_disable(priv);
> +
> + free_irq(priv->irq0, priv);
> + free_irq(priv->irq1, priv);
> +
> + base = &priv->core;
> + for (i = 0; i < BCM_SF2_REGS_NUM; i++) {
> + iounmap(*base);
> + base++;
Something for Florian to consider. Would it be possible to move to
using devm_ for interrupts and iomem? The question would be, what is
dev?
Andrew
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists