From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757441AbbJ2OvG (ORCPT ); Thu, 29 Oct 2015 10:51:06 -0400 Received: from vps0.lunn.ch ([178.209.37.122]:58216 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751017AbbJ2OvB (ORCPT ); Thu, 29 Oct 2015 10:51:01 -0400 Date: Thu, 29 Oct 2015 15:50:52 +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 1/5] net: dsa: allow switch drivers to cleanup their resources Message-ID: <20151029145052.GU2307@lunn.ch> References: <56323104.2030606@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56323104.2030606@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: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 > Signed-off-by: Neil Armstrong > --- > 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