aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPekka Enberg <penberg@kernel.org>2010-11-08 08:44:34 -0500
committerJens Axboe <jaxboe@fusionio.com>2010-11-08 08:44:34 -0500
commit2b51dca79a105dea022776ea7874193239df7fbd (patch)
tree55a50c05701b32e055f0fca576fddf22438ee63c
parentf6f94e2ab1b33f0082ac22d71f66385a60d8157f (diff)
floppy: replace NO_GEOM macro with a function
This patch replaces the NO_GEOM macro with a proper static inline function and converts an open-coded caller in check_floppy_change() to use it. Cc: Stephen Hemminger <shemminger@vyatta.com> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Pekka Enberg <penberg@kernel.org> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
-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 cf04c1b234e..709e69c6d02 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -596,6 +596,11 @@ static unsigned char fsector_t; /* sector in track */
596static unsigned char in_sector_offset; /* offset within physical sector, 596static unsigned char in_sector_offset; /* offset within physical sector,
597 * expressed in units of 512 bytes */ 597 * expressed in units of 512 bytes */
598 598
599static inline bool drive_no_geom(int drive)
600{
601 return !current_type[drive] && !ITYPE(UDRS->fd_device);
602}
603
599#ifndef fd_eject 604#ifndef fd_eject
600static inline int fd_eject(int drive) 605static inline int fd_eject(int drive)
601{ 606{
@@ -3757,7 +3762,7 @@ static int check_floppy_change(struct gendisk *disk)
3757 if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) || 3762 if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) ||
3758 test_bit(FD_VERIFY_BIT, &UDRS->flags) || 3763 test_bit(FD_VERIFY_BIT, &UDRS->flags) ||
3759 test_bit(drive, &fake_change) || 3764 test_bit(drive, &fake_change) ||
3760 (!ITYPE(UDRS->fd_device) && !current_type[drive])) 3765 drive_no_geom(drive))
3761 return 1; 3766 return 1;
3762 return 0; 3767 return 0;
3763} 3768}
@@ -3823,13 +3828,13 @@ static int __floppy_read_block_0(struct block_device *bdev)
3823static int floppy_revalidate(struct gendisk *disk) 3828static int floppy_revalidate(struct gendisk *disk)
3824{ 3829{
3825 int drive = (long)disk->private_data; 3830 int drive = (long)disk->private_data;
3826#define NO_GEOM (!current_type[drive] && !ITYPE(UDRS->fd_device))
3827 int cf; 3831 int cf;
3828 int res = 0; 3832 int res = 0;
3829 3833
3830 if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) || 3834 if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) ||
3831 test_bit(FD_VERIFY_BIT, &UDRS->flags) || 3835 test_bit(FD_VERIFY_BIT, &UDRS->flags) ||
3832 test_bit(drive, &fake_change) || NO_GEOM) { 3836 test_bit(drive, &fake_change) ||
3837 drive_no_geom(drive)) {
3833 if (WARN(atomic_read(&usage_count) == 0, 3838 if (WARN(atomic_read(&usage_count) == 0,
3834 "VFS: revalidate called on non-open device.\n")) 3839 "VFS: revalidate called on non-open device.\n"))
3835 return -EFAULT; 3840 return -EFAULT;
@@ -3837,7 +3842,7 @@ static int floppy_revalidate(struct gendisk *disk)
3837 lock_fdc(drive, false); 3842 lock_fdc(drive, false);
3838 cf = (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) || 3843 cf = (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) ||
3839 test_bit(FD_VERIFY_BIT, &UDRS->flags)); 3844 test_bit(FD_VERIFY_BIT, &UDRS->flags));
3840 if (!(cf || test_bit(drive, &fake_change) || NO_GEOM)) { 3845 if (!(cf || test_bit(drive, &fake_change) || drive_no_geom(drive))) {
3841 process_fd_request(); /*already done by another thread */ 3846 process_fd_request(); /*already done by another thread */
3842 return 0; 3847 return 0;
3843 } 3848 }
@@ -3849,7 +3854,7 @@ static int floppy_revalidate(struct gendisk *disk)
3849 clear_bit(FD_DISK_CHANGED_BIT, &UDRS->flags); 3854 clear_bit(FD_DISK_CHANGED_BIT, &UDRS->flags);
3850 if (cf) 3855 if (cf)
3851 UDRS->generation++; 3856 UDRS->generation++;
3852 if (NO_GEOM) { 3857 if (drive_no_geom(drive)) {
3853 /* auto-sensing */ 3858 /* auto-sensing */
3854 res = __floppy_read_block_0(opened_bdev[drive]); 3859 res = __floppy_read_block_0(opened_bdev[drive]);
3855 } else { 3860 } else {