diff options
author | Jonathan Corbet <corbet@lwn.net> | 2008-05-15 12:07:56 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2008-06-20 16:03:43 -0400 |
commit | ea2959a2972410f15155a015df74ce77ac79f8b8 (patch) | |
tree | e8496a1a99b7f805a13cdb1e3560995319cdab1c /drivers/block/paride/pt.c | |
parent | 579174a55f491edeaccb8f5d3dc7ad69a17f5423 (diff) |
paride: cdev lock_kernel() pushdown
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'drivers/block/paride/pt.c')
-rw-r--r-- | drivers/block/paride/pt.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c index 8b9549ab4a4e..314333db16ee 100644 --- a/drivers/block/paride/pt.c +++ b/drivers/block/paride/pt.c | |||
@@ -146,6 +146,7 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3}; | |||
146 | #include <linux/mtio.h> | 146 | #include <linux/mtio.h> |
147 | #include <linux/device.h> | 147 | #include <linux/device.h> |
148 | #include <linux/sched.h> /* current, TASK_*, schedule_timeout() */ | 148 | #include <linux/sched.h> /* current, TASK_*, schedule_timeout() */ |
149 | #include <linux/smp_lock.h> | ||
149 | 150 | ||
150 | #include <asm/uaccess.h> | 151 | #include <asm/uaccess.h> |
151 | 152 | ||
@@ -650,8 +651,11 @@ static int pt_open(struct inode *inode, struct file *file) | |||
650 | struct pt_unit *tape = pt + unit; | 651 | struct pt_unit *tape = pt + unit; |
651 | int err; | 652 | int err; |
652 | 653 | ||
653 | if (unit >= PT_UNITS || (!tape->present)) | 654 | lock_kernel(); |
655 | if (unit >= PT_UNITS || (!tape->present)) { | ||
656 | unlock_kernel(); | ||
654 | return -ENODEV; | 657 | return -ENODEV; |
658 | } | ||
655 | 659 | ||
656 | err = -EBUSY; | 660 | err = -EBUSY; |
657 | if (!atomic_dec_and_test(&tape->available)) | 661 | if (!atomic_dec_and_test(&tape->available)) |
@@ -678,10 +682,12 @@ static int pt_open(struct inode *inode, struct file *file) | |||
678 | } | 682 | } |
679 | 683 | ||
680 | file->private_data = tape; | 684 | file->private_data = tape; |
685 | unlock_kernel(); | ||
681 | return 0; | 686 | return 0; |
682 | 687 | ||
683 | out: | 688 | out: |
684 | atomic_inc(&tape->available); | 689 | atomic_inc(&tape->available); |
690 | unlock_kernel(); | ||
685 | return err; | 691 | return err; |
686 | } | 692 | } |
687 | 693 | ||