Skip to contentSkip to conversation

sched: fix "runnable_avg_yN_inv" not used warnings

PATCH Superseded Qian Cai 1 participant 1 message May 23, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Qian Cai

author
#0 lore raw

PATCH 1/1 sched: fix "runnable_avg_yN_inv" not used warnings

runnable_avg_yN_inv[] is only used in kernel/sched/pelt.c but was included in several other places and causes compilation warnings,

In file included from kernel/sched/pelt.h:2,
from kernel/sched/rt.c:8:
kernel/sched/sched-pelt.h:4:18: warning: 'runnable_avg_yN_inv' defined but not used [-Wunused-const-variable=]
In file included from kernel/sched/pelt.h:2,

                 from kernel/sched/fair.c:705:

kernel/sched/sched-pelt.h:4:18: warning: 'runnable_avg_yN_inv' defined but not used [-Wunused-const-variable=]
In file included from kernel/sched/pelt.h:2,
from kernel/sched/deadline.c:19:
kernel/sched/sched-pelt.h:4:18: warning: 'runnable_avg_yN_inv' defined but not used [-Wunused-const-variable=]

Fixed it by appending the __maybe_unused attribute for it, so all generated variables and macros can still be kept in the same file.

---
 Documentation/scheduler/sched-pelt.c | 2 +-
 kernel/sched/sched-pelt.h            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/scheduler/sched-pelt.c +1 -1
index e4219139386a..6c10b8764533 100644
@@ -20,7 +20,7 @@ void calc_runnable_avg_yN_inv(void)
 	int i;
 	unsigned int x;
 
-	printf("static const u32 runnable_avg_yN_inv[] = {");
+	printf("static const u32 runnable_avg_yN_inv[] __maybe_unused = {");
 	for (i = 0; i < HALFLIFE; i++) {
 		x = ((1UL<<32)-1)*pow(y, i);
 
kernel/sched/sched-pelt.h +1 -1
index a26473674fb7..c529706bed11 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Generated by Documentation/scheduler/sched-pelt; do not modify. */
 
-static const u32 runnable_avg_yN_inv[] = {
+static const u32 runnable_avg_yN_inv[] __maybe_unused = {
 	0xffffffff, 0xfa83b2da, 0xf5257d14, 0xefe4b99a, 0xeac0c6e6, 0xe5b906e6,
 	0xe0ccdeeb, 0xdbfbb796, 0xd744fcc9, 0xd2a81d91, 0xce248c14, 0xc9b9bd85,
 	0xc5672a10, 0xc12c4cc9, 0xbd08a39e, 0xb8fbaf46, 0xb504f333, 0xb123f581,
Signature · 1 line
2.20.1 (Apple Git-117)