summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2004-06-07 19:27:15 -0700
committerLinus Torvalds <torvalds@evo.osdl.org>2004-06-07 19:27:15 -0700
commit369a536059fec1a6eef8d7e91cee4f0e9cff7b7b (patch)
treed04a45367fad1711259c233c6301e49a439e918f
parenteb18549a95857c00bfade5dc0ee672f4e6d94c5d (diff)
[PATCH] Make paca xCurrent field be a pointer
The paca struct contains a pointer to the current task, which is used for the `current' macro. For some reason, this field is a u64, and every time we use it we need a cast, because it is really a pointer. This patch cleans things up a little by making it a pointer to struct task_struct and removing the casts. It also removes a now-incorrect comment which said that r13 contains current (it now holds &paca[smp_processor_id()]). Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/ppc64/kernel/smp.c7
-rw-r--r--include/asm-ppc64/current.h4
-rw-r--r--include/asm-ppc64/paca.h4
3 files changed, 7 insertions, 8 deletions
diff --git a/arch/ppc64/kernel/smp.c b/arch/ppc64/kernel/smp.c
index 5254a57e4e0d..7fa0e5a105b2 100644
--- a/arch/ppc64/kernel/smp.c
+++ b/arch/ppc64/kernel/smp.c
@@ -390,8 +390,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
}
/* Fixup atomic count: it exited inside IRQ handler. */
- ((struct task_struct *)paca[lcpu].xCurrent)->thread_info->preempt_count
- = 0;
+ paca[lcpu].xCurrent->thread_info->preempt_count = 0;
/* Fixup SLB round-robin so next segment (kernel) goes in segment 0 */
paca[lcpu].xStab_data.next_round_robin = 0;
@@ -817,7 +816,7 @@ static void __init smp_create_idle(unsigned int cpu)
init_idle(p, cpu);
unhash_process(p);
- paca[cpu].xCurrent = (u64)p;
+ paca[cpu].xCurrent = p;
current_set[cpu] = p->thread_info;
}
@@ -869,7 +868,7 @@ void __devinit smp_prepare_boot_cpu(void)
/* cpu_possible is set up in prom.c */
cpu_set(boot_cpuid, cpu_online_map);
- paca[boot_cpuid].xCurrent = (u64)current;
+ paca[boot_cpuid].xCurrent = current;
current_set[boot_cpuid] = current->thread_info;
}
diff --git a/include/asm-ppc64/current.h b/include/asm-ppc64/current.h
index 429487ddda16..24ea6e1ab6e8 100644
--- a/include/asm-ppc64/current.h
+++ b/include/asm-ppc64/current.h
@@ -8,13 +8,11 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
- *
- * Use r13 for current since the ppc64 ABI reserves it - Anton
*/
#include <asm/thread_info.h>
-#define get_current() ((struct task_struct *)(get_paca()->xCurrent))
+#define get_current() (get_paca()->xCurrent)
#define current get_current()
#endif /* !(_PPC64_CURRENT_H) */
diff --git a/include/asm-ppc64/paca.h b/include/asm-ppc64/paca.h
index 9b6028915e34..bf38c7f01721 100644
--- a/include/asm-ppc64/paca.h
+++ b/include/asm-ppc64/paca.h
@@ -37,6 +37,8 @@ extern struct paca_struct paca[];
register struct paca_struct *local_paca asm("r13");
#define get_paca() local_paca
+struct task_struct;
+
/*============================================================================
* Name_______: paca
*
@@ -59,7 +61,7 @@ struct paca_struct {
*/
struct ItLpPaca *xLpPacaPtr; /* Pointer to LpPaca for PLIC 0x00 */
struct ItLpRegSave *xLpRegSavePtr; /* Pointer to LpRegSave for PLIC 0x08 */
- u64 xCurrent; /* Pointer to current 0x10 */
+ struct task_struct *xCurrent; /* Pointer to current 0x10 */
/* Note: the spinlock functions in arch/ppc64/lib/locks.c load lock_token and
xPacaIndex with a single lwz instruction, using the constant offset 24.
If you move either field, fix the spinlocks and rwlocks. */