Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp938176imk; Sun, 3 Jul 2022 12:44:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tQhlmGzMTG8kNBljGAeyxC7lvtP6tyd2XIqU5YqwpNIzJBuhqeikRfj2CpxBRcSlio3Csi X-Received: by 2002:a17:907:2d0c:b0:726:9a23:9318 with SMTP id gs12-20020a1709072d0c00b007269a239318mr25635960ejc.238.1656877499327; Sun, 03 Jul 2022 12:44:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656877499; cv=none; d=google.com; s=arc-20160816; b=LHgmqOyfzbLNrufc7n9x20ROXQMAe44MpmL6DHOqNXxw5cDCgijNkUd08hHLncwmKo V2I8KfZsQ5atLkt2YclPNQCcBEXf1SYqMtieKN1gNnjjNe1M+HAT3277pGV0Ni8qBTUA oz8QqrodvvslyGwKg1QOlq58zFkamguGJA7ASh+ADa1B+Hw7jbzJ6JfAJHIUO9I8M0+2 BB+TPAFbgFNLIesX9eHUdiXdoKJE1TCyfJZnnwZvCgV1OnUGmMqtZUpgn/ZZQq4HAm0r EiV6ypkAaYWjD5IzukwL8/7tw2tg5d2tZ78Xb7KvwjGma8hahrHu9/6mWFsIif03O0nK 0erw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XI0bxFBrEKRBuDqtanZl8S03OsomJgySRxxoYC8Ucrc=; b=GbY5ihUhHNEEvcJGPsLwO8WuhV/UvbsKZ9p6LDiSVumze8vm2Hh94aBhxFUBQuH9c5 BpdNXpZOJi1hs+y0LNfzL7YP2B71hNk6Ewbi2rCt1E4ceZBmgt/tFmfBP7PdMmG/mksd +Q96cSYihXms4ivO+IQ0j9IeRCfHg/pKpDbKZfaAQuKhS/2aiKCMbEsNr+dM5Ec8MAYq J2NeO4eOV+UMflrfPIHB4GeGtZUwMo4p3KPw88vYWjRPoSN8NfhzaCL1Y3blHQgnsnQ+ Wm5mC8znUMAmmUB2loZoY9B7w3N9NZPoSHTUtIIQZ1+rmhEA9hf9uYa3S8ZzsrymoZb9 ndeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BMRuLECs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa42-20020a17090786aa00b007065d999015si3619056ejc.232.2022.07.03.12.44.35; Sun, 03 Jul 2022 12:44:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BMRuLECs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232853AbiGCTly (ORCPT + 99 others); Sun, 3 Jul 2022 15:41:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232809AbiGCTlt (ORCPT ); Sun, 3 Jul 2022 15:41:49 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D3BF6157; Sun, 3 Jul 2022 12:41:47 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id z1so1057044plb.1; Sun, 03 Jul 2022 12:41:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XI0bxFBrEKRBuDqtanZl8S03OsomJgySRxxoYC8Ucrc=; b=BMRuLECs2RX8B6S5+IZV8fP93sQaUeK4uPrhUKicuUsLE9HU0FKZbfklpf6VirX9lg 9DCIhzlSiWlXIR09aOkB1etop/nGQ2JVntWXMNI6BYXbDZ9HxM4BTi6NqLFEqYAPCqxc evfCU8JZ4TeOuxzq1Z8Z3SK7FDZ7C4LW3FPjfkTGGG2FXFfkgnj3jWLQ46QgxSdYFnr8 56zMstllAfIfejEk13ksSdnSKnnNCtlgQ+3sVsrRCtoQunL1VR3PAUGJH7oBTWYlod3l CoGaIWQYtZasb9muld9wqIkOQvxQGl7pbEng/KsLHt6eVjmrmYTTgw5+boH+lgqR/IQo O5kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XI0bxFBrEKRBuDqtanZl8S03OsomJgySRxxoYC8Ucrc=; b=CgPR+DwRAussj78jccWiQo8LClR04YQ5dwGcxAZdJlx3wWE3iKw0cQupaobeMdjKur 0XJABIlvylFG1ArpXItZwnBJGoj0r7bq9F29blsX/TDF6s4MY08L/0cbSrBAF4gMnOLr j5pmpCe8xH2t4sVF5CnkxqNVoc2bhSC3X2ToBH/dDCJLcXXg/f2sb/+95TgxUa16akmT lgGlibMnoY5gLrhBwAZs3Y/3iXgXtV1TEghaJfNgsTENufk0wn2YteuB4ouiOxjYGFC9 zWN3OmYS8C9j0qlE6VFMnU4U8ffct7lr266nCiJB386gtP2w2JLFsVK5SewqI1Z6jhyT DPSg== X-Gm-Message-State: AJIora+0TjeAkyXfWPLVUuIbSGUEEMahhFgBcbM4Fe8PczoR8aB3Fa+N ndIIYjuedEAtLMwPb/W1yOs= X-Received: by 2002:a17:90a:9401:b0:1ee:e31f:7523 with SMTP id r1-20020a17090a940100b001eee31f7523mr29827184pjo.175.1656877307226; Sun, 03 Jul 2022 12:41:47 -0700 (PDT) Received: from prasmi.domain.name ([103.219.60.86]) by smtp.gmail.com with ESMTPSA id y19-20020a17090aca9300b001e0c5da6a51sm10656104pjt.50.2022.07.03.12.41.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jul 2022 12:41:46 -0700 (PDT) From: Lad Prabhakar X-Google-Original-From: Lad Prabhakar To: Marc Zyngier , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Geert Uytterhoeven , Linus Walleij , Bartosz Golaszewski , Philipp Zabel , devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Lad Prabhakar Subject: [PATCH v7 3/5] gpio: gpiolib: Allow free() callback to be overridden Date: Sun, 3 Jul 2022 20:40:18 +0100 Message-Id: <20220703194020.78701-4-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220703194020.78701-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20220703194020.78701-1-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow free() callback to be overridden from irq_domain_ops for hierarchical chips. This allows drivers to free up resources which are allocated during child_to_parent_hwirq()/populate_parent_alloc_arg() callbacks. On Renesas RZ/G2L platform a bitmap is maintained for TINT slots, a slot is allocated in child_to_parent_hwirq() callback which is freed up in free callback hence this override. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven --- 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 bfde94243752..68d9f95d7799 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1181,15 +1181,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