aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/paride/pd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/paride/pd.c')
-rw-r--r--drivers/block/paride/pd.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index c1e5cd029b2..985f0d4f1d1 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -153,6 +153,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_GEO, D_SBY, D_DLY, D_SLV};
153#include <linux/blkdev.h> 153#include <linux/blkdev.h>
154#include <linux/blkpg.h> 154#include <linux/blkpg.h>
155#include <linux/kernel.h> 155#include <linux/kernel.h>
156#include <linux/smp_lock.h>
156#include <asm/uaccess.h> 157#include <asm/uaccess.h>
157#include <linux/workqueue.h> 158#include <linux/workqueue.h>
158 159
@@ -439,7 +440,7 @@ static char *pd_buf; /* buffer for request in progress */
439 440
440static enum action do_pd_io_start(void) 441static enum action do_pd_io_start(void)
441{ 442{
442 if (blk_special_request(pd_req)) { 443 if (pd_req->cmd_type == REQ_TYPE_SPECIAL) {
443 phase = pd_special; 444 phase = pd_special;
444 return pd_special(); 445 return pd_special();
445 } 446 }
@@ -735,12 +736,14 @@ static int pd_open(struct block_device *bdev, fmode_t mode)
735{ 736{
736 struct pd_unit *disk = bdev->bd_disk->private_data; 737 struct pd_unit *disk = bdev->bd_disk->private_data;
737 738
739 lock_kernel();
738 disk->access++; 740 disk->access++;
739 741
740 if (disk->removable) { 742 if (disk->removable) {
741 pd_special_command(disk, pd_media_check); 743 pd_special_command(disk, pd_media_check);
742 pd_special_command(disk, pd_door_lock); 744 pd_special_command(disk, pd_door_lock);
743 } 745 }
746 unlock_kernel();
744 return 0; 747 return 0;
745} 748}
746 749
@@ -768,8 +771,10 @@ static int pd_ioctl(struct block_device *bdev, fmode_t mode,
768 771
769 switch (cmd) { 772 switch (cmd) {
770 case CDROMEJECT: 773 case CDROMEJECT:
774 lock_kernel();
771 if (disk->access == 1) 775 if (disk->access == 1)
772 pd_special_command(disk, pd_eject); 776 pd_special_command(disk, pd_eject);
777 unlock_kernel();
773 return 0; 778 return 0;
774 default: 779 default:
775 return -EINVAL; 780 return -EINVAL;
@@ -780,8 +785,10 @@ static int pd_release(struct gendisk *p, fmode_t mode)
780{ 785{
781 struct pd_unit *disk = p->private_data; 786 struct pd_unit *disk = p->private_data;
782 787
788 lock_kernel();
783 if (!--disk->access && disk->removable) 789 if (!--disk->access && disk->removable)
784 pd_special_command(disk, pd_door_unlock); 790 pd_special_command(disk, pd_door_unlock);
791 unlock_kernel();
785 792
786 return 0; 793 return 0;
787} 794}
@@ -812,7 +819,7 @@ static const struct block_device_operations pd_fops = {
812 .owner = THIS_MODULE, 819 .owner = THIS_MODULE,
813 .open = pd_open, 820 .open = pd_open,
814 .release = pd_release, 821 .release = pd_release,
815 .locked_ioctl = pd_ioctl, 822 .ioctl = pd_ioctl,
816 .getgeo = pd_getgeo, 823 .getgeo = pd_getgeo,
817 .media_changed = pd_check_media, 824 .media_changed = pd_check_media,
818 .revalidate_disk= pd_revalidate 825 .revalidate_disk= pd_revalidate