linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 2/2] gpio: of: Allow -gpio suffix for property names
       [not found]   ` <CACRpkdbF3N5bFY1sFkabDHO7J0F8sb1uU0xL+mjkuF-z7VocMQ@mail.gmail.com>
@ 2014-06-02 23:04     ` Tony Lindgren
  2014-06-02 23:14       ` Tony Lindgren
  0 siblings, 1 reply; 4+ messages in thread
From: Tony Lindgren @ 2014-06-02 23:04 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Thierry Reding, Alexandre Courbot, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-omap

* Linus Walleij <linus.walleij@linaro.org> [140425 00:53]:
> On Wed, Apr 23, 2014 at 5:28 PM, Thierry Reding
> <thierry.reding@gmail.com> wrote:
> 
> > From: Thierry Reding <treding@nvidia.com>
> >
> > Many bindings use the -gpio suffix in property names. Support this in
> > addition to the -gpios suffix when requesting GPIOs using the new
> > descriptor-based API.
> >
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> 
> It appears this can save quite a lot of code in drivers, work that
> I trust Thierry to persue based on this to some extent so patch is
> tentatively applied unless something comes up.

Looks like this patch causes a regression where GPIOs on I2C will
no longer return -EPROBE_DEFER but seem to return -ENOENT instead.

This breaks drivers using things like devm_gpiod_get_index()
on a GPIO that's on a I2C bus not probed yet.

Reverting commit dd34c37aa3e (gpio: of: Allow -gpio suffix for
property names) fixes things.

Regards,

Tony

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] gpio: of: Allow -gpio suffix for property names
  2014-06-02 23:04     ` [PATCH 2/2] gpio: of: Allow -gpio suffix for property names Tony Lindgren
@ 2014-06-02 23:14       ` Tony Lindgren
  2014-06-04 13:08         ` Thierry Reding
  2014-06-12  8:18         ` Linus Walleij
  0 siblings, 2 replies; 4+ messages in thread
From: Tony Lindgren @ 2014-06-02 23:14 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Thierry Reding, Alexandre Courbot, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-omap

* Tony Lindgren <tony@atomide.com> [140602 16:06]:
> * Linus Walleij <linus.walleij@linaro.org> [140425 00:53]:
> > On Wed, Apr 23, 2014 at 5:28 PM, Thierry Reding
> > <thierry.reding@gmail.com> wrote:
> > 
> > > From: Thierry Reding <treding@nvidia.com>
> > >
> > > Many bindings use the -gpio suffix in property names. Support this in
> > > addition to the -gpios suffix when requesting GPIOs using the new
> > > descriptor-based API.
> > >
> > > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > 
> > It appears this can save quite a lot of code in drivers, work that
> > I trust Thierry to persue based on this to some extent so patch is
> > tentatively applied unless something comes up.
> 
> Looks like this patch causes a regression where GPIOs on I2C will
> no longer return -EPROBE_DEFER but seem to return -ENOENT instead.
> 
> This breaks drivers using things like devm_gpiod_get_index()
> on a GPIO that's on a I2C bus not probed yet.
> 
> Reverting commit dd34c37aa3e (gpio: of: Allow -gpio suffix for
> property names) fixes things.

Looks like something like below fixes the issue.

Regards,

Tony

8< -----------------------
From: Tony Lindgren <tony@atomide.com>
Date: Mon, 2 Jun 2014 16:13:46 -0700
Subject: [PATCH] gpio: of: Fix handling for deferred probe for -gpio suffix

Commit dd34c37aa3e (gpio: of: Allow -gpio suffix for property names)
added parsing for both -gpio and -gpios suffix but also changed
the handling for deferred probe unintentionally. Because of the
looping the second name will now return -ENOENT instead of
-EPROBE_DEFER. Fix the issue by breaking out of the loop if
-EPROBE_DEFER is encountered.

Signed-off-by: Tony Lindgren <tony@atomide.com>

--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2614,7 +2614,7 @@ static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,
 
 		desc = of_get_named_gpiod_flags(dev->of_node, prop_name, idx,
 						&of_flags);
-		if (!IS_ERR(desc))
+		if (!IS_ERR(desc) || (PTR_ERR(desc) == -EPROBE_DEFER))
 			break;
 	}
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] gpio: of: Allow -gpio suffix for property names
  2014-06-02 23:14       ` Tony Lindgren
