aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/floppy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/floppy.c')
-rw-r--r--drivers/block/floppy.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 25e4dffa0aad..b9ba04fc2b34 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -597,6 +597,11 @@ static unsigned char fsector_t; /* sector in track */
597static unsigned char in_sector_offset; /* offset within physical sector, 597static unsigned char in_sector_offset; /* offset within physical sector,
598 * expressed in units of 512 bytes */ 598 * expressed in units of 512 bytes */
599 599
600static inline bool drive_no_geom(int drive)
601{
602 return !current_type[drive] && !ITYPE(UDRS->fd_device);
603}
604
600#ifndef fd_eject 605#ifndef fd_eject
601static inline int fd_eject(int drive) 606static inline int fd_eject(int drive)
602{ 607{
@@ -3782,7 +3787,7 @@ static int check_floppy_change(struct gendisk *disk)
3782 if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) || 3787 if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) ||
3783 test_bit(FD_VERIFY_BIT, &UDRS->flags) || 3788 test_bit(FD_VERIFY_BIT, &UDRS->flags) ||
3784 test_bit(drive, &fake_change) || 3789 test_bit(drive, &fake_change) ||
3785 (!ITYPE(UDRS->fd_device) && !current_type[drive])) 3790 drive_no_geom(drive))
3786 return 1; 3791 return 1;
3787 return 0; 3792 return 0;
3788} 3793}
@@ -3848,13 +3853,13 @@ static int __floppy_read_block_0(struct block_device *bdev)
3848static int floppy_revalidate(struct gendisk *disk) 3853static int floppy_revalidate(struct gendisk *disk)
3849{ 3854{
3850 int drive = (long)disk->private_data; 3855 int drive = (long)disk->private_data;
3851#define NO_GEOM (!current_type[drive] && !ITYPE(UDRS->fd_device))
3852 int cf; 3856 int cf;
3853 int res = 0; 3857 int res = 0;
3854 3858
3855 if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) || 3859 if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) ||
3856 test_bit(FD_VERIFY_BIT, &UDRS->flags) || 3860 test_bit(FD_VERIFY_BIT, &UDRS->flags) ||
3857 test_bit(drive, &fake_change) || NO_GEOM) { 3861 test_bit(drive, &fake_change) ||
3862 drive_no_geom(drive)) {
3858 if (WARN(atomic_read(&usage_count) == 0, 3863 if (WARN(atomic_read(&usage_count) == 0,
3859 "VFS: revalidate called on non-open device.\n")) 3864 "VFS: revalidate called on non-open device.\n"))
3860 return -EFAULT; 3865 return -EFAULT;
@@ -3862,7 +3867,7 @@ static int floppy_revalidate(struct gendisk *disk)
3862 lock_fdc(drive, false); 3867 lock_fdc(drive, false);
3863 cf = (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) || 3868 cf = (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) ||
3864 test_bit(FD_VERIFY_BIT, &UDRS->flags)); 3869 test_bit(FD_VERIFY_BIT, &UDRS->flags));
3865 if (!(cf || test_bit(drive, &fake_change) || NO_GEOM)) { 3870 if (!(cf || test_bit(drive, &fake_change) || drive_no_geom(drive))) {
3866 process_fd_request(); /*already done by another thread */ 3871 process_fd_request(); /*already done by another thread */
3867 return 0; 3872 return 0;
3868 } 3873 }
@@ -3874,7 +3879,7 @@ static int floppy_revalidate(struct gendisk *disk)
3874 clear_bit(FD_DISK_CHANGED_BIT, &UDRS->flags); 3879 clear_bit(FD_DISK_CHANGED_BIT, &UDRS->flags);
3875 if (cf) 3880 if (cf)
3876 UDRS->generation++; 3881 UDRS->generation++;
3877 if (NO_GEOM) { 3882 if (drive_no_geom(drive)) {
3878 /* auto-sensing */ 3883 /* auto-sensing */
3879 res = __floppy_read_block_0(opened_bdev[drive]); 3884 res = __floppy_read_block_0(opened_bdev[drive]);
3880 } else { 3885 } else {