From patchwork Mon Oct 31 22:28:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= X-Patchwork-Id: 13455 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2587124wru; Mon, 31 Oct 2022 15:36:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7//YM4wmUavo9tAdnCggzxDGuDczVtPhr2xLA4oRkVQYtQMtPdqR/vVReO+wTyNkvJcJuw X-Received: by 2002:aa7:c9c7:0:b0:463:4eff:a07 with SMTP id i7-20020aa7c9c7000000b004634eff0a07mr8527976edt.88.1667255789535; Mon, 31 Oct 2022 15:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667255789; cv=none; d=google.com; s=arc-20160816; b=vQbKv6wbOa+Y0b28mj+8ISvTx+dMxB9rlGKRmxQfts78P1bPyHks8aZHDgU7jy2UGE Na/BRiK4KReWTbrKMfhI2ykifWfYy+0DLlRAvJ7qTXVVxmVbsSjDUDLRotK9MveJJ+E7 PN//zi11LrUv0uZup/ZhBUXhNaRspJ5bd5YtujHfGL8rQ7htYpD9kIx7YBagAQKffTca YaEkxDXkSZSmIS701WsPcvpmHavKBqEB5kVgM9j64JhBpBgGKWO2ZXyoX/Ji5Wn3adkU ifAIH/JXbTWiQTkjjEvAQYCifKsaLaV+ZC6oCsARuKaeS34fG/TTNS8MhPzXmW1wnxDu M5wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=dFuw+gUtiWu9nh5kN5Lmq0JsEnC/ZCyAjRNWRS6rZTg=; b=GCk82GrqkGRUZ6ZzJfRmm6fxkyvN6Thq9faUyaPlExP9oH7ZXtVzz6Z8hA1clJvVbG qUfF+efSFRMJCSpnvecRCK3IZ+3lGp0/lkQ+Vd02BxYt9o/43ajpxCetbut1OULkYY50 pnZaBPO/byoVfWtDjVWjCyTXL22ouoapbrWM+uWAX1dN6nZ3DmqI6Kwjd4+ripdC0x5A QH4mNl6dtUfJTXL9j4HyWUUjQzn+wToF3Yx3muYqZ23w4cb8FQEIjzxkUrlmDatrHKpW iRbs4XiznBjBPGavnBX9AAa6jBJnAAsNyUDAF0K1X6M3tuQ2KAxp3X7OTkWlLjP3Qo2Q T+Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=s31663417 header.b=Rtb5mwma; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmx.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t12-20020a056402240c00b0046153dd47f0si8515810eda.441.2022.10.31.15.36.05; Mon, 31 Oct 2022 15:36:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=s31663417 header.b=Rtb5mwma; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmx.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230116AbiJaW3W (ORCPT + 99 others); Mon, 31 Oct 2022 18:29:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbiJaW3K (ORCPT ); Mon, 31 Oct 2022 18:29:10 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26E89265C; Mon, 31 Oct 2022 15:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1667255332; bh=aMm72pcYD4B6skjo8RlmafJnq13ND5XBcNX4Keostng=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=Rtb5mwmazQ8ffgtu6ihCSn/zPqT1V6ua5DsyaurraxKlLU65m5mXxOripDbtYAp7U GiYb1iDVT0Ts40g5Om3khjpHvav02hPbkUafRQEhlXUHHhxEjcXBjJknIszkrPtsVy tzvuOhSfOfJ9jy0pN3J2SzE+Y9enizB5Bn5+V6KVqYJl5HOI040249gettos6GuaKC p94meQvpoUfrzZCMEPTbVir58OL+zq0V3ADTQmw7vx4rVaDgnCfHnaCXWRc1gwucs7 dAPtdSX5Yrn//I6/Tl48rIPbpzFZO05eI2LjlEAN8xlNhN6cESnmZ6Un7VWGWBCFKZ qgAt47Wnuae0g== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from probook ([78.35.189.154]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MDQeU-1oiVzW0Zhm-00AVgd; Mon, 31 Oct 2022 23:28:52 +0100 From: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= To: linux-gpio@vger.kernel.org Cc: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= , Linus Walleij , openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 RESEND] pinctrl: nuvoton: wpcm450: Convert irqchip to IRQCHIP_IMMUTABLE Date: Mon, 31 Oct 2022 23:28:33 +0100 Message-Id: <20221031222833.201322-1-j.neuschaefer@gmx.net> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:AtvZpBuUU6LlAmn5RA1tvbcrSn7Rb3dI5GZyg0b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k3QryyWvJQv9ACgb7vdZN7dyNal4+UcqHSNkKqi wr9T8xhmwgCJ68RzFotcHUD++E76Qb9mDM9Pn8Ja8haiwvBvcn7mr+DNzlq0jjyP1AU+9sc4V /uuPGctgvZLsrot8t9WeoaNS3xQ= X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748244406762137128?= X-GMAIL-MSGID: =?utf-8?q?1748244406762137128?= Commit 6c846d026d490 ("gpio: Don't fiddle with irqchips marked as immutable") added a warning for irqchips that are not marked with IRQCHIP_IMMUTABLE. Convert the pinctrl-wpcm450 driver to an immutable irqchip. Signed-off-by: Jonathan Neuschäfer --- v3: - Switch from raw d->hwirq to irqd_to_hwirq(d) v2: - Add missing gpiochip_*able_irq calls in mask/unmask methods - Remove unused instance of struct irq_chip in struct struct wpcm450_bank v1: - https://lore.kernel.org/lkml/20220606214301.2061467-1-j.neuschaefer@gmx.net/ --- drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) -- 2.35.1 diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c index 0dbeb91f0bf27..528259496da5b 100644 --- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c +++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c @@ -49,7 +49,6 @@ struct wpcm450_bank; struct wpcm450_gpio { struct gpio_chip gc; struct wpcm450_pinctrl *pctrl; - struct irq_chip irqc; const struct wpcm450_bank *bank; }; @@ -142,7 +141,8 @@ static void wpcm450_gpio_irq_ack(struct irq_data *d) static void wpcm450_gpio_irq_mask(struct irq_data *d) { - struct wpcm450_gpio *gpio = gpiochip_get_data(irq_data_get_irq_chip_data(d)); + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + struct wpcm450_gpio *gpio = gpiochip_get_data(gc); struct wpcm450_pinctrl *pctrl = gpio->pctrl; unsigned long flags; unsigned long even; @@ -157,11 +157,14 @@ static void wpcm450_gpio_irq_mask(struct irq_data *d) __assign_bit(bit, &even, 0); iowrite32(even, pctrl->gpio_base + WPCM450_GPEVEN); raw_spin_unlock_irqrestore(&pctrl->lock, flags); + + gpiochip_disable_irq(gc, irqd_to_hwirq(d)); } static void wpcm450_gpio_irq_unmask(struct irq_data *d) { - struct wpcm450_gpio *gpio = gpiochip_get_data(irq_data_get_irq_chip_data(d)); + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + struct wpcm450_gpio *gpio = gpiochip_get_data(gc); struct wpcm450_pinctrl *pctrl = gpio->pctrl; unsigned long flags; unsigned long even; @@ -171,6 +174,8 @@ static void wpcm450_gpio_irq_unmask(struct irq_data *d) if (bit < 0) return; + gpiochip_enable_irq(gc, irqd_to_hwirq(d)); + raw_spin_lock_irqsave(&pctrl->lock, flags); even = ioread32(pctrl->gpio_base + WPCM450_GPEVEN); __assign_bit(bit, &even, 1); @@ -293,6 +298,8 @@ static const struct irq_chip wpcm450_gpio_irqchip = { .irq_unmask = wpcm450_gpio_irq_unmask, .irq_mask = wpcm450_gpio_irq_mask, .irq_set_type = wpcm450_gpio_set_irq_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static void wpcm450_gpio_irqhandler(struct irq_desc *desc) @@ -1068,9 +1075,8 @@ static int wpcm450_gpio_register(struct platform_device *pdev, gpio->gc.fwnode = child; gpio->gc.add_pin_ranges = wpcm450_gpio_add_pin_ranges; - gpio->irqc = wpcm450_gpio_irqchip; girq = &gpio->gc.irq; - girq->chip = &gpio->irqc; + gpio_irq_chip_set_chip(girq, &wpcm450_gpio_irqchip); girq->parent_handler = wpcm450_gpio_irqhandler; girq->parents = devm_kcalloc(dev, WPCM450_NUM_GPIO_IRQS, sizeof(*girq->parents), GFP_KERNEL);