diff options
author | Jonathan Corbet <corbet@lwn.net> | 2008-05-15 11:10:50 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2008-05-18 17:43:40 -0400 |
commit | 7558da942e51933b5e6aa5e851d4da1df0cd6752 (patch) | |
tree | 4a9083e1a94b59cfec25cf5a53689f0f7893d1b8 /arch | |
parent | 0c401df37ef9f45f35390a5574e24cbf3f916acf (diff) |
mips: cdev lock_kernel() pushdown
Push the cdev lock_kernel() call into MIPS-specific drivers.
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/kernel/rtlx.c | 7 | ||||
-rw-r--r-- | arch/mips/kernel/vpe.c | 12 | ||||
-rw-r--r-- | arch/mips/sibyte/common/sb_tbprof.c | 25 |
3 files changed, 33 insertions, 11 deletions
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c index b88f1c18ff4d..b55641961232 100644 --- a/arch/mips/kernel/rtlx.c +++ b/arch/mips/kernel/rtlx.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/vmalloc.h> | 28 | #include <linux/vmalloc.h> |
29 | #include <linux/elf.h> | 29 | #include <linux/elf.h> |
30 | #include <linux/seq_file.h> | 30 | #include <linux/seq_file.h> |
31 | #include <linux/smp_lock.h> | ||
31 | #include <linux/syscalls.h> | 32 | #include <linux/syscalls.h> |
32 | #include <linux/moduleloader.h> | 33 | #include <linux/moduleloader.h> |
33 | #include <linux/interrupt.h> | 34 | #include <linux/interrupt.h> |
@@ -392,8 +393,12 @@ out: | |||
392 | static int file_open(struct inode *inode, struct file *filp) | 393 | static int file_open(struct inode *inode, struct file *filp) |
393 | { | 394 | { |
394 | int minor = iminor(inode); | 395 | int minor = iminor(inode); |
396 | int err; | ||
395 | 397 | ||
396 | return rtlx_open(minor, (filp->f_flags & O_NONBLOCK) ? 0 : 1); | 398 | lock_kernel(); |
399 | err = rtlx_open(minor, (filp->f_flags & O_NONBLOCK) ? 0 : 1); | ||
400 | unlock_kernel(); | ||
401 | return err; | ||
397 | } | 402 | } |
398 | 403 | ||
399 | static int file_release(struct inode *inode, struct file *filp) | 404 | static int file_release(struct inode *inode, struct file *filp) |
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 2794501ff302..972b2d2b8401 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/vmalloc.h> | 38 | #include <linux/vmalloc.h> |
39 | #include <linux/elf.h> | 39 | #include <linux/elf.h> |
40 | #include <linux/seq_file.h> | 40 | #include <linux/seq_file.h> |
41 | #include <linux/smp_lock.h> | ||
41 | #include <linux/syscalls.h> | 42 | #include <linux/syscalls.h> |
42 | #include <linux/moduleloader.h> | 43 | #include <linux/moduleloader.h> |
43 | #include <linux/interrupt.h> | 44 | #include <linux/interrupt.h> |
@@ -1050,17 +1051,20 @@ static int vpe_open(struct inode *inode, struct file *filp) | |||
1050 | enum vpe_state state; | 1051 | enum vpe_state state; |
1051 | struct vpe_notifications *not; | 1052 | struct vpe_notifications *not; |
1052 | struct vpe *v; | 1053 | struct vpe *v; |
1053 | int ret; | 1054 | int ret, err = 0; |
1054 | 1055 | ||
1056 | lock_kernel(); | ||
1055 | if (minor != iminor(inode)) { | 1057 | if (minor != iminor(inode)) { |
1056 | /* assume only 1 device at the moment. */ | 1058 | /* assume only 1 device at the moment. */ |
1057 | printk(KERN_WARNING "VPE loader: only vpe1 is supported\n"); | 1059 | printk(KERN_WARNING "VPE loader: only vpe1 is supported\n"); |
1058 | return -ENODEV; | 1060 | err = -ENODEV; |
1061 | goto out; | ||
1059 | } | 1062 | } |
1060 | 1063 | ||
1061 | if ((v = get_vpe(tclimit)) == NULL) { | 1064 | if ((v = get_vpe(tclimit)) == NULL) { |
1062 | printk(KERN_WARNING "VPE loader: unable to get vpe\n"); | 1065 | printk(KERN_WARNING "VPE loader: unable to get vpe\n"); |
1063 | return -ENODEV; | 1066 | err = -ENODEV; |
1067 | goto out; | ||
1064 | } | 1068 | } |
1065 | 1069 | ||
1066 | state = xchg(&v->state, VPE_STATE_INUSE); | 1070 | state = xchg(&v->state, VPE_STATE_INUSE); |
@@ -1100,6 +1104,8 @@ static int vpe_open(struct inode *inode, struct file *filp) | |||
1100 | v->shared_ptr = NULL; | 1104 | v->shared_ptr = NULL; |
1101 | v->__start = 0; | 1105 | v->__start = 0; |
1102 | 1106 | ||
1107 | out: | ||
1108 | unlock_kernel(); | ||
1103 | return 0; | 1109 | return 0; |
1104 | } | 1110 | } |
1105 | 1111 | ||
diff --git a/arch/mips/sibyte/common/sb_tbprof.c b/arch/mips/sibyte/common/sb_tbprof.c index 63b444eaf01e..28b012ab8dcb 100644 --- a/arch/mips/sibyte/common/sb_tbprof.c +++ b/arch/mips/sibyte/common/sb_tbprof.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/smp_lock.h> | ||
31 | #include <linux/vmalloc.h> | 32 | #include <linux/vmalloc.h> |
32 | #include <linux/fs.h> | 33 | #include <linux/fs.h> |
33 | #include <linux/errno.h> | 34 | #include <linux/errno.h> |
@@ -402,18 +403,26 @@ static int sbprof_zbprof_stop(void) | |||
402 | static int sbprof_tb_open(struct inode *inode, struct file *filp) | 403 | static int sbprof_tb_open(struct inode *inode, struct file *filp) |
403 | { | 404 | { |
404 | int minor; | 405 | int minor; |
406 | int err = 0; | ||
405 | 407 | ||
408 | lock_kernel(); | ||
406 | minor = iminor(inode); | 409 | minor = iminor(inode); |
407 | if (minor != 0) | 410 | if (minor != 0) { |
408 | return -ENODEV; | 411 | err = -ENODEV; |
412 | goto out; | ||
413 | } | ||
409 | 414 | ||
410 | if (xchg(&sbp.open, SB_OPENING) != SB_CLOSED) | 415 | if (xchg(&sbp.open, SB_OPENING) != SB_CLOSED) { |
411 | return -EBUSY; | 416 | err = -EBUSY; |
417 | goto out; | ||
418 | } | ||
412 | 419 | ||
413 | memset(&sbp, 0, sizeof(struct sbprof_tb)); | 420 | memset(&sbp, 0, sizeof(struct sbprof_tb)); |
414 | sbp.sbprof_tbbuf = vmalloc(MAX_TBSAMPLE_BYTES); | 421 | sbp.sbprof_tbbuf = vmalloc(MAX_TBSAMPLE_BYTES); |
415 | if (!sbp.sbprof_tbbuf) | 422 | if (!sbp.sbprof_tbbuf) { |
416 | return -ENOMEM; | 423 | err = -ENOMEM; |
424 | goto out; | ||
425 | } | ||
417 | memset(sbp.sbprof_tbbuf, 0, MAX_TBSAMPLE_BYTES); | 426 | memset(sbp.sbprof_tbbuf, 0, MAX_TBSAMPLE_BYTES); |
418 | init_waitqueue_head(&sbp.tb_sync); | 427 | init_waitqueue_head(&sbp.tb_sync); |
419 | init_waitqueue_head(&sbp.tb_read); | 428 | init_waitqueue_head(&sbp.tb_read); |
@@ -421,7 +430,9 @@ static int sbprof_tb_open(struct inode *inode, struct file *filp) | |||
421 | 430 | ||
422 | sbp.open = SB_OPEN; | 431 | sbp.open = SB_OPEN; |
423 | 432 | ||
424 | return 0; | 433 | out: |
434 | unlock_kernel(); | ||
435 | return err; | ||
425 | } | 436 | } |
426 | 437 | ||
427 | static int sbprof_tb_release(struct inode *inode, struct file *filp) | 438 | static int sbprof_tb_release(struct inode *inode, struct file *filp) |