X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=arch%2Fmips%2Fkernel%2Fvpe.c;h=c9ee9d2d5856a896a64e16321c92b37a174b7c6d;hb=18062a91d2ddc40e19fc674afeb7cad58cfa23ab;hp=4e832da48c698d05b03f61c863ac8f63148e1906;hpb=d68798374bcf5cd4a19105b86d96121651b3c8cb;p=linux-2.6 diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 4e832da48c..c9ee9d2d58 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c @@ -1079,6 +1079,7 @@ static int getcwd(char *buff, int size) static int vpe_open(struct inode *inode, struct file *filp) { int minor, ret; + enum vpe_state state; struct vpe *v; struct vpe_notifications *not; @@ -1093,7 +1094,8 @@ static int vpe_open(struct inode *inode, struct file *filp) return -ENODEV; } - if (v->state != VPE_STATE_UNUSED) { + state = xchg(&v->state, VPE_STATE_INUSE); + if (state != VPE_STATE_UNUSED) { dvpe(); 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) cleanup_tc(get_tc(minor)); } - // allocate it so when we get write ops we know it's expected. - v->state = VPE_STATE_INUSE; - /* this of-course trashes what was there before... */ v->pbuffer = vmalloc(P_SIZE); v->plen = P_SIZE; @@ -1208,7 +1207,7 @@ static ssize_t vpe_write(struct file *file, const char __user * buffer, return ret; } -static struct file_operations vpe_fops = { +static const struct file_operations vpe_fops = { .owner = THIS_MODULE, .open = vpe_open, .release = vpe_release,