From: Serge Semin <fancer.lancer@gmail.com> To: Geert Uytterhoeven <geert+renesas@glider.be> Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>, Hoan Tran <hoan@os.amperecomputing.com>, Linus Walleij <linus.walleij@linaro.org>, Bartosz Golaszewski <brgl@bgdev.pl>, Damien Le Moal <damien.lemoal@wdc.com>, Marc Zyngier <maz@kernel.org>, linux-gpio@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH] gpio: dwapb: Make the irqchip immutable Date: Mon, 23 May 2022 00:10:48 +0300 [thread overview] Message-ID: <20220522211048.5n6krpzgc4hzv4jg@mobilestation> (raw) In-Reply-To: <e6380b316db23ee03a9adbf0a7d1ad83538f9961.1652884676.git.geert+renesas@glider.be> On Wed, May 18, 2022 at 04:39:42PM +0200, Geert Uytterhoeven wrote: > Commit 6c846d026d49 ("gpio: Don't fiddle with irqchips marked as > immutable") added a warning to indicate if the gpiolib is altering the > internals of irqchips. Following this change the following warning is > now observed for the dwapb driver: > > gpio gpiochip0: (50200000.gpio): not an immutable chip, please consider fixing it! > > Fix this by making the irqchip in the dwapb driver immutable. > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > --- > Against linux-next. > Boot-tested on SiPEED MAiXBiT (Canaan K210). Currently no objection against the change. Thanks. Acked-by: Serge Semin <fancer.lancer@gmail.com> -Sergey > --- > drivers/gpio/gpio-dwapb.c | 32 ++++++++++++++++++++------------ > 1 file changed, 20 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c > index 7130195da48d75dd..29b9395548151992 100644 > --- a/drivers/gpio/gpio-dwapb.c > +++ b/drivers/gpio/gpio-dwapb.c > @@ -95,7 +95,6 @@ struct dwapb_context { > #endif > > struct dwapb_gpio_port_irqchip { > - struct irq_chip irqchip; > unsigned int nr_irqs; > unsigned int irq[DWAPB_MAX_GPIOS]; > }; > @@ -259,6 +258,8 @@ static void dwapb_irq_mask(struct irq_data *d) > val = dwapb_read(gpio, GPIO_INTMASK) | BIT(irqd_to_hwirq(d)); > dwapb_write(gpio, GPIO_INTMASK, val); > raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); > + > + gpiochip_disable_irq(gc, d->hwirq); > } > > static void dwapb_irq_unmask(struct irq_data *d) > @@ -268,6 +269,8 @@ static void dwapb_irq_unmask(struct irq_data *d) > unsigned long flags; > u32 val; > > + gpiochip_enable_irq(gc, d->hwirq); > + > raw_spin_lock_irqsave(&gc->bgpio_lock, flags); > val = dwapb_read(gpio, GPIO_INTMASK) & ~BIT(irqd_to_hwirq(d)); > dwapb_write(gpio, GPIO_INTMASK, val); > @@ -364,8 +367,23 @@ static int dwapb_irq_set_wake(struct irq_data *d, unsigned int enable) > > return 0; > } > +#else > +#define dwapb_irq_set_wake NULL > #endif > > +static const struct irq_chip dwapb_irq_chip = { > + .name = DWAPB_DRIVER_NAME, > + .irq_ack = dwapb_irq_ack, > + .irq_mask = dwapb_irq_mask, > + .irq_unmask = dwapb_irq_unmask, > + .irq_set_type = dwapb_irq_set_type, > + .irq_enable = dwapb_irq_enable, > + .irq_disable = dwapb_irq_disable, > + .irq_set_wake = dwapb_irq_set_wake, > + .flags = IRQCHIP_IMMUTABLE, > + GPIOCHIP_IRQ_RESOURCE_HELPERS, > +}; > + > static int dwapb_gpio_set_debounce(struct gpio_chip *gc, > unsigned offset, unsigned debounce) > { > @@ -439,16 +457,6 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, > girq->default_type = IRQ_TYPE_NONE; > > port->pirq = pirq; > - pirq->irqchip.name = DWAPB_DRIVER_NAME; > - pirq->irqchip.irq_ack = dwapb_irq_ack; > - pirq->irqchip.irq_mask = dwapb_irq_mask; > - pirq->irqchip.irq_unmask = dwapb_irq_unmask; > - pirq->irqchip.irq_set_type = dwapb_irq_set_type; > - pirq->irqchip.irq_enable = dwapb_irq_enable; > - pirq->irqchip.irq_disable = dwapb_irq_disable; > -#ifdef CONFIG_PM_SLEEP > - pirq->irqchip.irq_set_wake = dwapb_irq_set_wake; > -#endif > > /* > * Intel ACPI-based platforms mostly have the DesignWare APB GPIO > @@ -475,7 +483,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, > girq->parent_handler = dwapb_irq_handler; > } > > - girq->chip = &pirq->irqchip; > + gpio_irq_chip_set_chip(girq, &dwapb_irq_chip); > > return; > > -- > 2.25.1 >
WARNING: multiple messages have this Message-ID (diff)
From: Serge Semin <fancer.lancer@gmail.com> To: Geert Uytterhoeven <geert+renesas@glider.be> Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>, Hoan Tran <hoan@os.amperecomputing.com>, Linus Walleij <linus.walleij@linaro.org>, Bartosz Golaszewski <brgl@bgdev.pl>, Damien Le Moal <damien.lemoal@wdc.com>, Marc Zyngier <maz@kernel.org>, linux-gpio@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH] gpio: dwapb: Make the irqchip immutable Date: Mon, 23 May 2022 00:10:48 +0300 [thread overview] Message-ID: <20220522211048.5n6krpzgc4hzv4jg@mobilestation> (raw) In-Reply-To: <e6380b316db23ee03a9adbf0a7d1ad83538f9961.1652884676.git.geert+renesas@glider.be> On Wed, May 18, 2022 at 04:39:42PM +0200, Geert Uytterhoeven wrote: > Commit 6c846d026d49 ("gpio: Don't fiddle with irqchips marked as > immutable") added a warning to indicate if the gpiolib is altering the > internals of irqchips. Following this change the following warning is > now observed for the dwapb driver: > > gpio gpiochip0: (50200000.gpio): not an immutable chip, please consider fixing it! > > Fix this by making the irqchip in the dwapb driver immutable. > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > --- > Against linux-next. > Boot-tested on SiPEED MAiXBiT (Canaan K210). Currently no objection against the change. Thanks. Acked-by: Serge Semin <fancer.lancer@gmail.com> -Sergey > --- > drivers/gpio/gpio-dwapb.c | 32 ++++++++++++++++++++------------ > 1 file changed, 20 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c > index 7130195da48d75dd..29b9395548151992 100644 > --- a/drivers/gpio/gpio-dwapb.c > +++ b/drivers/gpio/gpio-dwapb.c > @@ -95,7 +95,6 @@ struct dwapb_context { > #endif > > struct dwapb_gpio_port_irqchip { > - struct irq_chip irqchip; > unsigned int nr_irqs; > unsigned int irq[DWAPB_MAX_GPIOS]; > }; > @@ -259,6 +258,8 @@ static void dwapb_irq_mask(struct irq_data *d) > val = dwapb_read(gpio, GPIO_INTMASK) | BIT(irqd_to_hwirq(d)); > dwapb_write(gpio, GPIO_INTMASK, val); > raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); > + > + gpiochip_disable_irq(gc, d->hwirq); > } > > static void dwapb_irq_unmask(struct irq_data *d) > @@ -268,6 +269,8 @@ static void dwapb_irq_unmask(struct irq_data *d) > unsigned long flags; > u32 val; > > + gpiochip_enable_irq(gc, d->hwirq); > + > raw_spin_lock_irqsave(&gc->bgpio_lock, flags); > val = dwapb_read(gpio, GPIO_INTMASK) & ~BIT(irqd_to_hwirq(d)); > dwapb_write(gpio, GPIO_INTMASK, val); > @@ -364,8 +367,23 @@ static int dwapb_irq_set_wake(struct irq_data *d, unsigned int enable) > > return 0; > } > +#else > +#define dwapb_irq_set_wake NULL > #endif > > +static const struct irq_chip dwapb_irq_chip = { > + .name = DWAPB_DRIVER_NAME, > + .irq_ack = dwapb_irq_ack, > + .irq_mask = dwapb_irq_mask, > + .irq_unmask = dwapb_irq_unmask, > + .irq_set_type = dwapb_irq_set_type, > + .irq_enable = dwapb_irq_enable, > + .irq_disable = dwapb_irq_disable, > + .irq_set_wake = dwapb_irq_set_wake, > + .flags = IRQCHIP_IMMUTABLE, > + GPIOCHIP_IRQ_RESOURCE_HELPERS, > +}; > + > static int dwapb_gpio_set_debounce(struct gpio_chip *gc, > unsigned offset, unsigned debounce) > { > @@ -439,16 +457,6 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, > girq->default_type = IRQ_TYPE_NONE; > > port->pirq = pirq; > - pirq->irqchip.name = DWAPB_DRIVER_NAME; > - pirq->irqchip.irq_ack = dwapb_irq_ack; > - pirq->irqchip.irq_mask = dwapb_irq_mask; > - pirq->irqchip.irq_unmask = dwapb_irq_unmask; > - pirq->irqchip.irq_set_type = dwapb_irq_set_type; > - pirq->irqchip.irq_enable = dwapb_irq_enable; > - pirq->irqchip.irq_disable = dwapb_irq_disable; > -#ifdef CONFIG_PM_SLEEP > - pirq->irqchip.irq_set_wake = dwapb_irq_set_wake; > -#endif > > /* > * Intel ACPI-based platforms mostly have the DesignWare APB GPIO > @@ -475,7 +483,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, > girq->parent_handler = dwapb_irq_handler; > } > > - girq->chip = &pirq->irqchip; > + gpio_irq_chip_set_chip(girq, &dwapb_irq_chip); > > return; > > -- > 2.25.1 > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2022-05-22 21:11 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-18 14:39 [PATCH] gpio: dwapb: Make the irqchip immutable Geert Uytterhoeven 2022-05-18 14:39 ` Geert Uytterhoeven 2022-05-18 15:00 ` Andy Shevchenko 2022-05-18 15:00 ` Andy Shevchenko 2022-05-22 21:10 ` Serge Semin [this message] 2022-05-22 21:10 ` Serge Semin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220522211048.5n6krpzgc4hzv4jg@mobilestation \ --to=fancer.lancer@gmail.com \ --cc=Sergey.Semin@baikalelectronics.ru \ --cc=brgl@bgdev.pl \ --cc=damien.lemoal@wdc.com \ --cc=geert+renesas@glider.be \ --cc=hoan@os.amperecomputing.com \ --cc=linus.walleij@linaro.org \ --cc=linux-gpio@vger.kernel.org \ --cc=linux-riscv@lists.infradead.org \ --cc=maz@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.