Skip to content

Commit

Permalink
gpio: thunderx: Use the default parent apis for {request,release}_res…
Browse files Browse the repository at this point in the history
…ources

thunderx_gpio_irq_{request,release}_resources apis are trying to
{request,release} resources on parent interrupt. There are default
apis doing the same. Use the default parent apis instead of writing
the same code snippet.

Cc: linux-gpio@vger.kernel.org
Cc: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
  • Loading branch information
Lokesh Vutla authored and Marc Zyngier committed May 1, 2019
1 parent 2bd1298 commit 0d04d0c
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions drivers/gpio/gpio-thunderx.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,33 +363,25 @@ static int thunderx_gpio_irq_request_resources(struct irq_data *data)
{
struct thunderx_line *txline = irq_data_get_irq_chip_data(data);
struct thunderx_gpio *txgpio = txline->txgpio;
struct irq_data *parent_data = data->parent_data;
int r;

r = gpiochip_lock_as_irq(&txgpio->chip, txline->line);
if (r)
return r;

if (parent_data && parent_data->chip->irq_request_resources) {
r = parent_data->chip->irq_request_resources(parent_data);
if (r)
goto error;
}
r = irq_chip_request_resources_parent(data);
if (r)
gpiochip_unlock_as_irq(&txgpio->chip, txline->line);

return 0;
error:
gpiochip_unlock_as_irq(&txgpio->chip, txline->line);
return r;
}

static void thunderx_gpio_irq_release_resources(struct irq_data *data)
{
struct thunderx_line *txline = irq_data_get_irq_chip_data(data);
struct thunderx_gpio *txgpio = txline->txgpio;
struct irq_data *parent_data = data->parent_data;

if (parent_data && parent_data->chip->irq_release_resources)
parent_data->chip->irq_release_resources(parent_data);
irq_chip_release_resources_parent(data);

gpiochip_unlock_as_irq(&txgpio->chip, txline->line);
}
Expand Down

0 comments on commit 0d04d0c

Please sign in to comment.