aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/vpe.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2007-02-23 08:40:45 -0500
committerRalf Baechle <ralf@linux-mips.org>2007-02-26 18:06:06 -0500
commitc4c4018b04f9b7993e3800dc1f391ac8947764a5 (patch)
tree346c9a4aa9c46eee6df883f89553e43b9d7033fc /arch/mips/kernel/vpe.c
parentcbc841356702ccf4f16e760c84006ed3ddd4b1fd (diff)
[MIPS] RTLX, VPE: Make open actually atomic.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/vpe.c')
-rw-r--r--arch/mips/kernel/vpe.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 9aca871a307f..c9ee9d2d5856 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -1079,6 +1079,7 @@ static int getcwd(char *buff, int size)
1079static int vpe_open(struct inode *inode, struct file *filp) 1079static int vpe_open(struct inode *inode, struct file *filp)
1080{ 1080{
1081 int minor, ret; 1081 int minor, ret;
1082 enum vpe_state state;
1082 struct vpe *v; 1083 struct vpe *v;
1083 struct vpe_notifications *not; 1084 struct vpe_notifications *not;
1084 1085
@@ -1093,7 +1094,8 @@ static int vpe_open(struct inode *inode, struct file *filp)
1093 return -ENODEV; 1094 return -ENODEV;
1094 } 1095 }
1095 1096
1096 if (v->state != VPE_STATE_UNUSED) { 1097 state = xchg(&v->state, VPE_STATE_INUSE);
1098 if (state != VPE_STATE_UNUSED) {
1097 dvpe(); 1099 dvpe();
1098 1100
1099 printk(KERN_DEBUG "VPE loader: tc in use dumping regs\n"); 1101 printk(KERN_DEBUG "VPE loader: tc in use dumping regs\n");
@@ -1108,9 +1110,6 @@ static int vpe_open(struct inode *inode, struct file *filp)
1108 cleanup_tc(get_tc(minor)); 1110 cleanup_tc(get_tc(minor));
1109 } 1111 }
1110 1112
1111 // allocate it so when we get write ops we know it's expected.
1112 v->state = VPE_STATE_INUSE;
1113
1114 /* this of-course trashes what was there before... */ 1113 /* this of-course trashes what was there before... */
1115 v->pbuffer = vmalloc(P_SIZE); 1114 v->pbuffer = vmalloc(P_SIZE);
1116 v->plen = P_SIZE; 1115 v->plen = P_SIZE;