Skip to content

Commit 48bd5c3

Browse files
geertuLinus Walleij
authored andcommitted
pinctrl: starfive: Make the irqchip immutable
Commit 6c846d0 ("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 starfive driver: gpio gpiochip0: (11910000.pinctrl): not an immutable chip, please consider fixing it! Fix this by making the irqchip in the starfive driver immutable. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/5eb66be34356afd5eb0ea9027329e0939d03d3a0.1652884852.git.geert+renesas@glider.be Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 2e1ccc6 commit 48bd5c3

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

drivers/pinctrl/pinctrl-starfive.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,8 @@ static void starfive_irq_mask(struct irq_data *d)
10741074
value = readl_relaxed(ie) & ~mask;
10751075
writel_relaxed(value, ie);
10761076
raw_spin_unlock_irqrestore(&sfp->lock, flags);
1077+
1078+
gpiochip_disable_irq(&sfp->gc, d->hwirq);
10771079
}
10781080

10791081
static void starfive_irq_mask_ack(struct irq_data *d)
@@ -1102,6 +1104,8 @@ static void starfive_irq_unmask(struct irq_data *d)
11021104
unsigned long flags;
11031105
u32 value;
11041106

1107+
gpiochip_enable_irq(&sfp->gc, d->hwirq);
1108+
11051109
raw_spin_lock_irqsave(&sfp->lock, flags);
11061110
value = readl_relaxed(ie) | mask;
11071111
writel_relaxed(value, ie);
@@ -1163,14 +1167,15 @@ static int starfive_irq_set_type(struct irq_data *d, unsigned int trigger)
11631167
return 0;
11641168
}
11651169

1166-
static struct irq_chip starfive_irq_chip = {
1170+
static const struct irq_chip starfive_irq_chip = {
11671171
.name = "StarFive GPIO",
11681172
.irq_ack = starfive_irq_ack,
11691173
.irq_mask = starfive_irq_mask,
11701174
.irq_mask_ack = starfive_irq_mask_ack,
11711175
.irq_unmask = starfive_irq_unmask,
11721176
.irq_set_type = starfive_irq_set_type,
1173-
.flags = IRQCHIP_SET_TYPE_MASKED,
1177+
.flags = IRQCHIP_IMMUTABLE | IRQCHIP_SET_TYPE_MASKED,
1178+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
11741179
};
11751180

11761181
static void starfive_gpio_irq_handler(struct irq_desc *desc)
@@ -1308,7 +1313,7 @@ static int starfive_probe(struct platform_device *pdev)
13081313
sfp->gc.base = -1;
13091314
sfp->gc.ngpio = NR_GPIOS;
13101315

1311-
sfp->gc.irq.chip = &starfive_irq_chip;
1316+
gpio_irq_chip_set_chip(&sfp->gc.irq, &starfive_irq_chip);
13121317
sfp->gc.irq.parent_handler = starfive_gpio_irq_handler;
13131318
sfp->gc.irq.num_parents = 1;
13141319
sfp->gc.irq.parents = devm_kcalloc(dev, sfp->gc.irq.num_parents,

0 commit comments

Comments
 (0)