Skip to content

Commit ef902f5

Browse files
Linus WalleijBartosz Golaszewski
authored andcommitted
gpio: thunderx: Convert to immutable irq_chip
Convert the driver to immutable irq-chip with a bit of intuition. Whereas in most cases we put the gpiochip_[enable|disable]_irq() calls in the .irq_mask() and .irq_unmask() callbacks, here we need to put them in the .irq_enable() and .irq_disable() callbacks, as this driver uses both .irq_mask() and .irq_mask_ack(). Cc: Marc Zyngier <maz@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent 32585b5 commit ef902f5

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

drivers/gpio/gpio-thunderx.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -354,16 +354,22 @@ static int thunderx_gpio_irq_set_type(struct irq_data *d,
354354
return IRQ_SET_MASK_OK;
355355
}
356356

357-
static void thunderx_gpio_irq_enable(struct irq_data *data)
357+
static void thunderx_gpio_irq_enable(struct irq_data *d)
358358
{
359-
irq_chip_enable_parent(data);
360-
thunderx_gpio_irq_unmask(data);
359+
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
360+
361+
gpiochip_enable_irq(gc, irqd_to_hwirq(d));
362+
irq_chip_enable_parent(d);
363+
thunderx_gpio_irq_unmask(d);
361364
}
362365

363-
static void thunderx_gpio_irq_disable(struct irq_data *data)
366+
static void thunderx_gpio_irq_disable(struct irq_data *d)
364367
{
365-
thunderx_gpio_irq_mask(data);
366-
irq_chip_disable_parent(data);
368+
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
369+
370+
thunderx_gpio_irq_mask(d);
371+
irq_chip_disable_parent(d);
372+
gpiochip_disable_irq(gc, irqd_to_hwirq(d));
367373
}
368374

369375
/*
@@ -372,7 +378,7 @@ static void thunderx_gpio_irq_disable(struct irq_data *data)
372378
* semantics and other acknowledgment tasks associated with the GPIO
373379
* mechanism.
374380
*/
375-
static struct irq_chip thunderx_gpio_irq_chip = {
381+
static const struct irq_chip thunderx_gpio_irq_chip = {
376382
.name = "GPIO",
377383
.irq_enable = thunderx_gpio_irq_enable,
378384
.irq_disable = thunderx_gpio_irq_disable,
@@ -383,8 +389,8 @@ static struct irq_chip thunderx_gpio_irq_chip = {
383389
.irq_eoi = irq_chip_eoi_parent,
384390
.irq_set_affinity = irq_chip_set_affinity_parent,
385391
.irq_set_type = thunderx_gpio_irq_set_type,
386-
387-
.flags = IRQCHIP_SET_TYPE_MASKED
392+
.flags = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_IMMUTABLE,
393+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
388394
};
389395

390396
static int thunderx_gpio_child_to_parent_hwirq(struct gpio_chip *gc,
@@ -526,7 +532,7 @@ static int thunderx_gpio_probe(struct pci_dev *pdev,
526532
chip->set_multiple = thunderx_gpio_set_multiple;
527533
chip->set_config = thunderx_gpio_set_config;
528534
girq = &chip->irq;
529-
girq->chip = &thunderx_gpio_irq_chip;
535+
gpio_irq_chip_set_chip(girq, &thunderx_gpio_irq_chip);
530536
girq->fwnode = of_node_to_fwnode(dev->of_node);
531537
girq->parent_domain =
532538
irq_get_irq_data(txgpio->msix_entries[0].vector)->domain;

0 commit comments

Comments
 (0)