Commit 2a5e76b9 authored by Sébastien Szymanski's avatar Sébastien Szymanski Committed by Jiri Kosina
Browse files

HID: cp2112: fix setter callbacks return value



Since commit 64855434 ("HID: cp2112: use new line value setter
callbacks"), setting a GPIO value always fails with error -EBADE.

That's because the returned value by the setter callbacks is the
returned value by the hid_hw_raw_request() function which is the number of
bytes sent on success or a negative value on error. The function
gpiochip_set() returns -EBADE if the setter callbacks return a value >
0.

Fix this by making the setter callbacks return 0 on success or a negative
value on error.

While at it, use the returned value by cp2112_gpio_set_unlocked() in the
direction_output callback.

Fixes: 64855434 ("HID: cp2112: use new line value setter callbacks")
Signed-off-by: default avatarSébastien Szymanski <sebastien.szymanski@armadeus.com>
Reviewed-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.com>
parent 8599049a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment