1 From e8287ec10f21877eb0ac4c1fb4e89e42d8bc10da Mon Sep 17 00:00:00 2001
2 From: Tim Harvey <tharvey@gateworks.com>
3 Date: Wed, 11 Mar 2020 08:19:45 -0700
4 Subject: [PATCH 2/7] gpio: thunderx: fix irq_request_resources
6 If there are no parent resources do not call irq_chip_request_resources_parent
7 at all as this will return an error.
9 This resolves a regression where devices using a thunderx gpio as an interrupt
12 Fixes: 0d04d0c ("gpio: thunderx: Use the default parent apis for {request,release}_resources")
13 Signed-off-by: Tim Harvey <tharvey@gateworks.com>
15 drivers/gpio/gpio-thunderx.c | 9 ++++++---
16 1 file changed, 6 insertions(+), 3 deletions(-)
18 --- a/drivers/gpio/gpio-thunderx.c
19 +++ b/drivers/gpio/gpio-thunderx.c
20 @@ -363,15 +363,18 @@ static int thunderx_gpio_irq_request_res
22 struct thunderx_line *txline = irq_data_get_irq_chip_data(data);
23 struct thunderx_gpio *txgpio = txline->txgpio;
24 + struct irq_data *parent_data = data->parent_data;
27 r = gpiochip_lock_as_irq(&txgpio->chip, txline->line);
31 - r = irq_chip_request_resources_parent(data);
33 - gpiochip_unlock_as_irq(&txgpio->chip, txline->line);
34 + if (parent_data && parent_data->chip->irq_request_resources) {
35 + r = irq_chip_request_resources_parent(data);
37 + gpiochip_unlock_as_irq(&txgpio->chip, txline->line);