Skip to contentSkip to conversation

HID: nintendo: Reduce JC_SUBCMD_RATE_MAX_ATTEMPTS

PATCH Applied Willy Huang 3 participants 3 messages Oct 30, 2025 – Oct 31, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: nintendo: Reduce JC_SUBCMD_RATE_MAX_ATTEMPTS

The JC_SUBCMD_RATE_MAX_ATTEMPTS constant is currently set to 500. In a worst-case scenario where all attempts consistently fail, this could cause the loop to block for up to 60000 ms (500 * 60ms * 2, including the additional retry after a timeout).

This change lowers the maximum potential blocking time to 3000 ms (25 * 60ms * 2), improving system responsiveness and efficiency.

---
 drivers/hid/hid-nintendo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-nintendo.c +1 -1
index c2849a541f65..342cd6893502 100644
@@ -819,7 +819,7 @@ static void joycon_wait_for_input_report(struct joycon_ctlr *ctlr)
 #define JC_INPUT_REPORT_MAX_DELTA	17
 #define JC_SUBCMD_TX_OFFSET_MS		4
 #define JC_SUBCMD_VALID_DELTA_REQ	3
-#define JC_SUBCMD_RATE_MAX_ATTEMPTS	500
+#define JC_SUBCMD_RATE_MAX_ATTEMPTS	25
 #define JC_SUBCMD_RATE_LIMITER_USB_MS	20
 #define JC_SUBCMD_RATE_LIMITER_BT_MS	60
 #define JC_SUBCMD_RATE_LIMITER_MS(ctlr)	((ctlr)->hdev->bus == BUS_USB ? JC_SUBCMD_RATE_LIMITER_USB_MS : JC_SUBCMD_RATE_LIMITER_BT_MS)
Signature · 1 line
2.51.1.851.g4ebd6896fd-goog
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi Willy,

Quoted 28 lines · Willy Huang

The JC_SUBCMD_RATE_MAX_ATTEMPTS constant is currently set to 500. In a worst-case scenario where all attempts consistently fail, this could cause the loop to block for up to 60000 ms (500 * 60ms * 2, including the additional retry after a timeout).

This change lowers the maximum potential blocking time to 3000 ms (25 * 60ms * 2), improving system responsiveness and efficiency.

---
 drivers/hid/hid-nintendo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-nintendo.c +1 -2
index c2849a541f65..342cd6893502 100644
@@ -819,7 +819,7 @@ static void joycon_wait_for_input_report(struct joycon_ctlr *ctlr)
 #define JC_INPUT_REPORT_MAX_DELTA      17
 #define JC_SUBCMD_TX_OFFSET_MS         4
 #define JC_SUBCMD_VALID_DELTA_REQ      3
-#define JC_SUBCMD_RATE_MAX_ATTEMPTS    500
+#define JC_SUBCMD_RATE_MAX_ATTEMPTS    25
 #define JC_SUBCMD_RATE_LIMITER_USB_MS  20
 #define JC_SUBCMD_RATE_LIMITER_BT_MS   60
 #define JC_SUBCMD_RATE_LIMITER_MS(ctlr)        ((ctlr)->hdev->bus == BUS_USB ? JC_SUBCMD_RATE_LIMITER_USB_MS : JC_SUBCMD_RATE_LIMITER_BT_MS)
--
Quoted 2 lines

2.51.1.851.g4ebd6896fd-goog

Thanks for the patch. Seems like a good change.

- Daniel

maintainer Applied
#2 lore raw
In reply to Willy Huang
Quoted 9 lines · Willy Huang

The JC_SUBCMD_RATE_MAX_ATTEMPTS constant is currently set to 500. In a worst-case scenario where all attempts consistently fail, this could cause the loop to block for up to 60000 ms (500 * 60ms * 2, including the additional retry after a timeout).

This change lowers the maximum potential blocking time to 3000 ms (25 * 60ms * 2), improving system responsiveness and efficiency.

Applied, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs