[PATCH v3 1/2] sandbox, test: add test for GPIO_HOG function

Patrick DELAUNAY patrick.delaunay at st.com
Fri May 15 09:13:56 CEST 2020


Hi Heiko,

> From: Heiko Schocher <hs at denx.de>
> Sent: vendredi 15 mai 2020 08:01
> 
> Hello Patrick,
> 
> Am 14.05.2020 um 15:47 schrieb Patrick DELAUNAY:
> > Hi Heiko
> >
> >> From: Heiko Schocher <hs at denx.de>
> >> Sent: mardi 12 mai 2020 09:32
> >>
> >> Hello tom, Patrick,
> >>
[...]
> >>>
> >>> It looks like the  plat->gpiod_flags are not written anymore into
> >>> gpiod through the gpio_dev_request_index() function ...
> >>
> >> Ok, I did now the following change:
> >>
> >> https://github.com/hsdenx/u-boot-test/commits/aristainetos-gpio-v4
> >>
> >> $ git show c4a3295fa6
> >> commit c4a3295fa67f23408ba3ff5552532222f48142f6
> >> Author: Heiko Schocher <hs at denx.de>
> >> Date:   Tue May 12 08:56:40 2020 +0200
> >>
> >>       gpio-uclass.c: save the GPIOD flags also in the gpio descriptor
> >>
> >>       save the GPIOD_ flags also in the gpio descriptor.
> >>
> >>       Signed-off-by: Heiko Schocher <hs at denx.de>
> >>
> >>       Patch-cc: Patrick Delaunay <patrick.delaunay at st.com>
> >>
> >>       Series-changes: 4
> >>       - new in version 4
> >>
> >> diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
> >> index
> >> 757ab7106e..fc94334160 100644
> >> --- a/drivers/gpio/gpio-uclass.c
> >> +++ b/drivers/gpio/gpio-uclass.c
> >> @@ -572,6 +572,9 @@ static int _dm_gpio_set_dir_flags(struct
> >> gpio_desc *desc, ulong flags)
> >>                   return ret;
> >>           }
> >>
> >> +       /* save the flags also in descriptor */
> >> +       desc->flags = flags;
> >> +
> >>           /* GPIOD_ are directly managed by driver in set_dir_flags*/
> >>           if (ops->set_dir_flags) {
> >>                   ret = ops->set_dir_flags(dev, desc->offset, flags);
> >>
> >> and with it, the sandbox tests and the aristainetos2 board works fine
> >> again. I have just started a travis build for it:
> >>
> >> https://travis-ci.org/github/hsdenx/u-boot-test/builds/685995112
> >>
> >> If no errors pop up, I send v4 version of my patchseries.
> >
> > In my serie, normally the update of the desc->flags was done in
> > dm_gpio_set_dir_flags()
> >
> > with the line
> >
> > 	/* update the descriptor flags */
> > 	if (ret)
> > 		desc->flags = flags;
> >
> > not needed in dm_gpio_set_dir (as requested with desc->flags)
> >
> > At first lok, I don't understood the execution path to have desc->flags not
> updated...
> >
> > But in fact I inverse the test (again :-<)
> >
> > 	/* update the descriptor flags */
> > +	if (!ret)
> > -	if (ret)
> > 		desc->flags = flags;
> 
> Ok, this fix works also, thanks!
> 
> > but this test could move in _ dm_gpio_set_deit to be more clear, but I
> > think we need continue to test ret value before to update descriptor
> 
> Moved this into _dm_gpio_set_dir_flags()
> > Sorry for the issue.
> 
> No problem, more problematic was, that I missed to add sandbox tests before and
> patch which adds them is pending for a while!
> > Do you prefer that send a sperate patch to correct this error ?
> 
> I would see this in this patchseries, travis build runs, and I post
> v5 if all is fine, thanks!
> 
> https://travis-ci.org/github/hsdenx/u-boot-test/builds/687305014

Ok, your patch is good for me.

Thanks 
Patrick



More information about the U-Boot mailing list