diff mbox

selftests: gpio: gpio-mockup-chardev GPIOHANDLE_REQUEST_OUTPUT fix

Message ID 20180606174424.9630-1-rafael.tinoco@linaro.org (mailing list archive)
State New
Headers show

Commit Message

Rafael David Tinoco June 6, 2018, 5:44 p.m. UTC
Following logic from commit: 22f6592b23, GPIOHANDLE_REQUEST_OUTPUT
should handle errors same way as GPIOHANDLE_REQUEST_INPUT does, or else
the following error occurs:

gpio-mockup-chardev: gpio<gpiochip1> line<0> test flag<0x2> value<0>: No
such file or directory

despite the real result of gpio_pin_test(), gpio_debugfs_get() and
gpiotools_request_linehandle() functions.

Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
---
 tools/testing/selftests/gpio/gpio-mockup-chardev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Linus Walleij June 14, 2018, 2:42 p.m. UTC | #1
On Wed, Jun 6, 2018 at 7:44 PM, Rafael David Tinoco
<rafael.tinoco@linaro.org> wrote:

> Following logic from commit: 22f6592b23, GPIOHANDLE_REQUEST_OUTPUT
> should handle errors same way as GPIOHANDLE_REQUEST_INPUT does, or else
> the following error occurs:
>
> gpio-mockup-chardev: gpio<gpiochip1> line<0> test flag<0x2> value<0>: No
> such file or directory
>
> despite the real result of gpio_pin_test(), gpio_debugfs_get() and
> gpiotools_request_linehandle() functions.
>
> Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>

Bartosz, does this look OK to you?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael David Tinoco June 28, 2018, 1:15 a.m. UTC | #2
Linus, Bartosz,

This was discovered during our investigations of a functional tests
regression/error:

https://bugs.linaro.org/show_bug.cgi?id=3769

Which turned out to be related to missing CONFIG_ARM{64}_MODULE_PLTS
config in our builds.

However, during investigations, we realized the functional test had
the issues best described in comment:

https://bugs.linaro.org/show_bug.cgi?id=3769#c3

Related to errno variable being considered outside the error scope.

Thank you
Rafael

On Thu, 14 Jun 2018 at 11:42, Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Wed, Jun 6, 2018 at 7:44 PM, Rafael David Tinoco
> <rafael.tinoco@linaro.org> wrote:
>
> > Following logic from commit: 22f6592b23, GPIOHANDLE_REQUEST_OUTPUT
> > should handle errors same way as GPIOHANDLE_REQUEST_INPUT does, or else
> > the following error occurs:
> >
> > gpio-mockup-chardev: gpio<gpiochip1> line<0> test flag<0x2> value<0>: No
> > such file or directory
> >
> > despite the real result of gpio_pin_test(), gpio_debugfs_get() and
> > gpiotools_request_linehandle() functions.
> >
> > Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
>
> Bartosz, does this look OK to you?
>
> Yours,
> Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij July 9, 2018, 2:08 p.m. UTC | #3
On Wed, Jun 6, 2018 at 7:44 PM Rafael David Tinoco
<rafael.tinoco@linaro.org> wrote:

> Following logic from commit: 22f6592b23, GPIOHANDLE_REQUEST_OUTPUT
> should handle errors same way as GPIOHANDLE_REQUEST_INPUT does, or else
> the following error occurs:
>
> gpio-mockup-chardev: gpio<gpiochip1> line<0> test flag<0x2> value<0>: No
> such file or directory
>
> despite the real result of gpio_pin_test(), gpio_debugfs_get() and
> gpiotools_request_linehandle() functions.
>
> Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>

Patch applied. Sorry for forgetting about it.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bartosz Golaszewski July 9, 2018, 3:05 p.m. UTC | #4
2018-07-09 16:08 GMT+02:00 Linus Walleij <linus.walleij@linaro.org>:
> On Wed, Jun 6, 2018 at 7:44 PM Rafael David Tinoco
> <rafael.tinoco@linaro.org> wrote:
>
>> Following logic from commit: 22f6592b23, GPIOHANDLE_REQUEST_OUTPUT
>> should handle errors same way as GPIOHANDLE_REQUEST_INPUT does, or else
>> the following error occurs:
>>
>> gpio-mockup-chardev: gpio<gpiochip1> line<0> test flag<0x2> value<0>: No
>> such file or directory
>>
>> despite the real result of gpio_pin_test(), gpio_debugfs_get() and
>> gpiotools_request_linehandle() functions.
>>
>> Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
>
> Patch applied. Sorry for forgetting about it.
>
> Yours,
> Linus Walleij

Oops somehow I just now noticed it in my inbox. It's too late anyway,
but it looks fine for me.

Bart
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tools/testing/selftests/gpio/gpio-mockup-chardev.c b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
index 667e916fa7cc..f8d468f54e98 100644
--- a/tools/testing/selftests/gpio/gpio-mockup-chardev.c
+++ b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
@@ -225,10 +225,10 @@  int gpio_pin_test(struct gpiochip_info *cinfo, int line, int flag, int value)
 		if (flag & GPIOHANDLE_REQUEST_ACTIVE_LOW)
 			debugfs_value = !debugfs_value;
 
-		if (!(debugfs_dir == OUT && value == debugfs_value))
+		if (!(debugfs_dir == OUT && value == debugfs_value)) {
 			errno = -EINVAL;
-		ret = -errno;
-
+			ret = -errno;
+		}
 	}
 	gpiotools_release_linehandle(fd);