All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio-uclass: fix gpio flags save condition
@ 2021-01-22 15:23 Kory Maincent
  2021-01-24 20:24 ` Simon Glass
  0 siblings, 1 reply; 6+ messages in thread
From: Kory Maincent @ 2021-01-22 15:23 UTC (permalink / raw)
  To: u-boot

The commit cd2faeba1a moves the location where we save the flags to the gpio
descriptor but it adds a "!" character.
This breaks the condition we expect to save the flags.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
 drivers/gpio/gpio-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 0c01413b58..39db89c004 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -650,7 +650,7 @@ static int _dm_gpio_set_dir_flags(struct gpio_desc *desc, ulong flags)
 	}
 
 	/* save the flags also in descriptor */
-	if (!ret)
+	if (ret)
 		desc->flags = flags;
 
 	return ret;
-- 
2.17.1

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

* [PATCH] gpio-uclass: fix gpio flags save condition
  2021-01-22 15:23 [PATCH] gpio-uclass: fix gpio flags save condition Kory Maincent
@ 2021-01-24 20:24 ` Simon Glass
  2021-01-25 14:27   ` Köry Maincent
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Glass @ 2021-01-24 20:24 UTC (permalink / raw)
  To: u-boot

Hi Kory,

On Fri, 22 Jan 2021 at 08:23, Kory Maincent <kory.maincent@bootlin.com> wrote:
>
> The commit cd2faeba1a moves the location where we save the flags to the gpio
> descriptor but it adds a "!" character.
> This breaks the condition we expect to save the flags.
>
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> ---
>  drivers/gpio/gpio-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

This does indeed seem to be a bug, and the tests do not cover it. But
this happens to be fixed by my GPIO series. I'm about to send out v3
so will copy you on it.

Regards,
Simon

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

* [PATCH] gpio-uclass: fix gpio flags save condition
  2021-01-24 20:24 ` Simon Glass
@ 2021-01-25 14:27   ` Köry Maincent
  2021-02-05  2:45     ` Simon Glass
  0 siblings, 1 reply; 6+ messages in thread
From: Köry Maincent @ 2021-01-25 14:27 UTC (permalink / raw)
  To: u-boot

Hello Simon,

On Sun, 24 Jan 2021 13:24:14 -0700
Simon Glass <sjg@chromium.org> wrote:

> Hi Kory,
> 
> On Fri, 22 Jan 2021 at 08:23, Kory Maincent <kory.maincent@bootlin.com> wrote:
> >
> > The commit cd2faeba1a moves the location where we save the flags to the gpio
> > descriptor but it adds a "!" character.
> > This breaks the condition we expect to save the flags.
> >
> > Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> > ---
> >  drivers/gpio/gpio-uclass.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >  
> 
> This does indeed seem to be a bug, and the tests do not cover it. But
> this happens to be fixed by my GPIO series. I'm about to send out v3
> so will copy you on it.

Thanks.

I have tested your series of patch and it seems to have also an issue with my
use case.
I am working with w1-gpio.
I got this issue: 
=> w1 bus
check_dir_flags: flags 0x16 has GPIOD_IS_OUT and GPIOD_IS_IN
gpio_sunxi PD: PD error: set_dir_flags for gpio PD2 has invalid dir flags 0x16
Bus 0:  onewire  (active)
        w1_eeprom at 0 (0) uclass w1_eeprom : family 0x0



Regards,

K?ry

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

