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

gpio: xlp: use resource management for irqs

Use the resource managed variant of irq_alloc_descs() and remove the
code manually freeing allocated interrupt descriptors.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Bartosz Golaszewski and committed by
Linus Walleij
31bd86d9 e971ac9a

+4 -4
+4 -4
drivers/gpio/gpio-xlp.c
··· 404 404 405 405 /* XLP(MIPS) has fixed range for GPIO IRQs, Vulcan(ARM64) does not */ 406 406 if (soc_type != GPIO_VARIANT_VULCAN) { 407 - irq_base = irq_alloc_descs(-1, XLP_GPIO_IRQ_BASE, gc->ngpio, 0); 407 + irq_base = devm_irq_alloc_descs(&pdev->dev, -1, 408 + XLP_GPIO_IRQ_BASE, 409 + gc->ngpio, 0); 408 410 if (irq_base < 0) { 409 411 dev_err(&pdev->dev, "Failed to allocate IRQ numbers\n"); 410 412 return irq_base; ··· 417 415 418 416 err = gpiochip_add_data(gc, priv); 419 417 if (err < 0) 420 - goto out_free_desc; 418 + return err; 421 419 422 420 err = gpiochip_irqchip_add(gc, &xlp_gpio_irq_chip, irq_base, 423 421 handle_level_irq, IRQ_TYPE_NONE); ··· 435 433 436 434 out_gpio_remove: 437 435 gpiochip_remove(gc); 438 - out_free_desc: 439 - irq_free_descs(irq_base, gc->ngpio); 440 436 return err; 441 437 } 442 438