@ 2014-06-04 13:08         ` Thierry Reding
  2014-06-12  8:18         ` Linus Walleij
  1 sibling, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2014-06-04 13:08 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Linus Walleij, Alexandre Courbot, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-omap

[-- Attachment #1: Type: text/plain, Size: 2344 bytes --]

On Mon, Jun 02, 2014 at 04:14:23PM -0700, Tony Lindgren wrote:
> * Tony Lindgren <tony@atomide.com> [140602 16:06]:
> > * Linus Walleij <linus.walleij@linaro.org> [140425 00:53]:
> > > On Wed, Apr 23, 2014 at 5:28 PM, Thierry Reding
> > > <thierry.reding@gmail.com> wrote:
> > > 
> > > > From: Thierry Reding <treding@nvidia.com>
> > > >
> > > > Many bindings use the -gpio suffix in property names. Support this in
> > > > addition to the -gpios suffix when requesting GPIOs using the new
> > > > descriptor-based API.
> > > >
> > > > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > > 
> > > It appears this can save quite a lot of code in drivers, work that
> > > I trust Thierry to persue based on this to some extent so patch is
> > > tentatively applied unless something comes up.
> > 
> > Looks like this patch causes a regression where GPIOs on I2C will
> > no longer return -EPROBE_DEFER but seem to return -ENOENT instead.
> > 
> > This breaks drivers using things like devm_gpiod_get_index()
> > on a GPIO that's on a I2C bus not probed yet.
> > 
> > Reverting commit dd34c37aa3e (gpio: of: Allow -gpio suffix for
> > property names) fixes things.
> 
> Looks like something like below fixes the issue.
> 
> Regards,
> 
> Tony
> 
> 8< -----------------------
> From: Tony Lindgren <tony@atomide.com>
> Date: Mon, 2 Jun 2014 16:13:46 -0700
> Subject: [PATCH] gpio: of: Fix handling for deferred probe for -gpio suffix
> 
> Commit dd34c37aa3e (gpio: of: Allow -gpio suffix for property names)
> added parsing for both -gpio and -gpios suffix but also changed
> the handling for deferred probe unintentionally. Because of the
> looping the second name will now return -ENOENT instead of
> -EPROBE_DEFER. Fix the issue by breaking out of the loop if
> -EPROBE_DEFER is encountered.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -2614,7 +2614,7 @@ static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,
>  
>  		desc = of_get_named_gpiod_flags(dev->of_node, prop_name, idx,
>  						&of_flags);
> -		if (!IS_ERR(desc))
> +		if (!IS_ERR(desc) || (PTR_ERR(desc) == -EPROBE_DEFER))
>  			break;
>  	}

This looks good to me:

Reviewed-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] gpio: of: Allow -gpio suffix for property names
  2014-06-02 23:14       ` Tony Lindgren
  2014-06-04 13:08         ` Thierry Reding
@ 2014-06-12  8:18         ` Linus Walleij
  1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2014-06-12  8:18 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Thierry Reding, Alexandre Courbot, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, Linux-OMAP

On Tue, Jun 3, 2014 at 1:14 AM, Tony Lindgren <tony@atomide.com> wrote:

> Looks like something like below fixes the issue.
>
> Regards,
>
> Tony
>
> 8< -----------------------
> From: Tony Lindgren <tony@atomide.com>
> Date: Mon, 2 Jun 2014 16:13:46 -0700
> Subject: [PATCH] gpio: of: Fix handling for deferred probe for -gpio suffix
>
> Commit dd34c37aa3e (gpio: of: Allow -gpio suffix for property names)
> added parsing for both -gpio and -gpios suffix but also changed
> the handling for deferred probe unintentionally. Because of the
> looping the second name will now return -ENOENT instead of
> -EPROBE_DEFER. Fix the issue by breaking out of the loop if
> -EPROBE_DEFER is encountered.
>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Patch applied for fixes with Thierry's Reveiwed-by tag.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-12  8:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1398266889-17489-1-git-send-email-thierry.reding@gmail.com>
     [not found] ` <1398266889-17489-2-git-send-email-thierry.reding@gmail.com>
     [not found]   ` <CACRpkdbF3N5bFY1sFkabDHO7J0F8sb1uU0xL+mjkuF-z7VocMQ@mail.gmail.com>
2014-06-02 23:04     ` [PATCH 2/2] gpio: of: Allow -gpio suffix for property names Tony Lindgren
2014-06-02 23:14       ` Tony Lindgren
2014-06-04 13:08         ` Thierry Reding
2014-06-12  8:18         ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).