blob: 44d91da52955e7f3b7f7857cd5b2bf3b302f9aea [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From e8287ec10f21877eb0ac4c1fb4e89e42d8bc10da Mon Sep 17 00:00:00 2001
2From: Tim Harvey <tharvey@gateworks.com>
3Date: Wed, 11 Mar 2020 08:19:45 -0700
4Subject: [PATCH 2/7] gpio: thunderx: fix irq_request_resources
5
6If there are no parent resources do not call irq_chip_request_resources_parent
7at all as this will return an error.
8
9This resolves a regression where devices using a thunderx gpio as an interrupt
10would fail probing.
11
12Fixes: 0d04d0c ("gpio: thunderx: Use the default parent apis for {request,release}_resources")
13Signed-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--- 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
21 {
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;
25 int r;
26
27 r = gpiochip_lock_as_irq(&txgpio->chip, txline->line);
28 if (r)
29 return r;
30
31- r = irq_chip_request_resources_parent(data);
32- if (r)
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);
36+ if (r)
37+ gpiochip_unlock_as_irq(&txgpio->chip, txline->line);
38+ }
39
40 return r;
41 }