Re: [PATCH v8 07/14] gpio: thunderx: Use the default parent apis for {request,release}_resources
From: Tim Harvey
Date: Tue Mar 10 2020 - 19:27:46 EST
On Tue, Apr 30, 2019 at 3:14 AM Lokesh Vutla <lokeshvutla@xxxxxx> wrote:
>
> 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@xxxxxxxxxxxxxxx
> Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
> Acked-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> Signed-off-by: Lokesh Vutla <lokeshvutla@xxxxxx>
> ---
> Changes since v7:
> - None
>
> drivers/gpio/gpio-thunderx.c | 16 ++++------------
> 1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpio/gpio-thunderx.c b/drivers/gpio/gpio-thunderx.c
> index 1306722faa5a..715371b5102a 100644
> --- a/drivers/gpio/gpio-thunderx.c
> +++ b/drivers/gpio/gpio-thunderx.c
> @@ -363,22 +363,16 @@ 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);
Lokesh,
This patch breaks irq resources for thunderx-gpio as
parent_data->chip->irq_request_resources is undefined thus your new
irq_chip_request_resources_parent() returns -ENOSYS causing this
function to return an error where as before it would happily return 0.
Is the following the correct fix or should we qualify
data->parent_data->chip->irq_request_resources before calling
irq_chip_request_resources_parent() in thunderx-gpio?
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index b3fa2d8..b2435ecb 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -1525,7 +1525,7 @@ int irq_chip_request_resources_parent(struct
irq_data *data)
if (data->chip->irq_request_resources)
return data->chip->irq_request_resources(data);
- return -ENOSYS;
+ return 0;
}
EXPORT_SYMBOL_GPL(irq_chip_request_resources_parent);
Regards,
Tim