Skip to content

Commit 3e7b669

Browse files
guoren83palmer-dabbelt
authored andcommitted
riscv: Cleanup unnecessary define in asm-offset.c
- TASK_THREAD_SP is duplicated define - TASK_STACK is no use at all - Don't worry about thread_info's offset in task_struct, have a look on comment in include/linux/sched.h: struct task_struct { /* * For reasons of header soup (see current_thread_info()), this * must be the first element of task_struct. */ struct thread_info thread_info; Signed-off-by: Guo Ren <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent ebc00dd commit 3e7b669

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

arch/riscv/kernel/asm-offsets.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ void asm_offsets(void)
2727
OFFSET(TASK_THREAD_S9, task_struct, thread.s[9]);
2828
OFFSET(TASK_THREAD_S10, task_struct, thread.s[10]);
2929
OFFSET(TASK_THREAD_S11, task_struct, thread.s[11]);
30-
OFFSET(TASK_THREAD_SP, task_struct, thread.sp);
31-
OFFSET(TASK_STACK, task_struct, stack);
32-
OFFSET(TASK_TI, task_struct, thread_info);
3330
OFFSET(TASK_TI_FLAGS, task_struct, thread_info.flags);
3431
OFFSET(TASK_TI_PREEMPT_COUNT, task_struct, thread_info.preempt_count);
3532
OFFSET(TASK_TI_KERNEL_SP, task_struct, thread_info.kernel_sp);

arch/riscv/kernel/entry.S

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -435,12 +435,8 @@ ENTRY(__switch_to)
435435
lw a4, TASK_TI_CPU(a1)
436436
sw a3, TASK_TI_CPU(a1)
437437
sw a4, TASK_TI_CPU(a0)
438-
#if TASK_TI != 0
439-
#error "TASK_TI != 0: tp will contain a 'struct thread_info', not a 'struct task_struct' so get_current() won't work."
440-
addi tp, a1, TASK_TI
441-
#else
438+
/* The offset of thread_info in task_struct is zero. */
442439
move tp, a1
443-
#endif
444440
ret
445441
ENDPROC(__switch_to)
446442

0 commit comments

Comments
 (0)