From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9CBBC433F5 for ; Thu, 12 May 2022 11:22:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353315AbiELLWG (ORCPT ); Thu, 12 May 2022 07:22:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353388AbiELLVI (ORCPT ); Thu, 12 May 2022 07:21:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E77D015EA42; Thu, 12 May 2022 04:19:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9B5F9B82796; Thu, 12 May 2022 11:19:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 664FEC385B8; Thu, 12 May 2022 11:19:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652354390; bh=8QUBHhVx6onGOMeXELO/RliEcskwHr2ea09LwLCtTwA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=bnqPpwX5fp24gDNsShY8x9P/lOXXDRMPJGp3H2U8H9x+UOPNMxGJaQjwJ5iy1MXZR JaAQXqflCTaHTd67UeZ4Gka+6NO/ZK4/3h/+Fc9D2CmLX5eWNR2CtSQDAytgr4Z40b RDxF/VmeJSL/Ey7oxPZ8Xm6B4GW3m0FDqYY7vwucmG+JqtAG9sAyJ/iZ+6TC3Yqi59 vYlNOtcYFX/mlRvYP5011VbXVeNXtyPDnph562EtCRRFnQayEvLKXTevPMyVkIReLp yGzGulz5qdrHaIjEANR6Nh/yvjAGDHNuv+u5HA89MvpsDcLCbuvA/iiukv9y7xZVwD 7MhHzNFwvg8cQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1np6rD-00Aqc1-Mz; Thu, 12 May 2022 12:19:47 +0100 Date: Thu, 12 May 2022 12:19:47 +0100 Message-ID: <87y1z75770.wl-maz@kernel.org> From: Marc Zyngier To: Lad Prabhakar Cc: Geert Uytterhoeven , Linus Walleij , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Bartosz Golaszewski , Philipp Zabel , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, Phil Edworthy , Biju Das , Prabhakar Subject: Re: [PATCH v3 3/5] gpio: gpiolib: Allow free() callback to be overridden In-Reply-To: <20220511183210.5248-4-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20220511183210.5248-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20220511183210.5248-4-prabhakar.mahadev-lad.rj@bp.renesas.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: prabhakar.mahadev-lad.rj@bp.renesas.com, geert+renesas@glider.be, linus.walleij@linaro.org, tglx@linutronix.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, brgl@bgdev.pl, p.zabel@pengutronix.de, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, phil.edworthy@renesas.com, biju.das.jz@bp.renesas.com, prabhakar.csengg@gmail.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On Wed, 11 May 2022 19:32:08 +0100, Lad Prabhakar wrote: > > Allow free() callback to be overridden from irq_domain_ops for > hierarchical chips. > > This allows drivers to free any resources which are allocated during > populate_parent_alloc_arg(). Do you mean more than the fwspec? I don't see this being used. There is also the question of why we need to have dynamic allocation for the fwspec itself. Why isn't that a simple stack allocation in the context of gpiochip_hierarchy_irq_domain_alloc()? M. > > Signed-off-by: Lad Prabhakar > --- > drivers/gpio/gpiolib.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > index b7694171655c..d36c4a965efc 100644 > --- a/drivers/gpio/gpiolib.c > +++ b/drivers/gpio/gpiolib.c > @@ -1187,15 +1187,18 @@ static void gpiochip_hierarchy_setup_domain_ops(struct irq_domain_ops *ops) > ops->activate = gpiochip_irq_domain_activate; > ops->deactivate = gpiochip_irq_domain_deactivate; > ops->alloc = gpiochip_hierarchy_irq_domain_alloc; > - ops->free = irq_domain_free_irqs_common; > > /* > - * We only allow overriding the translate() function for > + * We only allow overriding the translate() and free() functions for > * hierarchical chips, and this should only be done if the user > - * really need something other than 1:1 translation. > + * really need something other than 1:1 translation for translate() > + * callback and free if user wants to free up any resources which > + * were allocated during callbacks, for example populate_parent_alloc_arg. > */ > if (!ops->translate) > ops->translate = gpiochip_hierarchy_irq_domain_translate; > + if (!ops->free) > + ops->free = irq_domain_free_irqs_common; > } > > static int gpiochip_hierarchy_add_domain(struct gpio_chip *gc) > -- > 2.25.1 > > -- Without deviation from the norm, progress is not possible.