From patchwork Thu Feb 16 09:37:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57941 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp203597wrn; Thu, 16 Feb 2023 01:41:11 -0800 (PST) X-Google-Smtp-Source: AK7set/R6m+ta6xczb9p1aKqSTtnkYVlyBk7w+PQT6Xp6NZPBNmXESvn5ofyKnERQ0tocWvMMB/5 X-Received: by 2002:aa7:c910:0:b0:4ac:ca74:b65d with SMTP id b16-20020aa7c910000000b004acca74b65dmr5167382edt.28.1676540471826; Thu, 16 Feb 2023 01:41:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676540471; cv=none; d=google.com; s=arc-20160816; b=DCcpTSZWUAhcTbxcC0LSBs32xrgBpd3wXRljf+rFGFwarmtpH3CoBKU9dc78WYD+6G SgYGYG1+3qiXW2G6eOvSzDPI+09emoUdrv/et1EsmYqc7A0beA00Idg/HdaVT29AsmYe rtbgDiNLzZ58+z7xOmGl3M1+idZQ9CpStpO+qJeboPT1RMdm+LyH2ogfsWveaLHgoUn9 Lep4CNXB1FNuRIIBocFPUmYIp5QAa/SkRwMPCGkZYuv73P/N3Wi5MpCPer66WNtsWEQZ XBdsrEqLE9+XmH0kNoJA79th3puOyLZNin5gvZQvH/8JI825k0ooD8JvXVLgqd22W9N9 IteA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=p9WM9bt3/Qg3GpN9YlZ5Md1vJbLQ+qCNkMONfruzQdU=; b=VlhgAk+NIxG/XWSnjfGlRp4tsazSNiudb92g+TrV2baq+QWZbBdjgzxcUKsGHQxScI EY5HVnKKYG9/2hI2eVk1DTAHV9eWRgdCOIgmHjjZ13bUrMjUjuRt+R6s4vu4XkIv6+gO QLZcY5+iAo2YYaviRoIuErnQhsQQTLTym4XhSyTD28mWtkTT4jKuryZAoRqIyvJ5NzqH ULuUO2wVDs41/JZinFX68kpo6dRyX4zu5bCeVj1WdIyYfdncMNc0re+mYxhxCLjvneXV eCYMMGxh+oJb0EuvLylNdx8mve7Uhv5MkQ1cz8UuDz/li4b/oXOUf+eAmjB/D44A4g+I b+mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="uzg/z7Js"; 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=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d16-20020aa7d5d0000000b004acbea7f4f7si1676126eds.570.2023.02.16.01.40.48; Thu, 16 Feb 2023 01:41:11 -0800 (PST) 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=@linaro.org header.s=google header.b="uzg/z7Js"; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229853AbjBPJha (ORCPT + 99 others); Thu, 16 Feb 2023 04:37:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230076AbjBPJhV (ORCPT ); Thu, 16 Feb 2023 04:37:21 -0500 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D8BD4DBDD for ; Thu, 16 Feb 2023 01:37:12 -0800 (PST) Received: by mail-lf1-x12c.google.com with SMTP id c20so2024231lfv.6 for ; Thu, 16 Feb 2023 01:37:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=p9WM9bt3/Qg3GpN9YlZ5Md1vJbLQ+qCNkMONfruzQdU=; b=uzg/z7JsYN6JRINI2ztHDI7TVZ5gbs5hccwxhziMFWqgp6FPYevwrJdEn6294hbqEc 9RqcwZLiwz41RhtZox1l19YuY0E3m73AHer6GaayRRRTnZ6OAnosbKbjB6277iNWM9Vx tFyJ4pzjpNujTKprYJmj2G6u411h5U+UNkextvLF2I63BscpPxxgRFoVyu3Kul9S9BYD 41UJe28ggKb3d55uLsCZTOqn/FWPGtN0FB284wDKgWly9/4XXf7DDvgALtqQSVOE1mpV x2SXb0zMIjFSltPqWvVUOgvskt396AsontVpIlDa3gij5ylP+fLcR3RDLReVr8rfmn+a rNvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p9WM9bt3/Qg3GpN9YlZ5Md1vJbLQ+qCNkMONfruzQdU=; b=Dqe32AllDhBt0C87He7rLU7B4E1WWqK0j8IdjSt5fWw+ugHfW6BG6GmiY1XOW/t68o Izk/pDxRKBUZsCghhvLiQ2BnHfvTOf/XVmT8l1KSXs2N32oVlJA2nMEPV3tZrRZAgGql RjnpI0XgSopKY6Ur9uEVKy7QnZP39XUhPgjIzZu6HSp9VbkLG1a4hJPG8GBybPtXwzeB CqTWAIan2EwPc4ZCDm4FIFT6pXIj4Q3iQOPcjI/dKOVS0I07ljNyq0nIR/zw0SDd0lDq XgssaZvFKuHTKMoircsyf6Y7ZXeDnUCosDGuAVvD60A6XD3uZXbWn8pYzBvNxMjtOYHH 1noA== X-Gm-Message-State: AO0yUKXqLuQID9j4l8AzB+MDjP+HRwyhbgtuFPz6PQJCo5dWgBzVzIB/ 4mTiwjeBBi3yR2TSJ7dTebXWFQ== X-Received: by 2002:a19:750f:0:b0:4db:2c52:349b with SMTP id y15-20020a19750f000000b004db2c52349bmr1843213lfe.21.1676540231694; Thu, 16 Feb 2023 01:37:11 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id r3-20020a19ac43000000b004d8758a452asm229069lfc.288.2023.02.16.01.37.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 01:37:11 -0800 (PST) From: Linus Walleij Date: Thu, 16 Feb 2023 10:37:07 +0100 Subject: [PATCH 06/17] gpio: cadence: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v1-6-51a8f224a5d0@linaro.org> References: <20230215-immutable-chips-v1-0-51a8f224a5d0@linaro.org> In-Reply-To: <20230215-immutable-chips-v1-0-51a8f224a5d0@linaro.org> To: Mun Yew Tham , Bartosz Golaszewski , Joel Stanley , Andrew Jeffery , Alban Bedel , Orson Zhai , Baolin Wang , Chunyan Zhang , Jay Fang , Daniel Palmer , Romain Perier , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman , William Breathitt Gray Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-omap@vger.kernel.org, Linus Walleij , Marc Zyngier X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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?1757980101791194523?= X-GMAIL-MSGID: =?utf-8?q?1757980101791194523?= Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-cadence.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-cadence.c b/drivers/gpio/gpio-cadence.c index 137aea49ba02..3720b90cad10 100644 --- a/drivers/gpio/gpio-cadence.c +++ b/drivers/gpio/gpio-cadence.c @@ -70,6 +70,7 @@ static void cdns_gpio_irq_mask(struct irq_data *d) struct cdns_gpio_chip *cgpio = gpiochip_get_data(chip); iowrite32(BIT(d->hwirq), cgpio->regs + CDNS_GPIO_IRQ_DIS); + gpiochip_disable_irq(chip, irqd_to_hwirq(d)); } static void cdns_gpio_irq_unmask(struct irq_data *d) @@ -77,6 +78,7 @@ static void cdns_gpio_irq_unmask(struct irq_data *d) struct gpio_chip *chip = irq_data_get_irq_chip_data(d); struct cdns_gpio_chip *cgpio = gpiochip_get_data(chip); + gpiochip_enable_irq(chip, irqd_to_hwirq(d)); iowrite32(BIT(d->hwirq), cgpio->regs + CDNS_GPIO_IRQ_EN); } @@ -138,11 +140,13 @@ static void cdns_gpio_irq_handler(struct irq_desc *desc) chained_irq_exit(irqchip, desc); } -static struct irq_chip cdns_gpio_irqchip = { +static const struct irq_chip cdns_gpio_irqchip = { .name = "cdns-gpio", .irq_mask = cdns_gpio_irq_mask, .irq_unmask = cdns_gpio_irq_unmask, - .irq_set_type = cdns_gpio_irq_set_type + .irq_set_type = cdns_gpio_irq_set_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static int cdns_gpio_probe(struct platform_device *pdev) @@ -222,7 +226,7 @@ static int cdns_gpio_probe(struct platform_device *pdev) struct gpio_irq_chip *girq; girq = &cgpio->gc.irq; - girq->chip = &cdns_gpio_irqchip; + gpio_irq_chip_set_chip(girq, &cdns_gpio_irqchip); girq->parent_handler = cdns_gpio_irq_handler; girq->num_parents = 1; girq->parents = devm_kcalloc(&pdev->dev, 1,