Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Linus Walleij and committed by
Bartosz Golaszewski
ef902f54 32585b56

+16 -10
+16 -10
drivers/gpio/gpio-thunderx.c
··· 354 354 return IRQ_SET_MASK_OK; 355 355 } 356 356 357 - static void thunderx_gpio_irq_enable(struct irq_data *data) 357 + static void thunderx_gpio_irq_enable(struct irq_data *d) 358 358 { 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); 361 364 } 362 365 363 - static void thunderx_gpio_irq_disable(struct irq_data *data) 366 + static void thunderx_gpio_irq_disable(struct irq_data *d) 364 367 { 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)); 367 373 } 368 374 369 375 /* ··· 378 372 * semantics and other acknowledgment tasks associated with the GPIO 379 373 * mechanism. 380 374 */ 381 - static struct irq_chip thunderx_gpio_irq_chip = { 375 + static const struct irq_chip thunderx_gpio_irq_chip = { 382 376 .name = "GPIO", 383 377 .irq_enable = thunderx_gpio_irq_enable, 384 378 .irq_disable = thunderx_gpio_irq_disable, ··· 389 383 .irq_eoi = irq_chip_eoi_parent, 390 384 .irq_set_affinity = irq_chip_set_affinity_parent, 391 385 .irq_set_type = thunderx_gpio_irq_set_type, 392 - 393 - .flags = IRQCHIP_SET_TYPE_MASKED 386 + .flags = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_IMMUTABLE, 387 + GPIOCHIP_IRQ_RESOURCE_HELPERS, 394 388 }; 395 389 396 390 static int thunderx_gpio_child_to_parent_hwirq(struct gpio_chip *gc, ··· 532 526 chip->set_multiple = thunderx_gpio_set_multiple; 533 527 chip->set_config = thunderx_gpio_set_config; 534 528 girq = &chip->irq; 535 - girq->chip = &thunderx_gpio_irq_chip; 529 + gpio_irq_chip_set_chip(girq, &thunderx_gpio_irq_chip); 536 530 girq->fwnode = of_node_to_fwnode(dev->of_node); 537 531 girq->parent_domain = 538 532 irq_get_irq_data(txgpio->msix_entries[0].vector)->domain;