2021-04-08 13:14:24

by Peng Wu

[permalink] [raw]
Subject: [PATCH -next] sched/topology: Make some symbols static

The sparse tool complains as follows:

kernel/sched/topology.c:211:1: warning:
symbol 'sched_energy_mutex' was not declared. Should it be static?
kernel/sched/topology.c:212:6: warning:
symbol 'sched_energy_update' was not declared. Should it be static?

This symbol is not used outside of topology.c, so this
commit marks it static.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Peng Wu <[email protected]>
---
kernel/sched/topology.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index d1aec244c027..25c3f88d43cd 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -208,8 +208,8 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent)
#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
DEFINE_STATIC_KEY_FALSE(sched_energy_present);
unsigned int sysctl_sched_energy_aware = 1;
-DEFINE_MUTEX(sched_energy_mutex);
-bool sched_energy_update;
+static DEFINE_MUTEX(sched_energy_mutex);
+static bool sched_energy_update;

void rebuild_sched_domains_energy(void)
{


2021-04-13 09:53:15

by Quentin Perret

[permalink] [raw]
Subject: Re: [PATCH -next] sched/topology: Make some symbols static

On Thursday 08 Apr 2021 at 21:12:17 (+0800), Peng Wu wrote:
> The sparse tool complains as follows:
>
> kernel/sched/topology.c:211:1: warning:
> symbol 'sched_energy_mutex' was not declared. Should it be static?
> kernel/sched/topology.c:212:6: warning:
> symbol 'sched_energy_update' was not declared. Should it be static?
>
> This symbol is not used outside of topology.c, so this
> commit marks it static.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Peng Wu <[email protected]>
> ---
> kernel/sched/topology.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index d1aec244c027..25c3f88d43cd 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -208,8 +208,8 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent)
> #if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
> DEFINE_STATIC_KEY_FALSE(sched_energy_present);
> unsigned int sysctl_sched_energy_aware = 1;
> -DEFINE_MUTEX(sched_energy_mutex);
> -bool sched_energy_update;
> +static DEFINE_MUTEX(sched_energy_mutex);
> +static bool sched_energy_update;
>
> void rebuild_sched_domains_energy(void)
> {
>

FWIW, that has been reported some time ago:

https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/

But otherwise, this looks OK to me.

Thanks,
Quentin