lkml.org 
[lkml]   [2015]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: gpio-pxa: getting GPIOs by devicetree phandle broken
On Tue, Feb 10, 2015 at 2:38 AM, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> Tyler Hall <tylerwhall@gmail.com> writes:
>
>>> The issue with multiple gpiochips per of-node could be worked around as followed I believe, comments?
>>>
>>> diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
>>> index 08261f2..43984ab 100644
>>> --- a/drivers/gpio/gpiolib-of.c
>>> +++ b/drivers/gpio/gpiolib-of.c
>>> @@ -47,11 +47,12 @@ static int of_gpiochip_find_and_xlate(struct gpio_chip *gc, void *data)
>>> ret = gc->of_xlate(gc, &gg_data->gpiospec, gg_data->flags);
>>> if (ret < 0) {
>>> /* We've found the gpio chip, but the translation failed.
>>> - * Return true to stop looking and return the translation
>>> - * error via out_gpio
>>> + * Store translation error in out_gpio.
>>> + * Return false to keep looking, as more than one GPIO chip
>>> + * could be registered per of-node.
>>> */
>>> gg_data->out_gpio = ERR_PTR(ret);
>>> - return true;
>>> + return false;
>>> }
>>>
>>> gg_data->out_gpio = gpiochip_get_desc(gc, ret);
>>
>> As long as we're ok with multiple gpiochips per of-node, this would
>> work for me. It'll change the preference of which chip returns the
>> error in the case of multiple chips, but that's already undefined
>> behavior.
>
> Looks good to me too, this will solve my issue, and the global behavior would be
> consistent with the former one.
>
> Would you care submitting a proper patch so that we can apply our Reviewed-by,
> Tested-by etc ... ?

Looks ok to me too, if only a little bit hackish. A patch would be
appreciated so we can send it for -fixes as well.


\
 
 \ /
  Last update: 2015-02-10 06:41    [W:0.085 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site