On 5 October 2014 06:11, Mike Turquette mike.turquette@linaro.org wrote:
For reference, here is a patch that I've had locally in my tree for a couples months. I'm using it while prototyping some ways to integrate CPUfreq with the scheduler. It is almost identical to Thomas's approach but it doesn't try to mask off some flags. Additionally it does NOT change the u8 return type, which is currently how struct cpufreq_driver->flags is defined today. This is probably not good and should be an unsigned int or unsigned long so that the api is a bit more forward-looking.
Probably yes.
From 0053dfc6b09fa0c5923b7dcba23b67c1c005cb88 Mon Sep 17 00:00:00 2001 From: Mike Turquette mturquette@linaro.org Date: Sun, 3 Aug 2014 21:25:38 -0700 Subject: [PATCH] cpufreq: new function to query driver for flags
Signed-off-by: Mike Turquette mturquette@linaro.org
drivers/cpufreq/cpufreq.c | 9 +++++++++ include/linux/cpufreq.h | 1 + 2 files changed, 10 insertions(+)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 1abb44d..515e905 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2003,6 +2003,15 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, } EXPORT_SYMBOL_GPL(cpufreq_driver_target);
+u8 cpufreq_driver_get_flags(void) +{
if (!cpufreq_driver)
return 0;
Probably you need to return some error here. How would the caller know if there is no cpufreq-driver there..
return cpufreq_driver->flags;
+} +EXPORT_SYMBOL_GPL(cpufreq_driver_get_flags);
/*
- when "event" is CPUFREQ_GOV_LIMITS
*/ diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 221f0eb..5a97f5f 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -417,6 +417,7 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, int __cpufreq_driver_target(struct cpufreq_policy *policy, unsigned int target_freq, unsigned int relation); +u8 cpufreq_driver_get_flags(void); int cpufreq_register_governor(struct cpufreq_governor *governor); void cpufreq_unregister_governor(struct cpufreq_governor *governor);
-- 1.8.3.2