Commit 7558da94 authored by Jonathan Corbet's avatar Jonathan Corbet

mips: cdev lock_kernel() pushdown

Push the cdev lock_kernel() call into MIPS-specific drivers.
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 0c401df3
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/elf.h> #include <linux/elf.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/smp_lock.h>
#include <linux/syscalls.h> #include <linux/syscalls.h>
#include <linux/moduleloader.h> #include <linux/moduleloader.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -392,8 +393,12 @@ ssize_t rtlx_write(int index, const void __user *buffer, size_t count) ...@@ -392,8 +393,12 @@ ssize_t rtlx_write(int index, const void __user *buffer, size_t count)
static int file_open(struct inode *inode, struct file *filp) static int file_open(struct inode *inode, struct file *filp)
{ {
int minor = iminor(inode); int minor = iminor(inode);
int err;
return rtlx_open(minor, (filp->f_flags & O_NONBLOCK) ? 0 : 1); lock_kernel();
err = rtlx_open(minor, (filp->f_flags & O_NONBLOCK) ? 0 : 1);
unlock_kernel();
return err;
} }
static int file_release(struct inode *inode, struct file *filp) static int file_release(struct inode *inode, struct file *filp)
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/elf.h> #include <linux/elf.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/smp_lock.h>
#include <linux/syscalls.h> #include <linux/syscalls.h>
#include <linux/moduleloader.h> #include <linux/moduleloader.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -1050,17 +1051,20 @@ static int vpe_open(struct inode *inode, struct file *filp) ...@@ -1050,17 +1051,20 @@ static int vpe_open(struct inode *inode, struct file *filp)
enum vpe_state state; enum vpe_state state;
struct vpe_notifications *not; struct vpe_notifications *not;
struct vpe *v; struct vpe *v;
int ret; int ret, err = 0;
lock_kernel();
if (minor != iminor(inode)) { if (minor != iminor(inode)) {
/* assume only 1 device at the moment. */ /* assume only 1 device at the moment. */
printk(KERN_WARNING "VPE loader: only vpe1 is supported\n"); printk(KERN_WARNING "VPE loader: only vpe1 is supported\n");
return -ENODEV; err = -ENODEV;
goto out;
} }
if ((v = get_vpe(tclimit)) == NULL) { if ((v = get_vpe(tclimit)) == NULL) {
printk(KERN_WARNING "VPE loader: unable to get vpe\n"); printk(KERN_WARNING "VPE loader: unable to get vpe\n");
return -ENODEV; err = -ENODEV;
goto out;
} }
state = xchg(&v->state, VPE_STATE_INUSE); state = xchg(&v->state, VPE_STATE_INUSE);
...@@ -1100,6 +1104,8 @@ static int vpe_open(struct inode *inode, struct file *filp) ...@@ -1100,6 +1104,8 @@ static int vpe_open(struct inode *inode, struct file *filp)
v->shared_ptr = NULL; v->shared_ptr = NULL;
v->__start = 0; v->__start = 0;
out:
unlock_kernel();
return 0; return 0;
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/smp_lock.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -402,18 +403,26 @@ static int sbprof_zbprof_stop(void) ...@@ -402,18 +403,26 @@ static int sbprof_zbprof_stop(void)
static int sbprof_tb_open(struct inode *inode, struct file *filp) static int sbprof_tb_open(struct inode *inode, struct file *filp)
{ {
int minor; int minor;
int err = 0;
lock_kernel();
minor = iminor(inode); minor = iminor(inode);
if (minor != 0) if (minor != 0) {
return -ENODEV; err = -ENODEV;
goto out;
}
if (xchg(&sbp.open, SB_OPENING) != SB_CLOSED) if (xchg(&sbp.open, SB_OPENING) != SB_CLOSED) {
return -EBUSY; err = -EBUSY;
goto out;
}
memset(&sbp, 0, sizeof(struct sbprof_tb)); memset(&sbp, 0, sizeof(struct sbprof_tb));
sbp.sbprof_tbbuf = vmalloc(MAX_TBSAMPLE_BYTES); sbp.sbprof_tbbuf = vmalloc(MAX_TBSAMPLE_BYTES);
if (!sbp.sbprof_tbbuf) if (!sbp.sbprof_tbbuf) {
return -ENOMEM; err = -ENOMEM;
goto out;
}
memset(sbp.sbprof_tbbuf, 0, MAX_TBSAMPLE_BYTES); memset(sbp.sbprof_tbbuf, 0, MAX_TBSAMPLE_BYTES);
init_waitqueue_head(&sbp.tb_sync); init_waitqueue_head(&sbp.tb_sync);
init_waitqueue_head(&sbp.tb_read); init_waitqueue_head(&sbp.tb_read);
...@@ -421,7 +430,9 @@ static int sbprof_tb_open(struct inode *inode, struct file *filp) ...@@ -421,7 +430,9 @@ static int sbprof_tb_open(struct inode *inode, struct file *filp)
sbp.open = SB_OPEN; sbp.open = SB_OPEN;
return 0; out:
unlock_kernel();
return err;
} }
static int sbprof_tb_release(struct inode *inode, struct file *filp) static int sbprof_tb_release(struct inode *inode, struct file *filp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment