HID: logitech-hidpp: rework one more time the retries attempts
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Wed, 12 Jul 2023 15:02:34 +0000 (17:02 +0200)
committerBenjamin Tissoires <bentiss@kernel.org>
Fri, 25 Aug 2023 08:40:32 +0000 (10:40 +0200)
commit60165ab774cb0c509680a73cf826d0e158454653
tree80e1248b3cff463f8b7542299054fa4a7f932713
parent6f20d3261265885f6a6be4cda49d7019728760e0
HID: logitech-hidpp: rework one more time the retries attempts

Extract the internal code inside a helper function, fix the
initialization of the parameters used in the helper function
(`hidpp->answer_available` was not reset and `*response` wasn't either),
and use a `do {...} while();` loop.

Fixes: 586e8fede795 ("HID: logitech-hidpp: Retry commands when device is busy")
Cc: stable@vger.kernel.org
Reviewed-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20230621-logitech-fixes-v2-1-3635f7f9c8af@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
drivers/hid/hid-logitech-hidpp.c