Commit fd899c0cc725387992ccfc83fb6f70505c36cbeb

Authored by Michael Ellerman
Committed by Linus Torvalds
1 parent 88de0be0c7

[PATCH] ppc64: Make idle_loop a ppc_md function

This patch adds an idle member to the ppc_md structure and calls it from
cpu_idle().  If a platform leaves ppc_md.idle as null it will get the default
idle loop default_idle().

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 3 changed files with 13 additions and 6 deletions Side-by-side Diff

arch/ppc64/kernel/idle.c
... ... @@ -33,6 +33,7 @@
33 33 #include <asm/iSeries/ItLpQueue.h>
34 34 #include <asm/plpar_wrappers.h>
35 35 #include <asm/systemcfg.h>
  36 +#include <asm/machdep.h>
36 37  
37 38 extern void power4_idle(void);
38 39  
... ... @@ -122,7 +123,7 @@
122 123  
123 124 #else
124 125  
125   -static int default_idle(void)
  126 +int default_idle(void)
126 127 {
127 128 long oldval;
128 129 unsigned int cpu = smp_processor_id();
... ... @@ -288,7 +289,7 @@
288 289  
289 290 #endif /* CONFIG_PPC_PSERIES */
290 291  
291   -static int native_idle(void)
  292 +int native_idle(void)
292 293 {
293 294 while(1) {
294 295 /* check CPU type here */
... ... @@ -308,7 +309,8 @@
308 309  
309 310 void cpu_idle(void)
310 311 {
311   - idle_loop();
  312 + BUG_ON(NULL == ppc_md.idle_loop);
  313 + ppc_md.idle_loop();
312 314 }
313 315  
314 316 int powersave_nap;
arch/ppc64/kernel/setup.c
... ... @@ -96,7 +96,6 @@
96 96 extern unsigned long klimit;
97 97  
98 98 extern void mm_init_ppc64(void);
99   -extern int idle_setup(void);
100 99 extern void stab_initialize(unsigned long stab);
101 100 extern void htab_initialize(void);
102 101 extern void early_init_devtree(void *flat_dt);
... ... @@ -1081,8 +1080,9 @@
1081 1080  
1082 1081 ppc_md.setup_arch();
1083 1082  
1084   - /* Select the correct idle loop for the platform. */
1085   - idle_setup();
  1083 + /* Use the default idle loop if the platform hasn't provided one. */
  1084 + if (NULL == ppc_md.idle_loop)
  1085 + ppc_md.idle_loop = default_idle;
1086 1086  
1087 1087 paging_init();
1088 1088 ppc64_boot_msg(0x15, "Setup Done");
include/asm-ppc64/machdep.h
... ... @@ -140,7 +140,12 @@
140 140 unsigned long size,
141 141 pgprot_t vma_prot);
142 142  
  143 + /* Idle loop for this platform, leave empty for default idle loop */
  144 + int (*idle_loop)(void);
143 145 };
  146 +
  147 +extern int default_idle(void);
  148 +extern int native_idle(void);
144 149  
145 150 extern struct machdep_calls ppc_md;
146 151 extern char cmd_line[COMMAND_LINE_SIZE];