[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181109143950.gy7swu6vgaqgg7dw@pengutronix.de>
Date: Fri, 9 Nov 2018 15:39:50 +0100
From: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: Bamvor Jian Zhang <bamv2005@...il.com>,
Linus Walleij <linus.walleij@...aro.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] gpio: mockup: fix indicated direction
On Fri, Nov 09, 2018 at 02:53:16PM +0100, Bartosz Golaszewski wrote:
> pt., 9 lis 2018 o 14:10 Uwe Kleine-König
> <u.kleine-koenig@...gutronix.de> napisał(a):
> >
> > Hello,
> >
> > On Fri, Nov 09, 2018 at 01:24:36PM +0100, Bartosz Golaszewski wrote:
> > > pt., 9 lis 2018 o 12:54 Uwe Kleine-König
> > > <u.kleine-koenig@...gutronix.de> napisał(a):
> > > > On Fri, Nov 09, 2018 at 12:13:44PM +0100, Bartosz Golaszewski wrote:
> > > > > czw., 8 lis 2018 o 21:35 Uwe Kleine-König
> > > > > <u.kleine-koenig@...gutronix.de> napisał(a):
> > > > > > On Thu, Nov 08, 2018 at 05:52:53PM +0100, Bartosz Golaszewski wrote:
> > > > > > > Commit 3edfb7bd76bd ("gpiolib: Show correct direction from the
> > > > > > > beginning") fixed an existing issue but broke libgpiod tests by
> > > > > > > changing the default direction of dummy lines to output.
> > > > > >
> > > > > > The indicated commit only changed what was shown in debugfs, but didn't
> > > > > > touch the actual direction of a GPIO, doesn't it? If someone called
> > > > > > gpiod_get_direction before it would have returned "output", too, unless
> > > > > > I miss something.
> > > > > >
> > > > >
> > > > > This commit (3edfb7bd76bd) sets the correct direction of the line by
> > > > > actually calling get_direction() instead of assuming input if
> > > > > direction_input is not NULL. It just so happened that previously the
> > > > > default direction of gpio-mockup lines was output but it would be
> > > > > displayed as input due to this inconsistency.
> > > >
> > > > Does the test that fails since 3edfb7bd76bd use debugfs/gpio to find out
> > > > the direction of a gpio? I'd say it's a bad idea to depend on this as
> > > > (AFAICT) debugfs is only a debug aid and you shouldn't depend on stuff
> > > > contained in it.
> > >
> > > No, this is what we get from the LINEINFO ioctl(). I only use debugfs
> > > for triggering dummy interrupts.
> >
> > A right, gpio_ioctl uses these flags, too.
> >
> > > > I'd weaken the commit log a bit to not claim that the commit broke
> > > > libgpiod but that it only made the inconsistency visible. After all this
> > > > commit didn't "change the default direction of dummy lines to output",
> > > > they were an output already before.
> > >
> > > Well it did break the tests you know. ;)
> >
> > Which test failed exactly?
> >
>
> All gpioinfo tests that check the output of this command and expect to
> see input as line direction.
This wasn't the answer I expected. The background of my question was:
This failing test seems to expect that a given GPIO is an input. If that
expectation already exists after the gpio is only requested, then the
test is broken and a fix is necessary there.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Powered by blists - more mailing lists