[1/5] sched: hide unused sched_update_scaling()

Message ID 20230522195021.3456768-2-arnd@kernel.org
State New
Headers
Series sched: address missing-prototype warnings |

Commit Message

Arnd Bergmann May 22, 2023, 7:50 p.m. UTC
  From: Arnd Bergmann <arnd@arndb.de>

This function is only used when CONFIG_SMP is enabled, without that there
is no caller and no prototype:

kernel/sched/fair.c:688:5: error: no previous prototype for 'sched_update_scaling' [-Werror=missing-prototypes

Hide the definition in the same #ifdef check as the declaration.

Fixes: 8a99b6833c88 ("sched: Move SCHED_DEBUG sysctl to debugfs")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 kernel/sched/fair.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Mukesh Ojha May 23, 2023, 6:47 a.m. UTC | #1
On 5/23/2023 1:20 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> This function is only used when CONFIG_SMP is enabled, without that there
> is no caller and no prototype:
> 
> kernel/sched/fair.c:688:5: error: no previous prototype for 'sched_update_scaling' [-Werror=missing-prototypes
> 
> Hide the definition in the same #ifdef check as the declaration.
> 
> Fixes: 8a99b6833c88 ("sched: Move SCHED_DEBUG sysctl to debugfs")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

LGTM, thanks.
Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com>

-- Mukesh

> ---
>   kernel/sched/fair.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 48b6f0ca13ac..2c1b345c3b8d 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -684,7 +684,7 @@ struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
>   /**************************************************************
>    * Scheduling class statistics methods:
>    */
> -
> +#ifdef CONFIG_SMP
>   int sched_update_scaling(void)
>   {
>   	unsigned int factor = get_update_sysctl_factor();
> @@ -702,6 +702,7 @@ int sched_update_scaling(void)
>   	return 0;
>   }
>   #endif
> +#endif
>   
>   /*
>    * delta /= w
  

Patch

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 48b6f0ca13ac..2c1b345c3b8d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -684,7 +684,7 @@  struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
 /**************************************************************
  * Scheduling class statistics methods:
  */
-
+#ifdef CONFIG_SMP
 int sched_update_scaling(void)
 {
 	unsigned int factor = get_update_sysctl_factor();
@@ -702,6 +702,7 @@  int sched_update_scaling(void)
 	return 0;
 }
 #endif
+#endif
 
 /*
  * delta /= w