* [PATCH] gpio-uclass: fix gpio flags save condition
  2021-01-25 14:27   ` Köry Maincent
@ 2021-02-05  2:45     ` Simon Glass
  2021-02-05 14:48       ` Köry Maincent
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Glass @ 2021-02-05  2:45 UTC (permalink / raw)
  To: u-boot

Hi K?ry,

On Mon, 25 Jan 2021 at 07:27, K?ry Maincent <kory.maincent@bootlin.com> wrote:
>
> Hello Simon,
>
> On Sun, 24 Jan 2021 13:24:14 -0700
> Simon Glass <sjg@chromium.org> wrote:
>
> > Hi Kory,
> >
> > On Fri, 22 Jan 2021 at 08:23, Kory Maincent <kory.maincent@bootlin.com> wrote:
> > >
> > > The commit cd2faeba1a moves the location where we save the flags to the gpio
> > > descriptor but it adds a "!" character.
> > > This breaks the condition we expect to save the flags.
> > >
> > > Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> > > ---
> > >  drivers/gpio/gpio-uclass.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> >
> > This does indeed seem to be a bug, and the tests do not cover it. But
> > this happens to be fixed by my GPIO series. I'm about to send out v3
> > so will copy you on it.
>
> Thanks.
>
> I have tested your series of patch and it seems to have also an issue with my
> use case.
> I am working with w1-gpio.
> I got this issue:
> => w1 bus
> check_dir_flags: flags 0x16 has GPIOD_IS_OUT and GPIOD_IS_IN
> gpio_sunxi PD: PD error: set_dir_flags for gpio PD2 has invalid dir flags 0x16
> Bus 0:  onewire  (active)
>         w1_eeprom at 0 (0) uclass w1_eeprom : family 0x0

Thank you for that. I think that is because dm_gpio_set_dir_flags()
does not clear the flags first. But we now do actually update
desc->flags, where as before it was just supposed to happen. So I
think this function needs to update to clear the direction flags, then
add in the ones passed.

I have pushed this to u-boot-dm/gpio-working if you can test it again.

Regards,
Simon

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

* [PATCH] gpio-uclass: fix gpio flags save condition
  2021-02-05  2:45     ` Simon Glass
@ 2021-02-05 14:48       ` Köry Maincent
  2021-02-06  2:43         ` Simon Glass
  0 siblings, 1 reply; 6+ messages in thread
From: Köry Maincent @ 2021-02-05 14:48 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Thu, 4 Feb 2021 19:45:22 -0700
Simon Glass <sjg@chromium.org> wrote:


> Thank you for that. I think that is because dm_gpio_set_dir_flags()
> does not clear the flags first. But we now do actually update
> desc->flags, where as before it was just supposed to happen. So I
> think this function needs to update to clear the direction flags, then
> add in the ones passed.
> 
> I have pushed this to u-boot-dm/gpio-working if you can test it again.

I have tested your v4 series of patches and all works well for my onewire on
gpio.
Thanks for your update.

Regards,
K?ry

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

* [PATCH] gpio-uclass: fix gpio flags save condition
  2021-02-05 14:48       ` Köry Maincent
@ 2021-02-06  2:43         ` Simon Glass
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Glass @ 2021-02-06  2:43 UTC (permalink / raw)
  To: u-boot

Hi K?ry,

On Fri, 5 Feb 2021 at 07:48, K?ry Maincent <kory.maincent@bootlin.com> wrote:
>
> Hi Simon,
>
> On Thu, 4 Feb 2021 19:45:22 -0700
> Simon Glass <sjg@chromium.org> wrote:
>
>
> > Thank you for that. I think that is because dm_gpio_set_dir_flags()
> > does not clear the flags first. But we now do actually update
> > desc->flags, where as before it was just supposed to happen. So I
> > think this function needs to update to clear the direction flags, then
> > add in the ones passed.
> >
> > I have pushed this to u-boot-dm/gpio-working if you can test it again.
>
> I have tested your v4 series of patches and all works well for my onewire on
> gpio.
> Thanks for your update.

Thank you. You could reply to the patches with your Tested-by tag if you like.

Regards,
Simon

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

end of thread, other threads:[~2021-02-06  2:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22 15:23 [PATCH] gpio-uclass: fix gpio flags save condition Kory Maincent
2021-01-24 20:24 ` Simon Glass
2021-01-25 14:27   ` Köry Maincent
2021-02-05  2:45     ` Simon Glass
2021-02-05 14:48       ` Köry Maincent
2021-02-06  2:43         ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.