From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964906AbbJ0PkF (ORCPT ); Tue, 27 Oct 2015 11:40:05 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:35964 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932256AbbJ0PkD (ORCPT ); Tue, 27 Oct 2015 11:40:03 -0400 Message-ID: <562F9AAB.8090202@gmail.com> Date: Tue, 27 Oct 2015 08:39:23 -0700 From: Florian Fainelli User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Neil Armstrong , "David S. Miller" CC: Andrew Lunn , Guenter Roeck , vivien.didelot@savoirfairelinux.com, Fabian Frederick , Pavel Nakonechny , Joe Perches , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Frode Isaksen Subject: Re: [PATCH 2/6] net: dsa: allow switch drivers to cleanup their resources References: <562F8ED7.2000804@baylibre.com> In-Reply-To: <562F8ED7.2000804@baylibre.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 > --- > 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