diff options
author | Marcelo Feitoza Parisi <marcelo@feitoza.com.br> | 2006-03-28 04:56:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-28 12:16:06 -0500 |
commit | 50297cbf07427b47f0fff5ade8e21cdabf860249 (patch) | |
tree | 8d95f3c79f091c17ff78ba0ba0d7015166f6a52b /drivers/block/floppy.c | |
parent | f45e4656ac0609437267b242953c07d523649f8d (diff) |
[PATCH] drivers/block/*: use time_after() and friends
They deal with wrapping correctly and are nicer to read.
Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/block/floppy.c')
-rw-r--r-- | drivers/block/floppy.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index d3ad9081697e..bedb689b051f 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -170,6 +170,7 @@ static int print_unex = 1; | |||
170 | #include <linux/mm.h> | 170 | #include <linux/mm.h> |
171 | #include <linux/bio.h> | 171 | #include <linux/bio.h> |
172 | #include <linux/string.h> | 172 | #include <linux/string.h> |
173 | #include <linux/jiffies.h> | ||
173 | #include <linux/fcntl.h> | 174 | #include <linux/fcntl.h> |
174 | #include <linux/delay.h> | 175 | #include <linux/delay.h> |
175 | #include <linux/mc146818rtc.h> /* CMOS defines */ | 176 | #include <linux/mc146818rtc.h> /* CMOS defines */ |
@@ -747,7 +748,7 @@ static int disk_change(int drive) | |||
747 | { | 748 | { |
748 | int fdc = FDC(drive); | 749 | int fdc = FDC(drive); |
749 | #ifdef FLOPPY_SANITY_CHECK | 750 | #ifdef FLOPPY_SANITY_CHECK |
750 | if (jiffies - UDRS->select_date < UDP->select_delay) | 751 | if (time_before(jiffies, UDRS->select_date + UDP->select_delay)) |
751 | DPRINT("WARNING disk change called early\n"); | 752 | DPRINT("WARNING disk change called early\n"); |
752 | if (!(FDCS->dor & (0x10 << UNIT(drive))) || | 753 | if (!(FDCS->dor & (0x10 << UNIT(drive))) || |
753 | (FDCS->dor & 3) != UNIT(drive) || fdc != FDC(drive)) { | 754 | (FDCS->dor & 3) != UNIT(drive) || fdc != FDC(drive)) { |
@@ -1075,7 +1076,7 @@ static int fd_wait_for_completion(unsigned long delay, timeout_fn function) | |||
1075 | return 1; | 1076 | return 1; |
1076 | } | 1077 | } |
1077 | 1078 | ||
1078 | if ((signed)(jiffies - delay) < 0) { | 1079 | if (time_before(jiffies, delay)) { |
1079 | del_timer(&fd_timer); | 1080 | del_timer(&fd_timer); |
1080 | fd_timer.function = function; | 1081 | fd_timer.function = function; |
1081 | fd_timer.expires = delay; | 1082 | fd_timer.expires = delay; |
@@ -1535,7 +1536,7 @@ static void setup_rw_floppy(void) | |||
1535 | * again just before spinup completion. Beware that | 1536 | * again just before spinup completion. Beware that |
1536 | * after scandrives, we must again wait for selection. | 1537 | * after scandrives, we must again wait for selection. |
1537 | */ | 1538 | */ |
1538 | if ((signed)(ready_date - jiffies) > DP->select_delay) { | 1539 | if (time_after(ready_date, jiffies + DP->select_delay)) { |
1539 | ready_date -= DP->select_delay; | 1540 | ready_date -= DP->select_delay; |
1540 | function = (timeout_fn) floppy_start; | 1541 | function = (timeout_fn) floppy_start; |
1541 | } else | 1542 | } else |
@@ -3823,7 +3824,7 @@ static int check_floppy_change(struct gendisk *disk) | |||
3823 | if (UTESTF(FD_DISK_CHANGED) || UTESTF(FD_VERIFY)) | 3824 | if (UTESTF(FD_DISK_CHANGED) || UTESTF(FD_VERIFY)) |
3824 | return 1; | 3825 | return 1; |
3825 | 3826 | ||
3826 | if (UDP->checkfreq < (int)(jiffies - UDRS->last_checked)) { | 3827 | if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) { |
3827 | if (floppy_grab_irq_and_dma()) { | 3828 | if (floppy_grab_irq_and_dma()) { |
3828 | return 1; | 3829 | return 1; |
3829 | } | 3830 | } |