From patchwork Tue Jun 7 10:33:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 12871698 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 32B02C433EF for ; Tue, 7 Jun 2022 10:34:53 +0000 (UTC) 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:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=5/E/tIPVz7u+34d2re3z8jvkAFYn7OOVg/DMNNfi85w=; b=xqGg6nothnuNgm cylP2qjXOp3pMQVwnfn+mCUO87URsxCVY473MCtwYD5q1N9qDerbCYkztP9JdM4oFXIyWecMCfjhU eNI0RY1r15DzEgqPeqK5StwqrqKFOCe/75f+QWxePIo28paa4OSvz1V8ijfoHsjdEfxQZ8z2Ni4ub iqDq1PtcRU2J+EqMULlu/5XVw8MUDIfWhvt2aMc7nEp0FN9mWQbd+qZDLKTzKvl88R2p4fBcSqIJ7 vwodJrWkw2Dgcnzra86RTQkk6tNAXsQCqThdmPim2jawE+RrN7z7dJAFCEtxrdn2MhDRSN0e4gF+N 650opK9dTYdDvCdltzzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyWWl-006gdl-FU; Tue, 07 Jun 2022 10:33:36 +0000 Received: from mout.kundenserver.de ([217.72.192.73]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyWWZ-006gSh-1Y for linux-arm-kernel@lists.infradead.org; Tue, 07 Jun 2022 10:33:28 +0000 Received: from localhost.localdomain ([37.4.249.155]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N1xZX-1nnPaB1OdV-012GtX; Tue, 07 Jun 2022 12:33:10 +0200 From: Stefan Wahren To: Linus Walleij , Bartosz Golaszewski , Florian Fainelli , Ray Jui , Scott Branden Cc: Maxime Ripard , Phil Elwell , bcm-kernel-feedback-list@broadcom.com, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Stefan Wahren Subject: [PATCH RFC] pinctrl: bcm2835: Make the irqchip immutable Date: Tue, 7 Jun 2022 12:33:02 +0200 Message-Id: <20220607103302.37558-1-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:wc2Paej9uS/fFX4ddH7GuB6OXiMnchWUjsPHePnuASwdDMvG21E /ZUO3vQTyb56rVze+MbldfisZrEyzFA/dCbeiZkZwDvc28sU0x38Wx6hPOjvcmSACLe+kIi btK8MnG3KDfaoqnOGN83zO+jlNEB86DauMF8D/mNUWl9zTRY8fliTBoUQWkov+Z9pWLmJG+ FuXv6HfXCiv76OJnmN5Lg== X-UI-Out-Filterresults: notjunk:1;V03:K0:1bkrg0gViak=:j2gyLm/krd9nKD91j8zKDP MACvqL7+p5SS40WQNKUcwSe/+0vkT9PuRzYLaK404yMykQs2p7yIiqEXliFl6cHWo8ms32MkG 3027CLkWhq/gK+r+05fPpLG/sxQHLSn46Z/vXU5aQL267wYNSAUGK/bj4Ga7NLkXV7hNfmZrO FKIgygphoDEKoU213EbZ42t98S+nCSyEFNT1TJpoUDhaAeF+ebqOjQdAC/fJ+QXrWtg+Zcg55 136CHoukWvaFbQ5HJRZMLtOjAsswLMiuFMSzq+WhsOTGR0BbNNeR2LO/FDY8i/GFT2r4KnjTr FqnMEic5AcGlBnCPXpKgHgypHcQd02gFmxHxXnasnsE5SWWAlTMkxj3XXZOt7I0l3NDr5eGZ3 qnMVMv+exMdlS5pkiui6XVeGauyZ0JArpAVfomoRsp8EA9Tpz1057C+aPlf/rAe8YIagH+4/y +yPp/hKmzMD40gylHUfKRYy/yxcWnDEiBqbhsuF6jCUe8roqKk3tz0caBByzwbk56KL1ihXmR uXsDOPwDBYfTVdiRygLv3H5OgidxTm00cWwHZy9jWKpNBP5foW0vdgR1tS3NaCxndMJvz1MNT VVnqo8e59RGGb7jwa8nLyfcSKWSQExp8MdWvjr3M3ISGOrIpkDYs53tLh07i2ngp5ZE272uLR vK6KVGxamC1kewmeVjNm+6GsEvTdGyBvjjCdpB22jcu9odqo3ooIAs6Dq9tTeioQe95OosOS9 sSHLDI/AHCNNkvEzKJmUOgV7EYPaeCDbL3JVWLxc5x3Q62qBthaCnRcH3KY= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220607_033323_466954_E618D694 X-CRM114-Status: GOOD ( 15.19 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit 6c846d026d49 ("gpio: Don't fiddle with irqchips marked as immutable") added a warning to indicate if the gpiolib is altering the internals of irqchips. The bcm2835 pinctrl is also affected by this warning. Fix this by making the irqchip in the bcm2835 pinctrl driver immutable. Signed-off-by: Stefan Wahren --- Hi, not sure about this change because irq_mask/unmask also uses the enable/disable callbacks. drivers/pinctrl/bcm/pinctrl-bcm2835.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c index dad453054776..f754f7ed9eb9 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -516,6 +516,8 @@ static void bcm2835_gpio_irq_enable(struct irq_data *data) unsigned bank = GPIO_REG_OFFSET(gpio); unsigned long flags; + gpiochip_enable_irq(chip, gpio); + raw_spin_lock_irqsave(&pc->irq_lock[bank], flags); set_bit(offset, &pc->enabled_irq_map[bank]); bcm2835_gpio_irq_config(pc, gpio, true); @@ -537,6 +539,8 @@ static void bcm2835_gpio_irq_disable(struct irq_data *data) bcm2835_gpio_set_bit(pc, GPEDS0, gpio); clear_bit(offset, &pc->enabled_irq_map[bank]); raw_spin_unlock_irqrestore(&pc->irq_lock[bank], flags); + + gpiochip_disable_irq(chip, gpio); } static int __bcm2835_gpio_irq_set_type_disabled(struct bcm2835_pinctrl *pc, @@ -693,7 +697,7 @@ static int bcm2835_gpio_irq_set_wake(struct irq_data *data, unsigned int on) return ret; } -static struct irq_chip bcm2835_gpio_irq_chip = { +static const struct irq_chip bcm2835_gpio_irq_chip = { .name = MODULE_NAME, .irq_enable = bcm2835_gpio_irq_enable, .irq_disable = bcm2835_gpio_irq_disable, @@ -702,7 +706,7 @@ static struct irq_chip bcm2835_gpio_irq_chip = { .irq_mask = bcm2835_gpio_irq_disable, .irq_unmask = bcm2835_gpio_irq_enable, .irq_set_wake = bcm2835_gpio_irq_set_wake, - .flags = IRQCHIP_MASK_ON_SUSPEND, + .flags = (IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE), }; static int bcm2835_pctl_get_groups_count(struct pinctrl_dev *pctldev) @@ -1280,7 +1284,7 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) pinctrl_add_gpio_range(pc->pctl_dev, &pc->gpio_range); girq = &pc->gpio_chip.irq; - girq->chip = &bcm2835_gpio_irq_chip; + gpio_irq_chip_set_chip(girq, &bcm2835_gpio_irq_chip); girq->parent_handler = bcm2835_gpio_irq_handler; girq->num_parents = BCM2835_NUM_IRQS; girq->parents = devm_kcalloc(dev, BCM2835_NUM_IRQS,