From patchwork Tue Jun 14 20:28:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 12881581 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 4F76EC43334 for ; Tue, 14 Jun 2022 20:30:37 +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:References:In-Reply-To: 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: List-Owner; bh=7uccEchXhnVrggm9aQL/3ACK7YpzGc9/gNgpn01wHN0=; b=GQRyOqzo2Osnld Uxx2NhI7tnTpG1yLuB8cVHca75eJXWZd3O+/i2kVA9GCgAm9UpLdh2wxc8qXoCLVv50T7TJPSQ2Qa e+B8b723G8heaO+o2Ny230pycnyS6gj8atyeydaeJau9/wmxED//PQMJPOKYRMvs8BqZeN43gdeWi I9SYz/7MDWDFXCQPb7vBZkQ1UzRa5vzy878pYXEl8cXswqVR5HSN4xOgtv5xhm9rW+NUtRLN/gK92 9+XiKepD7xTe8MpE7EpLuVaSNUf/aOLhnlf7divAE03JeZRIi4N6vXY6XE/CkSeD5D6aoVELQbaOA SxpgELMFh7NrVi9a+bHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1DAT-00B8og-3P; Tue, 14 Jun 2022 20:29:41 +0000 Received: from mout.kundenserver.de ([212.227.17.10]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1DA3-00B8ff-KO for linux-arm-kernel@lists.infradead.org; Tue, 14 Jun 2022 20:29:18 +0000 Received: from localhost.localdomain ([37.4.249.155]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MbAUg-1nPfQ20Vrs-00baRl; Tue, 14 Jun 2022 22:29:06 +0200 From: Stefan Wahren To: Linus Walleij , Bartosz Golaszewski , Florian Fainelli , Ray Jui , Scott Branden , Marc Zyngier 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 V2 1/2] pinctrl: bcm2835: drop irq_enable/disable callbacks Date: Tue, 14 Jun 2022 22:28:30 +0200 Message-Id: <20220614202831.236341-2-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220614202831.236341-1-stefan.wahren@i2se.com> References: <20220614202831.236341-1-stefan.wahren@i2se.com> MIME-Version: 1.0 X-Provags-ID: V03:K1:SYHy4K1i151YMhm/X3GFFP86lIOtAoQO8ZFRgOBkiVGriDx0m0T 2LaWllpduCyw4tbfK7HQH+5OY/d08Ju9CU4R4hsD6jifG5fxT3d5vsY6DUOl/xJX9l5Rrzz boahKOdeER67vuBVWAy7aDO592d2bZU2kkx9QlGAgidui9WnX+3l1sEO1yXsYRRxMNGcWRw nKEj3f5WAwNqxZEUP0JyA== X-UI-Out-Filterresults: notjunk:1;V03:K0:ZCqHn3IchWA=:01s7A/9kXDZ9XwVmpmE9ej spE91dJxY9xkXRjEyyp66nEAGXLtgn5pj9LdwkEhisZAYsnmxf4w+mCOESgCCZovwPSu4PF+4 lgDAwcRj8Qth/B5MDzqYgDzV6IJMu28UAA4kbvU3/4FmqL7HG3dLmRjY1sSOcSZqIrF3zXZeC 5Ry3F2bpIfZGjJYMMZ3wqHKz24oFp4Y0iuH7WWDJqwe8qJPHW4D5QQdmLjHkT+eEn1Fd61gXK XngiISm8s0MmcTWfEMCEFAn0BTHQmrhDgYhqE7mWFF1Xn98uFdzvfC22HXlW0M4SXSg2hdCKJ BtNE6eL+ksyH/Ls0WVGf/YtGx7rWPACKjOjeu5EXN9s2Bq2ycS3Kpl+dM+CRsZRKe2QGj+y8i KL/MvPMIxf5uH7XqaK6owGFfTJm+7tRI7lNtuWMudXMdi0m4qAs645N0MdvCsPxzDYD446ykH A2aJmUUcLlwU8DDW0Pou9HP1DvVoRBqH+vZmfvJUMG04xSluTxa0FQrryxBvJGFqyx+yDGDfZ fiMU98MSeOFIkXJ1bNgd+ubC8a3E9LdtjXDzvatp641IfQvpk1JU+AMle8MGOR1qJ6NfdOBVJ HnL7t6L0S4Tb93yuJU/wyAYq2eXCAYTpt4AJrMjWBXfisR/mufwE9fLpjYLwYBfQ7KyoCP/OO tP1Vsd9NU3DRDsiQr36bF231A58I6hGqbuoG2GHMptntW/0ercz13kjNYLf7V4fA9n4+xAZ/a QUGO2YVOoKd0xeoYaY7ugwxp7tPp2dCsmUbkiMLeSN3rouf7CT/Pf8rser8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220614_132916_069079_04675EF6 X-CRM114-Status: GOOD ( 14.16 ) 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 The commit b8a19382ac62 ("pinctrl: bcm2835: Fix support for threaded level triggered IRQs") assigned the irq_mask/unmask callbacks with the already existing functions for irq_enable/disable. The wasn't completely the right way (tm) to fix the issue, because these callbacks shouldn't be identical. So fix this by rename the functions to represent their intension and drop the unnecessary irq_enable/disable assigment. Suggested-by: Marc Zyngier Signed-off-by: Stefan Wahren --- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c index dad453054776..807824bc9a10 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -507,7 +507,7 @@ static void bcm2835_gpio_irq_config(struct bcm2835_pinctrl *pc, } } -static void bcm2835_gpio_irq_enable(struct irq_data *data) +static void bcm2835_gpio_irq_unmask(struct irq_data *data) { struct gpio_chip *chip = irq_data_get_irq_chip_data(data); struct bcm2835_pinctrl *pc = gpiochip_get_data(chip); @@ -522,7 +522,7 @@ static void bcm2835_gpio_irq_enable(struct irq_data *data) raw_spin_unlock_irqrestore(&pc->irq_lock[bank], flags); } -static void bcm2835_gpio_irq_disable(struct irq_data *data) +static void bcm2835_gpio_irq_mask(struct irq_data *data) { struct gpio_chip *chip = irq_data_get_irq_chip_data(data); struct bcm2835_pinctrl *pc = gpiochip_get_data(chip); @@ -695,12 +695,10 @@ static int bcm2835_gpio_irq_set_wake(struct irq_data *data, unsigned int on) static struct irq_chip bcm2835_gpio_irq_chip = { .name = MODULE_NAME, - .irq_enable = bcm2835_gpio_irq_enable, - .irq_disable = bcm2835_gpio_irq_disable, .irq_set_type = bcm2835_gpio_irq_set_type, .irq_ack = bcm2835_gpio_irq_ack, - .irq_mask = bcm2835_gpio_irq_disable, - .irq_unmask = bcm2835_gpio_irq_enable, + .irq_mask = bcm2835_gpio_irq_mask, + .irq_unmask = bcm2835_gpio_irq_unmask, .irq_set_wake = bcm2835_gpio_irq_set_wake, .flags = IRQCHIP_MASK_ON_SUSPEND, }; From patchwork Tue Jun 14 20:28:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 12881582 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 28DF3C433EF for ; Tue, 14 Jun 2022 20:30:56 +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:References:In-Reply-To: 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: List-Owner; bh=N88+vt2KmcaOFoK6mArZ1fQ6TGQYd761PdKtWg+HxFk=; b=lutT77IqgbICqw D/Qy7DsUPD21mM/XNaepTpLKN+WfnZzHI/01caFjd9nzPv76Ss8vkOtUzKA/EE7DLmrDSxLELprQy eiKwnPujYOGjTp9xTa6f3BS/yZqSuhv0DOXcmM+AGQD+8Hd4u9jRGRGggg98XpiBcMvJsDEqMpy7C mwlgvszTB6vYlSaEUb8xFylg9gBGePSNU/fwiDu667lrORBwUnyGSBXIONURjieW7movxpwpWc6s5 ZV6pfRnG/zIbvAHnjmz57qDZMvpAfsgqPWGVnr0j4Gga96zuOaKSsk0yrtOV4m9x4V9BoEDhWYIa0 BxtqUN4k6wOqIe756bLw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1DAi-00B8ub-9W; Tue, 14 Jun 2022 20:29:56 +0000 Received: from mout.kundenserver.de ([217.72.192.74]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1DA5-00B8fv-Ev for linux-arm-kernel@lists.infradead.org; Tue, 14 Jun 2022 20:29:19 +0000 Received: from localhost.localdomain ([37.4.249.155]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mn2iP-1nKxWv2UcB-00k5h0; Tue, 14 Jun 2022 22:29:06 +0200 From: Stefan Wahren To: Linus Walleij , Bartosz Golaszewski , Florian Fainelli , Ray Jui , Scott Branden , Marc Zyngier 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 V2 2/2] pinctrl: bcm2835: Make the irqchip immutable Date: Tue, 14 Jun 2022 22:28:31 +0200 Message-Id: <20220614202831.236341-3-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220614202831.236341-1-stefan.wahren@i2se.com> References: <20220614202831.236341-1-stefan.wahren@i2se.com> MIME-Version: 1.0 X-Provags-ID: V03:K1:oWqgwADfGSQkbb8dC4ItUZznIfsMVheE+ifouker/5/oGszse2p zFYKmrmn5hmslm29vKqirmQyG+8yZnaeBYhDIsqk3fjvyiiPONJMdZzsWbLSbWU2EbCmSG3 m4RIbeCHsRO/HHORx5Gzw2klgAvyDbq0tiGbsflsJy+TgtmfuqU6apZTkYLhK/HN4/nkgrP l3eEJOYafjjeB3ZczzrXg== X-UI-Out-Filterresults: notjunk:1;V03:K0:nWnFlMfZQ+4=:oKCIFwvMlWEyc+X+90sC/i rPfyCk9fRWXNLjluh5vC/38SEhuzd60rf+v0GVIas1KKKhuQzx+nslIZzu6AFnwTEntOaK4Jo c6Jhz7Rdtr/HTGifvnCNWSuAYUfw15EU0VqwgE/0GseV58UXwx3rcfYpxS6FaeQpRdMmwksnM hcsU7m7LeV4BBT3yzAAqeE69eD9Y04PkV9J58rAmiFdR2IicARr9DtDUtYaXTBcbxEKDINcZl QrEZhT5Z54XNUBNlNAY2CUIX5lvEVe2h//cyKEtb0Mx0RO/UyHhddyyb26++0zgengoa2CA5Y hU/g9Vjrjd+JnCu9JdAVEsmkU1206QYB+6ASWExJO152+rsneSQs+q3DnGr2uC1zHQ9OM0Eue 3y/63nxZaWYYm+kri4PwAz+8gM8Gw8p5ho6fxzsMfUb3U09TYhfaTK/TDy6683T/U/qQlxXN9 uxr0ijOhz+JnLhMLuRMdQlyX2/p3lsKBHod91dbcYAwNF6/jSqG5KQdTzrPUbg1RJuCIlZADl j2xy0MhE7Vs6Xak8xKabfZOLFT7Kga4WV5G+TKRJA2kU6Qo8a+RMg6u00rLZwV4Pls37+RiW+ QYgw6EnVRXvcT/j/pgJi22WqcBHts1l1Pt9tcb69PWLWCPqSMtKkc2uQtG3lY9Idcw2d8UIwD 7hiQ9N0s+gyGmppg9R7XDkBzYcnOhGNAfCIc+vgC3MgCQa1Dpw8go3hXtnrOlNZcRMHYfgaN5 S8U1LNAoU2OIYx4U35XeEQS4/Rlek37EZlbE6JVhqVWEm71GwBXbBYAUsj8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220614_132917_836828_0DBEA2D9 X-CRM114-Status: GOOD ( 13.96 ) 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 --- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c index 807824bc9a10..7857e612a100 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -516,6 +516,8 @@ static void bcm2835_gpio_irq_unmask(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_mask(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,14 +697,15 @@ 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_set_type = bcm2835_gpio_irq_set_type, .irq_ack = bcm2835_gpio_irq_ack, .irq_mask = bcm2835_gpio_irq_mask, .irq_unmask = bcm2835_gpio_irq_unmask, .irq_set_wake = bcm2835_gpio_irq_set_wake, - .flags = IRQCHIP_MASK_ON_SUSPEND, + .flags = (IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE), + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static int bcm2835_pctl_get_groups_count(struct pinctrl_dev *pctldev) @@ -1278,7 +1283,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,