Re: [PATCH] HID: cp2112: fix setter callbacks return value

From
Jiri Kosina <jikos@kernel.org>
Date
2025-09-12 15:15:57
Also in
linux-gpio, lkml
Reply to
Sébastien Szymanski, 2025-09-04
On Thu, 4 Sep 2025, Sébastien Szymanski wrote:
Since commit 6485543488a6 ("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: 6485543488a6 ("HID: cp2112: use new line value setter callbacks")
Signed-off-by: Sébastien Szymanski <redacted>
Applied, thank you!

-- 
Jiri Kosina
SUSE Labs
Thread (3 messages) 3 messages, 3 authors, last reply 2025-09-12
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help