From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757655AbbJ2PS3 (ORCPT ); Thu, 29 Oct 2015 11:18:29 -0400 Received: from vps0.lunn.ch ([178.209.37.122]:58259 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754034AbbJ2PRa (ORCPT ); Thu, 29 Oct 2015 11:17:30 -0400 Date: Thu, 29 Oct 2015 16:17:18 +0100 From: Andrew Lunn To: Neil Armstrong Cc: "David S. Miller" , Florian Fainelli , Guenter Roeck , vivien.didelot@savoirfairelinux.com, Fabian Frederick , Pavel Nakonechny , Joe Perches , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v3 2/5] net: dsa: bcm_sf2: cleanup resources in remove callback Message-ID: <20151029151718.GW2307@lunn.ch> References: <5632310A.8040406@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5632310A.8040406@baylibre.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Signed-off-by: Neil Armstrong > --- > 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