From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61CD5C61DA4 for ; Thu, 9 Mar 2023 07:46:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230185AbjCIHqQ (ORCPT ); Thu, 9 Mar 2023 02:46:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230050AbjCIHp7 (ORCPT ); Thu, 9 Mar 2023 02:45:59 -0500 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FF3EDD352 for ; Wed, 8 Mar 2023 23:45:58 -0800 (PST) Received: by mail-lf1-x12d.google.com with SMTP id s20so1127930lfb.11 for ; Wed, 08 Mar 2023 23:45:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347956; 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=t+KEmI8whzjEUAizVJPshJjrICLTLWn62dQQiYVD1jA=; b=IzVpcZj96fumWwiZ9ce8p3OR00lwH2NSwIo6JgwE3eUrUbaCenSVg9A2IfJ0T5yKrF SkQWIosnVkJASnorq0HjSVujiLGhuf+H/CU3+yYMQDsjvDUskV5emKdM0lVSezIrvkss FdSBrCi4CbAaiEwps34Uui98JaatpeK5ak6yYuz8f0AyWyYZGKxp09rbxX+XT2uue5iD y0EBrkyqDVoaygONBXCc3okeqz57bWs1/PtSZqIlcbl24A1He/CyjbG+PL8ikEmDC83G bojse/lcmBP4bVFZ6FWWkICZkNA3MUkOtFnZcL3KeJuhzjI5+iXI9EZUHsr5eguGZ3l2 MDkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347956; 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=t+KEmI8whzjEUAizVJPshJjrICLTLWn62dQQiYVD1jA=; b=PDYrTYUUDwwAFbik6oSKNUrl7RGb/xz5cWevciQSjent4BQP7MXHCnfYvQyUzKY1KQ QVsL3OzkzWUnUxnrbvqu3usIFauvFacs/eq6CUef5y9ZfTvvcNTz4N65is1Oub0TKCom XP1HakWi1LgBi0HuRO/8Wtd4zjyJH5rYMOzl4eyM3eM2kDt/gGvtx+k9/4T6w/3+XYLb osV5zeMn602Y3lDIDSXZJPksC8wTXXDiH3zqXe616ns8mZcPnBiwpZqUp3EA7r63Mo+y 2JNTen5R8QqxEbskQJPmPH/EpRCTIe06Ym1ajoGP9P/fD1q1cwRcPruMZk/lCO5oceYG +dQw== X-Gm-Message-State: AO0yUKVYcSBC7Po6TyUDqDQBbUZDW4237WfGiA17/mcjwbqRqv2WhTNZ UwkQBeVgUrFjzd7fLQcysJmI7Q== X-Google-Smtp-Source: AK7set9WPD6eu/vWCYRu6sj0S213JwL98jfUk1++KvMe+8mAaYh/4t0MAArd1j+T9EDICORejXX9CQ== X-Received: by 2002:ac2:4c0d:0:b0:4e2:3453:40eb with SMTP id t13-20020ac24c0d000000b004e2345340ebmr5437312lfq.34.1678347956342; Wed, 08 Mar 2023 23:45:56 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.45.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:45:55 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:49 +0100 Subject: [PATCH v3 01/17] gpio: altera: Convert to immutable irq_chip MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-1-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-altera.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/gpio-altera.c b/drivers/gpio/gpio-altera.c index b59fae993626..c1599edb3453 100644 --- a/drivers/gpio/gpio-altera.c +++ b/drivers/gpio/gpio-altera.c @@ -24,14 +24,12 @@ * @interrupt_trigger : specifies the hardware configured IRQ trigger type * (rising, falling, both, high) * @mapped_irq : kernel mapped irq number. -* @irq_chip : IRQ chip configuration */ struct altera_gpio_chip { struct of_mm_gpio_chip mmchip; raw_spinlock_t gpio_lock; int interrupt_trigger; int mapped_irq; - struct irq_chip irq_chip; }; =20 static void altera_gpio_irq_unmask(struct irq_data *d) @@ -43,6 +41,7 @@ static void altera_gpio_irq_unmask(struct irq_data *d) =20 altera_gc =3D gpiochip_get_data(irq_data_get_irq_chip_data(d)); mm_gc =3D &altera_gc->mmchip; + gpiochip_enable_irq(&mm_gc->gc, irqd_to_hwirq(d)); =20 raw_spin_lock_irqsave(&altera_gc->gpio_lock, flags); intmask =3D readl(mm_gc->regs + ALTERA_GPIO_IRQ_MASK); @@ -68,6 +67,7 @@ static void altera_gpio_irq_mask(struct irq_data *d) intmask &=3D ~BIT(irqd_to_hwirq(d)); writel(intmask, mm_gc->regs + ALTERA_GPIO_IRQ_MASK); raw_spin_unlock_irqrestore(&altera_gc->gpio_lock, flags); + gpiochip_disable_irq(&mm_gc->gc, irqd_to_hwirq(d)); } =20 /* @@ -233,6 +233,17 @@ static void altera_gpio_irq_leveL_high_handler(struct = irq_desc *desc) chained_irq_exit(chip, desc); } =20 +static const struct irq_chip altera_gpio_irq_chip =3D { + .name =3D "altera-gpio", + .irq_mask =3D altera_gpio_irq_mask, + .irq_unmask =3D altera_gpio_irq_unmask, + .irq_set_type =3D altera_gpio_irq_set_type, + .irq_startup =3D altera_gpio_irq_startup, + .irq_shutdown =3D altera_gpio_irq_mask, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + static int altera_gpio_probe(struct platform_device *pdev) { struct device_node *node =3D pdev->dev.of_node; @@ -278,15 +289,9 @@ static int altera_gpio_probe(struct platform_device *p= dev) } altera_gc->interrupt_trigger =3D reg; =20 - altera_gc->irq_chip.name =3D "altera-gpio"; - altera_gc->irq_chip.irq_mask =3D altera_gpio_irq_mask; - altera_gc->irq_chip.irq_unmask =3D altera_gpio_irq_unmask; - altera_gc->irq_chip.irq_set_type =3D altera_gpio_irq_set_type; - altera_gc->irq_chip.irq_startup =3D altera_gpio_irq_startup; - altera_gc->irq_chip.irq_shutdown =3D altera_gpio_irq_mask; - girq =3D &altera_gc->mmchip.gc.irq; - girq->chip =3D &altera_gc->irq_chip; + gpio_irq_chip_set_chip(girq, &altera_gpio_irq_chip); + if (altera_gc->interrupt_trigger =3D=3D IRQ_TYPE_LEVEL_HIGH) girq->parent_handler =3D altera_gpio_irq_leveL_high_handler; else --=20 2.34.1 From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12EA5C64EC4 for ; Thu, 9 Mar 2023 07:46:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230219AbjCIHqU (ORCPT ); Thu, 9 Mar 2023 02:46:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230062AbjCIHqA (ORCPT ); Thu, 9 Mar 2023 02:46:00 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2631CDCA70 for ; Wed, 8 Mar 2023 23:45:59 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id i9so1157263lfc.6 for ; Wed, 08 Mar 2023 23:45:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347957; 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=gpj9iowK+fUp1eAd8JepT37zZC9XqDcnhD9hDARq2kU=; b=LVaYC1uHViSwQIwTtsQWwAe1lesXk5XAH+m8tsANxNLm8ZWQySYOnlqMTMrkgBKHra ZoCgaS0jAuZ1G56TqbjxcqO3X25zia57NoBxjobuvRccmpHolykoWf3Uuz/O2AM3orAc R93oTD3v95aaf560IINvCe7rMhHRRfBu1W81pMz1AzIkhqH1834ztCHpnxG05AF2zj3Q 3n5BGjk7AgkSLSfuM7woK+BYozB6up/xzXd5+t684HJB8NNv3jvusxR1F6r4tbggUbxq i7D46OqOvnbcFXjLQ4xHc9ZEigur2mB6ShJazmvrLGp1nFo3OPSnf7e3bBhW8594CZE0 msHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347957; 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=gpj9iowK+fUp1eAd8JepT37zZC9XqDcnhD9hDARq2kU=; b=HRS3JOUcBiuIDrJ2WscjUZId34+03diCbZry14O6ZXEB61BlqFnWr3f7mBIvk3ASA4 BpJSTFfls4NZNJRXha9KGQW493EWxZSiFhEWZ2fAKSLFpyHSvh85iZLSe2z9dNLFLR0I C8OIs7XcQzrrTCw7P+XScN7QZNaX29xbSmBo5AbxDnAY3nM68q/zB8J4gVfOhpAnoErz f27IaySPIeRZyZBzddjJMpiq58yR6VLtgJhRHZotcOTxMsoerb7iqZy+28jxn4rYnYZ9 1AokvueVL1sQBgccTHAl54tIZxkadYaSR93EPIdVlatatpoC38EllsI9pJrXQyXatslh FWWQ== X-Gm-Message-State: AO0yUKU29i8TNiIcn24ElKO6MZ5Bg/PhBT+H0ERcmwbplVOA/31t4hAl OaR6bH/cEYh/jkK8q3pi9DlnhA== X-Google-Smtp-Source: AK7set9jsf2WuGRz5LxAt7KqAy7iY8/0PXQZmq2Fb+Muy+D+yzkuBpmFzh1g/bSrLlMG71qOdJif9Q== X-Received: by 2002:ac2:55ac:0:b0:4cc:a107:82f4 with SMTP id y12-20020ac255ac000000b004cca10782f4mr5734632lfg.64.1678347957440; Wed, 08 Mar 2023 23:45:57 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:45:57 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:50 +0100 Subject: [PATCH v3 02/17] gpio: adnp: Convert to immutable irq_chip MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-2-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-adnp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-adnp.c b/drivers/gpio/gpio-adnp.c index a6439e3daff0..9b01c391efce 100644 --- a/drivers/gpio/gpio-adnp.c +++ b/drivers/gpio/gpio-adnp.c @@ -307,6 +307,7 @@ static void adnp_irq_mask(struct irq_data *d) unsigned int pos =3D d->hwirq & 7; =20 adnp->irq_enable[reg] &=3D ~BIT(pos); + gpiochip_disable_irq(gc, irqd_to_hwirq(d)); } =20 static void adnp_irq_unmask(struct irq_data *d) @@ -316,6 +317,7 @@ static void adnp_irq_unmask(struct irq_data *d) unsigned int reg =3D d->hwirq >> adnp->reg_shift; unsigned int pos =3D d->hwirq & 7; =20 + gpiochip_enable_irq(gc, irqd_to_hwirq(d)); adnp->irq_enable[reg] |=3D BIT(pos); } =20 @@ -372,13 +374,15 @@ static void adnp_irq_bus_unlock(struct irq_data *d) mutex_unlock(&adnp->irq_lock); } =20 -static struct irq_chip adnp_irq_chip =3D { +static const struct irq_chip adnp_irq_chip =3D { .name =3D "gpio-adnp", .irq_mask =3D adnp_irq_mask, .irq_unmask =3D adnp_irq_unmask, .irq_set_type =3D adnp_irq_set_type, .irq_bus_lock =3D adnp_irq_bus_lock, .irq_bus_sync_unlock =3D adnp_irq_bus_unlock, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; =20 static int adnp_irq_setup(struct adnp *adnp) @@ -469,7 +473,8 @@ static int adnp_gpio_setup(struct adnp *adnp, unsigned = int num_gpios, return err; =20 girq =3D &chip->irq; - girq->chip =3D &adnp_irq_chip; + gpio_irq_chip_set_chip(girq, &adnp_irq_chip); + /* This will let us handle the parent IRQ in the driver */ girq->parent_handler =3D NULL; girq->num_parents =3D 0; --=20 2.34.1 From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A502C61DA4 for ; Thu, 9 Mar 2023 07:46:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230237AbjCIHqX (ORCPT ); Thu, 9 Mar 2023 02:46:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230107AbjCIHqB (ORCPT ); Thu, 9 Mar 2023 02:46:01 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52F56DCA4F for ; Wed, 8 Mar 2023 23:46:00 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id bi9so1173757lfb.2 for ; Wed, 08 Mar 2023 23:46:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347958; 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=3J7dPBvISDsm7K/tqEkOGjTGzAkWKpmXKqK/yWwAM9o=; b=iY+SY1LIdoAVm51tddLFKx/+2eccgntYfbsSyXmvTPoMU5aYr959/qgD7O/lVfLfLi blBw+4ykSBG4AdAZjSdISmzV8Q/QCmAzVPc5eNX2t08XQy+cg4Utx8RQYNxa+LzbW7s/ ZqytsDEDtkx14JCpgzL/Kh27HWDByrN9L3SUZm0Deh6evvb5ZhgzkUNOdSIuxGifl37T 4GtKAcZedqLb41hyQRRLmoIwZp9h0Cieh8oX1ugkzM4LZQTISn46c9D5o3q9jazJ038+ hFeRiJjhW2ovjw/64Do94VXB56FfLUrjY4L1zgG0aX0jXI2i/HBTj5MizFebD3sJcJIO Q89g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347958; 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=3J7dPBvISDsm7K/tqEkOGjTGzAkWKpmXKqK/yWwAM9o=; b=GKQlxb3uveShjxGqKUqvj/rDu+nVSkKS9Kk3UIXSmtS8UaGPQtAKiPV8b7T4mUAMX6 GgY1mIpwg+cX7DrRnux7mPTuV4Zl/stuOvY2FX9ZKrSlgNEgKJxIDepHL50T59SyG1uO xk82Xvg/etVexZCHi2XyjZfJofmw0O5+5YESctrIy0J54z5/cJODTe7aB/pidz5sZuDH Ra/5mYElVaopSWpofupJTrmhQOS39vPYxnrcMsuZ/XQOOZ5z+sZnf5Qes2Ri5AdbORcl cani+wwxkR34hFoF/8K7WPijMKzrlLeJzUZEVGr6SmwYcjtzPSPKVTIsMPgIk0tpY3cd BOZA== X-Gm-Message-State: AO0yUKWbSDS3ztyY7Vx2rHWizNtQJFff5WwtV9u7Anz0jgYLo+N8QzQ/ 4/JacbIk5g6hQkpSX0HHgSVsxQ== X-Google-Smtp-Source: AK7set+xhLBmPqypzxZGrQllf47M/+e98U4TBDXDh2vxKVmQrSemX30LYekYnP5U6V5Wqi31VO335w== X-Received: by 2002:a19:ae01:0:b0:4b4:9068:2c0b with SMTP id f1-20020a19ae01000000b004b490682c0bmr6917425lfc.2.1678347958739; Wed, 08 Mar 2023 23:45:58 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.45.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:45:58 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:51 +0100 Subject: [PATCH v3 03/17] gpio: aspeed: Always register the irqchip MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-3-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 X-Mailer: b4 0.12.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joel Stanley The driver was implemented in a way that made the irqchip optional, if a irq was not present in the device tree. However, all of the device trees have always had an irq, so the optional-ness has never been used. Signed-off-by: Joel Stanley Signed-off-by: Linus Walleij --- drivers/gpio/gpio-aspeed.c | 49 ++++++++++++++++++++++--------------------= ---- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index a94da80d3a95..129f6a6b4d1d 100644 --- a/drivers/gpio/gpio-aspeed.c +++ b/drivers/gpio/gpio-aspeed.c @@ -1137,8 +1137,9 @@ MODULE_DEVICE_TABLE(of, aspeed_gpio_of_table); static int __init aspeed_gpio_probe(struct platform_device *pdev) { const struct of_device_id *gpio_id; + struct gpio_irq_chip *girq; struct aspeed_gpio *gpio; - int rc, i, banks, err; + int rc, irq, i, banks, err; u32 ngpio; =20 gpio =3D devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); @@ -1201,31 +1202,27 @@ static int __init aspeed_gpio_probe(struct platform= _device *pdev) aspeed_gpio_change_cmd_source(gpio, bank, 3, GPIO_CMDSRC_ARM); } =20 - /* Optionally set up an irqchip if there is an IRQ */ - rc =3D platform_get_irq(pdev, 0); - if (rc > 0) { - struct gpio_irq_chip *girq; - - gpio->irq =3D rc; - girq =3D &gpio->chip.irq; - girq->chip =3D &gpio->irqc; - girq->chip->name =3D dev_name(&pdev->dev); - girq->chip->irq_ack =3D aspeed_gpio_irq_ack; - girq->chip->irq_mask =3D aspeed_gpio_irq_mask; - girq->chip->irq_unmask =3D aspeed_gpio_irq_unmask; - girq->chip->irq_set_type =3D aspeed_gpio_set_type; - girq->parent_handler =3D aspeed_gpio_irq_handler; - girq->num_parents =3D 1; - girq->parents =3D devm_kcalloc(&pdev->dev, 1, - sizeof(*girq->parents), - GFP_KERNEL); - if (!girq->parents) - return -ENOMEM; - girq->parents[0] =3D gpio->irq; - girq->default_type =3D IRQ_TYPE_NONE; - girq->handler =3D handle_bad_irq; - girq->init_valid_mask =3D aspeed_init_irq_valid_mask; - } + /* Set up an irqchip */ + irq =3D platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + gpio->irq =3D irq; + girq =3D &gpio->chip.irq; + girq->chip =3D &gpio->irqc; + girq->chip->name =3D dev_name(&pdev->dev); + girq->chip->irq_ack =3D aspeed_gpio_irq_ack; + girq->chip->irq_mask =3D aspeed_gpio_irq_mask; + girq->chip->irq_unmask =3D aspeed_gpio_irq_unmask; + girq->chip->irq_set_type =3D aspeed_gpio_set_type; + girq->parent_handler =3D aspeed_gpio_irq_handler; + girq->num_parents =3D 1; + girq->parents =3D devm_kcalloc(&pdev->dev, 1, sizeof(*girq->parents), GFP= _KERNEL); + if (!girq->parents) + return -ENOMEM; + girq->parents[0] =3D gpio->irq; + girq->default_type =3D IRQ_TYPE_NONE; + girq->handler =3D handle_bad_irq; + girq->init_valid_mask =3D aspeed_init_irq_valid_mask; =20 gpio->offset_timer =3D devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL); --=20 2.34.1 From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEB44C61DA4 for ; Thu, 9 Mar 2023 07:46:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230107AbjCIHq2 (ORCPT ); Thu, 9 Mar 2023 02:46:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230131AbjCIHqC (ORCPT ); Thu, 9 Mar 2023 02:46:02 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59262DD370 for ; Wed, 8 Mar 2023 23:46:01 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id bi9so1173808lfb.2 for ; Wed, 08 Mar 2023 23:46:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347959; 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=zEW74q7+LMSUY62mVTwdBMLjddbljPzOZryQLptVoYY=; b=XMbLbd3t48QtZLIZdDhf0HUbvwbrN57LRxCsnWYwD95sSoH2C9ydCK9Ou4efqV4wBf fPho61KoVh/4YrAezawtOyTjD3HO3JWICfKNAme4sdUkVQiyuINnrmd0FI5wYdsJv3K3 EBch5GcMrv+1Jw6aPqiNtQool9SLVRIoZh+7fUKiAAJMA/e7/ch/BIxYVP7nksuk4aSL rPTs1Z688sR4BgDAUVMyh74s85bPjuMjJCoJVJ0L75uXA1Todzi5Oy9fS+BobwrqTWfJ azL/5VqCzWQFL8KilTI4GpkGuXTGbgnzloDwIRNt47hTvhJYDWiyLx5b/cS+eWRbSjZb gFBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347959; 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=zEW74q7+LMSUY62mVTwdBMLjddbljPzOZryQLptVoYY=; b=HThFdYLfaV2a6jGrHtZmwus5NTQejT/MEqghItHYeBuyCputqPg67bVdCVv5yTVV8g KY6yaDlAb06Yxe8lg7tOKB+mURPw8jrZ0AevPe4vDlOBqwor2A/mQCxX/joT96Sy+3ER 4/YzlB8u4HQpsf8HI3XBZhZYNc1BIQ8ZUEWD4dJufJyA2zrFVoD6nBowV003hWIGT/xt tIe27htQY8op/F4w1IL+gkK6gC0ryCwnXclCPIlHaZjuvoIqVnaFL6r2AxjjF1a9dOQV m/9DD+Bi/BdLGqmMqIogp+qAE6OZg4IHpZEOT1IEwnEppZKMmQX9y/tbwl4X3TDhwIaH f7fg== X-Gm-Message-State: AO0yUKXHDfsxsGyHUO9vdwQPp4DNNIQumpBZ1QaUBlDMFsxXtI+EAc3r LkJzUWKv5x3aBa1X+LyUAm5PQA== X-Google-Smtp-Source: AK7set9NiI3sz9FB4RU4+JFGgCcGNjfGi6smKIbqfdmd3mqgfKR8YgnJ28lt6ZQEbhknooPgZlQ61g== X-Received: by 2002:ac2:51c2:0:b0:4e2:40ba:af44 with SMTP id u2-20020ac251c2000000b004e240baaf44mr6215672lfm.7.1678347959770; Wed, 08 Mar 2023 23:45:59 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.45.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:45:59 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:52 +0100 Subject: [PATCH v3 04/17] gpio: aspeed: Convert to immutable irq_chip MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-4-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Tested-by: Joel Stanley Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Rebase on v6.3-rc1 - Collect ACKs ChangeLog v2->v3: - Drop chip->name =3D dev_name() assignment. - Rebase on top of Joels patch to make irqchip compulsory --- drivers/gpio/gpio-aspeed.c | 45 ++++++++++++++++++++++++++++++++++++++----= --- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index 129f6a6b4d1d..da33bbbdacb9 100644 --- a/drivers/gpio/gpio-aspeed.c +++ b/drivers/gpio/gpio-aspeed.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include =20 @@ -53,7 +54,7 @@ struct aspeed_gpio_config { */ struct aspeed_gpio { struct gpio_chip chip; - struct irq_chip irqc; + struct device *dev; raw_spinlock_t lock; void __iomem *base; int irq; @@ -566,6 +567,10 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *= d, bool set) =20 addr =3D bank_reg(gpio, bank, reg_irq_enable); =20 + /* Unmasking the IRQ */ + if (set) + gpiochip_enable_irq(&gpio->chip, irqd_to_hwirq(d)); + raw_spin_lock_irqsave(&gpio->lock, flags); copro =3D aspeed_gpio_copro_request(gpio, offset); =20 @@ -579,6 +584,10 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *= d, bool set) if (copro) aspeed_gpio_copro_release(gpio, offset); raw_spin_unlock_irqrestore(&gpio->lock, flags); + + /* Masking the IRQ */ + if (!set) + gpiochip_disable_irq(&gpio->chip, irqd_to_hwirq(d)); } =20 static void aspeed_gpio_irq_mask(struct irq_data *d) @@ -1080,6 +1089,30 @@ int aspeed_gpio_copro_release_gpio(struct gpio_desc = *desc) } EXPORT_SYMBOL_GPL(aspeed_gpio_copro_release_gpio); =20 +static void aspeed_gpio_irq_print_chip(struct irq_data *d, struct seq_file= *p) +{ + const struct aspeed_gpio_bank *bank; + struct aspeed_gpio *gpio; + u32 bit; + int rc, offset; + + rc =3D irqd_to_aspeed_gpio_data(d, &gpio, &bank, &bit, &offset); + if (rc) + return; + + seq_printf(p, dev_name(gpio->dev)); +} + +static const struct irq_chip aspeed_gpio_irq_chip =3D { + .irq_ack =3D aspeed_gpio_irq_ack, + .irq_mask =3D aspeed_gpio_irq_mask, + .irq_unmask =3D aspeed_gpio_irq_unmask, + .irq_set_type =3D aspeed_gpio_set_type, + .irq_print_chip =3D aspeed_gpio_irq_print_chip, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + /* * Any banks not specified in a struct aspeed_bank_props array are assumed= to * have the properties: @@ -1150,6 +1183,8 @@ static int __init aspeed_gpio_probe(struct platform_d= evice *pdev) if (IS_ERR(gpio->base)) return PTR_ERR(gpio->base); =20 + gpio->dev =3D &pdev->dev; + raw_spin_lock_init(&gpio->lock); =20 gpio_id =3D of_match_node(aspeed_gpio_of_table, pdev->dev.of_node); @@ -1208,12 +1243,8 @@ static int __init aspeed_gpio_probe(struct platform_= device *pdev) return irq; gpio->irq =3D irq; girq =3D &gpio->chip.irq; - girq->chip =3D &gpio->irqc; - girq->chip->name =3D dev_name(&pdev->dev); - girq->chip->irq_ack =3D aspeed_gpio_irq_ack; - girq->chip->irq_mask =3D aspeed_gpio_irq_mask; - girq->chip->irq_unmask =3D aspeed_gpio_irq_unmask; - girq->chip->irq_set_type =3D aspeed_gpio_set_type; + gpio_irq_chip_set_chip(girq, &aspeed_gpio_irq_chip); + girq->parent_handler =3D aspeed_gpio_irq_handler; girq->num_parents =3D 1; girq->parents =3D devm_kcalloc(&pdev->dev, 1, sizeof(*girq->parents), GFP= _KERNEL); --=20 2.34.1 From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5EF7C6FD1F for ; Thu, 9 Mar 2023 07:46:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230168AbjCIHqd (ORCPT ); Thu, 9 Mar 2023 02:46:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230163AbjCIHqE (ORCPT ); Thu, 9 Mar 2023 02:46:04 -0500 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F0FFDD594 for ; Wed, 8 Mar 2023 23:46:02 -0800 (PST) Received: by mail-lf1-x12d.google.com with SMTP id d36so1141134lfv.8 for ; Wed, 08 Mar 2023 23:46:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347960; 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=71KSFXipPt6AFUXeJ7X4eL7ZzgFaUvhDfIYjlqtJPYo=; b=HcD8RafOCrkba+DwCnjWTCDYkCx8BuPvKb3VLA1X+5duW0me6FZXc8kM1t2tmnFRhU PUc6PFWZ+IqLARsCadpuXf9ZD9ilEybWqEcsNFoZ3HGCaPM4FOOLMKItt4biVuqa9TG0 sYKW/ApX0kQ32n/7dbJhyy/CU7krTG6v2iCXsn56jffPFun7Y3NKuwPasjS5+2UwtHYc Z9eAnXzQdnA1hQq9PllyXJ3nxzct+xo//Pp6Z20b8sKN7quaC7WT6fN8p66zZmjGSoaM xBmqnI4fzHk/PRfcXBQF5+/7tuYsTaMR3fGg1nFEKzUhmNt6yzY1g6AJPj033+INFHHh dEFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347960; 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=71KSFXipPt6AFUXeJ7X4eL7ZzgFaUvhDfIYjlqtJPYo=; b=ePXJK3TZzehbORfiZKWO5brcAgFAnHQMQJLoJnGpQYhDo0Y78RDsAueXn+J5oqQj67 m57M9HdW9YF+KAV+2ZFgjGbJWT7RP7Wjbg2746sF6txdd9txqxlFeAsH90DunZDQSWAM WGfpDtTOJb7hglGXIlFFHoZnLVv5UO9DGAkAElu+5M0cQpPyvSQeDN7dxFKW6Mg5T9u9 wzovWX8PEMiqhHfTYsJw4Q4gMoZ2VCHiBjIpzHWJaZD3HaGZWm/sAV5Sf0lFsKob1JQv gcbqQwPj42QBQ8AuWU3UcxYGYVdJgMSvu8h6/vWeERtzlj/KDlBIR3GlQbg9ARyMCHYf nJCA== X-Gm-Message-State: AO0yUKX0wQYz0yrBI1tcL3nSDlFrtZy0x1RJ72kUIWviVfnsC9ZF8v2y SMUvQC4e0R9ABfuv3LC9pI28+g== X-Google-Smtp-Source: AK7set8RR2Mj+rE73ojhoeSkxrnf5iVpX8dsi9IU2VoejdjYg6Tzl7570E22Qp/5xs5oY8sCS3m9Pw== X-Received: by 2002:a19:f00f:0:b0:4c0:91d0:e7ab with SMTP id p15-20020a19f00f000000b004c091d0e7abmr4868474lfc.28.1678347960785; Wed, 08 Mar 2023 23:46:00 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.45.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:00 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:53 +0100 Subject: [PATCH v3 05/17] gpio: aspeed-sgpio: Convert to immutable irq_chip MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-5-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-aspeed-sgpio.c | 44 ++++++++++++++++++++++++++++++++----= ---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/drivers/gpio/gpio-aspeed-sgpio.c b/drivers/gpio/gpio-aspeed-sg= pio.c index 454cefbeecf0..3c1c0fc21fc5 100644 --- a/drivers/gpio/gpio-aspeed-sgpio.c +++ b/drivers/gpio/gpio-aspeed-sgpio.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include =20 @@ -29,7 +30,7 @@ struct aspeed_sgpio_pdata { =20 struct aspeed_sgpio { struct gpio_chip chip; - struct irq_chip intc; + struct device *dev; struct clk *pclk; raw_spinlock_t lock; void __iomem *base; @@ -296,6 +297,10 @@ static void aspeed_sgpio_irq_set_mask(struct irq_data = *d, bool set) irqd_to_aspeed_sgpio_data(d, &gpio, &bank, &bit, &offset); addr =3D bank_reg(gpio, bank, reg_irq_enable); =20 + /* Unmasking the IRQ */ + if (set) + gpiochip_enable_irq(&gpio->chip, irqd_to_hwirq(d)); + raw_spin_lock_irqsave(&gpio->lock, flags); =20 reg =3D ioread32(addr); @@ -307,6 +312,12 @@ static void aspeed_sgpio_irq_set_mask(struct irq_data = *d, bool set) iowrite32(reg, addr); =20 raw_spin_unlock_irqrestore(&gpio->lock, flags); + + /* Masking the IRQ */ + if (!set) + gpiochip_disable_irq(&gpio->chip, irqd_to_hwirq(d)); + + } =20 static void aspeed_sgpio_irq_mask(struct irq_data *d) @@ -401,6 +412,27 @@ static void aspeed_sgpio_irq_handler(struct irq_desc *= desc) chained_irq_exit(ic, desc); } =20 +static void aspeed_sgpio_irq_print_chip(struct irq_data *d, struct seq_fil= e *p) +{ + const struct aspeed_sgpio_bank *bank; + struct aspeed_sgpio *gpio; + u32 bit; + int offset; + + irqd_to_aspeed_sgpio_data(d, &gpio, &bank, &bit, &offset); + seq_printf(p, dev_name(gpio->dev)); +} + +static const struct irq_chip aspeed_sgpio_irq_chip =3D { + .irq_ack =3D aspeed_sgpio_irq_ack, + .irq_mask =3D aspeed_sgpio_irq_mask, + .irq_unmask =3D aspeed_sgpio_irq_unmask, + .irq_set_type =3D aspeed_sgpio_set_type, + .irq_print_chip =3D aspeed_sgpio_irq_print_chip, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + static int aspeed_sgpio_setup_irqs(struct aspeed_sgpio *gpio, struct platform_device *pdev) { @@ -423,14 +455,8 @@ static int aspeed_sgpio_setup_irqs(struct aspeed_sgpio= *gpio, iowrite32(0xffffffff, bank_reg(gpio, bank, reg_irq_status)); } =20 - gpio->intc.name =3D dev_name(&pdev->dev); - gpio->intc.irq_ack =3D aspeed_sgpio_irq_ack; - gpio->intc.irq_mask =3D aspeed_sgpio_irq_mask; - gpio->intc.irq_unmask =3D aspeed_sgpio_irq_unmask; - gpio->intc.irq_set_type =3D aspeed_sgpio_set_type; - irq =3D &gpio->chip.irq; - irq->chip =3D &gpio->intc; + gpio_irq_chip_set_chip(irq, &aspeed_sgpio_irq_chip); irq->init_valid_mask =3D aspeed_sgpio_irq_init_valid_mask; irq->handler =3D handle_bad_irq; irq->default_type =3D IRQ_TYPE_NONE; @@ -524,6 +550,8 @@ static int __init aspeed_sgpio_probe(struct platform_de= vice *pdev) if (IS_ERR(gpio->base)) return PTR_ERR(gpio->base); =20 + gpio->dev =3D &pdev->dev; + pdata =3D device_get_match_data(&pdev->dev); if (!pdata) return -EINVAL; --=20 2.34.1 From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59531C6FD19 for ; Thu, 9 Mar 2023 07:46:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230325AbjCIHqx (ORCPT ); Thu, 9 Mar 2023 02:46:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbjCIHqH (ORCPT ); Thu, 9 Mar 2023 02:46:07 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90D7FDD5B0 for ; Wed, 8 Mar 2023 23:46:03 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id t11so1175937lfr.1 for ; Wed, 08 Mar 2023 23:46:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347962; 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=3PUEBNIWi9XlpGpt5vSwoRNt6H80aDlupNA++Rohdv4=; b=nybRzTeW6RIm/2SrjGOF5FaP6SKi0d2JiXT906zjXJAVNYdYnXLgomwmFQ3almrEfr 6y+Wk8XrQG9P9BA0tGoydQmWGqeWAPlnB7UABZ/ZBKAlmBp7avsgDU1hBnali3npmo0X 3v1LYSh5mo+nsjTpHlMe3NQJoPm1k9seTsqo4Il5j5WFvoWRD/8AS88vDfTiL9hs/BRy aJ61t8qKUw6AvsY1GuSYuuz8DoPXutrHWXZvxrGAccfwUoMuO6zZHCExNPAlkNCkQlPL WGKfjoe9SFAE7uf/T2V2R2uabcIqtgPSeniJji05bixYq5dYPjT1/yO3BPqumDQTPsbe 42XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347962; 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=3PUEBNIWi9XlpGpt5vSwoRNt6H80aDlupNA++Rohdv4=; b=bUfGO8pLbKmvPGFjg3ff4wOcFwf9QD5yNPaJCXzPTU8OdQ6cXXXrWA1fjv3GPFmeQ/ 8zeKrZbZIDwyMJHyF4Wk+ceozFllzKCZUR0wWzoreBPEYcKUjIB1GCmmiyhCCQGJ2Tz5 7DmjDzLPoRdj27HcxytJgPgilJXSmtShzTFYglCohgm09J1p7GGG+XPDdOS4X53OVHpg 6nnjytf2SWhoQh2dkmRoGVKbJ8Mn5JvugdHi81oJSyz9iz3a+zb3D6Et51+J5cxydV8t baZQFySfD3kOGHY0Ko8Mg8J3SV6bGFZ53A9p6i+gEbf/uIul2k67zXEOhb17rZLAZvRp N66A== X-Gm-Message-State: AO0yUKUBm1g+nRgjIj4GRAZ0NbKE2wXwHlZDWe30eomaDz/4tcWHEwsL sYnpzkYEtL03ijsdD7KpbQv8Lg== X-Google-Smtp-Source: AK7set9Rf6KwMUejQHH6eNoYok3Zam8mTGRtBlpbIPx+hAHzI1oz/B6ewh7RXNguuScReStV6zHWSQ== X-Received: by 2002:a19:7406:0:b0:4d8:5e8e:b138 with SMTP id v6-20020a197406000000b004d85e8eb138mr5587064lfe.14.1678347961936; Wed, 08 Mar 2023 23:46:01 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.46.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:01 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:54 +0100 Subject: [PATCH v3 06/17] gpio: ath79: Convert to immutable irq_chip MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-6-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-ath79.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-ath79.c b/drivers/gpio/gpio-ath79.c index 3958c6d97639..aa0a954b8392 100644 --- a/drivers/gpio/gpio-ath79.c +++ b/drivers/gpio/gpio-ath79.c @@ -71,6 +71,7 @@ static void ath79_gpio_irq_unmask(struct irq_data *data) u32 mask =3D BIT(irqd_to_hwirq(data)); unsigned long flags; =20 + gpiochip_enable_irq(&ctrl->gc, irqd_to_hwirq(data)); raw_spin_lock_irqsave(&ctrl->lock, flags); ath79_gpio_update_bits(ctrl, AR71XX_GPIO_REG_INT_MASK, mask, mask); raw_spin_unlock_irqrestore(&ctrl->lock, flags); @@ -85,6 +86,7 @@ static void ath79_gpio_irq_mask(struct irq_data *data) raw_spin_lock_irqsave(&ctrl->lock, flags); ath79_gpio_update_bits(ctrl, AR71XX_GPIO_REG_INT_MASK, mask, 0); raw_spin_unlock_irqrestore(&ctrl->lock, flags); + gpiochip_disable_irq(&ctrl->gc, irqd_to_hwirq(data)); } =20 static void ath79_gpio_irq_enable(struct irq_data *data) @@ -169,13 +171,15 @@ static int ath79_gpio_irq_set_type(struct irq_data *d= ata, return 0; } =20 -static struct irq_chip ath79_gpio_irqchip =3D { +static const struct irq_chip ath79_gpio_irqchip =3D { .name =3D "gpio-ath79", .irq_enable =3D ath79_gpio_irq_enable, .irq_disable =3D ath79_gpio_irq_disable, .irq_mask =3D ath79_gpio_irq_mask, .irq_unmask =3D ath79_gpio_irq_unmask, .irq_set_type =3D ath79_gpio_irq_set_type, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; =20 static void ath79_gpio_irq_handler(struct irq_desc *desc) @@ -274,7 +278,7 @@ static int ath79_gpio_probe(struct platform_device *pde= v) /* Optional interrupt setup */ if (!np || of_property_read_bool(np, "interrupt-controller")) { girq =3D &ctrl->gc.irq; - girq->chip =3D &ath79_gpio_irqchip; + gpio_irq_chip_set_chip(girq, &ath79_gpio_irqchip); girq->parent_handler =3D ath79_gpio_irq_handler; girq->num_parents =3D 1; girq->parents =3D devm_kcalloc(dev, 1, sizeof(*girq->parents), --=20 2.34.1 From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74E3CC6FD19 for ; Thu, 9 Mar 2023 07:46:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229511AbjCIHqt (ORCPT ); Thu, 9 Mar 2023 02:46:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230032AbjCIHqH (ORCPT ); Thu, 9 Mar 2023 02:46:07 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91F5DDD37E for ; Wed, 8 Mar 2023 23:46:04 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id i28so1206250lfv.0 for ; Wed, 08 Mar 2023 23:46:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347963; 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=YxZa+3MhOrXUUjhkc+LrGW+xXurv1Litsrz7qLnZ7aI=; b=t8rkah655HCn9cL1h3Am/2+vV9AgN0P4gZ9nz2b0HxputsAayTbj821PqUa7otUYtR 4rT352da4OCJCfzzGkx9v813htRdIT96XMYNv1//VWUxakgKq165OFenRYcp5/5kdn30 Ag75I+gOCogp/+q0kzxvJtJZogUvIVcQ6yVAT6f0Y/qOf2S88dCiQqa5kz0UCIj+C6e6 1m4ygY3ig91t87dlglPlwRBVeCJWVMX0RsTwJN65yun6okbknftwuSQ0DyUnVS6P73If 0ODs59J99Vwr19HNTlOec8uCB7RYpPoN87qHQYs/v3qQNAJdhj0QMK29Zyylffu6ehsm KNbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347963; 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=YxZa+3MhOrXUUjhkc+LrGW+xXurv1Litsrz7qLnZ7aI=; b=zQ1MCXy6nyapOSmCkDSe3wlvhPb1UGdHQWXm480+r7rhRtTZz0p4EKfT5/vNuMecCq YuWCNr97aI2x+SkbMABsQKTtNxjmueQtXY+Zi5Ml8q1UWCRzBOi63eYuEnU1ugXaZ1gT xx1Sfu8ZUIef8+cEgO/W8RNXed5W6jIOoxkazIMf2tOg2EBUy8w0n42s2uVHg2ukMCo8 HP3zTG8Es2awcfUqz6bJ5NZCZn1rvtgcIx2HqIWt9lyH3MK7YMTcbd6usgsOGSI6J3Sz tJgS/s5uPs8B1byHuBXDmAQvynlRYHkLsQspRePQZED6YPezAJHqPWCwibh2kZyg5p2u pvww== X-Gm-Message-State: AO0yUKVensugYkHflnqhgnxBLLzORmbjtfbsrLYeB0YvZ9MuD6twFwmg CFROQHuDW+XTnmY4tOoVIXJ2zw== X-Google-Smtp-Source: AK7set9+YUkmbffwVNF3AIk/o8rXQz65/wJCi4qVl7hoX4l3kYgknjGEoz/Z3F52gOsCNKsSA4bbQA== X-Received: by 2002:ac2:4475:0:b0:4b0:1305:6e02 with SMTP id y21-20020ac24475000000b004b013056e02mr6031006lfl.8.1678347962992; Wed, 08 Mar 2023 23:46:02 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.46.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:02 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:55 +0100 Subject: [PATCH v3 07/17] gpio: cadence: Convert to immutable irq_chip MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-7-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Acked-by: 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 =3D gpiochip_get_data(chip); =20 iowrite32(BIT(d->hwirq), cgpio->regs + CDNS_GPIO_IRQ_DIS); + gpiochip_disable_irq(chip, irqd_to_hwirq(d)); } =20 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 =3D irq_data_get_irq_chip_data(d); struct cdns_gpio_chip *cgpio =3D gpiochip_get_data(chip); =20 + gpiochip_enable_irq(chip, irqd_to_hwirq(d)); iowrite32(BIT(d->hwirq), cgpio->regs + CDNS_GPIO_IRQ_EN); } =20 @@ -138,11 +140,13 @@ static void cdns_gpio_irq_handler(struct irq_desc *de= sc) chained_irq_exit(irqchip, desc); } =20 -static struct irq_chip cdns_gpio_irqchip =3D { +static const struct irq_chip cdns_gpio_irqchip =3D { .name =3D "cdns-gpio", .irq_mask =3D cdns_gpio_irq_mask, .irq_unmask =3D cdns_gpio_irq_unmask, - .irq_set_type =3D cdns_gpio_irq_set_type + .irq_set_type =3D cdns_gpio_irq_set_type, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; =20 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; =20 girq =3D &cgpio->gc.irq; - girq->chip =3D &cdns_gpio_irqchip; + gpio_irq_chip_set_chip(girq, &cdns_gpio_irqchip); girq->parent_handler =3D cdns_gpio_irq_handler; girq->num_parents =3D 1; girq->parents =3D devm_kcalloc(&pdev->dev, 1, --=20 2.34.1 From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89B61C742A7 for ; Thu, 9 Mar 2023 07:46:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230289AbjCIHqn (ORCPT ); Thu, 9 Mar 2023 02:46:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229716AbjCIHqG (ORCPT ); Thu, 9 Mar 2023 02:46:06 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8801FDB6E4 for ; Wed, 8 Mar 2023 23:46:04 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id r27so1134932lfe.10 for ; Wed, 08 Mar 2023 23:46:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347964; 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=c+tr96cZPYMIs0/699FeDkH9/3i8GidF6/NXAvTE8Kg=; b=oGW4OUQOWAHop80go+7eApoUqKVJQON4IntulrZQevBtG7/txnRJ1hEPqqfqWliJ3/ eQ4luTNNRRIvo4ZQ5IrXKX2HMtUI5ARBUVi+45UZ1NSgSLq4lvMHn6XqEqz4PuYZPIT8 m1upl/zAA244KcLjUxk4wfhic/fEhP7jUJ3IX4y8pzpIJU3DfwSwgaLQVTGrYIpE1/Zm ZeiA75Yomc6pyu7as9PecDHpKv56m+T6RsagMseeYS43IzgC3i46K4zTFv9L1g0HyJBO gxkj/MIhbE3NYOS/6XbaMpAvFGhW9BbJLj8mSKHyRgsNKzqcStlN38pffi9HgN3ksQ97 XAwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347964; 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=c+tr96cZPYMIs0/699FeDkH9/3i8GidF6/NXAvTE8Kg=; b=JIlUt/2sTENSsvty92rjlLeOXhusStUI1Kmpo4JR7mLltrNMr0LEwROYPxUafyQmZ7 dMp7qdr2uqQFf8AWT26SAsevNfdXz3/tuZru1mBvDaS8+ddxvFIuwQYzP3c0fNx6Pywy J733QTwb5SrZgBpia6c1mSKKtsEEcrvzJVJvQAhU22UfR3sJiOyrA45WbMAHrtny4EWg 7mQmBMd/deodrsWFrCDbU9B4YKVXs962/80ycbhg5wk6gr5POhG5sl3Oy8GdZJPhpveF IVC6IroOVEzZzlnHemT5nbBSWu/AdczgNmXL3T13tH7THEfoF3mafc3IlneQXhWPd0AR FbJA== X-Gm-Message-State: AO0yUKXAAJ5RMd4pk0ywasf5FNv0VxQT02cYWB6aSpZFR+LJxEtrJf6e 9MJKg6P9eB2NvKEM8OoEmpcV/A== X-Google-Smtp-Source: AK7set9O0Rzn6gceHkhyQLCg6KQ/J7lIL+u70P7LbVjJf285Bv2SVczsQHACcSpz6PjNCY+uHSpttA== X-Received: by 2002:a05:6512:4c9:b0:4dd:d687:4ea7 with SMTP id w9-20020a05651204c900b004ddd6874ea7mr5528402lfq.36.1678347964117; Wed, 08 Mar 2023 23:46:04 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.46.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:03 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:56 +0100 Subject: [PATCH v3 08/17] gpio: hisi: Convert to immutable irq_chip MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-8-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. The IRQ chip was unnamed which seems unwise, so we just assign the name "HISI-GPIO". Cc: Marc Zyngier Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-hisi.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/gpio-hisi.c b/drivers/gpio/gpio-hisi.c index 55bd69043bf4..29a03de37fd8 100644 --- a/drivers/gpio/gpio-hisi.c +++ b/drivers/gpio/gpio-hisi.c @@ -37,7 +37,6 @@ struct hisi_gpio { struct device *dev; void __iomem *reg_base; unsigned int line_num; - struct irq_chip irq_chip; int irq; }; =20 @@ -100,12 +99,14 @@ static void hisi_gpio_irq_set_mask(struct irq_data *d) struct gpio_chip *chip =3D irq_data_get_irq_chip_data(d); =20 hisi_gpio_write_reg(chip, HISI_GPIO_INTMASK_SET_WX, BIT(irqd_to_hwirq(d))= ); + gpiochip_disable_irq(chip, irqd_to_hwirq(d)); } =20 static void hisi_gpio_irq_clr_mask(struct irq_data *d) { struct gpio_chip *chip =3D irq_data_get_irq_chip_data(d); =20 + gpiochip_enable_irq(chip, irqd_to_hwirq(d)); hisi_gpio_write_reg(chip, HISI_GPIO_INTMASK_CLR_WX, BIT(irqd_to_hwirq(d))= ); } =20 @@ -191,20 +192,24 @@ static void hisi_gpio_irq_handler(struct irq_desc *de= sc) chained_irq_exit(irq_c, desc); } =20 +static const struct irq_chip hisi_gpio_irq_chip =3D { + .name =3D "HISI-GPIO", + .irq_ack =3D hisi_gpio_set_ack, + .irq_mask =3D hisi_gpio_irq_set_mask, + .irq_unmask =3D hisi_gpio_irq_clr_mask, + .irq_set_type =3D hisi_gpio_irq_set_type, + .irq_enable =3D hisi_gpio_irq_enable, + .irq_disable =3D hisi_gpio_irq_disable, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + static void hisi_gpio_init_irq(struct hisi_gpio *hisi_gpio) { struct gpio_chip *chip =3D &hisi_gpio->chip; struct gpio_irq_chip *girq_chip =3D &chip->irq; =20 - /* Set hooks for irq_chip */ - hisi_gpio->irq_chip.irq_ack =3D hisi_gpio_set_ack; - hisi_gpio->irq_chip.irq_mask =3D hisi_gpio_irq_set_mask; - hisi_gpio->irq_chip.irq_unmask =3D hisi_gpio_irq_clr_mask; - hisi_gpio->irq_chip.irq_set_type =3D hisi_gpio_irq_set_type; - hisi_gpio->irq_chip.irq_enable =3D hisi_gpio_irq_enable; - hisi_gpio->irq_chip.irq_disable =3D hisi_gpio_irq_disable; - - girq_chip->chip =3D &hisi_gpio->irq_chip; + gpio_irq_chip_set_chip(girq_chip, &hisi_gpio_irq_chip); girq_chip->default_type =3D IRQ_TYPE_NONE; girq_chip->num_parents =3D 1; girq_chip->parents =3D &hisi_gpio->irq; --=20 2.34.1 From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F30DC6FD19 for ; Thu, 9 Mar 2023 07:47:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230183AbjCIHq5 (ORCPT ); Thu, 9 Mar 2023 02:46:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230201AbjCIHqR (ORCPT ); Thu, 9 Mar 2023 02:46:17 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB874DF70D for ; Wed, 8 Mar 2023 23:46:06 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id r27so1134975lfe.10 for ; Wed, 08 Mar 2023 23:46:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347965; 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=zhXTDSkBpSBmoLnt16h1xxcFV0v4vmTT7mnJI/zNpFI=; b=RdVd7acfqbV/RJ0zljVIdHf8OEekFM1TtLnwjfbFmZBCfpKs48zDqq9jmJ00FNhc3+ /21cJMiUoapp6aQgyYn2yng55EYkn3VehxFmuN1KnP/66ZoKwnbW0Wb8Gmj1f2X4zxlV 6LNliyaEJkqXcqyNFaQ/sM8kHziZlZvQx4gpkJETQSQ83/q9298lWDpGeGdTJmd6GNn4 cGXLY4Hj3atvGpFxTvp1/dXiAJqtNMlGCMP2rAqJr2cXTfR7dDa2I1yjcHTBYj/eTDgY qwctT1YvUcEGtoaxJZUIzCJNr3Gjesc1tFMnBD9WrbkLI9DoPMhpqxXXFYdpMbMvZm76 LW1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347965; 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=zhXTDSkBpSBmoLnt16h1xxcFV0v4vmTT7mnJI/zNpFI=; b=DKsjhH8UZHzFXzYBKYE2FkYrNW0irp4GtkT7iCVjpJkAUmjYe5oQXyVBg/0oZL0XTf L1OnFhVjcbwwlp0gNykJrlNiUxPbX6r7iVLIscgVQbFK0RuoY5R2qBCV2wuwDSXbQZ2y /0YuMxqsv/jDLVm7b+iEH7PE+4Kwptkn0JFtYdSwwb1kzcKKpZec7aQbpcj2F3GwY+6U 9Swmzb6l0WJqLY++tupK3E1Y2R55gUc5MQzqGsbuMAzUz8r3FayBdPIFhGDs/lMtvpUr nK27+iz/rDE8AjSgy82AIBAwnK12Vi62sKQm69d2vWRP4A3yg8qwI6ZxgTdzt0Z17zg/ ktBA== X-Gm-Message-State: AO0yUKUcrtwnECPy3cMCFAfrAAJdgGdi64c/l5PIsfObq96niJK0gaRr LubRSuX4ELUJfxvtr/o3FxqJBw== X-Google-Smtp-Source: AK7set+l0IBAcPEMof3/gCWtD/52DgbhsGMf+RINIiurOj/KsNvWkoCxqcEPKNnC9v2V7US9f4a2Fg== X-Received: by 2002:ac2:5630:0:b0:4db:384c:bb8 with SMTP id b16-20020ac25630000000b004db384c0bb8mr5204447lff.69.1678347965235; Wed, 08 Mar 2023 23:46:05 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:04 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:57 +0100 Subject: [PATCH v3 09/17] gpio: hlwd: Convert to immutable irq_chip MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-9-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-hlwd.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/drivers/gpio/gpio-hlwd.c b/drivers/gpio/gpio-hlwd.c index 4e13e937f832..c208ac1c54a6 100644 --- a/drivers/gpio/gpio-hlwd.c +++ b/drivers/gpio/gpio-hlwd.c @@ -11,6 +11,7 @@ #include #include #include +#include #include =20 /* @@ -48,7 +49,7 @@ =20 struct hlwd_gpio { struct gpio_chip gpioc; - struct irq_chip irqc; + struct device *dev; void __iomem *regs; int irq; u32 edge_emulation; @@ -123,6 +124,7 @@ static void hlwd_gpio_irq_mask(struct irq_data *data) mask &=3D ~BIT(data->hwirq); iowrite32be(mask, hlwd->regs + HW_GPIOB_INTMASK); raw_spin_unlock_irqrestore(&hlwd->gpioc.bgpio_lock, flags); + gpiochip_disable_irq(&hlwd->gpioc, irqd_to_hwirq(data)); } =20 static void hlwd_gpio_irq_unmask(struct irq_data *data) @@ -132,6 +134,7 @@ static void hlwd_gpio_irq_unmask(struct irq_data *data) unsigned long flags; u32 mask; =20 + gpiochip_enable_irq(&hlwd->gpioc, irqd_to_hwirq(data)); raw_spin_lock_irqsave(&hlwd->gpioc.bgpio_lock, flags); mask =3D ioread32be(hlwd->regs + HW_GPIOB_INTMASK); mask |=3D BIT(data->hwirq); @@ -202,6 +205,24 @@ static int hlwd_gpio_irq_set_type(struct irq_data *dat= a, unsigned int flow_type) return 0; } =20 +static void hlwd_gpio_irq_print_chip(struct irq_data *data, struct seq_fil= e *p) +{ + struct hlwd_gpio *hlwd =3D + gpiochip_get_data(irq_data_get_irq_chip_data(data)); + + seq_printf(p, dev_name(hlwd->dev)); +} + +static const struct irq_chip hlwd_gpio_irq_chip =3D { + .irq_mask =3D hlwd_gpio_irq_mask, + .irq_unmask =3D hlwd_gpio_irq_unmask, + .irq_enable =3D hlwd_gpio_irq_enable, + .irq_set_type =3D hlwd_gpio_irq_set_type, + .irq_print_chip =3D hlwd_gpio_irq_print_chip, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + static int hlwd_gpio_probe(struct platform_device *pdev) { struct hlwd_gpio *hlwd; @@ -216,6 +237,8 @@ static int hlwd_gpio_probe(struct platform_device *pdev) if (IS_ERR(hlwd->regs)) return PTR_ERR(hlwd->regs); =20 + hlwd->dev =3D &pdev->dev; + /* * Claim all GPIOs using the OWNER register. This will not work on * systems where the AHBPROT memory firewall hasn't been configured to @@ -259,14 +282,8 @@ static int hlwd_gpio_probe(struct platform_device *pde= v) return hlwd->irq; } =20 - hlwd->irqc.name =3D dev_name(&pdev->dev); - hlwd->irqc.irq_mask =3D hlwd_gpio_irq_mask; - hlwd->irqc.irq_unmask =3D hlwd_gpio_irq_unmask; - hlwd->irqc.irq_enable =3D hlwd_gpio_irq_enable; - hlwd->irqc.irq_set_type =3D hlwd_gpio_irq_set_type; - girq =3D &hlwd->gpioc.irq; - girq->chip =3D &hlwd->irqc; + gpio_irq_chip_set_chip(girq, &hlwd_gpio_irq_chip); girq->parent_handler =3D hlwd_gpio_irqhandler; girq->num_parents =3D 1; girq->parents =3D devm_kcalloc(&pdev->dev, 1, --=20 2.34.1 From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E27F3C6FD19 for ; Thu, 9 Mar 2023 07:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230018AbjCIHrI (ORCPT ); Thu, 9 Mar 2023 02:47:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbjCIHqb (ORCPT ); Thu, 9 Mar 2023 02:46:31 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0892BDD366 for ; Wed, 8 Mar 2023 23:46:07 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id d36so1141395lfv.8 for ; Wed, 08 Mar 2023 23:46:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347966; 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=mrWM+EAKAzwQ5ezMEftNhFMLDl9SqlbwY2w38EwevvI=; b=dpeqQOhAC2IXszdN6b8072Sl3bUiKHrw7h4NcCf0ogXh4B0yfqJj4ByencdTElx2aJ sKF4q5jllyoAmMUW1uRtjq8pRUmfXSCBbZVRrj3c2xQQ0x0vtVj7XokQal+UY9jqLosg Xx+05Ne3vk9lXNGwr8b/JGeQcueOHbwq5PWrmt9z39hSY2nGyWtfcKQRqCpZYWcY6wV4 JW6F/ONnjvJUwNtFnrrd2R099Hw9dktMpGsFvYioElhFKu6kHxEJVHQ5pqKTod0lk1v+ vuTU590mZUpAPXNWN4bYA6rqfMeoD8fC6xhG4fbLX/Sz+AO32D4l60l+nwuZPGTHP3AS dzyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347966; 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=mrWM+EAKAzwQ5ezMEftNhFMLDl9SqlbwY2w38EwevvI=; b=SZmKbGIsQlGPrjYjPYZAAAGGq7FTLensYvqi3pY+eV2za3lz842JrNeDFb7e6Kojsb uUpiN2nZ0mN1O8ZNnX/58vgO7ECowBznQSave3hOUYKdVSZfhbAb1cnyj3xUMrJXqNzE GDyqGmvk8Rx35L6ErrQknQIx3OBQXnUtcxSlG22jksYZSPQDZ6xiIu6VaOGZHuQ8T+Pb 9dK1WmKSylGqLk483Qx9BZR5oKWhlUh1WZUsIPfOhg3EQVsHI0m1lJH/1DnVypvuX9FA sx6v2iU0z6UJB670SQC5w9/G2voXGsj/WCke0XQq4gxPRh5Bh3JRplxdLJTYLksDhkc7 x8nw== X-Gm-Message-State: AO0yUKUAQSzmPlvFCKejsGOXfe0oMXCqleaXoxXDQpQRmnPH5w+3pUKX 46v0jYq1gMH2Kg0e9uW9480Jig== X-Google-Smtp-Source: AK7set87fT21JTW4faB6eJ2rms/WTKqyCslnbwT2UP6lQ5L4Z1c0bjHVrhO2dqhxeFk7Qxewgh+FmA== X-Received: by 2002:ac2:555a:0:b0:4de:6973:82aa with SMTP id l26-20020ac2555a000000b004de697382aamr5913982lfk.68.1678347966337; Wed, 08 Mar 2023 23:46:06 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:05 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:58 +0100 Subject: [PATCH v3 10/17] gpio: idt3243x: Convert to immutable irq_chip MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-10-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 , Thomas Bogendoerfer X-Mailer: b4 0.12.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Tested-by: Thomas Bogendoerfer Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-idt3243x.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-idt3243x.c b/drivers/gpio/gpio-idt3243x.c index 1cafdf46f875..00f547d26254 100644 --- a/drivers/gpio/gpio-idt3243x.c +++ b/drivers/gpio/gpio-idt3243x.c @@ -92,6 +92,8 @@ static void idt_gpio_mask(struct irq_data *d) writel(ctrl->mask_cache, ctrl->pic + IDT_PIC_IRQ_MASK); =20 raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); + + gpiochip_disable_irq(gc, irqd_to_hwirq(d)); } =20 static void idt_gpio_unmask(struct irq_data *d) @@ -100,6 +102,7 @@ static void idt_gpio_unmask(struct irq_data *d) struct idt_gpio_ctrl *ctrl =3D gpiochip_get_data(gc); unsigned long flags; =20 + gpiochip_enable_irq(gc, irqd_to_hwirq(d)); raw_spin_lock_irqsave(&gc->bgpio_lock, flags); =20 ctrl->mask_cache &=3D ~BIT(d->hwirq); @@ -119,12 +122,14 @@ static int idt_gpio_irq_init_hw(struct gpio_chip *gc) return 0; } =20 -static struct irq_chip idt_gpio_irqchip =3D { +static const struct irq_chip idt_gpio_irqchip =3D { .name =3D "IDTGPIO", .irq_mask =3D idt_gpio_mask, .irq_ack =3D idt_gpio_ack, .irq_unmask =3D idt_gpio_unmask, - .irq_set_type =3D idt_gpio_irq_set_type + .irq_set_type =3D idt_gpio_irq_set_type, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; =20 static int idt_gpio_probe(struct platform_device *pdev) @@ -168,7 +173,7 @@ static int idt_gpio_probe(struct platform_device *pdev) return parent_irq; =20 girq =3D &ctrl->gc.irq; - girq->chip =3D &idt_gpio_irqchip; + gpio_irq_chip_set_chip(girq, &idt_gpio_irqchip); girq->init_hw =3D idt_gpio_irq_init_hw; girq->parent_handler =3D idt_gpio_dispatch; girq->num_parents =3D 1; --=20 2.34.1 From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0E7EC61DA4 for ; Thu, 9 Mar 2023 07:47:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230331AbjCIHrB (ORCPT ); Thu, 9 Mar 2023 02:47:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbjCIHqa (ORCPT ); Thu, 9 Mar 2023 02:46:30 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C22EEDF720 for ; Wed, 8 Mar 2023 23:46:07 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id i9so1157712lfc.6 for ; Wed, 08 Mar 2023 23:46:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347967; 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=Nj6jio3cM/arnjJ3w8Z7XTVvD/CZOiBuUJssoRypJa0=; b=xwf8KALZLR0nIYkuFjQZGVcY2mmqSH9Bfzggzf2PNDHJUzO3FLSp55bkFvwwJSjugU bySHixGlQTucE5mALVhMAqd0U+SRxp4YOp92wG1995YoeXHMhdFR3yToSBGokblA+vvP memzY3k/ZT9CqUyFJw0X9S2BjjUsf9rzmVL+yqMBnchOcpNOFJ1qUcxjGEm8hYv+nACV BjEEZ/dQQF5gc2Is9vQYGVC+P6zD65aux1fObZAcWAyhb9Uw2cwVjkKt23QS8an5bAgg zOP52WaV4fGwrWmCuf1qkEqT69qCzTzLIdQrXVCadt6QYxOuR83ew8G9YRq2lNEF30VF DUKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347967; 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=Nj6jio3cM/arnjJ3w8Z7XTVvD/CZOiBuUJssoRypJa0=; b=1TjoxJXyfkqk2ldbwqxupruXXReTzO4QBXEm+3txVs/GZyeKso6WDnP81RIdeFZfpL rSbu1zz4VMa6JmBn2ELugk/6Cyx8CEEuFg8CkyM5xX6gizjKkbvpgO3ID7wSGaI5OKAF 66unQFNNypZKbh9dr3DTnxILpPmkAklBRDt95UKGqpiIVSEFYqTPhgR6p4zCIlhZsT7o 2XIQGA5QC7hqGi33bSf+1McE+bYwV6leiCWiXzriVv8HamQh4oRnIQ0iA8doxczFRxc8 ysY1ModVHZDDkJtLK1qkrEtu592HC53CugmKxNUch9amgfHfSCEJCUXwaW2KrRSUilyI BOcw== X-Gm-Message-State: AO0yUKX/i5AQMcvmOf/Y807LM7/UIxrECp9vnQfF48gDYTQGicSwGh+V y7AbsI6VTEy3sqoEviE48L/ELA== X-Google-Smtp-Source: AK7set+7SeKoeP6ww+p3rAPDNpLbeniGpZIzW6H3NPKfLtikv3/3WvapNsR2GFMi6AMLr1TPdSWKnQ== X-Received: by 2002:a19:a416:0:b0:4dd:a025:d8e with SMTP id q22-20020a19a416000000b004dda0250d8emr6336857lfc.47.1678347967362; Wed, 08 Mar 2023 23:46:07 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:07 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:59 +0100 Subject: [PATCH v3 11/17] gpio: msc313: Convert to immutable irq_chip MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-11-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. This conversion follows the pattern of the gpio-ixp4xx hierarchical GPIO interrupt driver. Cc: Marc Zyngier Acked-by: Marc Zyngier Signed-off-by: Linus Walleij Reviewed-by: Romain Perier --- drivers/gpio/gpio-msc313.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-msc313.c b/drivers/gpio/gpio-msc313.c index b0773e5652fa..036ad2324892 100644 --- a/drivers/gpio/gpio-msc313.c +++ b/drivers/gpio/gpio-msc313.c @@ -532,17 +532,35 @@ static int msc313_gpio_direction_output(struct gpio_c= hip *chip, unsigned int off return 0; } =20 +static void msc313_gpio_irq_mask(struct irq_data *d) +{ + struct gpio_chip *gc =3D irq_data_get_irq_chip_data(d); + + irq_chip_mask_parent(d); + gpiochip_disable_irq(gc, d->hwirq); +} + +static void msc313_gpio_irq_unmask(struct irq_data *d) +{ + struct gpio_chip *gc =3D irq_data_get_irq_chip_data(d); + + gpiochip_enable_irq(gc, d->hwirq); + irq_chip_unmask_parent(d); +} + /* * The interrupt handling happens in the parent interrupt controller, * we don't do anything here. */ -static struct irq_chip msc313_gpio_irqchip =3D { +static const struct irq_chip msc313_gpio_irqchip =3D { .name =3D "GPIO", .irq_eoi =3D irq_chip_eoi_parent, - .irq_mask =3D irq_chip_mask_parent, - .irq_unmask =3D irq_chip_unmask_parent, + .irq_mask =3D msc313_gpio_irq_mask, + .irq_unmask =3D msc313_gpio_irq_unmask, .irq_set_type =3D irq_chip_set_type_parent, .irq_set_affinity =3D irq_chip_set_affinity_parent, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; =20 /* @@ -644,7 +662,7 @@ static int msc313_gpio_probe(struct platform_device *pd= ev) gpiochip->names =3D gpio->gpio_data->names; =20 gpioirqchip =3D &gpiochip->irq; - gpioirqchip->chip =3D &msc313_gpio_irqchip; + gpio_irq_chip_set_chip(gpioirqchip, &msc313_gpio_irqchip); gpioirqchip->fwnode =3D of_node_to_fwnode(dev->of_node); gpioirqchip->parent_domain =3D parent_domain; gpioirqchip->child_to_parent_hwirq =3D msc313e_gpio_child_to_parent_hwirq; --=20 2.34.1 From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D34B0C64EC4 for ; Thu, 9 Mar 2023 07:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229672AbjCIHrF (ORCPT ); Thu, 9 Mar 2023 02:47:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230261AbjCIHqb (ORCPT ); Thu, 9 Mar 2023 02:46:31 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8A1EDDB19 for ; Wed, 8 Mar 2023 23:46:08 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id r27so1135114lfe.10 for ; Wed, 08 Mar 2023 23:46:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347968; 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=Pkmx+b8ik/C6bLfv+4RBCDp/VEmyhMZOMZzx00ojykk=; b=p3Kr/WFNbbKFk66agzCT4u42Y5KITAZpT48aFDNPE9ZUZHzzWb76fkK8FF1mTSwXvA YN00K6GTgQC1XC+mSoGVipsLmUmGGI2Ditgn5WnNaGmdlVcaT0n1cQsDlfgsKhlAdyIG 0VD4mueZ56RA8/YbfkwoduJ4nCXDurAqKFa6Rt8oQHpjXxLFrUWlgtfVwrrAoMGpKt0w aariaDW/AIcCYsIghKFcThCHY0OPYL8YkfwbdKEkF8qSKkpnlYYSD99dkFG0/dqduNje gSlB2/gHJo7+OIQaV7pAaEMDPRnenW8c0PzItdFAYuv0gBV0pV2zXHmS6KtCDIR3Fn+W Eg0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347968; 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=Pkmx+b8ik/C6bLfv+4RBCDp/VEmyhMZOMZzx00ojykk=; b=XaxOMzX+/BrLMnZW6upnRJhRzSZwjUfc45UhEeZczz/zdkdvPsEkhydS0lMNytqD3z 2cCgzSx+QEXISAjvsLmVH7eujUPxPmGT/Zyv93cMVivPTsdQGkv4zfbOySg0uVyM0Q+d vY4Jy+X7FXZETuVsN7guZ1GBIdTZEFKszzQHw2lbjjJ5AbMcH3B+z6rk0l7f2N8PyQIf HPznrPRCnSeC1OYo804tOcFak/v3aF/ERw1zxEtkgzehYk7NEfl4eRM9XWOkc9JbGxRn k2KzQdnRtWVZUF9WpKcDd/5YrkH/++HVIRj++0ixcnzuMJw+/A91gFK9N5JXaYzTOvL7 zenA== X-Gm-Message-State: AO0yUKVELHDs82zHKwo21Wykc31+oVpTMbSKUgBYSoEovQGcnaECSmVd UdLb/OY7gWqdMlARYSzhgxnyxQ== X-Google-Smtp-Source: AK7set/7bPEP30lH2CywZpfXJDDlcTykBdecq0v0yxbUeNWQFNURhNsZZCgZbpHl19Di3POVs7nG3A== X-Received: by 2002:ac2:5dfa:0:b0:4b6:e405:1027 with SMTP id z26-20020ac25dfa000000b004b6e4051027mr6046717lfq.14.1678347968374; Wed, 08 Mar 2023 23:46:08 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.46.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:08 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:46:00 +0100 Subject: [PATCH v3 12/17] gpio: mlxbf2: Convert to immutable irq_chip MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-12-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-mlxbf2.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/gpio/gpio-mlxbf2.c b/drivers/gpio/gpio-mlxbf2.c index 77a41151c921..6abe01bc39c3 100644 --- a/drivers/gpio/gpio-mlxbf2.c +++ b/drivers/gpio/gpio-mlxbf2.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include =20 @@ -65,10 +66,10 @@ struct mlxbf2_gpio_context_save_regs { /* BlueField-2 gpio block context structure. */ struct mlxbf2_gpio_context { struct gpio_chip gc; - struct irq_chip irq_chip; =20 /* YU GPIO blocks address */ void __iomem *gpio_io; + struct device *dev; =20 struct mlxbf2_gpio_context_save_regs *csave_regs; }; @@ -237,6 +238,7 @@ static void mlxbf2_gpio_irq_enable(struct irq_data *irq= d) unsigned long flags; u32 val; =20 + gpiochip_enable_irq(gc, irqd_to_hwirq(irqd)); raw_spin_lock_irqsave(&gs->gc.bgpio_lock, flags); val =3D readl(gs->gpio_io + YU_GPIO_CAUSE_OR_CLRCAUSE); val |=3D BIT(offset); @@ -261,6 +263,7 @@ static void mlxbf2_gpio_irq_disable(struct irq_data *ir= qd) val &=3D ~BIT(offset); writel(val, gs->gpio_io + YU_GPIO_CAUSE_OR_EVTEN0); raw_spin_unlock_irqrestore(&gs->gc.bgpio_lock, flags); + gpiochip_disable_irq(gc, irqd_to_hwirq(irqd)); } =20 static irqreturn_t mlxbf2_gpio_irq_handler(int irq, void *ptr) @@ -322,6 +325,24 @@ mlxbf2_gpio_irq_set_type(struct irq_data *irqd, unsign= ed int type) return 0; } =20 +static void mlxbf2_gpio_irq_print_chip(struct irq_data *irqd, + struct seq_file *p) +{ + struct gpio_chip *gc =3D irq_data_get_irq_chip_data(irqd); + struct mlxbf2_gpio_context *gs =3D gpiochip_get_data(gc); + + seq_printf(p, dev_name(gs->dev)); +} + +static const struct irq_chip mlxbf2_gpio_irq_chip =3D { + .irq_set_type =3D mlxbf2_gpio_irq_set_type, + .irq_enable =3D mlxbf2_gpio_irq_enable, + .irq_disable =3D mlxbf2_gpio_irq_disable, + .irq_print_chip =3D mlxbf2_gpio_irq_print_chip, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + /* BlueField-2 GPIO driver initialization routine. */ static int mlxbf2_gpio_probe(struct platform_device *pdev) @@ -340,6 +361,8 @@ mlxbf2_gpio_probe(struct platform_device *pdev) if (!gs) return -ENOMEM; =20 + gs->dev =3D dev; + /* YU GPIO block address */ gs->gpio_io =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(gs->gpio_io)) @@ -376,13 +399,8 @@ mlxbf2_gpio_probe(struct platform_device *pdev) =20 irq =3D platform_get_irq(pdev, 0); if (irq >=3D 0) { - gs->irq_chip.name =3D name; - gs->irq_chip.irq_set_type =3D mlxbf2_gpio_irq_set_type; - gs->irq_chip.irq_enable =3D mlxbf2_gpio_irq_enable; - gs->irq_chip.irq_disable =3D mlxbf2_gpio_irq_disable; - girq =3D &gs->gc.irq; - girq->chip =3D &gs->irq_chip; + gpio_irq_chip_set_chip(girq, &mlxbf2_gpio_irq_chip); girq->handler =3D handle_simple_irq; girq->default_type =3D IRQ_TYPE_NONE; /* This will let us handle the parent IRQ in the driver */ --=20 2.34.1 From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22DCBC61DA4 for ; Thu, 9 Mar 2023 07:47:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229914AbjCIHrP (ORCPT ); Thu, 9 Mar 2023 02:47:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229955AbjCIHqj (ORCPT ); Thu, 9 Mar 2023 02:46:39 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1215DF729 for ; Wed, 8 Mar 2023 23:46:09 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id j11so1118071lfg.13 for ; Wed, 08 Mar 2023 23:46:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347969; 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=BE0hN/evTOxc8pxKXkniQeMiy8yek7h1H53mI21BTS8=; b=wJC3zufwPxxsbKw7VfvKKo3TwQtynJvjK4ttQs4bLtNyCksMt/VUnyY2BAbGcZ0wtG Z8D4qs41flPvAArqB5IeScGx0OuJ3Y7b5xrdlVrR8/nx93gcNo2qIhz9ELUvRLrg5G33 SKHUIgTXjHgfbHrlzU0SyIMIcJjeR0/6LJakIm2q2d1xVcsm13ovij7Qr/i7HpJUYDDZ 5/pHCUJA2ejaKXai6/ynckG06C8xwHNzmp0nBIcXKjVMJK1Yl1Jqu49ECcYleQcCO3BM iV4ZI0ur3ifZGcLbEU/77B5APP93JAcyJcKWXx0P+1HMwVuCU8lmquVKY7yB62YJEjmC 0Tcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347969; 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=BE0hN/evTOxc8pxKXkniQeMiy8yek7h1H53mI21BTS8=; b=U20QBcic9MeMtCqtBEzWz4Df8LZHrR/xOGJIC+iao2xv+wrVnk7E46UJJGO6Ia3i3b IcpfF1HW+Tbwt8iTK60U2PzOo71KroD72UxVxEL5TBUWYFAEk1A+6BwK4VHK7RQ3thQ6 0HLy9aaWQlDrlEzjFQgdaNdu2oc+SXVZCfN/B6xhw33HnkoQZkV780mNcHzAFfu2YhLj sopXqGrPimDjL6veXyHzUafJ3s30BkieZiHHFLRa8bReH0szpS6VIo2DCooo7R+GB8FE UKjYLOTOs7G5Uo1TtyO7W8iCWo3ZPlPM8PkwtIXG/Rgo8Y7GHn18FI1EeUIOo+rrx7h/ OdxQ== X-Gm-Message-State: AO0yUKUSSCtStvlDJM68oxW5ihNQTZn9DW1BLqnSfuc2yw2XWLYEEx+c kFaXpRLufoVzZ6CvieijVXenKQ== X-Google-Smtp-Source: AK7set8oIb7klIzQY7BPa8cZvqgfYhhXZT50T/adiRtau3X8Oi4aw7qxIH/e+BQ9EDeRLQ0xkXKhbg== X-Received: by 2002:ac2:50d5:0:b0:4dd:a57e:9960 with SMTP id h21-20020ac250d5000000b004dda57e9960mr5974777lfm.5.1678347969422; Wed, 08 Mar 2023 23:46:09 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:09 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:46:01 +0100 Subject: [PATCH v3 13/17] gpio: max732x: Convert to immutable irq_chip MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-13-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-max732x.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c index 68e982cdee73..7f2fde191755 100644 --- a/drivers/gpio/gpio-max732x.c +++ b/drivers/gpio/gpio-max732x.c @@ -351,6 +351,7 @@ static void max732x_irq_mask(struct irq_data *d) struct max732x_chip *chip =3D gpiochip_get_data(gc); =20 chip->irq_mask_cur &=3D ~(1 << d->hwirq); + gpiochip_disable_irq(gc, irqd_to_hwirq(d)); } =20 static void max732x_irq_unmask(struct irq_data *d) @@ -358,6 +359,7 @@ static void max732x_irq_unmask(struct irq_data *d) struct gpio_chip *gc =3D irq_data_get_irq_chip_data(d); struct max732x_chip *chip =3D gpiochip_get_data(gc); =20 + gpiochip_enable_irq(gc, irqd_to_hwirq(d)); chip->irq_mask_cur |=3D 1 << d->hwirq; } =20 @@ -429,7 +431,7 @@ static int max732x_irq_set_wake(struct irq_data *data, = unsigned int on) return 0; } =20 -static struct irq_chip max732x_irq_chip =3D { +static const struct irq_chip max732x_irq_chip =3D { .name =3D "max732x", .irq_mask =3D max732x_irq_mask, .irq_unmask =3D max732x_irq_unmask, @@ -437,6 +439,8 @@ static struct irq_chip max732x_irq_chip =3D { .irq_bus_sync_unlock =3D max732x_irq_bus_sync_unlock, .irq_set_type =3D max732x_irq_set_type, .irq_set_wake =3D max732x_irq_set_wake, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; =20 static uint8_t max732x_irq_pending(struct max732x_chip *chip) @@ -517,7 +521,7 @@ static int max732x_irq_setup(struct max732x_chip *chip, } =20 girq =3D &chip->gpio_chip.irq; - girq->chip =3D &max732x_irq_chip; + gpio_irq_chip_set_chip(girq, &max732x_irq_chip); /* This will let us handle the parent IRQ in the driver */ girq->parent_handler =3D NULL; girq->num_parents =3D 0; --=20 2.34.1 From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62666C64EC4 for ; Thu, 9 Mar 2023 07:47:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230192AbjCIHrf (ORCPT ); Thu, 9 Mar 2023 02:47:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230050AbjCIHqn (ORCPT ); Thu, 9 Mar 2023 02:46:43 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 456EDDDF17 for ; Wed, 8 Mar 2023 23:46:12 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id j11so1118135lfg.13 for ; Wed, 08 Mar 2023 23:46:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347970; 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=p1r1zyYA9t+QO+JcvGnUo/RuruD1eWdYkbb9TESedm0=; b=Tn0kT9pG+OpUApaG8znHQ+ekGoIVakiLzD95tkVlpHddMSmj9vog6WG1rG3HUDZpgC BuaWUky0NZEFG3ZjPUEXCHe4cjuJR4SB0LLxYr/6BEwlPalYqJ6aOkj73iU3gVyGurYv dgBNUTKW/8M2EvU3Wvmzljdpz+fwneQxO6uQOe1kVLLE7T8m6XX3o8gLdJAbG+wZy4zM JYyqjcm1V+q7sf8tnlK/k2TEUIIRKSJM4OF3CUv3TDMnLRdu342Hsyf6/PmXD1hTlhiV bPOKa03FmOGd6MT+j+We7hC3UCMI3wCQXCQKuU11VOTZ204ZYL8/1oLy8hOm4JNjrCJM m4pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347970; 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=p1r1zyYA9t+QO+JcvGnUo/RuruD1eWdYkbb9TESedm0=; b=qL+iWGnPtHSB3LwK2IvMDkfsMUjx+8IfhkgRPHJO0faQLa9aImACi0i0jfexuJjxAP PXPi1wvxVgB4O4+Yl0/Ecm7gZDC/k9Qv4kJgittXPn2VJPiWEmBC870yOIjJJcDRpmnb shJFDU0ifypqZC9ctXoUBEFwKgBUFxgTZZ0O0tsCPhZXGrC4reb1yyydEzQv9JFYyeuy jotza8MIml1yyDAX8QTpjGg5aZeWOBW7Ca9xVq5jIWXaHFGYjwP+nprc34uC5BJ/O3pr 0LVUm2dIaPONWBhejwIgkJVCV1EV4D2nsHjvSoUd56Ew3pW4rY5joxM/8AohW9zBERm8 sSsw== X-Gm-Message-State: AO0yUKUjPBPyl/aDmCFajnHVux3mTBA64ZDo8OSwo6ONc4vE10TwpM9F cQeBPI6bPEh01MhzBUUN7FFZEg== X-Google-Smtp-Source: AK7set/7z6Z0N4Go3hn+jqpbROoq+slAfzXqziRoxhWDiBhE25au89gRe6ixCefCQGyqKogt0n9jjw== X-Received: by 2002:ac2:54a5:0:b0:4dc:4b92:dbc4 with SMTP id w5-20020ac254a5000000b004dc4b92dbc4mr5293556lfk.14.1678347970521; Wed, 08 Mar 2023 23:46:10 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.46.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:10 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:46:02 +0100 Subject: [PATCH v3 14/17] gpio: omap: Drop irq_base MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-14-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 , Janusz Krzysztofik , Tony Lindgren , Arnd Bergmann , Marc Zyngier X-Mailer: b4 0.12.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The OMAP1 at one point was using static irqs but that time is gone, OMAP1 uses sparse irqs like all other multiplatform targets so this static allocation of descriptors should just go. Cc: Janusz Krzysztofik Cc: Tony Lindgren Acked-by: Arnd Bergmann Acked-by: Marc Zyngier Reviewed-by: Tony Lindgren Signed-off-by: Linus Walleij --- drivers/gpio/gpio-omap.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index f5f3d4b22452..1cbd040cf796 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -992,7 +992,6 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, = struct irq_chip *irqc, struct gpio_irq_chip *irq; static int gpio; const char *label; - int irq_base =3D 0; int ret; =20 /* @@ -1024,19 +1023,6 @@ static int omap_gpio_chip_init(struct gpio_bank *ban= k, struct irq_chip *irqc, } bank->chip.ngpio =3D bank->width; =20 -#ifdef CONFIG_ARCH_OMAP1 - /* - * REVISIT: Once we have OMAP1 supporting SPARSE_IRQ, we can drop - * irq_alloc_descs() since a base IRQ offset will no longer be needed. - */ - irq_base =3D devm_irq_alloc_descs(bank->chip.parent, - -1, 0, bank->width, 0); - if (irq_base < 0) { - dev_err(bank->chip.parent, "Couldn't allocate IRQ numbers\n"); - return -ENODEV; - } -#endif - /* MPUIO is a bit different, reading IRQ status clears it */ if (bank->is_mpuio && !bank->regs->wkup_en) irqc->irq_set_wake =3D NULL; @@ -1047,7 +1033,6 @@ static int omap_gpio_chip_init(struct gpio_bank *bank= , struct irq_chip *irqc, irq->default_type =3D IRQ_TYPE_NONE; irq->num_parents =3D 1; irq->parents =3D &bank->irq; - irq->first =3D irq_base; =20 ret =3D gpiochip_add_data(&bank->chip, bank); if (ret) --=20 2.34.1 From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB6F6C61DA4 for ; Thu, 9 Mar 2023 07:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230294AbjCIHrc (ORCPT ); Thu, 9 Mar 2023 02:47:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbjCIHqn (ORCPT ); Thu, 9 Mar 2023 02:46:43 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3311DDF10 for ; Wed, 8 Mar 2023 23:46:11 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id m6so1161648lfq.5 for ; Wed, 08 Mar 2023 23:46:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347971; 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=vYLgGoAAs4DcH8LZQncbtVAjj3rbStL1HUOVD02/kfE=; b=rJW1pSbwgXGQIlPm5ZBopg7dEA8C3O55AzE5vYaOruYmgvx5z0j4F7H0Lewh/xU3Dd /xeRDYCyohcL0ULLOkqBAsG46h38ZzjlCTW3uMseFqTSg1h4cuygoaeaJL5N27Y+krl9 XwIDv02p5/81Z9aTe/zJ9iT+5T6G7cfeMDThpA/1G2zkZUNgLKvDm/s4yLJehxUn59Y2 zkg9YB16i46HNi0D1AyIlIyZSE9TCV2nAMM74+snebtys9ozxLiRKJ/Wn0yAwXt8WuXg Wb1AXDnYkimrgs3ZMuS/B8e09KuQwmWyxwCQsGqDOjtXrKfgmI/NTlQOVLm6XUXiTC8D bOIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347971; 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=vYLgGoAAs4DcH8LZQncbtVAjj3rbStL1HUOVD02/kfE=; b=NYnRtJVImQwx5m/58Z9aXwLA63qtPSBShj5MNloyMYQd1OL4Phh9JbPcRtRTYqVcSo Y8ktIwihVrXCUjhHnp7Rt7u8HaSibERaR7HijaLEOHxftQ6e63SEa4fwqTdmiq0N/Rma X/Xmr+St5W8mWmugiFXsYUilR93lsRg5LuVUkML7acvdX2FBEgvQ9frYiJ0YuDldwD3S mltuS6U/sw0SwRqNZJkqd7+NgTYhNWK4QoEjXpZZ8xPf9ZmKihHPe2RX+AfzVUth1lEi kB+Gn2GX9A2O8IqrBdgOXAX+DzxUN+x9TAO4PpdVm6y+zWbKrY8d4m+8egK1Ji/d+25M WDDg== X-Gm-Message-State: AO0yUKWfTk6rJFn5RXcIhUrJ+VWB4WwSuWCM62Y4cXErN2/+OAwTe32I bBrlwgQRcdozS/I7xmsNyc83Dw== X-Google-Smtp-Source: AK7set+OwrelDKOTCHQ5D4UzvKLaGoQSyvbZB2fwQemO/aBw4V37VR9FeZ0MmSn2ufVp+AZCP6MVTQ== X-Received: by 2002:ac2:5a4c:0:b0:4dc:7ff4:83f9 with SMTP id r12-20020ac25a4c000000b004dc7ff483f9mr6093156lfn.16.1678347971558; Wed, 08 Mar 2023 23:46:11 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.46.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:11 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:46:03 +0100 Subject: [PATCH v3 15/17] gpio: omap: Convert to immutable irq_chip MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-15-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 , Tony Lindgren X-Mailer: b4 0.12.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. This driver require some special care: .irq_ack() was copied from dummy_irq_chip where it was defined as noop. This only makes sense if using handle_edge_irq() that will unconditionally call .irq_ack() to avoid a crash, but this driver is not ever using handle_edge_irq() so just avoid assigning .irq_ack(). A separate chip had to be created for the non-wakeup instance. Cc: Marc Zyngier Reviewed-by: Tony Lindgren Tested-by: Tony Lindgren Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-omap.c | 68 ++++++++++++++++++++++++++++++++------------= ---- 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 1cbd040cf796..a08be5bf6808 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -47,6 +48,7 @@ struct gpio_regs { struct gpio_bank { void __iomem *base; const struct omap_gpio_reg_offs *regs; + struct device *dev; =20 int irq; u32 non_wakeup_gpios; @@ -681,6 +683,7 @@ static void omap_gpio_mask_irq(struct irq_data *d) omap_set_gpio_triggering(bank, offset, IRQ_TYPE_NONE); omap_set_gpio_irqenable(bank, offset, 0); raw_spin_unlock_irqrestore(&bank->lock, flags); + gpiochip_disable_irq(&bank->chip, offset); } =20 static void omap_gpio_unmask_irq(struct irq_data *d) @@ -690,6 +693,7 @@ static void omap_gpio_unmask_irq(struct irq_data *d) u32 trigger =3D irqd_get_trigger_type(d); unsigned long flags; =20 + gpiochip_enable_irq(&bank->chip, offset); raw_spin_lock_irqsave(&bank->lock, flags); omap_set_gpio_irqenable(bank, offset, 1); =20 @@ -708,6 +712,40 @@ static void omap_gpio_unmask_irq(struct irq_data *d) raw_spin_unlock_irqrestore(&bank->lock, flags); } =20 +static void omap_gpio_irq_print_chip(struct irq_data *d, struct seq_file *= p) +{ + struct gpio_bank *bank =3D omap_irq_data_get_bank(d); + + seq_printf(p, dev_name(bank->dev)); +} + +static const struct irq_chip omap_gpio_irq_chip =3D { + .irq_startup =3D omap_gpio_irq_startup, + .irq_shutdown =3D omap_gpio_irq_shutdown, + .irq_mask =3D omap_gpio_mask_irq, + .irq_unmask =3D omap_gpio_unmask_irq, + .irq_set_type =3D omap_gpio_irq_type, + .irq_set_wake =3D omap_gpio_wake_enable, + .irq_bus_lock =3D omap_gpio_irq_bus_lock, + .irq_bus_sync_unlock =3D gpio_irq_bus_sync_unlock, + .irq_print_chip =3D omap_gpio_irq_print_chip, + .flags =3D IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + +static const struct irq_chip omap_gpio_irq_chip_nowake =3D { + .irq_startup =3D omap_gpio_irq_startup, + .irq_shutdown =3D omap_gpio_irq_shutdown, + .irq_mask =3D omap_gpio_mask_irq, + .irq_unmask =3D omap_gpio_unmask_irq, + .irq_set_type =3D omap_gpio_irq_type, + .irq_bus_lock =3D omap_gpio_irq_bus_lock, + .irq_bus_sync_unlock =3D gpio_irq_bus_sync_unlock, + .irq_print_chip =3D omap_gpio_irq_print_chip, + .flags =3D IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + /*---------------------------------------------------------------------*/ =20 static int omap_mpuio_suspend_noirq(struct device *dev) @@ -986,8 +1024,7 @@ static void omap_gpio_mod_init(struct gpio_bank *bank) writel_relaxed(0, base + bank->regs->ctrl); } =20 -static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *ir= qc, - struct device *pm_dev) +static int omap_gpio_chip_init(struct gpio_bank *bank, struct device *pm_d= ev) { struct gpio_irq_chip *irq; static int gpio; @@ -1023,12 +1060,12 @@ static int omap_gpio_chip_init(struct gpio_bank *ba= nk, struct irq_chip *irqc, } bank->chip.ngpio =3D bank->width; =20 + irq =3D &bank->chip.irq; /* MPUIO is a bit different, reading IRQ status clears it */ if (bank->is_mpuio && !bank->regs->wkup_en) - irqc->irq_set_wake =3D NULL; - - irq =3D &bank->chip.irq; - irq->chip =3D irqc; + gpio_irq_chip_set_chip(irq, &omap_gpio_irq_chip_nowake); + else + gpio_irq_chip_set_chip(irq, &omap_gpio_irq_chip); irq->handler =3D handle_bad_irq; irq->default_type =3D IRQ_TYPE_NONE; irq->num_parents =3D 1; @@ -1361,7 +1398,6 @@ static int omap_gpio_probe(struct platform_device *pd= ev) struct device_node *node =3D dev->of_node; const struct omap_gpio_platform_data *pdata; struct gpio_bank *bank; - struct irq_chip *irqc; int ret; =20 pdata =3D device_get_match_data(dev); @@ -1374,21 +1410,7 @@ static int omap_gpio_probe(struct platform_device *p= dev) if (!bank) return -ENOMEM; =20 - irqc =3D devm_kzalloc(dev, sizeof(*irqc), GFP_KERNEL); - if (!irqc) - return -ENOMEM; - - irqc->irq_startup =3D omap_gpio_irq_startup, - irqc->irq_shutdown =3D omap_gpio_irq_shutdown, - irqc->irq_ack =3D dummy_irq_chip.irq_ack, - irqc->irq_mask =3D omap_gpio_mask_irq, - irqc->irq_unmask =3D omap_gpio_unmask_irq, - irqc->irq_set_type =3D omap_gpio_irq_type, - irqc->irq_set_wake =3D omap_gpio_wake_enable, - irqc->irq_bus_lock =3D omap_gpio_irq_bus_lock, - irqc->irq_bus_sync_unlock =3D gpio_irq_bus_sync_unlock, - irqc->name =3D dev_name(&pdev->dev); - irqc->flags =3D IRQCHIP_MASK_ON_SUSPEND; + bank->dev =3D dev; =20 bank->irq =3D platform_get_irq(pdev, 0); if (bank->irq <=3D 0) { @@ -1452,7 +1474,7 @@ static int omap_gpio_probe(struct platform_device *pd= ev) =20 omap_gpio_mod_init(bank); =20 - ret =3D omap_gpio_chip_init(bank, irqc, dev); + ret =3D omap_gpio_chip_init(bank, dev); if (ret) { pm_runtime_put_sync(dev); pm_runtime_disable(dev); --=20 2.34.1 From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18C05C64EC4 for ; Thu, 9 Mar 2023 07:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230310AbjCIHrl (ORCPT ); Thu, 9 Mar 2023 02:47:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230303AbjCIHqo (ORCPT ); Thu, 9 Mar 2023 02:46:44 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35BDADDF2C for ; Wed, 8 Mar 2023 23:46:13 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id bi9so1174374lfb.2 for ; Wed, 08 Mar 2023 23:46:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347972; 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=EBLzNrziBJousn1yobeY2nHyRl+4RLWPBMZMMzuQhho=; b=bWmtMKb6fEUF/NZ6LH5RuXerUIViljmwR4bhAP4X3ybB1hO77AJtkWOPfPKgUmh/jW TmF5VNEgVV1l9zxS2yaBM0mmE1P8UQMBVY06NqrmxcGTY2KexUr8WXnpjvApNqP0XgwS xFDF/9ZXGlZWKSQproLVORlPhMr+pLQOhS6ifVO12cldkZJk2Kkl5fM2G7G0BomE5684 hMVjRCrFdG0EXD8hhzDA6Ppf/gHui37ivuZ/rMpnpbkI447fZlG798+d+wZkcNuKUBkP ppUhPHLOOMIwamflqyJtuoMxXx+FJiaP+JGvKBF9r/jQnXxqls2IIuFdVMDMOeePY5T2 IbXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347972; 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=EBLzNrziBJousn1yobeY2nHyRl+4RLWPBMZMMzuQhho=; b=6jhl941DDiXQnDGf/S2puQnKhRyDBzUovF1A2cSq+WVlmiy4Ne3ii+GYZpIODq46r3 HRgIUn+mFui4YUHkF9v2bSB4n2LRGOmKXOJ3e9HUjW1VQYK/JH2t7s7nVl5GICYqj3hd 1frVD59Oy7gXOtyBWh4lI6OEtmqgjMOUsO2+8zP7FEbW1x0bsPmr0WIDbRvgiBW+LnrJ joT2crakJWZBYKC5flan4SUeo8EEIFZ5Jqv6lzBn+20PasITCohfgmkk0NR0AS1Vq4Lb y+y8JeEEE7WLM0thHaxCP65U5na8I1iDWbhgJ3LTUvol8reYbXjvNWaEu2qULgeEzIsv YJ2w== X-Gm-Message-State: AO0yUKXI9AmgNHf4KhilqJMYAU7s3vHsZWI5e6+OFshok9sxJpBdRmoN hVuwfjX8eov7O8IcTye+TqTvCQ== X-Google-Smtp-Source: AK7set9olKiBOTVrFht+9xflh5zhHRdfaQm4sTKxC2vdSTyE8Hr2EklbTYRVmpul0pWlgnCeBjc9Zg== X-Received: by 2002:ac2:538c:0:b0:4d7:44c9:9f4c with SMTP id g12-20020ac2538c000000b004d744c99f4cmr5198184lfh.4.1678347972678; Wed, 08 Mar 2023 23:46:12 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.46.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:12 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:46:04 +0100 Subject: [PATCH v3 16/17] gpio: pci-idio-16: Convert to immutable irq_chip MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-16-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Acked-by: William Breathitt Gray Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-pci-idio-16.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-pci-idio-16.c b/drivers/gpio/gpio-pci-idio-1= 6.c index a86ce748384b..6726c32e31e6 100644 --- a/drivers/gpio/gpio-pci-idio-16.c +++ b/drivers/gpio/gpio-pci-idio-16.c @@ -107,6 +107,8 @@ static void idio_16_irq_mask(struct irq_data *data) =20 raw_spin_unlock_irqrestore(&idio16gpio->lock, flags); } + + gpiochip_disable_irq(chip, irqd_to_hwirq(data)); } =20 static void idio_16_irq_unmask(struct irq_data *data) @@ -117,6 +119,8 @@ static void idio_16_irq_unmask(struct irq_data *data) const unsigned long prev_irq_mask =3D idio16gpio->irq_mask; unsigned long flags; =20 + gpiochip_enable_irq(chip, irqd_to_hwirq(data)); + idio16gpio->irq_mask |=3D mask; =20 if (!prev_irq_mask) { @@ -138,12 +142,14 @@ static int idio_16_irq_set_type(struct irq_data *data= , unsigned int flow_type) return 0; } =20 -static struct irq_chip idio_16_irqchip =3D { +static const struct irq_chip idio_16_irqchip =3D { .name =3D "pci-idio-16", .irq_ack =3D idio_16_irq_ack, .irq_mask =3D idio_16_irq_mask, .irq_unmask =3D idio_16_irq_unmask, - .irq_set_type =3D idio_16_irq_set_type + .irq_set_type =3D idio_16_irq_set_type, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; =20 static irqreturn_t idio_16_irq_handler(int irq, void *dev_id) @@ -242,7 +248,7 @@ static int idio_16_probe(struct pci_dev *pdev, const st= ruct pci_device_id *id) idio_16_state_init(&idio16gpio->state); =20 girq =3D &idio16gpio->chip.irq; - girq->chip =3D &idio_16_irqchip; + gpio_irq_chip_set_chip(girq, &idio_16_irqchip); /* This will let us handle the parent IRQ in the driver */ girq->parent_handler =3D NULL; girq->num_parents =3D 0; --=20 2.34.1 From nobody Thu Sep 11 20:21:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10033C61DA4 for ; Thu, 9 Mar 2023 07:47:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230131AbjCIHrr (ORCPT ); Thu, 9 Mar 2023 02:47:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229817AbjCIHqu (ORCPT ); Thu, 9 Mar 2023 02:46:50 -0500 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B942DDF22 for ; Wed, 8 Mar 2023 23:46:15 -0800 (PST) Received: by mail-lj1-x229.google.com with SMTP id h9so930910ljq.2 for ; Wed, 08 Mar 2023 23:46:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347974; 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=/ycp1fOFRcqnvrXtuAswlNcdj2NkXI8qjDu7ztULp4g=; b=hfYUvbEJ/fIs0adm48Nn43F1+/5O7YPhYpEpE/GRRX2ZWZh6Gq+yCigTRjTLV/SkXN EpZ/VQupisd3fsrS7/H/gCFUoMeX5JGZkvaZ7xtzK4gRVZZ2UmkBx9v5BfV5eY5PQy3b sePtBA87IWZ8Ux7FBFpZ3wTFqe67boz1z867/kDMzJfoX82TaPRyMaelqKdFTikiOM8f rvPfgXQXjKPcVm9VeRxRb7H+zXL989U9EAzlfR2uqXTYXvu98NBxaLBdDuUmo7+Pilld 0o3IRXZp5dLbQpnnOVuSp/qIX+2Ys07bLCdGkAgj0vbmtMvdKNe58z8YxfFQTFgwozP1 Nw5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347974; 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=/ycp1fOFRcqnvrXtuAswlNcdj2NkXI8qjDu7ztULp4g=; b=JolLYm9vkLJ/jA6872E+KXRihJtjGUP+4u91qA6ijXSJLBGqKSApNyGXViWdXBUvnN NswX7j95dKRU5sW85qymS1oHrI3dfyXdo7ZrB4V73BE7tFZyMeuBZTZZBkydtm1fBskm /k5HathP/hkmRtbBY8J19P3MZSL7YjVdyi38n2FcSFvVRj9W2nYsmZGjiHSyvBr7qLt1 RScZypur131BaQJ/acEGDHaGfAgTCNkDfOrZwdan7+KSTuOwEMEH3VKsLwfYPYKD/X6B ZGHmMTV9fymx7KGuM2cKbYcGi6E9SLKXtvlebw87DxHPkI7szIprWx4XejTsSPuSRhS+ kmfw== X-Gm-Message-State: AO0yUKUEYQjqyHodpmI1VuCDfsG0NM2kWFaBYMG3iE+YcVI5QZcEl4C7 +5eUx/W7riebVNdwDPVuQPztfQ== X-Google-Smtp-Source: AK7set+Rry5lPtiW93AZhDxq/Tyl/szlfsTGucmnPsQNNXqvYn6WiEk2+814+u0pUuLqnBF+Evuqnw== X-Received: by 2002:a05:651c:88:b0:293:3dd6:89a4 with SMTP id 8-20020a05651c008800b002933dd689a4mr6194273ljq.34.1678347973846; Wed, 08 Mar 2023 23:46:13 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.46.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:13 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:46:05 +0100 Subject: [PATCH v3 17/17] gpio: pcie-idio-24: Convert to immutable irq_chip MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230215-immutable-chips-v3-17-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 , 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Acked-by: William Breathitt Gray Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-pcie-idio-24.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-pcie-idio-24.c b/drivers/gpio/gpio-pcie-idio= -24.c index 8a9b98fa418f..ac42150f4009 100644 --- a/drivers/gpio/gpio-pcie-idio-24.c +++ b/drivers/gpio/gpio-pcie-idio-24.c @@ -396,6 +396,8 @@ static void idio_24_irq_mask(struct irq_data *data) } =20 raw_spin_unlock_irqrestore(&idio24gpio->lock, flags); + + gpiochip_disable_irq(chip, irqd_to_hwirq(data)); } =20 static void idio_24_irq_unmask(struct irq_data *data) @@ -408,6 +410,8 @@ static void idio_24_irq_unmask(struct irq_data *data) const unsigned long bank_offset =3D bit_offset / 8; unsigned char cos_enable_state; =20 + gpiochip_enable_irq(chip, irqd_to_hwirq(data)); + raw_spin_lock_irqsave(&idio24gpio->lock, flags); =20 prev_irq_mask =3D idio24gpio->irq_mask >> bank_offset * 8; @@ -437,12 +441,14 @@ static int idio_24_irq_set_type(struct irq_data *data= , unsigned int flow_type) return 0; } =20 -static struct irq_chip idio_24_irqchip =3D { +static const struct irq_chip idio_24_irqchip =3D { .name =3D "pcie-idio-24", .irq_ack =3D idio_24_irq_ack, .irq_mask =3D idio_24_irq_mask, .irq_unmask =3D idio_24_irq_unmask, - .irq_set_type =3D idio_24_irq_set_type + .irq_set_type =3D idio_24_irq_set_type, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; =20 static irqreturn_t idio_24_irq_handler(int irq, void *dev_id) @@ -535,7 +541,7 @@ static int idio_24_probe(struct pci_dev *pdev, const st= ruct pci_device_id *id) idio24gpio->chip.set_multiple =3D idio_24_gpio_set_multiple; =20 girq =3D &idio24gpio->chip.irq; - girq->chip =3D &idio_24_irqchip; + gpio_irq_chip_set_chip(girq, &idio_24_irqchip); /* This will let us handle the parent IRQ in the driver */ girq->parent_handler =3D NULL; girq->num_parents =3D 0; --=20 2.34.1