From nobody Sat Apr 11 14:29:33 2026 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 4264EC6FD1B for ; Tue, 7 Mar 2023 13:05:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230295AbjCGNFq (ORCPT ); Tue, 7 Mar 2023 08:05:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230012AbjCGNF0 (ORCPT ); Tue, 7 Mar 2023 08:05:26 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2F9EE0 for ; Tue, 7 Mar 2023 05:04:56 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id k14so16963290lfj.7 for ; Tue, 07 Mar 2023 05:04:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194286; 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=ivIOKdjXJOAGhCprjPgOdvonPXMyFzqBR0VHl+PrzMbdmTRzJIvMQr3bkAKB8TUTt6 VJkVZq/cX3c6mxFLVPYwZAbo9fHd4WpwZzvU/jNVSjyBXMIhIPbqSgXfzP7vMc0r3IR0 Wze9ZWsbA0eXNu8gx6u40bSLeg5OM8NxSflVtn2+EDdVG/3Wunq+WQjvhK9CH/ut8iLl DLShDAZeZ1gnYiYq/GR88Ag/QBSlaM7NT/KJyuCN6pY2cnBGW5+eHQuoRzhxX0DOuR2F G/FF/Mhd6tyK9fPpwgYzbzj6MdPtz4hrae/mLZ4JX1+vbjzHzVUoiz/mT6tFPlV/3/CK s6Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194286; 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=ry65MwBIDuTTYDYR2/na0t47sds3UFOUFvclq5ILJSL9SMTH2Mw6BNK9zwUgb776od ruKnzgfr/v/3w8rWVCX5SoLwohkQip08qgKeH7DogdGR9uHC3NpnMRZI7MiAMA4CZ9Xi NtrIt+DL+pvMqqV44Q5gDas5LTn6A9CygjSCIEnHtc8qMUQ0roOTUmUIgUUpdBZJ6sKk 5wSACMOEsn3ncOdPVZnxyJBAYnbTU0Lr8GAS26ecy9xnv8XNRyACTQWl9lDFxBvba50A 9ts/Kk0AByrnE53rNQRb655bxgrOQrOtc8dZahD9Kd7abXWWxyHUPP2jT/+HT/+UU9Fj HHiQ== X-Gm-Message-State: AO0yUKX29270X77TdR5BAQbQbb0LKrs87hBcdueRig3olGNr8gUkpUIT v6I05LDKuvEov7amBtwie8mQkg== X-Google-Smtp-Source: AK7set8VxHEGYGpsZW0/selFSXoV2TQysp2TeyhwgH4Mz1Y9cEa/yyGjc+FFad13OmFBaxNGKoDrUw== X-Received: by 2002:ac2:5504:0:b0:4e1:d90:e754 with SMTP id j4-20020ac25504000000b004e10d90e754mr4113951lfk.7.1678194286233; Tue, 07 Mar 2023 05:04:46 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:45 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:43 +0100 Subject: [PATCH v2 01/16] 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-v2-1-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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 Sat Apr 11 14:29:33 2026 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 AA89DC678D4 for ; Tue, 7 Mar 2023 13:05:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230228AbjCGNFl (ORCPT ); Tue, 7 Mar 2023 08:05:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbjCGNF0 (ORCPT ); Tue, 7 Mar 2023 08:05:26 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D870193CD for ; Tue, 7 Mar 2023 05:04:57 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id n2so16923657lfb.12 for ; Tue, 07 Mar 2023 05:04:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194287; 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=JyrVtTmOCBIoOhyPdDdC18qctC1k7zocllhJ3F82qo4ju64IjASdsxHZ5LbSWxWdSp qVV8eZeaHm2+CzX6q/TqnSUbEV2PVAl5SPusA3wxaKCHCWuyAttPKXJ0x/OP1149kTxr tVYNUtMZrWK1zPFfefu7Er/bh5FEqV4Lj4prZaTVXMMt9Zjo05BF82u0KmHuold1L+7V fck0z0YSuJE1bKOiEm1jdwbd12qrmPoU30BMUs1D/LnnLypE3gF5ZcwyA/sblnsKXhgw LWP10pUJnyFXYuJNc9KUnuT7JI3l58FhKby2F/7bUkUJwtHissEnY1oATIKvFccvsb0W bIVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194287; 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=ik3q1oN/VoCcvMAb022eFO3Ibe4unpnzz5lKTYc/eh5uGpAuS24WBZn14vrROp2VFb OLEICzm3E+Bgeyu3I+Z8KqBazYnnPrx6gFY2xt7GZyIe5MSMhpEwG4h+CurbAo2QBx1K 6BdY9EOkPZCSbN+4t6/Ig4D9uvvyhYuLtBLxydschugwQqQb7tBtIC+dMuyhHog59Pj5 RTSDMC9/+mPnjBTq4+e6vOZbvRfGfhBEAIMi/iGWTlIP97iOWpkLfoxvI94E7gYlEW6i xkFerzv9RfIvr9275EsZUElOOSfuANI97m7Eo/Y0WYE7hZ5kLqnaEp9BQdfeG2/SuB0S zl3w== X-Gm-Message-State: AO0yUKUawcN0s5Lu7tiw9SeC8sMt/E/iUN3G2Lwou+B6nREzdFVOFaus pEkD8bMnEuvIOkgCSgFU5+Djnw== X-Google-Smtp-Source: AK7set8ZBJPsO7wOSF+lK/f+NWLqzFtFZ2FzVIw604jMt6Euc+RP3smHoaHmTDJGMz9+VxRsPQSfyg== X-Received: by 2002:ac2:483a:0:b0:4df:51a7:a92 with SMTP id 26-20020ac2483a000000b004df51a70a92mr3942917lft.11.1678194287438; Tue, 07 Mar 2023 05:04:47 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:47 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:44 +0100 Subject: [PATCH v2 02/16] 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-v2-2-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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 Sat Apr 11 14:29:33 2026 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 75A91C678D4 for ; Tue, 7 Mar 2023 13:05:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230332AbjCGNFw (ORCPT ); Tue, 7 Mar 2023 08:05:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230143AbjCGNFb (ORCPT ); Tue, 7 Mar 2023 08:05:31 -0500 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C0E37B481 for ; Tue, 7 Mar 2023 05:05:00 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id r27so16941576lfe.10 for ; Tue, 07 Mar 2023 05:05:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194288; 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=b0p5EbpuJP6hwcjXoMYtiND4JppiiLVgXD+CFpX3rE4=; b=xFEOAYGuIoPsxPVhSwnYu52ahL7geiD4JVsX78tkiKB0nDxX66O85TkmquqlMnV3Cf KFT9X4bqt5tlWpqJAvS5nYwxT8BHqoEvAJLGm07IPzLBcFnoUfUsxg2mF5Bh7UxTpmcY br0YeIBO98Hp3nNOFbKpVqEqKRqnlIFsR0xn2ggRhWM1OOw0tzyYYawGXjt8jdbc8tP9 EJZOC7XmbmHahw2Q/qcEC1YKAtlX49HY9TO16gaaJt6v1uDqU55HClT+gx6G5+/3mLaQ Kb94zbPBynfFJXDzuqWS4ulOsWjA61IsdxelOB/Cc8MSGiAMkj8fP5wzey3fV3vui+RG 1pkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194288; 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=b0p5EbpuJP6hwcjXoMYtiND4JppiiLVgXD+CFpX3rE4=; b=rrRi9kGUhBHOVG3MLLPJH2eNxD3Pw3EsQg6Uq13TAhGgg1tdhUYoQfiW9KXUsk4Gup doBnV8Q4wG/XFvHELnJWqkv0iizb8fyc62Rg1em9qKBmgPuoD9jJNBKgOUzydLHzIiAi /4tpxpXqfFNetwFCdmewoqP0UuXbeHujGrE70oOLs/mhrAxl2wOoKfj8qz+N98NJsqs7 HjyRppzi8pAxVlI0Wr/YqOcWE/JmE4HZkmchg9LWOv/Y8hEeoJq2dJ/WKY3xEfP8+kMN u2GBfEPNIbsgO9Bz/Ivwr9+WaD1L/C9w7kdnk0BhhmNvSbvJoSclMq4i5zECliV0oSyP Ki6g== X-Gm-Message-State: AO0yUKV1+xrN+f2YD5iC0/gVQe6uMnL3geiPJb2pZxiFIu/gHjE9bv2x Qun8NTuWdnrtyi1fHatv9FUVag== X-Google-Smtp-Source: AK7set80tiqRps6GnP0ry1iYfsh+Gyc80TWyuQ9ZZB6e138GElBWWZ9wf8irKeXrZucKvQPf+SK3Lw== X-Received: by 2002:ac2:551d:0:b0:4dd:9a38:fcc with SMTP id j29-20020ac2551d000000b004dd9a380fccmr3973440lfk.63.1678194288471; Tue, 07 Mar 2023 05:04:48 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:48 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:45 +0100 Subject: [PATCH v2 03/16] 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-v2-3-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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 --- drivers/gpio/gpio-aspeed.c | 44 ++++++++++++++++++++++++++++++++++++++----= -- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index a94da80d3a95..9c4852de2733 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: @@ -1149,6 +1182,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,9 @@ static int __init aspeed_gpio_probe(struct platform_= device *pdev) =20 gpio->irq =3D rc; girq =3D &gpio->chip.irq; - girq->chip =3D &gpio->irqc; + gpio_irq_chip_set_chip(girq, &aspeed_gpio_irq_chip); 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, --=20 2.34.1 From nobody Sat Apr 11 14:29:33 2026 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 4C2F5C678D5 for ; Tue, 7 Mar 2023 13:06:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230369AbjCGNGG (ORCPT ); Tue, 7 Mar 2023 08:06:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230172AbjCGNFg (ORCPT ); Tue, 7 Mar 2023 08:05:36 -0500 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8BAD25BBC for ; Tue, 7 Mar 2023 05:05:03 -0800 (PST) Received: by mail-lj1-x235.google.com with SMTP id b10so13123481ljr.0 for ; Tue, 07 Mar 2023 05:05:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194289; 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=LaGKvhnOuEdjQlskLsAk3XTkexGofp5EYb2xlFvIN7HrICTe8agB7umlUaSpjQtRGb mATWkUpjInHrxhvx98qMCuSYPZFcPI+TjrZdC0rnVMh9Um0xmPLCPNk3dwIys+irE8BX PfTyCTn2IPe9tuiyPRC2j//RWo67afoXMKrhi3fgqY+fPYX8z3B1OqJEvSdfGBsr5H/I l9HEpeWtmW0OHCe05sHzT3w0AyTgM51/RbaEC0MZVZN5JJ56B3/+9gVQ78gskQIM4hMi 5sxsXjqvrxy2K/nY4JInBGHzBp+OmjQ/TP7zw27rRqtRqKhffAX2atnU6MygylR5fnlj UD9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194289; 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=TotUwAO6Nu0/MT5cGyAlKx8nC/o6i/HwOiIrkrczLM3YFvmfdEoDGtbBwWc1M6IItF qBloAh+2KyGb3HI2TLEOGr+6PZAQfXsR0EKXVz8qkf1uo14FCbBJGt60Wa+ktSoSl8Bp kRgShMeL0i40MusoPISbzzqe96BgqCI0IFcnEYEStGqtZNTj9sGG8/abOLJdQhXN6FlM MDHaOdf0CMLJ7y2q4srhXlsbmKQGxa0y1RXFr7KeSyWUSgjh5GMFOik6v6XRFdrOmTtY 6iK+jwNAd9bFREguK99bHe3xONkn4JDN1nIfO26jqW3UTYo7RwHrG6sa0gMqmR8PSz3u vyRQ== X-Gm-Message-State: AO0yUKUgMQ1EBiA/DD9cjyNHxIDHqTOT3kssVG780dzYaSRfNaL09tBO IgJmaUP7uqLQ1Zr2BAQOE1QbCA== X-Google-Smtp-Source: AK7set91P59ZVpgeiHIrGZ/D7uM9gIerZi/78626uHZzkgh5XEVGvwp3vnbYmPvDHtoflFY+Jfnbww== X-Received: by 2002:a2e:8085:0:b0:295:a32b:92ed with SMTP id i5-20020a2e8085000000b00295a32b92edmr4144886ljg.48.1678194289545; Tue, 07 Mar 2023 05:04:49 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:49 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:46 +0100 Subject: [PATCH v2 04/16] 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-v2-4-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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 Sat Apr 11 14:29:33 2026 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 7BFE5C678D5 for ; Tue, 7 Mar 2023 13:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230347AbjCGNFz (ORCPT ); Tue, 7 Mar 2023 08:05:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229887AbjCGNFb (ORCPT ); Tue, 7 Mar 2023 08:05:31 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BB85BDD3 for ; Tue, 7 Mar 2023 05:05:04 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id bi9so17001978lfb.2 for ; Tue, 07 Mar 2023 05:05:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194290; 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=QXsMqYlKGC8BIFrpVBwoMJw3jitiZ7aT6M1ELBa0ist/N1XoxIZooLBDUNVrnzAbmI yoXGbnY4TSmgf7jXGuGWkHGSWiFEoZeK9OgM+GuB3nUBU5Ke2z7KpZ3l9kUew9rHrG0T ol3sQvqoMY69wVHCoaCRgnJEegNl1rfkzA3Z5O+Rt9DKDg7otFNmc1o5JfFzrjGu6q0M D4p3rjfwpy1JfLOnf7q2X8U382eYyVR2/3/VsmU20rB8GUKl2jXuqGEf/lzImnl3K4fb 55e+VC3ry3ANQT3FMYt24J9jaXKivzjNPkSdFSrMaCq2O8ubTy47vf8VvC9W30vfVpQs w2Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194290; 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=aBSeqsxs9vMKLVZIQrIyPbCjmagEqEooDEI4lDl2Xumq4Mh+QinJDLIg5Q3dqsxsdV GC+64pOH28fmxqm0GQR7stcOgMbgm+LibpwBebNHD3MTLJzQ42xbaSh0KR48stnx5S4M k/4klTQ4qgaZHO2/DvZvwB7PtRnjT+qeE1SfrCf8vBQFp68Hj8zyuUUMbS+fKxp5peaM 4HDkW6qx9phrDVGjx/Vlj9wi2gjIJE4HKvOg2X0MfRoE4a7wqzyDpKS9fRiqR3eROJ9s WEHov+SUNL87l/6uD1wazF3xtqfIAIWy+AF5+jP3yCOa6fif/svfszY6WT81Qt4+Ugya BK9g== X-Gm-Message-State: AO0yUKUIPY6Cah7hxRKc2LxOsKgzWDhNn3El9IFB64lTEnN9U8OTwMVz L4Wfmgvy4Kbwyqijzt7V1J9yIQ== X-Google-Smtp-Source: AK7set/0PjNNMhMg48I9ruK+nxErAAJX2QK/D8hZmLrkYx7SI2vEk66DRWyhtM1nOMOYCHefMnN4Lw== X-Received: by 2002:a19:c208:0:b0:4df:9ce8:300 with SMTP id l8-20020a19c208000000b004df9ce80300mr3966975lfc.52.1678194290600; Tue, 07 Mar 2023 05:04:50 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:50 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:47 +0100 Subject: [PATCH v2 05/16] 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-v2-5-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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 Sat Apr 11 14:29:33 2026 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 7034EC6FA99 for ; Tue, 7 Mar 2023 13:06:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230354AbjCGNF7 (ORCPT ); Tue, 7 Mar 2023 08:05:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230171AbjCGNFg (ORCPT ); Tue, 7 Mar 2023 08:05:36 -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 66EFE4FF04 for ; Tue, 7 Mar 2023 05:05:05 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id r27so16941816lfe.10 for ; Tue, 07 Mar 2023 05:05:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194291; 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=FOsLAFR4aJaT6cegudEG+nQzhg/px9P0RBR3m2KqmJXANgyhdZkOgw0Oqs/2NwomjO cNp7npQYIZ+zBcHN1RcsOqNPaVgcLdlTzLmwbqXXbqyAa6DWI8nttbGR7YVg52zyxiR8 QffXvLy84zDBN8oWts17U5XpHOEecbe58+/BwLQ4VQrLqhk6whlyMPWoOYE4iA63xJ+j 4wJ+sxiQhb3y2ftp6oQrPLYWIJ4Cbk97ymR5SrP+I1yi/Jf4gNaYHRxRtJ+R4gpuOI/F /Zdq9EgQ+4blVaLXq6zhOfo0Nkyxh1Hprys2CEK6+yjk/dZCdyWL79gAm8XIOJ+ew0Dx xepA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194291; 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=1tuXsX3lJ8yEyK6Kr2SqBw/50/C4et7zc2R/Q7pWjXECvmO8eeyPXVT8+m3X7X29De AGJz1/0bBsXoEDNk745LHgctzW2fkg3utexb3zKfMPDJdhFgMcxq2U7kWY8T09YGwsB2 WDuCfHvPYTY2LUUVu9bZWfxRlPvjBF18Se8vNYJPrb4/1JDj8E7Im26tgoQK0o9GaDug 5+gTgdfqOXWgFsUHnJfLoeUe0zqsGLu/STAumCniksYDAJNSIvt4lAIWpnQ1KP75WEOl kjQNlkKsbX7hNPVPVE9KHvSB94x/3ewdRPeBlodIwdsD94iOHijchZV7YspJH8taoXwb E/Pw== X-Gm-Message-State: AO0yUKWCYqEEv6GyKO4QppoLCBRem4YlHCeUZYkknMEvm1Spke5m/nBp UTzCQSC5uSO6zxb3iOSJ4LLWyg== X-Google-Smtp-Source: AK7set+G1fG9oVwtlrbXsTuC1Xj1dVb/epzn2WdT/mLhlI1kqvrL2HGEs2SVGZUSSYmXicyy5x+ljw== X-Received: by 2002:a05:6512:10c2:b0:4d8:86c1:4772 with SMTP id k2-20020a05651210c200b004d886c14772mr4298774lfg.7.1678194291670; Tue, 07 Mar 2023 05:04:51 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:51 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:48 +0100 Subject: [PATCH v2 06/16] 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-v2-6-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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 Sat Apr 11 14:29:33 2026 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 6F0DCC678D4 for ; Tue, 7 Mar 2023 13:06:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230362AbjCGNGC (ORCPT ); Tue, 7 Mar 2023 08:06:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230178AbjCGNFh (ORCPT ); Tue, 7 Mar 2023 08:05:37 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEDA0222D6 for ; Tue, 7 Mar 2023 05:05:06 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id g17so16984413lfv.4 for ; Tue, 07 Mar 2023 05:05:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194292; 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=MTRyrWkS7GsWcEkunnMBjIRdfCenrGT6pejPsQpaMjny1E9LxOLhNuYcmE63XcretE q32JKPriAzgizybVT2MdxJB81iYgmxx9BDGvO5sThBiHenSJ7TSi/mcCS7HV45kNSB+o nFuYaRyNuTrLB/gDQWIzcHqjGHC4nG+KIehAX49XQhAmP6StJuWO/emG5x7MtfyOBx9l GaidXtEecvBXnaThlgDQYyk6Tii4rSQ5+FWEGPJMgf0tXP/G8OvA1Q4Owy9fxFZtgjTS Z73ZjNA+ds7dyP6GQI9sn+6ttAPoCeqV+GNke2NCiS00Xz8TQ5J4gx5NG89RyXvxS8in LnRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194292; 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=Tm1KTLmu7W0mKUf2aN1iOyPOYg+n4a/XDv0SAnrqI8JDvqjXNjyIMBGGRydck8poi6 ViuM1/unD5I4S0B+CYJwYM5lOJpEG2iab7G6++CtCbpmJ65ImbvgEWcwDmd96CJFoHlY J8SOjCNVyFpDWx1wbq1V+vLz7mEEGZFZQ1ePLM1RRiyM10fV/u0h0GhT0Q7Vg9M9H5NW 15yYLb56u1ktNv1zImQ9QMfvbmAXhz1+GsN2Q+MekxSoUhLilqTLBT4lSkvkQqTTJUKx gPnmhz1nyI++FHioWqfptZjOUu+aWd0+ObkyblKSmVlSP7+CDjKErIXKrR34JHN63c60 FssQ== X-Gm-Message-State: AO0yUKV/X0JBCvTXNT1Lvvoj4qmgRjOq5tFJu5QVwnWvd7PXYF+hMtqO TQWAGDucQ3FzbQOYq6o+TDjcig== X-Google-Smtp-Source: AK7set9g/IsePfcmVZgtOuwdUbeGGpWUnVw4aVHXZ/UHLSYz7Ma3PHzyfGze02RO/OeQK2wE28E2Dg== X-Received: by 2002:ac2:5214:0:b0:4cb:4378:9c6 with SMTP id a20-20020ac25214000000b004cb437809c6mr3479109lfl.23.1678194292689; Tue, 07 Mar 2023 05:04:52 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:52 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:49 +0100 Subject: [PATCH v2 07/16] 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-v2-7-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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 Sat Apr 11 14:29:33 2026 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 3BD06C678D5 for ; Tue, 7 Mar 2023 13:06:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230388AbjCGNGM (ORCPT ); Tue, 7 Mar 2023 08:06:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229624AbjCGNFi (ORCPT ); Tue, 7 Mar 2023 08:05:38 -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 322AD36096 for ; Tue, 7 Mar 2023 05:05:08 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id k14so16963787lfj.7 for ; Tue, 07 Mar 2023 05:05:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194293; 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=SefXo38QgFexmgMWTApFnWYCQ1D38J1mZxECZRSEWq2DgCPStiPBhN7E0gHFh/oKnO a/ctUs9MCxRKx/PwkqBSuaAB9/QSurcpyPlLYRJZRoTDIGaTgrOK/hZQY9Km0isk5eNW tufwKDB5XDxiA5gOxd4mKIwwT5bnjIKlugZWVVDZAI2TpZeoTWm3uKyZOPHaVDjhrJfC az++FZPBChNabjvBHtcIEGQGaesTb5YHV7pL8kUK0kQZ7fOLQSq3DvGw0XCmrGOaOA9I /zR1FzEAt3kDie5OWkpsVikEaTD3X+hsElGVMnrs4J7XEzHTfupYzB0bMTmreCDN4qhI GUYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194293; 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=kG1myfN/E+bI5ljA3E9+ZswD6MAPM24kKg/8s2RnRrMPoy4DJL/ZFW2BIRBKUPiu7W s2pRU/4XCYIcJrmDSgdf25f9TEclEgR30cgx9ZDzmlI2Efic/RLH/VUtqQ5hnGgIUv2E bnkhLKNuKjsrnNOWjLoEQ9rNF0MFGiATQhgXWCGZQShkB/ceph091BF/KO4PLjk0HNBB wwqxkDxPDIdsEGkfQo9ULaTfUnTynhOFSN/mnpkJkaVMH6C5tvz3O9yZ6EE8M9dUKpZW eCijIjxAOqbYNXAOHFdWl+VmEu6cuVvYZPeJxDFV6OPZ7dIx/jbyozFmSXyFHRUH8inc o4Ng== X-Gm-Message-State: AO0yUKV1+VUzsbMtbzNJaRJSzQQxF45AZpTIBrFX67THR4d29d4pne9u O/4KQ21C3U26urEBH/I2fAjKGQ== X-Google-Smtp-Source: AK7set8nsY/rRbAZWm3TfUBvnameO4Ctl8qcGn09Lr/8Fou/gwAjzMt5HC6aZdFoEzU5RDjFzeFs6A== X-Received: by 2002:a05:6512:4c2:b0:4dd:cbf3:e981 with SMTP id w2-20020a05651204c200b004ddcbf3e981mr3773006lfq.28.1678194293760; Tue, 07 Mar 2023 05:04:53 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:53 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:50 +0100 Subject: [PATCH v2 08/16] 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-v2-8-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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 Sat Apr 11 14:29:33 2026 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 E9298C6FD1B for ; Tue, 7 Mar 2023 13:06:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230379AbjCGNGI (ORCPT ); Tue, 7 Mar 2023 08:06:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230183AbjCGNFi (ORCPT ); Tue, 7 Mar 2023 08:05:38 -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 639BD360B1 for ; Tue, 7 Mar 2023 05:05:08 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id bi9so17002254lfb.2 for ; Tue, 07 Mar 2023 05:05:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194295; 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=qEmoyYvtgIkJSqf2Pqh6Ym564INZh0BwzurBMQLlWZmSk8nzc8RGKvmI0hegLFxPKY vcwgmnrbX8J6CXWiJNG56ybOQpRIzjmrfLiPW9MzQfCDwgA6bUUnD0Ocpa20ATwBgP9m A/kNsIOkf6r9XFr9kj2EMb5Nrhno/+FcFquWbL69edEYKrrRQYWXF4RRp8TxDzmfLggt lpDEFkFu37kGvJ2OLITkQJg2lYcKqCzkmVy4n4eox8eBHZVvg5k4QHyCMIs5Z0ynE3zm FuV41w/UN0D41os3dqTUZxxRP69iho+WD29viJZOccqZ2Lm217SWEXDOnsKwcFDfPpQ6 KjEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194295; 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=MF/cN/eRg4LZnRFclKkpGgQSRuG3L+Ed7U5H1yDR1ROKs6L0Y135NWO74vuZDQfHy9 +FOfUZH03PwPcllzpFISXX4NughYnnOWD+9+qjDbSMvE+XvW8JZgcwnNq6cm1sAQ/rFY Vd4XcRxXd0yB8UItTCodvro3cerExxhziCyindAUqZp1W1xbGIEY9ttbLYrTz4xXWvG9 TrVJAk6S+g1UxFGL2wpeaK4sOaFk+tHzckisQbaxPH/CpBAswUwnhccZo44zjIhHOPm1 xR2zE/D75ZDBDgPdani77uNVQQViyV80mvzc5/P1gVh5V9opU86qHQd4VUX9dPLIaWX8 OYeg== X-Gm-Message-State: AO0yUKW5i1ddRfzZEEnu5O8MChWc3ayvc3cGLU5yLgegrkSQCs00Oufq CYMclgeJlFFuVacm+1ttCfoRnQ== X-Google-Smtp-Source: AK7set9dOUNpwLPmkw26TebbIX2+K42H2bMUD/10wUIZq3p/In1OaKdeUJQyM4bBdLB4uJKuq/Qr6g== X-Received: by 2002:a19:5206:0:b0:4e7:4a3c:695 with SMTP id m6-20020a195206000000b004e74a3c0695mr3596668lfb.65.1678194294792; Tue, 07 Mar 2023 05:04:54 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:54 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:51 +0100 Subject: [PATCH v2 09/16] 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-v2-9-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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 Sat Apr 11 14:29:33 2026 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 E94F8C6FA99 for ; Tue, 7 Mar 2023 13:06:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230404AbjCGNGW (ORCPT ); Tue, 7 Mar 2023 08:06:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230198AbjCGNFi (ORCPT ); Tue, 7 Mar 2023 08:05:38 -0500 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CC761EBC6 for ; Tue, 7 Mar 2023 05:05:09 -0800 (PST) Received: by mail-lf1-x12c.google.com with SMTP id k14so16963913lfj.7 for ; Tue, 07 Mar 2023 05:05:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194296; 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=gTl0sWAHZELkBxPNjBg4QMipl5SoU+iNUQxL6p5sL5f0MBR5nPYOyZaiMzeOB+Q+xj 3GaijKUlUOO0C2yVej7qgB6oK4tr/pCZr0ZEHV3NQ5+miMkcnDahGA/O2BQgaULoJJBd mU/TWvz84AOJwTsrP7ocKUZty9JD/vdR3+cBkaTmVo2RmLiLbhmhjLtFpH+IvL4FvP1U jQB+d450gCmiksPXVpSBV6LL4OGkFDeHg2jIJQFjV3MrsgmqD2KJ6N5fTf0JUeHvQwLI 5NK3CVAcz1wSJrJfFumcuXHqd2qH6tJmF8ovGZVTV6xhphAgnT1ITng5XXRqFgzJSOmu gM5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194296; 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=CzR5TwNH06HhsV9rrYzS1dq1En/vZMy/FhMUp2EO86QLwMM63Pn1OfdfY2cCFt6rv2 vInK9u+P6l2EDhE0t9YpyphcE2F1jhE5VI6/ltQ/pd+EOHxUl6yLbnwdSIr8e+C5dBVu 06FLZJxZby21JpChF4AMg2V2JcfQVVPwvsIhCaK8mlPgT6ZDWt/wxSQh5yfj0zxOA9uf WFocWTnEoze0SeQS58ErgtVgZ8vgEEvJz3UeF9j3/4udzEIEk7uRcjjxrztcJ2yURuBu 3K1bA4I8QqoVQ/r6mMnVfTco1wcsQSdawMCi0xyJvahjFiu05apUGk8ItBT/XWgfjgvb dagg== X-Gm-Message-State: AO0yUKXTI4gsMIlOke7QnKdJbZB6LC40nZdCntcQzLna+HGfUzpMEVSJ VJ7A3mLeW/A/pv/i2kWmh2dmQg== X-Google-Smtp-Source: AK7set9z4O5TDeAgNvJ2hZmgaZa6GINTcQ4TTJ21C+OJ5m8X3lagEuaZ48dkwefG3tKzGshJuOGmeQ== X-Received: by 2002:ac2:4ac9:0:b0:4dc:84dd:eb91 with SMTP id m9-20020ac24ac9000000b004dc84ddeb91mr4510736lfp.22.1678194295779; Tue, 07 Mar 2023 05:04:55 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:55 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:52 +0100 Subject: [PATCH v2 10/16] 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-v2-10-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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 --- 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 Sat Apr 11 14:29:33 2026 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 9EAD7C74A44 for ; Tue, 7 Mar 2023 13:06:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230429AbjCGNGc (ORCPT ); Tue, 7 Mar 2023 08:06:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230146AbjCGNFl (ORCPT ); Tue, 7 Mar 2023 08:05:41 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA0874FF1B for ; Tue, 7 Mar 2023 05:05:10 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id t11so16987872lfr.1 for ; Tue, 07 Mar 2023 05:05:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194297; 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=tdXfnpQveQZ13YRTjuwgCi+dCDAKPyozw1qYk19o2EtuyEuikBRxXl6nyMRSB2xKRJ WoI6iAmTDBWherJFYCKCXcxRe/4XJHx/fCeWmZ2DZcA3HbL4fOi6nokat7LiDvCQuXYG gU4udntoQ0XJ6m+b5ON3WpTR8+YyCXOtbXyrqj8uhMVAbxIy6TMWKhfBezu6mscGBj0J TwcV9YsgtwqysWedxow5kbw5KklVoarBDjxm0WDoB0g65+qOJdrsFtY6YuNQA//qVo36 AxYfUHWcp7ClBdAzlY8RLrdBA/86dbEVMh44W/lFDzziSOxKOoBukra245PzOwLMl0Pl YYWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194297; 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=fOShDjZ/wQUy+rsLRloiczrrEE35ASHswXISdnGLHyuESjsoV+223q9IZa1EESfT01 CgJVANRaoSdyGzcLLCMRrryB5fG2MFqAEeu2LMPaSW9jAXKEJFx5gLEO5l2AB4kN52jo cI03LyasYP4GrBTm06eNHRsmP6ByKcKuKcr52m2ajsJEjdOt44WUIOPNHAX6c+CJtXuL td7CI6Po9AIXojSlimz1I2FyIaKi8c7LPZSlFI+k/vOHpIXhxPsL6DLHdlHa7v2+cWgW zDnoX8TzFTuyIYD6TDN4vbn09li7S4nhWmJcuZT5MFJ09A8DDlSEjW+XSnqnDvHWSwJO x2UA== X-Gm-Message-State: AO0yUKVjCuHglif/qWkxC76BDixJ2zlYjq2MPyaW6feKLeyFXhYqubVu o5s1ZJ15fRIrUZc17afvZN8FwA== X-Google-Smtp-Source: AK7set+BPTrxIQszyBjkoemozr65iYSYHYZLhbySZe0iKuYbn7PX2UF10OfwR0QpBDODuoR5HJXYOw== X-Received: by 2002:ac2:46d6:0:b0:4da:f436:d423 with SMTP id p22-20020ac246d6000000b004daf436d423mr3963036lfo.21.1678194296895; Tue, 07 Mar 2023 05:04:56 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:56 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:53 +0100 Subject: [PATCH v2 11/16] 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-v2-11-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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 Sat Apr 11 14:29:33 2026 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 31F52C678D5 for ; Tue, 7 Mar 2023 13:05:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230325AbjCGNFs (ORCPT ); Tue, 7 Mar 2023 08:05:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230133AbjCGNF3 (ORCPT ); Tue, 7 Mar 2023 08:05:29 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 632871968C for ; Tue, 7 Mar 2023 05:04:58 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id r27so16942217lfe.10 for ; Tue, 07 Mar 2023 05:04:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194298; 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=vZKm0sHQNOSMMZoNqibcrK3Qe6Lg01/4Fr1aaxO9TGYf/45NkCHHxU/yfX8ZsCGMx/ J9zXwTKz+qF5UBNy0qy4JohKdNJ2XymtlmWrfhlrgGpAO0PHnES4m2FWy9S8RxHJXPUq wzs1CANIN4hrO+6RHsyevTyy1CwkdAbUJYmUtP73VVtm1ucs9J7twojT3oreATjs7YQf UAyT80ziocByhf7ZYiouICdsrHgNauSbu71i+RphcnA7crEl+YsM74LvNV2BN70FI8H5 1rVIfU6qqA2Fa9brCUIIg1nI8ecG+TXZBn84g9c2Jfe8TAFLkKN9LLRBCjHzML+yhZq8 DdXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194298; 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=vtPVYWyAPlhKrqNKTQI1q9sqOTFeREKFSwX/KYYoipJJJPekRn89nBXz4EU+9SOrVH x0E1/yQyC00BReG8wrU7hc64PZOnAwEBrJTXy2khfAbNBogx41o4IGBNFNq4AGsM2HZx DvsCJLmreTLRl1E5hZVx6Vx2xM20HX29AlE2KNqXpt3/CoDm1z2vRO/XEccz/jvY3tYC tZkr5PG2fMRkxJ2fPrE9JYWMvSo/qzyH3vkAqhjmtsd7KkYfx6JfqW73ilkkFiTJitxp 5pSfkiSl2tKGnaj0GNwHGjpkF1luVg9Rap43YKSMmFyzAPd/3cot+qun4XCPTdCJJ9kY mxew== X-Gm-Message-State: AO0yUKUBBBrf2vjDkxbJ6A6HXSczQ/zpHmz9/tgiaExb09tQg12PtIxg vGRY9M+pw3by1/HCoR090Foy8Q== X-Google-Smtp-Source: AK7set9wENuA3GfSq1Bk7Dw+Yjl09qsPMHBsyKksazihCREvuGQFHqQ3k0XZPposjOWqIHAg57giKA== X-Received: by 2002:ac2:52bb:0:b0:4d8:5de4:e3b4 with SMTP id r27-20020ac252bb000000b004d85de4e3b4mr4312862lfm.1.1678194297974; Tue, 07 Mar 2023 05:04:57 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:57 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:54 +0100 Subject: [PATCH v2 12/16] 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-v2-12-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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 Sat Apr 11 14:29:33 2026 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 B3D6EC678D4 for ; Tue, 7 Mar 2023 13:06:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230444AbjCGNGj (ORCPT ); Tue, 7 Mar 2023 08:06:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230251AbjCGNFm (ORCPT ); Tue, 7 Mar 2023 08:05:42 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45445AE for ; Tue, 7 Mar 2023 05:05:13 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id n2so16924398lfb.12 for ; Tue, 07 Mar 2023 05:05:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194299; 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=XI0UmKS1DqsLREENXEyfQRgiR7jhCtGsIzKxy49toW+kuBW4SQlQoHVh0hwV6jFcu+ aYbUbgsFyN8oj7PPp3WcL7Z+4F+Y094WggSBSS8z7xY8qPeUN+l160jmOr9Y1LqPqvqR wR+mqRS3HlNIGJLI0cGBYiV4m/pVb3+pheIdC5rg6RwjNpDB+UyT89JZ8zC3s8HHi5Ug RzKh+pgaU5eyNQr6uSTb7kraNJTBjxGsxAtXkqsFGbP3YA3jEMaBgHB4DWd2ZX8l5i+i hl9GEpV2AMq7t9uy18J8uHMpSIul0CNfP4FqaSw7oV536zICcuz4cUiypiBR31J2CElz QRUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194299; 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=gan2ZCsHXuVLoeb0fWOFLz3zMPQUhbNsdRm0+MNEALLtawdjmuqamlknEeP4f57kTv N3AmnmA7bBJ++6hfI/paXQLVd/CQ5iQ5v9xQAaou5EsZzNcJ34nXqO53NDaehj2CUJIk e7ISmz9zpryc9VcckAuTonIbPSYXuQnAW3zp2tirxitrac5nlVmbNnG8Isca09w+3Gt/ hYVnRPajJCkiFtK9seY13rjWRMxbo1KqG5Fql0QdIsIuZIjNUNmrutval1pV05x3HqXc ta7/B4KUJaNk0hAdYf0M/Ya/bvVioYK0jRDPyoYxJvzP+Rrv6MvTlDKk87C1mrfC6QMA tmBw== X-Gm-Message-State: AO0yUKXas0+oiEFC6ROJHYhctV0t1V3L7fd+4sMBbbJUwPLqL23ZRjvl 4GE7NOC6hGHBMRa0QukTjEb0vw== X-Google-Smtp-Source: AK7set8LiewOjfSfMDSVpT8vLK4Kc41jk8YyNSr17wtiD84vpf6AnEv3OouhhoZf4ap+crKisrs+/g== X-Received: by 2002:a19:7418:0:b0:4cc:73ff:579a with SMTP id v24-20020a197418000000b004cc73ff579amr3664898lfe.38.1678194299039; Tue, 07 Mar 2023 05:04:59 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:58 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:55 +0100 Subject: [PATCH v2 13/16] 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-v2-13-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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 Sat Apr 11 14:29:33 2026 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 D529BC678D4 for ; Tue, 7 Mar 2023 13:06:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229729AbjCGNGq (ORCPT ); Tue, 7 Mar 2023 08:06:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230267AbjCGNFm (ORCPT ); Tue, 7 Mar 2023 08:05:42 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 284687B4B7 for ; Tue, 7 Mar 2023 05:05:14 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id bi9so17002590lfb.2 for ; Tue, 07 Mar 2023 05:05:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194300; 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=xFksW1ucR4VOlqND6VFtfCf8TmvKFAMaPgfmp89lUYxRs/sod65QrfiIah7Gh/Dy39 u1yUTnfZG8eABAidi24UpO/uHNb/HrPCEKyWBVqrM4etXND3x8pr2PkwDDULloTm6G0U 7FYs892dZq4G1/2pi5X+pCiqihETM0BZ055oUEhbh5iBVT17MORRCwbHuucrepQR9XKV G2GHTrQefD4prN4B1VTCjuXQlFJ1YUWHxu19RLWtFzIjQOmIDiSYjOPamg/ffYDJK8pE sErqOCZ1CIxpOatarkfbwdhpirqgqiDTVzDqc/j4E0TjqBk5tXkuGpeHuS09pFbq1VI7 vDvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194300; 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=AwTroZj7fYmliLWJeQvK3IrP3cO3y3hPiMU8wW8F3bIvz+gSTEvJXNJ+qY8J242en5 gRPpEnyRSL4jDE4APNXTNn24iOmuQ3Qaq02myewbTv+6/gKwR48rSBrdGEayUFs8vQTt l/oZvUX/e9bDPbBoztHBWyL+0Cy2cg+87tu4BlCO1PRtDgFmGm6zKsqmg7sBJC8DnTRW Rb1gcUMRMVZuRokdOirzdS31Xyps0jUCQKShxh8FhhIUI6dIsq6jylR+WTDkmKmi2eeR lVWTg290+R45Lfrp1x9Taux2ajeqOJvJ5srawG5sEJJVZQLzBXZst7QPJnsmDBuOoKBq 96Jw== X-Gm-Message-State: AO0yUKXjqiWcYjvx3w6UZhweFg6hBklSL3aSrlB/s0oi0wdk6+TE9e8C gM1SCDI7GdpjBIuW0sn2kfl/XQ== X-Google-Smtp-Source: AK7set8gxJncJ8ZqcM6tJhdZJV6p4xolHeK/90/vQ/dpBvJGIP9q+gH7AIIrOXM6XQo+SFT/MVLQbQ== X-Received: by 2002:a05:6512:144:b0:4db:513f:fe2a with SMTP id m4-20020a056512014400b004db513ffe2amr4069156lfo.23.1678194300102; Tue, 07 Mar 2023 05:05:00 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:59 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:56 +0100 Subject: [PATCH v2 14/16] 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-v2-14-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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 Sat Apr 11 14:29:33 2026 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 1F515C678D4 for ; Tue, 7 Mar 2023 13:06:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230352AbjCGNGu (ORCPT ); Tue, 7 Mar 2023 08:06:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230284AbjCGNFo (ORCPT ); Tue, 7 Mar 2023 08:05:44 -0500 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A33BA277 for ; Tue, 7 Mar 2023 05:05:16 -0800 (PST) Received: by mail-lj1-x234.google.com with SMTP id t14so13056810ljd.5 for ; Tue, 07 Mar 2023 05:05:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194301; 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=WoDr9naT88KPAmWtmecnyXyKXIJdxVKHY3fSLJFVbGwG76jmxOMnW1et6daEkqtG8a ihRSCVa77byEIL8HXfej//ovzCXo2+wz4tewtmwIYanbdWMiw1u7VZSjs3FvkhLGWAAz 8bU+ToyGYK5TQqxPFixsNJk3BwPb+xCmOtBb1wfh0vJiixcJpC+jZ6wCUl1pBey1Sfnj 5O+2O/5WrBnQhSh/+P8FR0PuM04bQvZab0oLWH67mE9DsyTdVwceUHDEC87OzrOq7RJH NAeSyLCPgKw2C9ADzYlHWxkINSMPIl1OEVULA0x0k+31OVxFKBls9sFnQoFEVdHaeguW 1tkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194301; 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=gBC3PpNW7ho6E+2Rnn6AjUlsKlAjuetvKnHsyybmd3IXVn7v6tfjlvTjSuIa7EnTv6 g+mHifsx0ZU0MM5h28xtNcXjWTzPsrXk5+5uQj6sYt+izexcP4CNsxQG/gdWMsolx0td dc7z9JK7Y4TXUTKzuIsyj9B3426gwT/p9JqUgIcxHNRJy5ibb0qyflzWgvhlJvFyoZfz /53hYRGl3sf7/hTeR7kz4xVrHvX/+HDAn7E7VtLBYjejrCKQMe+TEYM/h4rdBzyHVs8j KnTgWtdJlEpSQKcyphIlFLMPlG9FQEODJVUTkzhHZLmQjmloUYsitE3qw4Rz7Yc0+K3B 24GQ== X-Gm-Message-State: AO0yUKVhfdgDhxgrjpm/avNsBfFVJeZhVPKh+606Gv859yl0uKHm5vdP pb+5HDq0y0LekzzINlu4wI3IVA== X-Google-Smtp-Source: AK7set9FIRk+D02EpqNXIipxeF+W2c44Rc49IDIGvQg7pSf1+vwkxVbmpAXxb9VPe8SErITD4clMrg== X-Received: by 2002:a2e:a99b:0:b0:28b:6525:e6b1 with SMTP id x27-20020a2ea99b000000b0028b6525e6b1mr4810829ljq.24.1678194301238; Tue, 07 Mar 2023 05:05:01 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:05:00 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:57 +0100 Subject: [PATCH v2 15/16] 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-v2-15-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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 Sat Apr 11 14:29:33 2026 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 DE509C678D5 for ; Tue, 7 Mar 2023 13:07:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230394AbjCGNHD (ORCPT ); Tue, 7 Mar 2023 08:07:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbjCGNFs (ORCPT ); Tue, 7 Mar 2023 08:05:48 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFF627E8A4 for ; Tue, 7 Mar 2023 05:05:19 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id n2so16924624lfb.12 for ; Tue, 07 Mar 2023 05:05:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194302; 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=QehD1bhYUi9CqVD9QXVP0PtANkHCGauBClYHYYp0hr12HX7h0TkjG6fFMxmn9vm4Fq A0X4es0spCzccWcbPoMxmOrMCNy/A5TG0QfpzMRBydTn0gUeRbHifX49RoaxF28/p4c3 3MPzisEdzqQcDpwFKdn1vn0WbPQoyeWfa56aT8dso6OaTuDQ3wnHvEk04IKND9fyVPLy Q6J9Et8+kF3WOl+6mfaK7yqU8cRBEec7+/1TvJLaC+JdzO19/KWv8b2nUAnoD8s5OhEH /FYgtuMbVw+pao3NUpX0jp4lf0kWuC3tKBRndIYTnNOznEgDVQg2LLCkUfoNy87pvt5c k3cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194302; 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=uzMz5R1nYftb+3SoVjKy5rfxqnYT7LS0jiNJkLhCaz5MhM2nG+6TZ98VbYpJSE9mFf 6VZS6H+mhFf4xpmkfBAnW1v6T6FNaVZ6/nO77ccmq0a3CMdtaogRuFUNJhhyt2J8KsfG WPbHfpZeRnGjnUBJVO+qbpeuVMY/Ark3wY62QqjdOAIsQCOA4YQq8aqUD82eSyCz+J4t H0BxXiR9tmTEKnn7EI/B7mxZ8OuL8e8pHbxJMyjZlPnFbUjGjFDgxbBYCPWMQcMQmkdD EfMjNwkBi8QDnl0AEZZ9RZibd+L1DXOis22ZwfWwG4oChqLM/fisSD+Q7cNnVvPgAjnU SaXw== X-Gm-Message-State: AO0yUKUzBVXl38/t55miX8DgNx4Uv3qwoA+o8d7ym0BKOvVjOCDhO98E C39iTETX8TVHCydoEMvRthgCeA== X-Google-Smtp-Source: AK7set93WXjwZmiOBSQIZMB+0eDjPtJOLkR/LAOqDz4vWAPBj9BCaVrg7CvYpdXzX2eFJC+J4/9b9A== X-Received: by 2002:a19:760e:0:b0:4df:2c71:57fb with SMTP id c14-20020a19760e000000b004df2c7157fbmr4088445lff.43.1678194302348; Tue, 07 Mar 2023 05:05:02 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.05.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:05:01 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:58 +0100 Subject: [PATCH v2 16/16] 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-v2-16-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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