[MIPS] MT: Enable coexistence of AP/SP with VSMP and SMTC.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index c658001..cb9a14a 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -89,7 +89,7 @@
 #define MTSP_O_EXCL		0x0800
 #define MTSP_O_BINARY		0x8000
 
-#define SP_VPE 1
+extern int tclimit;
 
 struct apsp_table  {
 	int sp;
@@ -225,8 +225,8 @@
 	/* Run the syscall at the priviledge of the user who loaded the
 	   SP program */
 
-	if (vpe_getuid(SP_VPE))
-		sp_setfsuidgid( vpe_getuid(SP_VPE), vpe_getgid(SP_VPE));
+	if (vpe_getuid(tclimit))
+		sp_setfsuidgid(vpe_getuid(tclimit), vpe_getgid(tclimit));
 
 	switch (sc.cmd) {
 	/* needs the flags argument translating from SDE kit to
@@ -245,7 +245,7 @@
 
  	case MTSP_SYSCALL_EXIT:
 		list_for_each_entry(n, &kspd_notifylist, list)
- 			n->kspd_sp_exit(SP_VPE);
+			n->kspd_sp_exit(tclimit);
 		sp_stopping = 1;
 
 		printk(KERN_DEBUG "KSPD got exit syscall from SP exitcode %d\n",
@@ -255,7 +255,7 @@
  	case MTSP_SYSCALL_OPEN:
  		generic.arg1 = translate_open_flags(generic.arg1);
 
- 		vcwd = vpe_getcwd(SP_VPE);
+		vcwd = vpe_getcwd(tclimit);
 
  		/* change to the cwd of the process that loaded the SP program */
 		old_fs = get_fs();
@@ -283,7 +283,7 @@
 		break;
  	} /* switch */
 
-	if (vpe_getuid(SP_VPE))
+	if (vpe_getuid(tclimit))
 		sp_setfsuidgid( 0, 0);
 
 	old_fs = get_fs();
@@ -364,10 +364,9 @@
 		}
 
 		INIT_WORK(&work, sp_work);
-		queue_work(workqueue, &work);
-	} else
-		queue_work(workqueue, &work);
+	}
 
+	queue_work(workqueue, &work);
 }
 
 static void stopwork(int vpe)
@@ -389,7 +388,7 @@
 
 	notify.start = startwork;
 	notify.stop = stopwork;
-	vpe_notify(SP_VPE, &notify);
+	vpe_notify(tclimit, &notify);
 
 	return 0;
 }