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/mips/sibyte | |
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/mips/sibyte')
-rw-r--r-- | arch/mips/sibyte/common/sb_tbprof.c | 25 |
1 files changed, 18 insertions, 7 deletions
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) |