c6x: switch to generic kernel_thread()
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 22 Sep 2012 22:23:49 +0000 (18:23 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 1 Oct 2012 04:59:09 +0000 (00:59 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
arch/c6x/Kconfig
arch/c6x/include/asm/processor.h
arch/c6x/kernel/process.c

index 983c859e40b7b57e5eb1da68094524b7fe1c1301..45268b50c0c88907e09a738a3d60f55c4ac2afe5 100644 (file)
@@ -17,6 +17,7 @@ config C6X
        select OF
        select OF_EARLY_FLATTREE
        select GENERIC_CLOCKEVENTS
+       select GENERIC_KERNEL_THREAD
 
 config MMU
        def_bool n
index c50af7ef1c96a5538252474e6ab37681141583a5..b9eb3da7f278dac858bfb2191094f9fc837ac5c8 100644 (file)
@@ -92,8 +92,6 @@ static inline void release_thread(struct task_struct *dead_task)
 {
 }
 
-extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
-
 #define copy_segments(tsk, mm)         do { } while (0)
 #define release_segments(mm)           do { } while (0)
 
index f98616d92f2d9970d35434d84ddf9bfe45ed1dbf..2770d9a9a84edbc4d66b9cbae3e39aff8f001d38 100644 (file)
@@ -104,22 +104,6 @@ void machine_power_off(void)
        halt_loop();
 }
 
-/*
- * Create a kernel thread
- */
-int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
-{
-       struct pt_regs regs = {
-               .a0 = (unsigned long)fn,
-               .a1 = (unsigned long)arg,
-               .tsr = 0, /* kernel mode */
-       };
-
-       /* Ok, create the new process.. */
-       return do_fork(flags | CLONE_VM | CLONE_UNTRACED, -1, &regs,
-                      0, NULL, NULL);
-}
-
 void flush_thread(void)
 {
 }
@@ -177,14 +161,16 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
 
        childregs = task_pt_regs(p);
 
-       *childregs = *regs;
-
-       if (usp == -1) {
+       if (!regs) {
                /* case of  __kernel_thread: we return to supervisor space */
+               memset(childregs, 0, sizeof(struct pt_regs));
                childregs->sp = (unsigned long)(childregs + 1);
                p->thread.pc = (unsigned long) ret_from_kernel_thread;
+               childregs->a0 = usp;            /* function */
+               childregs->a1 = ustk_size;      /* argument */
        } else {
                /* Otherwise use the given stack */
+               *childregs = *regs;
                childregs->sp = usp;
                p->thread.pc = (unsigned long) ret_from_fork;
        }