Skip to content

Commit 0626e1c

Browse files
committed
LoongArch: Fix copy_thread() build errors
Commit c5febea ("fork: Pass struct kernel_clone_args into copy_thread") change the prototype of copy_thread(), while commit 5bd2e97 ("fork: Generalize PF_IO_WORKER handling") change the structure of kernel_clone_args. They cause build errors, so fix it. Fixes: 5bd2e97 ("fork: Generalize PF_IO_WORKER handling") Fixes: c5febea ("fork: Pass struct kernel_clone_args into copy_thread") Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 255b465 commit 0626e1c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

arch/loongarch/kernel/process.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,12 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
120120
/*
121121
* Copy architecture-specific thread state
122122
*/
123-
int copy_thread(unsigned long clone_flags, unsigned long usp,
124-
unsigned long kthread_arg, struct task_struct *p, unsigned long tls)
123+
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
125124
{
126125
unsigned long childksp;
126+
unsigned long tls = args->tls;
127+
unsigned long usp = args->stack;
128+
unsigned long clone_flags = args->flags;
127129
struct pt_regs *childregs, *regs = current_pt_regs();
128130

129131
childksp = (unsigned long)task_stack_page(p) + THREAD_SIZE - 32;
@@ -136,12 +138,12 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
136138
p->thread.csr_crmd = csr_read32(LOONGARCH_CSR_CRMD);
137139
p->thread.csr_prmd = csr_read32(LOONGARCH_CSR_PRMD);
138140
p->thread.csr_ecfg = csr_read32(LOONGARCH_CSR_ECFG);
139-
if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) {
141+
if (unlikely(args->fn)) {
140142
/* kernel thread */
141-
p->thread.reg23 = usp; /* fn */
142-
p->thread.reg24 = kthread_arg;
143143
p->thread.reg03 = childksp;
144-
p->thread.reg01 = (unsigned long) ret_from_kernel_thread;
144+
p->thread.reg23 = (unsigned long)args->fn;
145+
p->thread.reg24 = (unsigned long)args->fn_arg;
146+
p->thread.reg01 = (unsigned long)ret_from_kernel_thread;
145147
memset(childregs, 0, sizeof(struct pt_regs));
146148
childregs->csr_euen = p->thread.csr_euen;
147149
childregs->csr_crmd = p->thread.csr_crmd;

0 commit comments

Comments
 (0)