From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Bogendoerfer Date: Fri, 17 Feb 2023 14:28:16 +0100 Subject: [PATCH 10/17] gpio: idt3243x: Convert to immutable irq_chip In-Reply-To: <20230215-immutable-chips-v1-10-51a8f224a5d0@linaro.org> References: <20230215-immutable-chips-v1-0-51a8f224a5d0@linaro.org> <20230215-immutable-chips-v1-10-51a8f224a5d0@linaro.org> Message-ID: <20230217132816.GA9335@alpha.franken.de> List-Id: To: linux-aspeed@lists.ozlabs.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Thu, Feb 16, 2023 at 10:37:11AM +0100, Linus Walleij wrote: > Convert the driver to immutable irq-chip with a bit of > intuition. > > Cc: 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); > > raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); > + > + gpiochip_disable_irq(gc, irqd_to_hwirq(d)); > } > > 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 = gpiochip_get_data(gc); > unsigned long flags; > > + gpiochip_enable_irq(gc, irqd_to_hwirq(d)); > raw_spin_lock_irqsave(&gc->bgpio_lock, flags); > > ctrl->mask_cache &= ~BIT(d->hwirq); > @@ -119,12 +122,14 @@ static int idt_gpio_irq_init_hw(struct gpio_chip *gc) > return 0; > } > > -static struct irq_chip idt_gpio_irqchip = { > +static const struct irq_chip idt_gpio_irqchip = { > .name = "IDTGPIO", > .irq_mask = idt_gpio_mask, > .irq_ack = idt_gpio_ack, > .irq_unmask = idt_gpio_unmask, > - .irq_set_type = idt_gpio_irq_set_type > + .irq_set_type = idt_gpio_irq_set_type, > + .flags = IRQCHIP_IMMUTABLE, > + GPIOCHIP_IRQ_RESOURCE_HELPERS, > }; > > 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; > > girq = &ctrl->gc.irq; > - girq->chip = &idt_gpio_irqchip; > + gpio_irq_chip_set_chip(girq, &idt_gpio_irqchip); > girq->init_hw = idt_gpio_irq_init_hw; > girq->parent_handler = idt_gpio_dispatch; > girq->num_parents = 1; > > -- > 2.34.1 Tested-by: Thomas Bogendoerfer -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ] From mboxrd@z Thu Jan 1 00:00:00 1970 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 12380C6379F for ; Fri, 17 Feb 2023 14:34:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229506AbjBQOeN (ORCPT ); Fri, 17 Feb 2023 09:34:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbjBQOeM (ORCPT ); Fri, 17 Feb 2023 09:34:12 -0500 Received: from elvis.franken.de (elvis.franken.de [193.175.24.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5C3F6644FB; Fri, 17 Feb 2023 06:34:11 -0800 (PST) Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1pT1o3-0001zG-00; Fri, 17 Feb 2023 15:33:47 +0100 Received: by alpha.franken.de (Postfix, from userid 1000) id 19465C28A2; Fri, 17 Feb 2023 14:28:16 +0100 (CET) Date: Fri, 17 Feb 2023 14:28:16 +0100 From: Thomas Bogendoerfer To: Linus Walleij Cc: Mun Yew Tham , Bartosz Golaszewski , Joel Stanley , Andrew Jeffery , Alban Bedel , Orson Zhai , Baolin Wang , Chunyan Zhang , Jay Fang , Daniel Palmer , Romain Perier , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman , William Breathitt Gray , 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, Marc Zyngier Subject: Re: [PATCH 10/17] gpio: idt3243x: Convert to immutable irq_chip Message-ID: <20230217132816.GA9335@alpha.franken.de> References: <20230215-immutable-chips-v1-0-51a8f224a5d0@linaro.org> <20230215-immutable-chips-v1-10-51a8f224a5d0@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230215-immutable-chips-v1-10-51a8f224a5d0@linaro.org> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On Thu, Feb 16, 2023 at 10:37:11AM +0100, Linus Walleij wrote: > Convert the driver to immutable irq-chip with a bit of > intuition. > > Cc: 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); > > raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); > + > + gpiochip_disable_irq(gc, irqd_to_hwirq(d)); > } > > 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 = gpiochip_get_data(gc); > unsigned long flags; > > + gpiochip_enable_irq(gc, irqd_to_hwirq(d)); > raw_spin_lock_irqsave(&gc->bgpio_lock, flags); > > ctrl->mask_cache &= ~BIT(d->hwirq); > @@ -119,12 +122,14 @@ static int idt_gpio_irq_init_hw(struct gpio_chip *gc) > return 0; > } > > -static struct irq_chip idt_gpio_irqchip = { > +static const struct irq_chip idt_gpio_irqchip = { > .name = "IDTGPIO", > .irq_mask = idt_gpio_mask, > .irq_ack = idt_gpio_ack, > .irq_unmask = idt_gpio_unmask, > - .irq_set_type = idt_gpio_irq_set_type > + .irq_set_type = idt_gpio_irq_set_type, > + .flags = IRQCHIP_IMMUTABLE, > + GPIOCHIP_IRQ_RESOURCE_HELPERS, > }; > > 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; > > girq = &ctrl->gc.irq; > - girq->chip = &idt_gpio_irqchip; > + gpio_irq_chip_set_chip(girq, &idt_gpio_irqchip); > girq->init_hw = idt_gpio_irq_init_hw; > girq->parent_handler = idt_gpio_dispatch; > girq->num_parents = 1; > > -- > 2.34.1 Tested-by: Thomas Bogendoerfer -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ] From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 73407C05027 for ; Fri, 17 Feb 2023 14:35:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qUGoUfYS5x3gByYbV0d8ZGzOkARS5CbzJa46lcwzY1o=; b=mPz8bDgxc9rePo xs6wpgml4HWFGQxKEWy4vKXMPEO9yJMLUN133V8jBGVcsPw1u9DU5sQmFrw1z9tmY+vZdV0CKGAbn a5Dq7l2NtB6Xx44WbPoO5Qr8yF5Y0bFbCO1ulVqfhHLTvZe9ji/kQSPfGGyvw9s9EucAgBwdvGRGN AJ7KKhpxGcOb41CkTQNN0vP8/Z6nhdBsiZ80FEg8O7M07ozodCMBzFoTz8TJlYgJ+XVREJTCyV7e2 gGUJg5gVQ+PrchtezXl0rmqYXIBQJ+CEIk0+2qFgjviOlnc4y0ZrKOsGcHe6kXcgxDXH9qcF40Bul pgRyPHkx+HW48+945k/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pT1oa-00EaGF-AB; Fri, 17 Feb 2023 14:34:20 +0000 Received: from elvis.franken.de ([193.175.24.41]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pT1oU-00EaDR-PF for linux-arm-kernel@lists.infradead.org; Fri, 17 Feb 2023 14:34:18 +0000 Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1pT1o3-0001zG-00; Fri, 17 Feb 2023 15:33:47 +0100 Received: by alpha.franken.de (Postfix, from userid 1000) id 19465C28A2; Fri, 17 Feb 2023 14:28:16 +0100 (CET) Date: Fri, 17 Feb 2023 14:28:16 +0100 From: Thomas Bogendoerfer To: Linus Walleij Cc: Mun Yew Tham , Bartosz Golaszewski , Joel Stanley , Andrew Jeffery , Alban Bedel , Orson Zhai , Baolin Wang , Chunyan Zhang , Jay Fang , Daniel Palmer , Romain Perier , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman , William Breathitt Gray , 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, Marc Zyngier Subject: Re: [PATCH 10/17] gpio: idt3243x: Convert to immutable irq_chip Message-ID: <20230217132816.GA9335@alpha.franken.de> References: <20230215-immutable-chips-v1-0-51a8f224a5d0@linaro.org> <20230215-immutable-chips-v1-10-51a8f224a5d0@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230215-immutable-chips-v1-10-51a8f224a5d0@linaro.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230217_063415_254615_A06D6548 X-CRM114-Status: GOOD ( 20.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Feb 16, 2023 at 10:37:11AM +0100, Linus Walleij wrote: > Convert the driver to immutable irq-chip with a bit of > intuition. > > Cc: 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); > > raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); > + > + gpiochip_disable_irq(gc, irqd_to_hwirq(d)); > } > > 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 = gpiochip_get_data(gc); > unsigned long flags; > > + gpiochip_enable_irq(gc, irqd_to_hwirq(d)); > raw_spin_lock_irqsave(&gc->bgpio_lock, flags); > > ctrl->mask_cache &= ~BIT(d->hwirq); > @@ -119,12 +122,14 @@ static int idt_gpio_irq_init_hw(struct gpio_chip *gc) > return 0; > } > > -static struct irq_chip idt_gpio_irqchip = { > +static const struct irq_chip idt_gpio_irqchip = { > .name = "IDTGPIO", > .irq_mask = idt_gpio_mask, > .irq_ack = idt_gpio_ack, > .irq_unmask = idt_gpio_unmask, > - .irq_set_type = idt_gpio_irq_set_type > + .irq_set_type = idt_gpio_irq_set_type, > + .flags = IRQCHIP_IMMUTABLE, > + GPIOCHIP_IRQ_RESOURCE_HELPERS, > }; > > 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; > > girq = &ctrl->gc.irq; > - girq->chip = &idt_gpio_irqchip; > + gpio_irq_chip_set_chip(girq, &idt_gpio_irqchip); > girq->init_hw = idt_gpio_irq_init_hw; > girq->parent_handler = idt_gpio_dispatch; > girq->num_parents = 1; > > -- > 2.34.1 Tested-by: Thomas Bogendoerfer -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel