Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3845836pxb; Mon, 4 Oct 2021 10:51:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqSstvq/Qi57xDlcbZLjo/l1Y+NevGdveMBpzWdaeH710TbWfvC0jXfxwY+Ud+Td1xSoOU X-Received: by 2002:a50:e183:: with SMTP id k3mr20602860edl.22.1633369866692; Mon, 04 Oct 2021 10:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633369866; cv=none; d=google.com; s=arc-20160816; b=hdDlpc8VD/KdChwdlo8QQHwqd3o5pHkpJZJg8fmJ+ZI0su1VLmohjnuEvhe4IZekN4 FbE9ZMJazVwvrsvirIpGq5rgIA53Xzc5hOQd7dtkJI/FuMP0IsEHdKiNGOwxcsiHsgAx FG9B/wmCA1fGZFR35PGkjtTCJjHBUznVrzxNSAsgVD71zQznxsYDrrwY/8zwYmzD2fHi Ml8/IyG6FiPlgCkUnQJBvmShwtU4oxcnMs//Ba28a/qYPMrfiXZCFEOzbdzll/8QsOxk hqk85Wl1kUSDqnbRWKf16K0LSzxTkvmxzhdlvkW88Y7sczjUXGtb8qQY8IEQ2FBa2efb 8HAA== 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; bh=04u9HrHvopK+Qx0rr9TojIrIzwVyQ9P12bAyng4Dcac=; b=XF8CfLSjhLLOAonAGXcVD2fx2KXAGiEHmM4OWwmAt9ALFcnrCNZtI28tA4QW1OW3TY W0KYfvm9/uRdQvp4C6poaUBqIII2yryifygg9D2Q+eGlG7TwuGE0u0hoeYjgTikMZERD lKRdxSiW+mWIXT3ySv7YPtZh3d6yWRoLsfdF6YnDEqRn0vTow/BguHtqoop6Rb9LAFO0 5gBeMlEPu8Q5B8JSiKhfEWi+PTyXSRn1HKrMzW4GP5fsROsob5cdZB3XzCdKkX1Y99yd QA8POpdcaxUxUGUaEbY4hhA4c+4omfPjKif/XRAxFyHUK6kCvO5aq0IRjyUXxru8sinx ivrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b15si21976067edm.218.2021.10.04.10.50.32; Mon, 04 Oct 2021 10:51:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233821AbhJDPP4 (ORCPT + 99 others); Mon, 4 Oct 2021 11:15:56 -0400 Received: from mail-ua1-f47.google.com ([209.85.222.47]:42848 "EHLO mail-ua1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233387AbhJDPPz (ORCPT ); Mon, 4 Oct 2021 11:15:55 -0400 Received: by mail-ua1-f47.google.com with SMTP id c33so12558027uae.9; Mon, 04 Oct 2021 08:14:06 -0700 (PDT) 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=04u9HrHvopK+Qx0rr9TojIrIzwVyQ9P12bAyng4Dcac=; b=1GT2qdf7bHz2ruStg2oLTcDHUm4H0P2waKGMzG09eY1CCv+1Wt1ssqXmd6GIrbleS0 uZFEsinRMVUSWNonJXUKA/kXXIMMVnbqpjR0ttL5Ndlti+3QfrqlGxB3BVKZbylV3TSp uNgFtcPEJ0/Fbh0vGuGe1xhIF4ivRHiSFMXZnyhh3Pnvnu6kaH8FBUrou7VhibGH8Rln GDQ7825UoiDteVOYag3mTSTF2FBUTXp0CwFC+wFpNTv9xEqgseuBTCCav/x4X7uPD6kt 8X4qapRz+ZU3/onDBwZl+SzRRhUoYrwr4k4ET6Oxx2q/bJU1oXmK4Flb+8sHbhBkqXwv LjjQ== X-Gm-Message-State: AOAM531bT2itk3hPHivt16vbXybCcgfe80oa3XbIG/lLTBWZAMClSkRp Q+ShsMsyShZlf1HfwrJnT1v6ljfbWgxnrRGAypA= X-Received: by 2002:ab0:58c1:: with SMTP id r1mr7168725uac.89.1633360446142; Mon, 04 Oct 2021 08:14:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Geert Uytterhoeven Date: Mon, 4 Oct 2021 17:13:54 +0200 Message-ID: Subject: Re: [PATCH] gpio: aggregator: Add interrupt support To: Andy Shevchenko Cc: Linus Walleij , Bartosz Golaszewski , Viresh Kumar , metux IT consult , Andy Shevchenko , Arnd Bergmann , "open list:GPIO SUBSYSTEM" , Linux-Renesas , Linux Kernel Mailing List , virtualization@lists.linux-foundation.org, stratos-dev@op-lists.linaro.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, On Mon, Oct 4, 2021 at 3:21 PM Andy Shevchenko wrote: > On Mon, Oct 4, 2021 at 3:45 PM Geert Uytterhoeven > wrote: > > Currently the GPIO Aggregator does not support interrupts. This means > > that kernel drivers going from a GPIO to an IRQ using gpiod_to_irq(), > > and userspace applications using line events do not work. > > > > Add interrupt support by providing a gpio_chip.to_irq() callback, which > > just calls into the parent GPIO controller. > > > > Note that this does not implement full interrupt controller (irq_chip) > > support, so using e.g. gpio-keys with "interrupts" instead of "gpios" > > still does not work. > > ... > > > @@ -414,7 +421,8 @@ static struct gpiochip_fwd *gpiochip_fwd_create(struct device *dev, > > for (i = 0; i < ngpios; i++) { > > struct gpio_chip *parent = gpiod_to_chip(descs[i]); > > > > - dev_dbg(dev, "%u => gpio-%d\n", i, desc_to_gpio(descs[i])); > > + dev_dbg(dev, "%u => gpio %d irq %d\n", i, > > + desc_to_gpio(descs[i]), gpiod_to_irq(descs[i])); > > This is an unconditional call that will allocate the IRQ descriptor If DEBUG and CONFIG_DYNAMIC_DEBUG* are not enabled, it's a no-op (protected by if (0) { ... }). If CONFIG_DYNAMIC_DEBUG is enabled, the operation is a no-op if not enabled dynamically (if (dynamic_checl) { ... }). If DEBUG (CONFIG_DEBUG_GPIO) is enabled, the output is wanted. (yes, I've just checked the preprocessor and assembler output ;-). > even if we don't use it. Correct? It calls .to_irq() of the parent GPIO controller, which is usually just doing some offset addition. But that's driver-dependent. > If so, I don't like this. No worries, desc_to_gpio() and gpiod_to_irq() are only evaluated when the debug output is wanted. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds