8c4de51aae4a8d5b1d06f928f98735a584425977
[openwrt/openwrt.git] / target / linux / octeontx / patches-5.4 / 0002-gpio-thunderx-fix-irq_request_resources.patch
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
5
6 If there are no parent resources do not call irq_chip_request_resources_parent
7 at all as this will return an error.
8
9 This resolves a regression where devices using a thunderx gpio as an interrupt
10 would fail probing.
11
12 Fixes: 0d04d0c ("gpio: thunderx: Use the default parent apis for {request,release}_resources")
13 Signed-off-by: Tim Harvey <tharvey@gateworks.com>
14 ---
15 drivers/gpio/gpio-thunderx.c | 9 ++++++---
16 1 file changed, 6 insertions(+), 3 deletions(-)
17
18 diff --git a/drivers/gpio/gpio-thunderx.c b/drivers/gpio/gpio-thunderx.c
19 index 715371b..feda2a2 100644
20 --- a/drivers/gpio/gpio-thunderx.c
21 +++ b/drivers/gpio/gpio-thunderx.c
22 @@ -363,15 +363,18 @@ static int thunderx_gpio_irq_request_resources(struct irq_data *data)
23 {
24 struct thunderx_line *txline = irq_data_get_irq_chip_data(data);
25 struct thunderx_gpio *txgpio = txline->txgpio;
26 + struct irq_data *parent_data = data->parent_data;
27 int r;
28
29 r = gpiochip_lock_as_irq(&txgpio->chip, txline->line);
30 if (r)
31 return r;
32
33 - r = irq_chip_request_resources_parent(data);
34 - if (r)
35 - gpiochip_unlock_as_irq(&txgpio->chip, txline->line);
36 + if (parent_data && parent_data->chip->irq_request_resources) {
37 + r = irq_chip_request_resources_parent(data);
38 + if (r)
39 + gpiochip_unlock_as_irq(&txgpio->chip, txline->line);
40 + }
41
42 return r;
43 }
44 --
45 2.7.4
46