|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v1 06/11] xen/cpufreq: introduce policy type when cpufreq_driver->setpolicy exists
On 03.12.2024 09:11, Penny Zheng wrote:
> --- a/xen/drivers/cpufreq/utility.c
> +++ b/xen/drivers/cpufreq/utility.c
> @@ -484,3 +484,14 @@ int __cpufreq_set_policy(struct cpufreq_policy *data,
>
> return __cpufreq_governor(data, CPUFREQ_GOV_LIMITS);
> }
> +
> +unsigned int cpufreq_parse_policy(struct cpufreq_governor *gov)
> +{
> + if ( !strncasecmp(gov->name, "performance", CPUFREQ_NAME_LEN) )
> + return CPUFREQ_POLICY_PERFORMANCE;
> +
> + if ( !strncasecmp(gov->name, "powersave", CPUFREQ_NAME_LEN) )
> + return CPUFREQ_POLICY_POWERSAVE;
> +
> + return CPUFREQ_POLICY_UNKNOWN;
> +}
> diff --git a/xen/include/acpi/cpufreq/cpufreq.h
> b/xen/include/acpi/cpufreq/cpufreq.h
> index acf133430b..cad27f6811 100644
> --- a/xen/include/acpi/cpufreq/cpufreq.h
> +++ b/xen/include/acpi/cpufreq/cpufreq.h
> @@ -133,6 +133,17 @@ extern int cpufreq_register_governor(struct
> cpufreq_governor *governor);
> extern struct cpufreq_governor *__find_governor(const char *governor);
> #define CPUFREQ_DEFAULT_GOVERNOR &cpufreq_gov_dbs
>
> +#define CPUFREQ_POLICY_UNKNOWN 0
> +/*
> + * If cpufreq_driver->target() exists, the ->governor decides what frequency
> + * within the limits is used. If cpufreq_driver->setpolicy() exists, these
> + * two generic policies are available:
> + */
> +#define CPUFREQ_POLICY_POWERSAVE 1
> +#define CPUFREQ_POLICY_PERFORMANCE 2
> +
> +unsigned int cpufreq_parse_policy(struct cpufreq_governor *gov);
> +
> /* pass a target to the cpufreq driver */
> extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
> unsigned int target_freq,
The new function has no callers, making it difficult to review the change (not
seeing how it is used) and violating Misra (by introducing unreachable code).
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |