Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp988869iob; Fri, 13 May 2022 18:45:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUOx3/3vSDYAhK0HGP3yKX8httmTcBXDLTVQmlb5wMOgPdctPH2P+togBjeZ/fV1ewCUUO X-Received: by 2002:a5d:4dc7:0:b0:20a:ed1a:2c0 with SMTP id f7-20020a5d4dc7000000b0020aed1a02c0mr5867976wru.448.1652492736790; Fri, 13 May 2022 18:45:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652492736; cv=none; d=google.com; s=arc-20160816; b=euRIfeF0tB5AdbX3dNiPfSkS0z9N6z1z+EXziAPdgqj8vWtbwryAPaG972Ef7kSprQ V+OLKPkdPUDtf+573bS9pil26P//DC87tk64C0B8AOUQKgnLPh2n0fYQtyCEcMKFKYbF R2dZ0U8bV9gVRILEmRwl65oheNfEuZZHbLZsJkDDHCZhqFsX2fMlqQQRe6480+7V8SPs yIahxJRITQ74zCtuaXgrqjMJrThWJjpltHMVW4fQaJaBKdKZnJzVOF/dXz4/hSg0g2bD bNyxFt+xcECSdWCZYozWGDokom6KoJFrbUDX5rt229rkJ+1fSI3oHfoV+eSzNXg/IMdo xZiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=QEFiFZ1/ciZzHW+xjDIhz3vWAg4nMa4ZVXzSZCjuxq0=; b=m+jESBpGIwtaX489U9+vkhjtgZF30cwr7cge8XrodHu18y3AHn77Eid41Lb1Itv/oF tzG2CmdHmCTHPJG4/fdpJcYdO+FZHSXr7LkNKp0yChvkZufBCb+FrC+yeB8T43fz0W2Y I8aGrIZ7fRc5xs939KiSaPEN2fXPgr5YGEvwDCCEyNh/e5QOmevRjsu6n8PeQ1gmk4uW AqYaPh8yCbZDIQCHHnQr5tU7oedC4haCnOvlICUSt6BBLhwXYLQTyp4X+011wz5bnRdp a3bFgT8pu0fBeVVWWtQW/cnfTi+0U3tmy2ijYFDRS6/7Pufdh/F6UmdTsoF7INZBKRvq dqmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eWiMTMcE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n8-20020a5d5888000000b002060de0b7edsi3316768wrf.846.2022.05.13.18.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 18:45:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eWiMTMcE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E397C437061; Fri, 13 May 2022 17:10:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245237AbiELNuq (ORCPT + 99 others); Thu, 12 May 2022 09:50:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354686AbiELNud (ORCPT ); Thu, 12 May 2022 09:50:33 -0400 Received: from mail-yw1-x1135.google.com (mail-yw1-x1135.google.com [IPv6:2607:f8b0:4864:20::1135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA2A924A390; Thu, 12 May 2022 06:50:32 -0700 (PDT) Received: by mail-yw1-x1135.google.com with SMTP id 00721157ae682-2ebf4b91212so57126177b3.8; Thu, 12 May 2022 06:50:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QEFiFZ1/ciZzHW+xjDIhz3vWAg4nMa4ZVXzSZCjuxq0=; b=eWiMTMcE7xdesXFlcaYF+vIe62G2XVMe02DKy6lG4V3iHzsii2svHkjvVs3A9IQqLy Y9ktwHLUEKhLrZpZvquPUA97WntlLJwLgFtp/5UG7ULm/ywxbJNuvcPDrh+XtmDnWabd JlJ1GxWQBA8mr17CUfHy5m+HbSED00lY24SALvYXSMSejXcGaifgeW0gExOOmU5f0QYE MicFXWleXqXhvqqjZoXJHexmS9gJUdJ5cebOyQnQay9yYHORyiFS/t4f96kQKSmymXWu QHe9XKO+2YuRyiZDDWA2AXKCQdnrWpGnWI0ENTGhPbudbeoDQNUBkX5Eu2LhrK0/Em+4 T4Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QEFiFZ1/ciZzHW+xjDIhz3vWAg4nMa4ZVXzSZCjuxq0=; b=HQZgxQlzH0CE1gxuzWAKRTivQmh5Wpiy3SFXGWkcYbYFxdW6T47xwstE7EbaNeZ8i1 XHx1Q+XT2rlC1YptcsH9nHYEaFCufanhzUinS7Qpx+l2d9YJtty4IH0lYDFqDuBlC2PD 0ui6El0VLsFf3AQIOYu/6FuDshbpV9eE09ae42MC4aYcp380auXCKzpnJt7Z4BFavMSc L770u5WWSfP57vjUBe4uaVu7BtWv8CxBXThI/QmY0xOQfnrDBGV1SsfDXrI77WqvZWzP nuCPtU/ces7L35yeXlusD07kqsoEaihZ1D0JAJZ1lmn2ga/eLCl40nrFZE17IpZLRb+p eQ2g== X-Gm-Message-State: AOAM532ctKr2s7ScWXtupzGVn31IerPqc6oHcdPBL7UDn2+2KSqBEr8W MlBS+JPn1Jz7yai+YnmPovYADwrYNGYS7xp/PkY= X-Received: by 2002:a0d:d491:0:b0:2ef:5485:fca with SMTP id w139-20020a0dd491000000b002ef54850fcamr154901ywd.16.1652363431692; Thu, 12 May 2022 06:50:31 -0700 (PDT) MIME-Version: 1.0 References: <20220511183210.5248-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20220511183210.5248-4-prabhakar.mahadev-lad.rj@bp.renesas.com> <87y1z75770.wl-maz@kernel.org> <87wneq6fz3.wl-maz@kernel.org> In-Reply-To: <87wneq6fz3.wl-maz@kernel.org> From: "Lad, Prabhakar" Date: Thu, 12 May 2022 14:50:05 +0100 Message-ID: Subject: Re: [PATCH v3 3/5] gpio: gpiolib: Allow free() callback to be overridden To: Marc Zyngier Cc: Lad Prabhakar , Geert Uytterhoeven , Linus Walleij , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Bartosz Golaszewski , Philipp Zabel , "open list:GPIO SUBSYSTEM" , LKML , Linux-Renesas , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Phil Edworthy , Biju Das Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi Marc, On Thu, May 12, 2022 at 2:24 PM Marc Zyngier wrote: > > On Thu, 12 May 2022 13:48:53 +0100, > "Lad, Prabhakar" wrote: > > > > Hi Marc, > > > > Thank you for the review. > > > > On Thu, May 12, 2022 at 12:19 PM Marc Zyngier wrote: > > > > > > 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. > > > > > The free callback is used in patch 5/5 where free is overridden by > > rzg2l_gpio_irq_domain_free. I just gave an example there as an > > populate_parent_alloc_arg() In actual in the child_to_parent_hwirq > > callback I am using a bitmap [0] to get a free tint slot, this bitmap > > needs freeing up when the GPIO interrupt is released from the driver > > that as when overridden free callback frees the allocated tint slot so > > that its available for re-use. > > Right, so that's actually a different life-cycle, and the whole > populate_parent_alloc_arg() is a red herring. What you want is to free > resources that have been allocated via some other paths. It'd be good Is there any other path which I have missed where I can free up resources? > if your commit message actually reflected this instead of using an > example that doesn't actually exist. > My bad, I will update the commit message. > > > > > 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()? > > > > > you mean gpio core itself should handle the fwspec > > allocation/freeing? > > Yes. The only reason we resort to dynamic allocation is because > ThunderX is using MSI-based GPIOs, and thus doesn't use a fwspec (no > firmware is involved here). > I see.. > If we had a union of the two types, we could just have a stack > variable, and pass that along, completely sidestepping the whole > dynamic allocation/freeing business. > Right agreed. Cheers, Prabhakar