aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/swim3.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/swim3.c')
-rw-r--r--drivers/block/swim3.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index f3657b2a5386..cc6a3864822c 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -949,15 +949,28 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
949 return 0; 949 return 0;
950} 950}
951 951
952static int floppy_unlocked_open(struct block_device *bdev, fmode_t mode)
953{
954 int ret;
955
956 lock_kernel();
957 ret = floppy_open(bdev, mode);
958 unlock_kernel();
959
960 return ret;
961}
962
952static int floppy_release(struct gendisk *disk, fmode_t mode) 963static int floppy_release(struct gendisk *disk, fmode_t mode)
953{ 964{
954 struct floppy_state *fs = disk->private_data; 965 struct floppy_state *fs = disk->private_data;
955 struct swim3 __iomem *sw = fs->swim3; 966 struct swim3 __iomem *sw = fs->swim3;
967 lock_kernel();
956 if (fs->ref_count > 0 && --fs->ref_count == 0) { 968 if (fs->ref_count > 0 && --fs->ref_count == 0) {
957 swim3_action(fs, MOTOR_OFF); 969 swim3_action(fs, MOTOR_OFF);
958 out_8(&sw->control_bic, 0xff); 970 out_8(&sw->control_bic, 0xff);
959 swim3_select(fs, RELAX); 971 swim3_select(fs, RELAX);
960 } 972 }
973 unlock_kernel();
961 return 0; 974 return 0;
962} 975}
963 976
@@ -1008,7 +1021,7 @@ static int floppy_revalidate(struct gendisk *disk)
1008} 1021}
1009 1022
1010static const struct block_device_operations floppy_fops = { 1023static const struct block_device_operations floppy_fops = {
1011 .open = floppy_open, 1024 .open = floppy_unlocked_open,
1012 .release = floppy_release, 1025 .release = floppy_release,
1013 .ioctl = floppy_ioctl, 1026 .ioctl = floppy_ioctl,
1014 .media_changed = floppy_check_change, 1027 .media_changed = floppy_check_change,