aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/swim.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/swim.c')
-rw-r--r--drivers/block/swim.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index f04f74e3758f..2e46815876df 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -662,11 +662,23 @@ out:
662 return err; 662 return err;
663} 663}
664 664
665static int floppy_unlocked_open(struct block_device *bdev, fmode_t mode)
666{
667 int ret;
668
669 lock_kernel();
670 ret = floppy_open(bdev, mode);
671 unlock_kernel();
672
673 return ret;
674}
675
665static int floppy_release(struct gendisk *disk, fmode_t mode) 676static int floppy_release(struct gendisk *disk, fmode_t mode)
666{ 677{
667 struct floppy_state *fs = disk->private_data; 678 struct floppy_state *fs = disk->private_data;
668 struct swim __iomem *base = fs->swd->base; 679 struct swim __iomem *base = fs->swd->base;
669 680
681 lock_kernel();
670 if (fs->ref_count < 0) 682 if (fs->ref_count < 0)
671 fs->ref_count = 0; 683 fs->ref_count = 0;
672 else if (fs->ref_count > 0) 684 else if (fs->ref_count > 0)
@@ -674,6 +686,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode)
674 686
675 if (fs->ref_count == 0) 687 if (fs->ref_count == 0)
676 swim_motor(base, OFF); 688 swim_motor(base, OFF);
689 unlock_kernel();
677 690
678 return 0; 691 return 0;
679} 692}
@@ -754,7 +767,7 @@ static int floppy_revalidate(struct gendisk *disk)
754 767
755static const struct block_device_operations floppy_fops = { 768static const struct block_device_operations floppy_fops = {
756 .owner = THIS_MODULE, 769 .owner = THIS_MODULE,
757 .open = floppy_open, 770 .open = floppy_unlocked_open,
758 .release = floppy_release, 771 .release = floppy_release,
759 .ioctl = floppy_ioctl, 772 .ioctl = floppy_ioctl,
760 .getgeo = floppy_getgeo, 773 .getgeo = floppy_getgeo,