From cc87858adc55a1d67669d6593eaa9aa1b32cae07 Mon Sep 17 00:00:00 2001 From: Paul Kilar Date: Sat, 29 Aug 2026 20:41:33 -0400 Subject: [PATCH] rocknix-joypad: ratelimit the saradc read-failure message joypad_adc_check() runs from the input polling loop. When joypad_adc_read() fails it returns 0, and the driver logs at dev_err level with no ratelimiting - so a persistent ADC failure emits one line per poll, about 8 per second, for as long as the condition lasts. On a 1.5Mbaud serial console that is a permanent stream of identical lines. It drowns out whatever actually broke, and it adds console work to a machine that by that point is usually already in trouble. Observed on a Gusgu H7 (RK3326) whenever the SARADC stops answering: tens of thousands of identical messages, which actively hindered debugging an unrelated interrupt storm. Use dev_err_ratelimited() at all three call sites. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01985tp15STZZvPFMfnVBGnm --- .../002-ratelimit-saradc-read-failures.patch | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 projects/ROCKNIX/packages/linux-drivers/rocknix-joypad/patches/002-ratelimit-saradc-read-failures.patch diff --git a/projects/ROCKNIX/packages/linux-drivers/rocknix-joypad/patches/002-ratelimit-saradc-read-failures.patch b/projects/ROCKNIX/packages/linux-drivers/rocknix-joypad/patches/002-ratelimit-saradc-read-failures.patch new file mode 100644 index 00000000000..0ba36a76a8a --- /dev/null +++ b/projects/ROCKNIX/packages/linux-drivers/rocknix-joypad/patches/002-ratelimit-saradc-read-failures.patch @@ -0,0 +1,44 @@ +rocknix-joypad: ratelimit the saradc read-failure message + +joypad_adc_check() runs from the input polling loop. When joypad_adc_read() +fails it returns 0, and the driver logs at dev_err level with no ratelimiting - +so a persistent ADC failure emits one line per poll, about 8 per second, for as +long as the condition lasts. + +On a 1.5Mbaud serial console that is a permanent stream of identical lines. It +drowns out whatever actually broke, and it adds console work to a machine that +by that point is usually already in trouble. Observed on a Gusgu H7 whenever the +SARADC stops answering: tens of thousands of identical messages, which actively +hindered debugging an unrelated interrupt storm. + +Use dev_err_ratelimited() at all three call sites. + +--- a/rocknix-joypad.c 2026-08-27 19:05:34.283963099 -0400 ++++ b/rocknix-joypad.c 2026-08-27 19:05:34.284933731 -0400 +@@ -143,7 +143,7 @@ + /* Read first joystick axis */ + adcx->value = joypad_adc_read(joypad, adcx); + if (!adcx->value) { +- dev_err(joypad->dev, "saradc channels[%d]!\n", nbtn); ++ dev_err_ratelimited(joypad->dev, "saradc channels[%d]!\n", nbtn); + continue; + } + adcx->value = adcx->value - adcx->cal; +@@ -151,7 +151,7 @@ + /* Read second joystick axis */ + adcy->value = joypad_adc_read(joypad, adcy); + if (!adcy->value) { +- dev_err(joypad->dev, "saradc channels[%d]!\n", nbtn + 1); ++ dev_err_ratelimited(joypad->dev, "saradc channels[%d]!\n", nbtn + 1); + continue; + } + adcy->value = adcy->value - adcy->cal; +@@ -229,7 +229,7 @@ + + adc->value = joypad_adc_read(joypad, adc); + if (!adc->value) { +- dev_err(joypad->dev, "saradc channels[%d]!\n", nbtn); ++ dev_err_ratelimited(joypad->dev, "saradc channels[%d]!\n", nbtn); + continue; + } + adc->cal = adc->value;