From nobody Tue Dec 16 03:08:26 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8867C07E9D for ; Mon, 26 Sep 2022 11:11:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237504AbiIZLLS (ORCPT ); Mon, 26 Sep 2022 07:11:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237794AbiIZLJi (ORCPT ); Mon, 26 Sep 2022 07:09:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BA3D501A1; Mon, 26 Sep 2022 03:35:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 734E8B8092F; Mon, 26 Sep 2022 10:33:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B824AC433C1; Mon, 26 Sep 2022 10:33:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188431; bh=QGczFgAHvbSQI3rwphu6DQAbiEnCcEoB8hmQoCSCrjw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mcY45A3m1WZrtYRz+V3Hg6jaZDg3gJMr1r4UkhyUmlZULRx4HogWmw/Usq3bVMyN9 VxCtFfcyjpQbEuSCJ94qiyq1z0+P1tcXiPVKUknHiOIuAcmZ65gx06YH/hKICh3gLo cXibwFO8mNc/uIY3JOmP3Flew1ATmGIQOuYCtWog= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Linus Walleij , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.10 128/141] gpio: ixp4xx: Make irqchip immutable Date: Mon, 26 Sep 2022 12:12:34 +0200 Message-Id: <20220926100759.099973151@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100754.639112000@linuxfoundation.org> References: <20220926100754.639112000@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij [ Upstream commit 94e9bc73d85aa6ecfe249e985ff57abe0ab35f34 ] This turns the IXP4xx GPIO irqchip into an immutable irqchip, a bit different from the standard template due to being hierarchical. Tested on the IXP4xx which uses drivers/ata/pata_ixp4xx_cf.c for a rootfs on compact flash with IRQs from this GPIO block to the CF ATA controller. Cc: Marc Zyngier Signed-off-by: Linus Walleij Acked-by: Marc Zyngier Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpio-ixp4xx.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-ixp4xx.c b/drivers/gpio/gpio-ixp4xx.c index b3b050604e0b..6bd047e2ca46 100644 --- a/drivers/gpio/gpio-ixp4xx.c +++ b/drivers/gpio/gpio-ixp4xx.c @@ -67,6 +67,14 @@ static void ixp4xx_gpio_irq_ack(struct irq_data *d) __raw_writel(BIT(d->hwirq), g->base + IXP4XX_REG_GPIS); } =20 +static void ixp4xx_gpio_mask_irq(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 ixp4xx_gpio_irq_unmask(struct irq_data *d) { struct gpio_chip *gc =3D irq_data_get_irq_chip_data(d); @@ -76,6 +84,7 @@ static void ixp4xx_gpio_irq_unmask(struct irq_data *d) if (!(g->irq_edge & BIT(d->hwirq))) ixp4xx_gpio_irq_ack(d); =20 + gpiochip_enable_irq(gc, d->hwirq); irq_chip_unmask_parent(d); } =20 @@ -153,12 +162,14 @@ static int ixp4xx_gpio_irq_set_type(struct irq_data *= d, unsigned int type) return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH); } =20 -static struct irq_chip ixp4xx_gpio_irqchip =3D { +static const struct irq_chip ixp4xx_gpio_irqchip =3D { .name =3D "IXP4GPIO", .irq_ack =3D ixp4xx_gpio_irq_ack, - .irq_mask =3D irq_chip_mask_parent, + .irq_mask =3D ixp4xx_gpio_mask_irq, .irq_unmask =3D ixp4xx_gpio_irq_unmask, .irq_set_type =3D ixp4xx_gpio_irq_set_type, + .flags =3D IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; =20 static int ixp4xx_gpio_child_to_parent_hwirq(struct gpio_chip *gc, @@ -282,7 +293,7 @@ static int ixp4xx_gpio_probe(struct platform_device *pd= ev) g->gc.owner =3D THIS_MODULE; =20 girq =3D &g->gc.irq; - girq->chip =3D &ixp4xx_gpio_irqchip; + gpio_irq_chip_set_chip(girq, &ixp4xx_gpio_irqchip); girq->fwnode =3D g->fwnode; girq->parent_domain =3D parent; girq->child_to_parent_hwirq =3D ixp4xx_gpio_child_to_parent_hwirq; --=20 2.35.1