rocknix-joypad: ratelimit the saradc read-failure message - #3250
Closed
pkilar wants to merge 1 commit into
Closed
Conversation
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) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01985tp15STZZvPFMfnVBGnm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
joypad_adc_check()runs from the input polling loop. Whenjoypad_adc_read()fails it returns 0 and the driver logs atdev_errlevel 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.
Switches the three call sites to
dev_err_ratelimited(). A genuine ADC failure still gets reported; it just stops repeating thousands of times.Testing
saradc channels[N]!messages — this actively hindered debugging an unrelated interrupt storm, since the useful output scrolled away. After, the message appears at the ratelimited rate and the surrounding log stays readable.Additional Context
continueon failure is untouched.dev_err_ratelimited()is the standard helper for exactly this case and is already used widely in the kernel's input drivers.rocknix-joypad, which is shared across device families, so it is worth a glance from someone with other hardware — but the change is confined to three log statements.AI Usage
Did you use AI tools to help write this code? YES — Claude Code was used to trace the log flood back to the polling loop and to draft the patch and this description.