Subject: linux-next: build failure after merge of the pm tree

From: Stephen Rothwell <[email-masked]>
Date: Wed, 31 Jul 2019 15:34:19 +1000

Hi all,

After merging the pm tree, today's linux-next build (x86_64 allnoconfig)
failed like this:

x86_64-linux-gnu-ld: kernel/sched/core.o: in function `cpuidle_poll_time':
core.c:(.text+0x230): multiple definition of `cpuidle_poll_time'; arch/x86/kernel/process.o:process.c:(.text+0xc0): first defined here
x86_64-linux-gnu-ld: kernel/sched/loadavg.o: in function `cpuidle_poll_time':
loadavg.c:(.text+0x0): multiple definition of `cpuidle_poll_time'; arch/x86/kernel/process.o:process.c:(.text+0xc0): first defined here
x86_64-linux-gnu-ld: kernel/sched/clock.o: in function `cpuidle_poll_time':
clock.c:(.text+0x0): multiple definition of `cpuidle_poll_time'; arch/x86/kernel/process.o:process.c:(.text+0xc0): first defined here
x86_64-linux-gnu-ld: kernel/sched/cputime.o: in function `cpuidle_poll_time':
cputime.c:(.text+0x0): multiple definition of `cpuidle_poll_time'; arch/x86/kernel/process.o:process.c:(.text+0xc0): first defined here
x86_64-linux-gnu-ld: kernel/sched/idle.o: in function `cpuidle_poll_time':
idle.c:(.text+0xd0): multiple definition of `cpuidle_poll_time'; arch/x86/kernel/process.o:process.c:(.text+0xc0): first defined here
x86_64-linux-gnu-ld: kernel/sched/fair.o: in function `cpuidle_poll_time':
fair.c:(.text+0xb20): multiple definition of `cpuidle_poll_time'; arch/x86/kernel/process.o:process.c:(.text+0xc0): first defined here
x86_64-linux-gnu-ld: kernel/sched/rt.o: in function `cpuidle_poll_time':
rt.c:(.text+0x790): multiple definition of `cpuidle_poll_time'; arch/x86/kernel/process.o:process.c:(.text+0xc0): first defined here
x86_64-linux-gnu-ld: kernel/sched/deadline.o: in function `cpuidle_poll_time':
deadline.c:(.text+0xce0): multiple definition of `cpuidle_poll_time'; arch/x86/kernel/process.o:process.c:(.text+0xc0): first defined here
x86_64-linux-gnu-ld: kernel/sched/wait.o: in function `cpuidle_poll_time':
wait.c:(.text+0x1d0): multiple definition of `cpuidle_poll_time'; arch/x86/kernel/process.o:process.c:(.text+0xc0): first defined here
x86_64-linux-gnu-ld: kernel/sched/wait_bit.o: in function `cpuidle_poll_time':
wait_bit.c:(.text+0x50): multiple definition of `cpuidle_poll_time'; arch/x86/kernel/process.o:process.c:(.text+0xc0): first defined here
x86_64-linux-gnu-ld: kernel/sched/swait.o: in function `cpuidle_poll_time':
swait.c:(.text+0x30): multiple definition of `cpuidle_poll_time'; arch/x86/kernel/process.o:process.c:(.text+0xc0): first defined here
x86_64-linux-gnu-ld: kernel/sched/completion.o: in function `cpuidle_poll_time':
completion.c:(.text+0x0): multiple definition of `cpuidle_poll_time'; arch/x86/kernel/process.o:process.c:(.text+0xc0): first defined here

Caused by commit

  259231a04561 ("cpuidle: add poll_limit_ns to cpuidle_device structure")

I have added the following patch for today:

From: Stephen Rothwell <[email-masked]>
Date: Wed, 31 Jul 2019 15:29:52 +1000
Subject: [PATCH] cpuidle: header file stubs must be "static inline"

An x86_64 allmodconfig build produces these errors:

x86_64-linux-gnu-ld: kernel/sched/core.o: in function `cpuidle_poll_time':
core.c:(.text+0x230): multiple definition of `cpuidle_poll_time'; arch/x86/kernel/process.o:process.c:(.text+0xc0): first defined here

(and more)

Fixes: 259231a04561 ("cpuidle: add poll_limit_ns to cpuidle_device structure")
Signed-off-by: Stephen Rothwell <[email-masked]>
---
 include/linux/cpuidle.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index ba535a1a47d5..1a9f54eb3aa1 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -170,7 +170,7 @@ static inline int cpuidle_enter(struct cpuidle_driver *drv,
 				struct cpuidle_device *dev, int index)
 {return -ENODEV; }
 static inline void cpuidle_reflect(struct cpuidle_device *dev, int index) { }
-extern u64 cpuidle_poll_time(struct cpuidle_driver *drv,
+static inline u64 cpuidle_poll_time(struct cpuidle_driver *drv,
 			     struct cpuidle_device *dev)
 {return 0; }
 static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
-- 
2.20.1

-- 
Cheers,
Stephen Rothwell