lkml.org 
[lkml]   [2020]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v8 07/14] gpio: thunderx: Use the default parent apis for {request,release}_resources
From
Date
Hi Tim,

On 11/03/20 4:57 AM, Tim Harvey wrote:
> On Tue, Apr 30, 2019 at 3:14 AM Lokesh Vutla <lokeshvutla@ti.com> 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@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>
>> ---
>> 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.

Returning -ENOSYS is the right behaviour. If the parent doesn't have the
resources, child driver should not hook it at all.

>
> 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?

If there are no parent resources why should thunderx-gpio request parent
resources at all?

Thanks and regards,
Lokesh

\
 
 \ /
  Last update: 2020-03-11 05:59    [W:0.076 / U:4.780 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site