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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C01AC433F5 for ; Thu, 30 Sep 2021 13:10:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3BE116126A for ; Thu, 30 Sep 2021 13:10:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3BE116126A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uI2Fm42zR4rTuZ0rm7QL1nDxkfgWNzbCG+1RFtY4bXI=; b=YeUHYS0N8zyJgP lLhim0erWvlqcN7VHXhLJi1awwI5khXsjh43WbnWh9P6/lsjAQC4UyRyf+RkrtqSEgNNy/EQVgDIW QeExH5IVF9C700D6KI4/wAvY6JwLvkeKFk8QyViFAmkr54CgtV/rfXqqtrBcKZa9enm1DZ7Q93gH2 eVQnVd+VCJGTPOuoZW8MLLBQ5tEPqYMrLheJ495TLRqN1jGnKvKqjJ0kOcY+usBqgzEzeSm6S1EGa B7iAlE2gIQN6mv8WEXT5CuQpSZ4JrbSkEyeEG+zzdG0hC+hLBLi7RN+56KW2BN1FVHXwS6Rc8D5Vp mufijcv7yO/vV3lSyhtw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVvlL-00ELxF-Pi; Thu, 30 Sep 2021 13:06:12 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVvlE-00ELv0-3R for linux-arm-kernel@lists.infradead.org; Thu, 30 Sep 2021 13:06:06 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A6F6761A03; Thu, 30 Sep 2021 13:06:03 +0000 (UTC) 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 1mVvlB-00DzHF-L3; Thu, 30 Sep 2021 14:06:01 +0100 Date: Thu, 30 Sep 2021 14:06:01 +0100 Message-ID: <874ka2tdqe.wl-maz@kernel.org> From: Marc Zyngier To: Linus Walleij Cc: Daniel Palmer , DTML , Rob Herring , Thomas Gleixner , linux-arm-kernel , Romain Perier Subject: Re: [PATCH 2/3] irqchip: SigmaStar SSD20xD gpi In-Reply-To: References: <20210914100415.1549208-1-daniel@0x0f.com> <20210914100415.1549208-3-daniel@0x0f.com> <87zgs7vavl.wl-maz@kernel.org> <87wnnbv6ac.wl-maz@kernel.org> <87lf3quydn.wl-maz@kernel.org> 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") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: linus.walleij@linaro.org, daniel@0x0f.com, devicetree@vger.kernel.org, robh+dt@kernel.org, tglx@linutronix.de, linux-arm-kernel@lists.infradead.org, romain.perier@gmail.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210930_060604_249301_CC6C6B22 X-CRM114-Status: GOOD ( 27.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org [huh, missed this email...] On Tue, 21 Sep 2021 19:23:04 +0100, Linus Walleij wrote: > > On Tue, Sep 21, 2021 at 10:27 AM Marc Zyngier wrote: > > > Linus: is there a reason why the gpiolib insist on setting its own > > handler while building the hierarchy? > > Is it this? > > /* > * We set handle_bad_irq because the .set_type() should > * always be invoked and set the right type of handler. > */ > irq_domain_set_info(d, > irq, > hwirq, > gc->irq.chip, > gc, > girq->handler, > NULL, NULL); > irq_set_probe(irq); > (...) It is its relative position wrt to irq_domain_alloc_irqs_parent() that has the potential for annoyance. irq_domain_set_info() will trigger an irq startup, which will explode if the parent level hasn't been initialised correctly. > > IIUC it's because sometimes, on elder systems (such as ixp4xx) some machines > are still using boardfiles, and drivers are not obtaining IRQs dynamically > from device tree or ACPI, instead they are set up statically at machine > init. > > I assume it would otherwise be done as part of ops->translate? No, this is the right spot if you really need to set the handler. But it should really be after the parent allocation (see below for something totally untested). Ultimately, setting the flow handler when there is a parent domain is a bit odd, as you'd expect the root domain to be in charge of the overall flow. Thanks, M. diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index abfbf546d159..53221d54c4be 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1103,19 +1103,6 @@ static int gpiochip_hierarchy_irq_domain_alloc(struct irq_domain *d, } chip_dbg(gc, "found parent hwirq %u\n", parent_hwirq); - /* - * We set handle_bad_irq because the .set_type() should - * always be invoked and set the right type of handler. - */ - irq_domain_set_info(d, - irq, - hwirq, - gc->irq.chip, - gc, - girq->handler, - NULL, NULL); - irq_set_probe(irq); - /* This parent only handles asserted level IRQs */ parent_arg = girq->populate_parent_alloc_arg(gc, parent_hwirq, parent_type); if (!parent_arg) @@ -1137,6 +1124,18 @@ static int gpiochip_hierarchy_irq_domain_alloc(struct irq_domain *d, parent_hwirq, hwirq); kfree(parent_arg); + + if (!ret) { + irq_domain_set_info(d, + irq, + hwirq, + gc->irq.chip, + gc, + girq->handler, + NULL, NULL); + irq_set_probe(irq); + } + return ret; } -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel