* [PATCH v2] pinctrl: nuvoton: wpcm450: Convert irqchip to IRQCHIP_IMMUTABLE
@ 2022-06-10 0:16 ` Jonathan Neuschäfer
0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Neuschäfer @ 2022-06-10 0:16 UTC (permalink / raw)
To: linux-gpio; +Cc: Jonathan Neuschäfer, Linus Walleij, openbmc, linux-kernel
Commit 6c846d026d490 ("gpio: Don't fiddle with irqchips marked as
immutable") added a warning for irqchips that are not marked with
IRQCHIP_IMMUTABLE.
Convert the pinctrl-wpcm450 driver to an immutable irqchip.
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
v2:
- Add missing gpiochip_*able_irq calls in mask/unmask methods
- Remove unused instance of struct irq_chip in struct struct wpcm450_bank
v1:
- https://lore.kernel.org/lkml/20220606214301.2061467-1-j.neuschaefer@gmx.net/
---
drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
index 0dbeb91f0bf27..d44639ede2ce6 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
@@ -49,7 +49,6 @@ struct wpcm450_bank;
struct wpcm450_gpio {
struct gpio_chip gc;
struct wpcm450_pinctrl *pctrl;
- struct irq_chip irqc;
const struct wpcm450_bank *bank;
};
@@ -142,7 +141,8 @@ static void wpcm450_gpio_irq_ack(struct irq_data *d)
static void wpcm450_gpio_irq_mask(struct irq_data *d)
{
- struct wpcm450_gpio *gpio = gpiochip_get_data(irq_data_get_irq_chip_data(d));
+ struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+ struct wpcm450_gpio *gpio = gpiochip_get_data(gc);
struct wpcm450_pinctrl *pctrl = gpio->pctrl;
unsigned long flags;
unsigned long even;
@@ -157,11 +157,14 @@ static void wpcm450_gpio_irq_mask(struct irq_data *d)
__assign_bit(bit, &even, 0);
iowrite32(even, pctrl->gpio_base + WPCM450_GPEVEN);
raw_spin_unlock_irqrestore(&pctrl->lock, flags);
+
+ gpiochip_disable_irq(gc, d->hwirq);
}
static void wpcm450_gpio_irq_unmask(struct irq_data *d)
{
- struct wpcm450_gpio *gpio = gpiochip_get_data(irq_data_get_irq_chip_data(d));
+ struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+ struct wpcm450_gpio *gpio = gpiochip_get_data(gc);
struct wpcm450_pinctrl *pctrl = gpio->pctrl;
unsigned long flags;
unsigned long even;
@@ -171,6 +174,8 @@ static void wpcm450_gpio_irq_unmask(struct irq_data *d)
if (bit < 0)
return;
+ gpiochip_enable_irq(gc, d->hwirq);
+
raw_spin_lock_irqsave(&pctrl->lock, flags);
even = ioread32(pctrl->gpio_base + WPCM450_GPEVEN);
__assign_bit(bit, &even, 1);
@@ -293,6 +298,8 @@ static const struct irq_chip wpcm450_gpio_irqchip = {
.irq_unmask = wpcm450_gpio_irq_unmask,
.irq_mask = wpcm450_gpio_irq_mask,
.irq_set_type = wpcm450_gpio_set_irq_type,
+ .flags = IRQCHIP_IMMUTABLE,
+ GPIOCHIP_IRQ_RESOURCE_HELPERS,
};
static void wpcm450_gpio_irqhandler(struct irq_desc *desc)
@@ -1068,9 +1075,8 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
gpio->gc.fwnode = child;
gpio->gc.add_pin_ranges = wpcm450_gpio_add_pin_ranges;
- gpio->irqc = wpcm450_gpio_irqchip;
girq = &gpio->gc.irq;
- girq->chip = &gpio->irqc;
+ gpio_irq_chip_set_chip(girq, &wpcm450_gpio_irqchip);
girq->parent_handler = wpcm450_gpio_irqhandler;
girq->parents = devm_kcalloc(dev, WPCM450_NUM_GPIO_IRQS,
sizeof(*girq->parents), GFP_KERNEL);
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2] pinctrl: nuvoton: wpcm450: Convert irqchip to IRQCHIP_IMMUTABLE
@ 2022-06-10 0:16 ` Jonathan Neuschäfer
0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Neuschäfer @ 2022-06-10 0:16 UTC (permalink / raw)
To: linux-gpio; +Cc: linux-kernel, Linus Walleij, Jonathan Neuschäfer, openbmc
Commit 6c846d026d490 ("gpio: Don't fiddle with irqchips marked as
immutable") added a warning for irqchips that are not marked with
IRQCHIP_IMMUTABLE.
Convert the pinctrl-wpcm450 driver to an immutable irqchip.
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
v2:
- Add missing gpiochip_*able_irq calls in mask/unmask methods
- Remove unused instance of struct irq_chip in struct struct wpcm450_bank
v1:
- https://lore.kernel.org/lkml/20220606214301.2061467-1-j.neuschaefer@gmx.net/
---
drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
index 0dbeb91f0bf27..d44639ede2ce6 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
@@ -49,7 +49,6 @@ struct wpcm450_bank;
struct wpcm450_gpio {
struct gpio_chip gc;
struct wpcm450_pinctrl *pctrl;
- struct irq_chip irqc;
const struct wpcm450_bank *bank;
};
@@ -142,7 +141,8 @@ static void wpcm450_gpio_irq_ack(struct irq_data *d)
static void wpcm450_gpio_irq_mask(struct irq_data *d)
{
- struct wpcm450_gpio *gpio = gpiochip_get_data(irq_data_get_irq_chip_data(d));
+ struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+ struct wpcm450_gpio *gpio = gpiochip_get_data(gc);
struct wpcm450_pinctrl *pctrl = gpio->pctrl;
unsigned long flags;
unsigned long even;
@@ -157,11 +157,14 @@ static void wpcm450_gpio_irq_mask(struct irq_data *d)
__assign_bit(bit, &even, 0);
iowrite32(even, pctrl->gpio_base + WPCM450_GPEVEN);
raw_spin_unlock_irqrestore(&pctrl->lock, flags);
+
+ gpiochip_disable_irq(gc, d->hwirq);
}
static void wpcm450_gpio_irq_unmask(struct irq_data *d)
{
- struct wpcm450_gpio *gpio = gpiochip_get_data(irq_data_get_irq_chip_data(d));
+ struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+ struct wpcm450_gpio *gpio = gpiochip_get_data(gc);
struct wpcm450_pinctrl *pctrl = gpio->pctrl;
unsigned long flags;
unsigned long even;
@@ -171,6 +174,8 @@ static void wpcm450_gpio_irq_unmask(struct irq_data *d)
if (bit < 0)
return;
+ gpiochip_enable_irq(gc, d->hwirq);
+
raw_spin_lock_irqsave(&pctrl->lock, flags);
even = ioread32(pctrl->gpio_base + WPCM450_GPEVEN);
__assign_bit(bit, &even, 1);
@@ -293,6 +298,8 @@ static const struct irq_chip wpcm450_gpio_irqchip = {
.irq_unmask = wpcm450_gpio_irq_unmask,
.irq_mask = wpcm450_gpio_irq_mask,
.irq_set_type = wpcm450_gpio_set_irq_type,
+ .flags = IRQCHIP_IMMUTABLE,
+ GPIOCHIP_IRQ_RESOURCE_HELPERS,
};
static void wpcm450_gpio_irqhandler(struct irq_desc *desc)
@@ -1068,9 +1075,8 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
gpio->gc.fwnode = child;
gpio->gc.add_pin_ranges = wpcm450_gpio_add_pin_ranges;
- gpio->irqc = wpcm450_gpio_irqchip;
girq = &gpio->gc.irq;
- girq->chip = &gpio->irqc;
+ gpio_irq_chip_set_chip(girq, &wpcm450_gpio_irqchip);
girq->parent_handler = wpcm450_gpio_irqhandler;
girq->parents = devm_kcalloc(dev, WPCM450_NUM_GPIO_IRQS,
sizeof(*girq->parents), GFP_KERNEL);
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] pinctrl: nuvoton: wpcm450: Convert irqchip to IRQCHIP_IMMUTABLE
2022-06-10 0:16 ` Jonathan Neuschäfer
(?)
@ 2022-06-10 12:07 ` Andy Shevchenko
2022-06-13 9:44 ` Jonathan Neuschäfer
-1 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2022-06-10 12:07 UTC (permalink / raw)
To: Jonathan Neuschäfer
Cc: open list:GPIO SUBSYSTEM, Linus Walleij, OpenBMC Maillist,
Linux Kernel Mailing List
On Fri, Jun 10, 2022 at 2:24 AM Jonathan Neuschäfer
<j.neuschaefer@gmx.net> wrote:
>
> Commit 6c846d026d490 ("gpio: Don't fiddle with irqchips marked as
> immutable") added a warning for irqchips that are not marked with
> IRQCHIP_IMMUTABLE.
>
> Convert the pinctrl-wpcm450 driver to an immutable irqchip.
...
> + gpiochip_disable_irq(gc, d->hwirq);
> + gpiochip_enable_irq(gc, d->hwirq);
Can you use the helper (*) as stated in the documentation?
*) irqd_to_hwirq(d)
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] pinctrl: nuvoton: wpcm450: Convert irqchip to IRQCHIP_IMMUTABLE
2022-06-10 12:07 ` Andy Shevchenko
@ 2022-06-13 9:44 ` Jonathan Neuschäfer
0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Neuschäfer @ 2022-06-13 9:44 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Neuschäfer, open list:GPIO SUBSYSTEM,
Linus Walleij, OpenBMC Maillist, Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 655 bytes --]
On Fri, Jun 10, 2022 at 02:07:55PM +0200, Andy Shevchenko wrote:
> On Fri, Jun 10, 2022 at 2:24 AM Jonathan Neuschäfer
> <j.neuschaefer@gmx.net> wrote:
> >
> > Commit 6c846d026d490 ("gpio: Don't fiddle with irqchips marked as
> > immutable") added a warning for irqchips that are not marked with
> > IRQCHIP_IMMUTABLE.
> >
> > Convert the pinctrl-wpcm450 driver to an immutable irqchip.
>
> ...
>
> > + gpiochip_disable_irq(gc, d->hwirq);
>
> > + gpiochip_enable_irq(gc, d->hwirq);
>
> Can you use the helper (*) as stated in the documentation?
>
> *) irqd_to_hwirq(d)
Ah, oops. I'll fix it.
Thanks,
Jonathan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] pinctrl: nuvoton: wpcm450: Convert irqchip to IRQCHIP_IMMUTABLE
@ 2022-06-13 9:44 ` Jonathan Neuschäfer
0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Neuschäfer @ 2022-06-13 9:44 UTC (permalink / raw)
To: Andy Shevchenko
Cc: open list:GPIO SUBSYSTEM, Linus Walleij,
Jonathan Neuschäfer, Linux Kernel Mailing List,
OpenBMC Maillist
[-- Attachment #1: Type: text/plain, Size: 655 bytes --]
On Fri, Jun 10, 2022 at 02:07:55PM +0200, Andy Shevchenko wrote:
> On Fri, Jun 10, 2022 at 2:24 AM Jonathan Neuschäfer
> <j.neuschaefer@gmx.net> wrote:
> >
> > Commit 6c846d026d490 ("gpio: Don't fiddle with irqchips marked as
> > immutable") added a warning for irqchips that are not marked with
> > IRQCHIP_IMMUTABLE.
> >
> > Convert the pinctrl-wpcm450 driver to an immutable irqchip.
>
> ...
>
> > + gpiochip_disable_irq(gc, d->hwirq);
>
> > + gpiochip_enable_irq(gc, d->hwirq);
>
> Can you use the helper (*) as stated in the documentation?
>
> *) irqd_to_hwirq(d)
Ah, oops. I'll fix it.
Thanks,
Jonathan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-06-13 9:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 0:16 [PATCH v2] pinctrl: nuvoton: wpcm450: Convert irqchip to IRQCHIP_IMMUTABLE Jonathan Neuschäfer
2022-06-10 0:16 ` Jonathan Neuschäfer
2022-06-10 12:07 ` Andy Shevchenko
2022-06-13 9:44 ` Jonathan Neuschäfer
2022-06-13 9:44 ` Jonathan Neuschäfer
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.