2020-02-03 17:52:50

by Frank Lee

[permalink] [raw]
Subject: [PATCH] cpufreq: make cpufreq_global_kobject static

The cpufreq_global_kobject is only used internally by cpufreq.c
after this:

commit 2361be236662 ("cpufreq: Don't create empty
/sys/devices/system/cpu/cpufreq directory")

Make it static.

Signed-off-by: Yangtao Li <[email protected]>
---
drivers/cpufreq/cpufreq.c | 4 +---
include/linux/cpufreq.h | 3 ---
2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 4adac3a8c265..a0831d3d5ed1 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -105,6 +105,7 @@ bool have_governor_per_policy(void)
}
EXPORT_SYMBOL_GPL(have_governor_per_policy);

+static struct kobject *cpufreq_global_kobject;
struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy)
{
if (have_governor_per_policy())
@@ -2745,9 +2746,6 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)
}
EXPORT_SYMBOL_GPL(cpufreq_unregister_driver);

-struct kobject *cpufreq_global_kobject;
-EXPORT_SYMBOL(cpufreq_global_kobject);
-
static int __init cpufreq_core_init(void)
{
if (cpufreq_disabled())
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 018dce868de6..0fb561d1b524 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -201,9 +201,6 @@ static inline bool policy_is_shared(struct cpufreq_policy *policy)
return cpumask_weight(policy->cpus) > 1;
}

-/* /sys/devices/system/cpu/cpufreq: entry point for global variables */
-extern struct kobject *cpufreq_global_kobject;
-
#ifdef CONFIG_CPU_FREQ
unsigned int cpufreq_get(unsigned int cpu);
unsigned int cpufreq_quick_get(unsigned int cpu);
--
2.17.1


2020-02-03 17:54:00

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] cpufreq: make cpufreq_global_kobject static

On Mon, Feb 3, 2020 at 4:45 PM Yangtao Li <[email protected]> wrote:
>
> The cpufreq_global_kobject is only used internally by cpufreq.c
> after this:
>
> commit 2361be236662 ("cpufreq: Don't create empty
> /sys/devices/system/cpu/cpufreq directory")
>
> Make it static.
>
> Signed-off-by: Yangtao Li <[email protected]>
> ---
> drivers/cpufreq/cpufreq.c | 4 +---
> include/linux/cpufreq.h | 3 ---
> 2 files changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 4adac3a8c265..a0831d3d5ed1 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -105,6 +105,7 @@ bool have_governor_per_policy(void)
> }
> EXPORT_SYMBOL_GPL(have_governor_per_policy);
>
> +static struct kobject *cpufreq_global_kobject;
> struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy)
> {
> if (have_governor_per_policy())
> @@ -2745,9 +2746,6 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)
> }
> EXPORT_SYMBOL_GPL(cpufreq_unregister_driver);
>
> -struct kobject *cpufreq_global_kobject;
> -EXPORT_SYMBOL(cpufreq_global_kobject);
> -
> static int __init cpufreq_core_init(void)
> {
> if (cpufreq_disabled())
> diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
> index 018dce868de6..0fb561d1b524 100644
> --- a/include/linux/cpufreq.h
> +++ b/include/linux/cpufreq.h
> @@ -201,9 +201,6 @@ static inline bool policy_is_shared(struct cpufreq_policy *policy)
> return cpumask_weight(policy->cpus) > 1;
> }
>
> -/* /sys/devices/system/cpu/cpufreq: entry point for global variables */
> -extern struct kobject *cpufreq_global_kobject;
> -
> #ifdef CONFIG_CPU_FREQ
> unsigned int cpufreq_get(unsigned int cpu);
> unsigned int cpufreq_quick_get(unsigned int cpu);
> --

Applied as 5.6 material with minor modification, thanks!