drivers/devfreq: add missing governor_data field and ondemand declaration - #19788
Merged
Conversation
…tion The ondemand governor (devfreq_ondemand.c) references dev->governor_data to store its private state, and defines devfreq_ondemand(), but neither the field in struct devfreq_s nor the function declaration were present in include/nuttx/devfreq.h. As a result, building with CONFIG_DEVFREQ_GOV_ONDEMAND=y failed to compile. These two definitions were originally introduced by a downstream commit that was not part of the devfreq upstreaming series, so the gap only surfaced when the ondemand governor is enabled (which additionally requires !CONFIG_SCHED_CPULOAD_NONE and is off by default). Add the governor_data field to struct devfreq_s and declare devfreq_ondemand() alongside the other governors. Signed-off-by: guanyi <guanyi@xiaomi.com>
Contributor
Author
|
@xiaoxiang781216
|
raiden00pl
approved these changes
Aug 11, 2026
Contributor
user can enable it only for cpu freq scaling.
|
acassis
approved these changes
Aug 11, 2026
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
The ondemand governor (
drivers/devfreq/devfreq_ondemand.c) stores itsprivate state in
dev->governor_dataand definesdevfreq_ondemand(),but neither the
governor_datafield instruct devfreq_snor thedevfreq_ondemand()declaration were present ininclude/nuttx/devfreq.h. As a result, building withCONFIG_DEVFREQ_GOV_ONDEMAND=yfailed to compile.This gap was introduced during upstreaming of the devfreq framework: the
two definitions originally lived in a downstream commit whose main topic
was a cpufreq refactor, and that commit was not part of the devfreq
upstreaming series. The performance and powersave governors do not use
governor_data, so the problem only surfaces when the ondemand governoris enabled (which additionally requires
!CONFIG_SCHED_CPULOAD_NONEandis off by default), which is why it was not caught earlier.
This PR:
governor_datafield tostruct devfreq_sdevfreq_ondemand()alongsidedevfreq_performance()anddevfreq_powersave()Reported-by: @raiden00pl
Impact
CONFIG_DEVFREQ_GOV_ONDEMAND=y.governor_datais a new field instruct devfreq_sand the declaration is additive; the default build(ondemand off) is unchanged.
governors.
Testing
Host
gcc(sim)Before this PR — building sim with the ondemand governor enabled
fails to compile
devfreq_ondemand.cbecausestruct devfreq_shas nogovernor_datamember anddevfreq_ondemand()is undeclared.After this PR — clean build:
Result:
devfreq_ondemand.ois produced and linking succeeds with no errors or warnings.tools/checkpatch.sh -g apache/master..HEADpasses.