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.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index 730ccea78e45..612965307ba0 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -244,10 +244,10 @@ static int grab_drive(struct floppy_state *fs, enum swim_state state,
244 int interruptible); 244 int interruptible);
245static void release_drive(struct floppy_state *fs); 245static void release_drive(struct floppy_state *fs);
246static int fd_eject(struct floppy_state *fs); 246static int fd_eject(struct floppy_state *fs);
247static int floppy_ioctl(struct inode *inode, struct file *filp, 247static int floppy_ioctl(struct block_device *bdev, fmode_t mode,
248 unsigned int cmd, unsigned long param); 248 unsigned int cmd, unsigned long param);
249static int floppy_open(struct inode *inode, struct file *filp); 249static int floppy_open(struct block_device *bdev, fmode_t mode);
250static int floppy_release(struct inode *inode, struct file *filp); 250static int floppy_release(struct gendisk *disk, fmode_t mode);
251static int floppy_check_change(struct gendisk *disk); 251static int floppy_check_change(struct gendisk *disk);
252static int floppy_revalidate(struct gendisk *disk); 252static int floppy_revalidate(struct gendisk *disk);
253 253
@@ -839,10 +839,10 @@ static int fd_eject(struct floppy_state *fs)
839static struct floppy_struct floppy_type = 839static struct floppy_struct floppy_type =
840 { 2880,18,2,80,0,0x1B,0x00,0xCF,0x6C,NULL }; /* 7 1.44MB 3.5" */ 840 { 2880,18,2,80,0,0x1B,0x00,0xCF,0x6C,NULL }; /* 7 1.44MB 3.5" */
841 841
842static int floppy_ioctl(struct inode *inode, struct file *filp, 842static int floppy_ioctl(struct block_device *bdev, fmode_t mode,
843 unsigned int cmd, unsigned long param) 843 unsigned int cmd, unsigned long param)
844{ 844{
845 struct floppy_state *fs = inode->i_bdev->bd_disk->private_data; 845 struct floppy_state *fs = bdev->bd_disk->private_data;
846 int err; 846 int err;
847 847
848 if ((cmd & 0x80) && !capable(CAP_SYS_ADMIN)) 848 if ((cmd & 0x80) && !capable(CAP_SYS_ADMIN))
@@ -868,9 +868,9 @@ static int floppy_ioctl(struct inode *inode, struct file *filp,
868 return -ENOTTY; 868 return -ENOTTY;
869} 869}
870 870
871static int floppy_open(struct inode *inode, struct file *filp) 871static int floppy_open(struct block_device *bdev, fmode_t mode)
872{ 872{
873 struct floppy_state *fs = inode->i_bdev->bd_disk->private_data; 873 struct floppy_state *fs = bdev->bd_disk->private_data;
874 struct swim3 __iomem *sw = fs->swim3; 874 struct swim3 __iomem *sw = fs->swim3;
875 int n, err = 0; 875 int n, err = 0;
876 876
@@ -904,17 +904,17 @@ static int floppy_open(struct inode *inode, struct file *filp)
904 swim3_action(fs, SETMFM); 904 swim3_action(fs, SETMFM);
905 swim3_select(fs, RELAX); 905 swim3_select(fs, RELAX);
906 906
907 } else if (fs->ref_count == -1 || filp->f_flags & O_EXCL) 907 } else if (fs->ref_count == -1 || mode & FMODE_EXCL)
908 return -EBUSY; 908 return -EBUSY;
909 909
910 if (err == 0 && (filp->f_flags & O_NDELAY) == 0 910 if (err == 0 && (mode & FMODE_NDELAY) == 0
911 && (filp->f_mode & 3)) { 911 && (mode & (FMODE_READ|FMODE_WRITE))) {
912 check_disk_change(inode->i_bdev); 912 check_disk_change(bdev);
913 if (fs->ejected) 913 if (fs->ejected)
914 err = -ENXIO; 914 err = -ENXIO;
915 } 915 }
916 916
917 if (err == 0 && (filp->f_mode & 2)) { 917 if (err == 0 && (mode & FMODE_WRITE)) {
918 if (fs->write_prot < 0) 918 if (fs->write_prot < 0)
919 fs->write_prot = swim3_readbit(fs, WRITE_PROT); 919 fs->write_prot = swim3_readbit(fs, WRITE_PROT);
920 if (fs->write_prot) 920 if (fs->write_prot)
@@ -930,7 +930,7 @@ static int floppy_open(struct inode *inode, struct file *filp)
930 return err; 930 return err;
931 } 931 }
932 932
933 if (filp->f_flags & O_EXCL) 933 if (mode & FMODE_EXCL)
934 fs->ref_count = -1; 934 fs->ref_count = -1;
935 else 935 else
936 ++fs->ref_count; 936 ++fs->ref_count;
@@ -938,9 +938,9 @@ static int floppy_open(struct inode *inode, struct file *filp)
938 return 0; 938 return 0;
939} 939}
940 940
941static int floppy_release(struct inode *inode, struct file *filp) 941static int floppy_release(struct gendisk *disk, fmode_t mode)
942{ 942{
943 struct floppy_state *fs = inode->i_bdev->bd_disk->private_data; 943 struct floppy_state *fs = disk->private_data;
944 struct swim3 __iomem *sw = fs->swim3; 944 struct swim3 __iomem *sw = fs->swim3;
945 if (fs->ref_count > 0 && --fs->ref_count == 0) { 945 if (fs->ref_count > 0 && --fs->ref_count == 0) {
946 swim3_action(fs, MOTOR_OFF); 946 swim3_action(fs, MOTOR_OFF);
@@ -1000,7 +1000,7 @@ static int floppy_revalidate(struct gendisk *disk)
1000static struct block_device_operations floppy_fops = { 1000static struct block_device_operations floppy_fops = {
1001 .open = floppy_open, 1001 .open = floppy_open,
1002 .release = floppy_release, 1002 .release = floppy_release,
1003 .ioctl = floppy_ioctl, 1003 .locked_ioctl = floppy_ioctl,
1004 .media_changed = floppy_check_change, 1004 .media_changed = floppy_check_change,
1005 .revalidate_disk= floppy_revalidate, 1005 .revalidate_disk= floppy_revalidate,
1006}; 1006};