aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-03-10 18:20:55 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-12 18:52:30 -0500
commite029853612ba5999caed4dbc833dab729aac75ba (patch)
tree9847614b32644c47249649e24f30aab5fd87bc6f /drivers/block
parent87f530d8f1733651f3e34b81c801d6e1bb635936 (diff)
drivers/block/floppy.c: remove [U]CLEARF, [U]SETF, and [U]TESTF macros
Use clear_bit, set_bit, and test_bit functions directly Signed-off-by: Joe Perches <joe@perches.com> Cc: Stephen Hemminger <shemminger@vyatta.com> Cc: Jens Axboe <jens.axboe@oracle.com> Cc: Marcin Slusarz <marcin.slusarz@gmail.com> Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/floppy.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 41f366327193..35ce4e3f04dd 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -305,17 +305,11 @@ static int initialising = 1;
305#define DRS (&drive_state[current_drive]) 305#define DRS (&drive_state[current_drive])
306#define DRWE (&write_errors[current_drive]) 306#define DRWE (&write_errors[current_drive])
307#define FDCS (&fdc_state[fdc]) 307#define FDCS (&fdc_state[fdc])
308#define CLEARF(x) clear_bit(x##_BIT, &DRS->flags)
309#define SETF(x) set_bit(x##_BIT, &DRS->flags)
310#define TESTF(x) test_bit(x##_BIT, &DRS->flags)
311 308
312#define UDP (&drive_params[drive]) 309#define UDP (&drive_params[drive])
313#define UDRS (&drive_state[drive]) 310#define UDRS (&drive_state[drive])
314#define UDRWE (&write_errors[drive]) 311#define UDRWE (&write_errors[drive])
315#define UFDCS (&fdc_state[FDC(drive)]) 312#define UFDCS (&fdc_state[FDC(drive)])
316#define UCLEARF(x) clear_bit(x##_BIT, &UDRS->flags)
317#define USETF(x) set_bit(x##_BIT, &UDRS->flags)
318#define UTESTF(x) test_bit(x##_BIT, &UDRS->flags)
319 313
320#define DPRINT(format, args...) \ 314#define DPRINT(format, args...) \
321 pr_info(DEVICE_NAME "%d: " format, current_drive, ##args) 315 pr_info(DEVICE_NAME "%d: " format, current_drive, ##args)
@@ -764,13 +758,13 @@ static int disk_change(int drive)
764 debug_dcl(UDP->flags, "flags=%lx\n", UDRS->flags); 758 debug_dcl(UDP->flags, "flags=%lx\n", UDRS->flags);
765 759
766 if (UDP->flags & FD_BROKEN_DCL) 760 if (UDP->flags & FD_BROKEN_DCL)
767 return UTESTF(FD_DISK_CHANGED); 761 return test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags);
768 if ((fd_inb(FD_DIR) ^ UDP->flags) & 0x80) { 762 if ((fd_inb(FD_DIR) ^ UDP->flags) & 0x80) {
769 USETF(FD_VERIFY); /* verify write protection */ 763 set_bit(FD_VERIFY_BIT, &UDRS->flags);
770 if (UDRS->maxblock) { 764 /* verify write protection */
771 /* mark it changed */ 765
772 USETF(FD_DISK_CHANGED); 766 if (UDRS->maxblock) /* mark it changed */
773 } 767 set_bit(FD_DISK_CHANGED_BIT, &UDRS->flags);
774 768
775 /* invalidate its geometry */ 769 /* invalidate its geometry */
776 if (UDRS->keep_data >= 0) { 770 if (UDRS->keep_data >= 0) {
@@ -785,7 +779,7 @@ static int disk_change(int drive)
785 return 1; 779 return 1;
786 } else { 780 } else {
787 UDRS->last_checked = jiffies; 781 UDRS->last_checked = jiffies;
788 UCLEARF(FD_DISK_NEWCHANGE); 782 clear_bit(FD_DISK_NEWCHANGE_BIT, &UDRS->flags);
789 } 783 }
790 return 0; 784 return 0;
791} 785}
@@ -1477,11 +1471,11 @@ static int interpret_errors(void)
1477 bad = 1; 1471 bad = 1;
1478 if (ST1 & ST1_WP) { 1472 if (ST1 & ST1_WP) {
1479 DPRINT("Drive is write protected\n"); 1473 DPRINT("Drive is write protected\n");
1480 CLEARF(FD_DISK_WRITABLE); 1474 clear_bit(FD_DISK_WRITABLE_BIT, &DRS->flags);
1481 cont->done(0); 1475 cont->done(0);
1482 bad = 2; 1476 bad = 2;
1483 } else if (ST1 & ST1_ND) { 1477 } else if (ST1 & ST1_ND) {
1484 SETF(FD_NEED_TWADDLE); 1478 set_bit(FD_NEED_TWADDLE_BIT, &DRS->flags);
1485 } else if (ST1 & ST1_OR) { 1479 } else if (ST1 & ST1_OR) {
1486 if (DP->flags & FTD_MSG) 1480 if (DP->flags & FTD_MSG)
1487 DPRINT("Over/Underrun - retrying\n"); 1481 DPRINT("Over/Underrun - retrying\n");
@@ -1587,7 +1581,8 @@ static void seek_interrupt(void)
1587 debug_dcl(DP->flags, 1581 debug_dcl(DP->flags,
1588 "clearing NEWCHANGE flag because of effective seek\n"); 1582 "clearing NEWCHANGE flag because of effective seek\n");
1589 debug_dcl(DP->flags, "jiffies=%lu\n", jiffies); 1583 debug_dcl(DP->flags, "jiffies=%lu\n", jiffies);
1590 CLEARF(FD_DISK_NEWCHANGE); /* effective seek */ 1584 clear_bit(FD_DISK_NEWCHANGE_BIT, &DRS->flags);
1585 /* effective seek */
1591 DRS->select_date = jiffies; 1586 DRS->select_date = jiffies;
1592 } 1587 }
1593 DRS->track = ST1; 1588 DRS->track = ST1;
@@ -1596,23 +1591,23 @@ static void seek_interrupt(void)
1596 1591
1597static void check_wp(void) 1592static void check_wp(void)
1598{ 1593{
1599 if (TESTF(FD_VERIFY)) { 1594 if (test_bit(FD_VERIFY_BIT, &DRS->flags)) {
1600 /* check write protection */ 1595 /* check write protection */
1601 output_byte(FD_GETSTATUS); 1596 output_byte(FD_GETSTATUS);
1602 output_byte(UNIT(current_drive)); 1597 output_byte(UNIT(current_drive));
1603 if (result() != 1) { 1598 if (result() != 1) {
1604 FDCS->reset = 1; 1599 FDCS->reset = 1;
1605 return; 1600 return;
1606 } 1601 }
1607 CLEARF(FD_VERIFY); 1602 clear_bit(FD_VERIFY_BIT, &DRS->flags);
1608 CLEARF(FD_NEED_TWADDLE); 1603 clear_bit(FD_NEED_TWADDLE_BIT, &DRS->flags);
1609 debug_dcl(DP->flags, 1604 debug_dcl(DP->flags,
1610 "checking whether disk is write protected\n"); 1605 "checking whether disk is write protected\n");
1611 debug_dcl(DP->flags, "wp=%x\n", ST3 & 0x40); 1606 debug_dcl(DP->flags, "wp=%x\n", ST3 & 0x40);
1612 if (!(ST3 & 0x40)) 1607 if (!(ST3 & 0x40))
1613 SETF(FD_DISK_WRITABLE); 1608 set_bit(FD_DISK_WRITABLE_BIT, &DRS->flags);
1614 else 1609 else
1615 CLEARF(FD_DISK_WRITABLE); 1610 clear_bit(FD_DISK_WRITABLE_BIT, &DRS->flags);
1616 } 1611 }
1617} 1612}
1618 1613
@@ -1624,13 +1619,13 @@ static void seek_floppy(void)
1624 1619
1625 debug_dcl(DP->flags, "calling disk change from seek\n"); 1620 debug_dcl(DP->flags, "calling disk change from seek\n");
1626 1621
1627 if (!TESTF(FD_DISK_NEWCHANGE) && 1622 if (!test_bit(FD_DISK_NEWCHANGE_BIT, &DRS->flags) &&
1628 disk_change(current_drive) && (raw_cmd->flags & FD_RAW_NEED_DISK)) { 1623 disk_change(current_drive) && (raw_cmd->flags & FD_RAW_NEED_DISK)) {
1629 /* the media changed flag should be cleared after the seek. 1624 /* the media changed flag should be cleared after the seek.
1630 * If it isn't, this means that there is really no disk in 1625 * If it isn't, this means that there is really no disk in
1631 * the drive. 1626 * the drive.
1632 */ 1627 */
1633 SETF(FD_DISK_CHANGED); 1628 set_bit(FD_DISK_CHANGED_BIT, &DRS->flags);
1634 cont->done(0); 1629 cont->done(0);
1635 cont->redo(); 1630 cont->redo();
1636 return; 1631 return;
@@ -1638,7 +1633,7 @@ static void seek_floppy(void)
1638 if (DRS->track <= NEED_1_RECAL) { 1633 if (DRS->track <= NEED_1_RECAL) {
1639 recalibrate_floppy(); 1634 recalibrate_floppy();
1640 return; 1635 return;
1641 } else if (TESTF(FD_DISK_NEWCHANGE) && 1636 } else if (test_bit(FD_DISK_NEWCHANGE_BIT, &DRS->flags) &&
1642 (raw_cmd->flags & FD_RAW_NEED_DISK) && 1637 (raw_cmd->flags & FD_RAW_NEED_DISK) &&
1643 (DRS->track <= NO_TRACK || DRS->track == raw_cmd->track)) { 1638 (DRS->track <= NO_TRACK || DRS->track == raw_cmd->track)) {
1644 /* we seek to clear the media-changed condition. Does anybody 1639 /* we seek to clear the media-changed condition. Does anybody
@@ -1701,7 +1696,7 @@ static void recal_interrupt(void)
1701 debug_dcl(DP->flags, 1696 debug_dcl(DP->flags,
1702 "clearing NEWCHANGE flag because of second recalibrate\n"); 1697 "clearing NEWCHANGE flag because of second recalibrate\n");
1703 1698
1704 CLEARF(FD_DISK_NEWCHANGE); 1699 clear_bit(FD_DISK_NEWCHANGE_BIT, &DRS->flags);
1705 DRS->select_date = jiffies; 1700 DRS->select_date = jiffies;
1706 /* fall through */ 1701 /* fall through */
1707 default: 1702 default:
@@ -1991,7 +1986,7 @@ static void floppy_start(void)
1991 1986
1992 scandrives(); 1987 scandrives();
1993 debug_dcl(DP->flags, "setting NEWCHANGE in floppy_start\n"); 1988 debug_dcl(DP->flags, "setting NEWCHANGE in floppy_start\n");
1994 SETF(FD_DISK_NEWCHANGE); 1989 set_bit(FD_DISK_NEWCHANGE_BIT, &DRS->flags);
1995 floppy_ready(); 1990 floppy_ready();
1996} 1991}
1997 1992
@@ -2647,7 +2642,8 @@ static int make_raw_rw_request(void)
2647 HEAD = fsector_t / _floppy->sect; 2642 HEAD = fsector_t / _floppy->sect;
2648 2643
2649 if (((_floppy->stretch & (FD_SWAPSIDES | FD_SECTBASEMASK)) || 2644 if (((_floppy->stretch & (FD_SWAPSIDES | FD_SECTBASEMASK)) ||
2650 TESTF(FD_NEED_TWADDLE)) && fsector_t < _floppy->sect) 2645 test_bit(FD_NEED_TWADDLE_BIT, &DRS->flags)) &&
2646 fsector_t < _floppy->sect)
2651 max_sector = _floppy->sect; 2647 max_sector = _floppy->sect;
2652 2648
2653 /* 2M disks have phantom sectors on the first track */ 2649 /* 2M disks have phantom sectors on the first track */
@@ -2919,7 +2915,7 @@ static void redo_fd_request(void)
2919 return; 2915 return;
2920 disk_change(current_drive); 2916 disk_change(current_drive);
2921 if (test_bit(current_drive, &fake_change) || 2917 if (test_bit(current_drive, &fake_change) ||
2922 TESTF(FD_DISK_CHANGED)) { 2918 test_bit(FD_DISK_CHANGED_BIT, &DRS->flags)) {
2923 DPRINT("disk absent or changed during operation\n"); 2919 DPRINT("disk absent or changed during operation\n");
2924 REPEAT; 2920 REPEAT;
2925 } 2921 }
@@ -2944,7 +2940,7 @@ static void redo_fd_request(void)
2944 continue; 2940 continue;
2945 } 2941 }
2946 2942
2947 if (TESTF(FD_NEED_TWADDLE)) 2943 if (test_bit(FD_NEED_TWADDLE_BIT, &DRS->flags))
2948 twaddle(); 2944 twaddle();
2949 schedule_bh(floppy_start); 2945 schedule_bh(floppy_start);
2950 debugt("queue fd request"); 2946 debugt("queue fd request");
@@ -3010,7 +3006,7 @@ static int poll_drive(int interruptible, int flag)
3010 raw_cmd->cmd_count = 0; 3006 raw_cmd->cmd_count = 0;
3011 cont = &poll_cont; 3007 cont = &poll_cont;
3012 debug_dcl(DP->flags, "setting NEWCHANGE in poll_drive\n"); 3008 debug_dcl(DP->flags, "setting NEWCHANGE in poll_drive\n");
3013 SETF(FD_DISK_NEWCHANGE); 3009 set_bit(FD_DISK_NEWCHANGE_BIT, &DRS->flags);
3014 WAIT(floppy_ready); 3010 WAIT(floppy_ready);
3015 return ret; 3011 return ret;
3016} 3012}
@@ -3502,8 +3498,8 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
3502 * non-Sparc architectures */ 3498 * non-Sparc architectures */
3503 ret = fd_eject(UNIT(drive)); 3499 ret = fd_eject(UNIT(drive));
3504 3500
3505 USETF(FD_DISK_CHANGED); 3501 set_bit(FD_DISK_CHANGED_BIT, &UDRS->flags);
3506 USETF(FD_VERIFY); 3502 set_bit(FD_VERIFY_BIT, &UDRS->flags);
3507 process_fd_request(); 3503 process_fd_request();
3508 return ret; 3504 return ret;
3509 case FDCLRPRM: 3505 case FDCLRPRM:
@@ -3700,8 +3696,8 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
3700 goto out2; 3696 goto out2;
3701 3697
3702 if (!UDRS->fd_ref && (UDP->flags & FD_BROKEN_DCL)) { 3698 if (!UDRS->fd_ref && (UDP->flags & FD_BROKEN_DCL)) {
3703 USETF(FD_DISK_CHANGED); 3699 set_bit(FD_DISK_CHANGED_BIT, &UDRS->flags);
3704 USETF(FD_VERIFY); 3700 set_bit(FD_VERIFY_BIT, &UDRS->flags);
3705 } 3701 }
3706 3702
3707 if (UDRS->fd_ref == -1 || (UDRS->fd_ref && (mode & FMODE_EXCL))) 3703 if (UDRS->fd_ref == -1 || (UDRS->fd_ref && (mode & FMODE_EXCL)))
@@ -3761,11 +3757,12 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
3761 if (mode & (FMODE_READ|FMODE_WRITE)) { 3757 if (mode & (FMODE_READ|FMODE_WRITE)) {
3762 UDRS->last_checked = 0; 3758 UDRS->last_checked = 0;
3763 check_disk_change(bdev); 3759 check_disk_change(bdev);
3764 if (UTESTF(FD_DISK_CHANGED)) 3760 if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags))
3765 goto out; 3761 goto out;
3766 } 3762 }
3767 res = -EROFS; 3763 res = -EROFS;
3768 if ((mode & FMODE_WRITE) && !(UTESTF(FD_DISK_WRITABLE))) 3764 if ((mode & FMODE_WRITE) &&
3765 !test_bit(FD_DISK_WRITABLE_BIT, &UDRS->flags))
3769 goto out; 3766 goto out;
3770 } 3767 }
3771 mutex_unlock(&open_lock); 3768 mutex_unlock(&open_lock);
@@ -3789,7 +3786,8 @@ static int check_floppy_change(struct gendisk *disk)
3789{ 3786{
3790 int drive = (long)disk->private_data; 3787 int drive = (long)disk->private_data;
3791 3788
3792 if (UTESTF(FD_DISK_CHANGED) || UTESTF(FD_VERIFY)) 3789 if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) ||
3790 test_bit(FD_VERIFY_BIT, &UDRS->flags))
3793 return 1; 3791 return 1;
3794 3792
3795 if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) { 3793 if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
@@ -3798,8 +3796,8 @@ static int check_floppy_change(struct gendisk *disk)
3798 process_fd_request(); 3796 process_fd_request();
3799 } 3797 }
3800 3798
3801 if (UTESTF(FD_DISK_CHANGED) || 3799 if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) ||
3802 UTESTF(FD_VERIFY) || 3800 test_bit(FD_VERIFY_BIT, &UDRS->flags) ||
3803 test_bit(drive, &fake_change) || 3801 test_bit(drive, &fake_change) ||
3804 (!ITYPE(UDRS->fd_device) && !current_type[drive])) 3802 (!ITYPE(UDRS->fd_device) && !current_type[drive]))
3805 return 1; 3803 return 1;
@@ -3870,14 +3868,16 @@ static int floppy_revalidate(struct gendisk *disk)
3870 int cf; 3868 int cf;
3871 int res = 0; 3869 int res = 0;
3872 3870
3873 if (UTESTF(FD_DISK_CHANGED) || 3871 if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) ||
3874 UTESTF(FD_VERIFY) || test_bit(drive, &fake_change) || NO_GEOM) { 3872 test_bit(FD_VERIFY_BIT, &UDRS->flags) ||
3873 test_bit(drive, &fake_change) || NO_GEOM) {
3875 if (usage_count == 0) { 3874 if (usage_count == 0) {
3876 pr_info("VFS: revalidate called on non-open device.\n"); 3875 pr_info("VFS: revalidate called on non-open device.\n");
3877 return -EFAULT; 3876 return -EFAULT;
3878 } 3877 }
3879 lock_fdc(drive, 0); 3878 lock_fdc(drive, 0);
3880 cf = UTESTF(FD_DISK_CHANGED) || UTESTF(FD_VERIFY); 3879 cf = (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) ||
3880 test_bit(FD_VERIFY_BIT, &UDRS->flags));
3881 if (!(cf || test_bit(drive, &fake_change) || NO_GEOM)) { 3881 if (!(cf || test_bit(drive, &fake_change) || NO_GEOM)) {
3882 process_fd_request(); /*already done by another thread */ 3882 process_fd_request(); /*already done by another thread */
3883 return 0; 3883 return 0;
@@ -3887,7 +3887,7 @@ static int floppy_revalidate(struct gendisk *disk)
3887 if (buffer_drive == drive) 3887 if (buffer_drive == drive)
3888 buffer_track = -1; 3888 buffer_track = -1;
3889 clear_bit(drive, &fake_change); 3889 clear_bit(drive, &fake_change);
3890 UCLEARF(FD_DISK_CHANGED); 3890 clear_bit(FD_DISK_CHANGED_BIT, &UDRS->flags);
3891 if (cf) 3891 if (cf)
3892 UDRS->generation++; 3892 UDRS->generation++;
3893 if (NO_GEOM) { 3893 if (NO_GEOM) {
@@ -4277,9 +4277,9 @@ static int __init floppy_init(void)
4277 for (drive = 0; drive < N_DRIVE; drive++) { 4277 for (drive = 0; drive < N_DRIVE; drive++) {
4278 memset(UDRS, 0, sizeof(*UDRS)); 4278 memset(UDRS, 0, sizeof(*UDRS));
4279 memset(UDRWE, 0, sizeof(*UDRWE)); 4279 memset(UDRWE, 0, sizeof(*UDRWE));
4280 USETF(FD_DISK_NEWCHANGE); 4280 set_bit(FD_DISK_NEWCHANGE_BIT, &UDRS->flags);
4281 USETF(FD_DISK_CHANGED); 4281 set_bit(FD_DISK_CHANGED_BIT, &UDRS->flags);
4282 USETF(FD_VERIFY); 4282 set_bit(FD_VERIFY_BIT, &UDRS->flags);
4283 UDRS->fd_device = -1; 4283 UDRS->fd_device = -1;
4284 floppy_track_buffer = NULL; 4284 floppy_track_buffer = NULL;
4285 max_buffer_sectors = 0; 4285 max_buffer_sectors = 0;