[PATCH] floppy: use time_after() and time_before() macros From: Marcelo Feitoza Parisi They deal with wrapping correctly and are nicer to read. Signed-off-by: Marcelo Feitoza Parisi Signed-off-by: Alexey Dobriyan Index: linux-kj/drivers/block/floppy.c =================================================================== --- linux-kj.orig/drivers/block/floppy.c 2005-09-21 01:23:52.000000000 +0400 +++ linux-kj/drivers/block/floppy.c 2005-09-21 01:50:41.000000000 +0400 @@ -179,6 +179,7 @@ static int print_unex = 1; #include #include #include /* for invalidate_buffers() */ +#include /* * PS/2 floppies have much slower step rates than regular floppies. @@ -735,7 +736,7 @@ static int disk_change(int drive) { int fdc = FDC(drive); #ifdef FLOPPY_SANITY_CHECK - if (jiffies - UDRS->select_date < UDP->select_delay) + if (time_before(jiffies, UDRS->select_date + UDP->select_delay)) DPRINT("WARNING disk change called early\n"); if (!(FDCS->dor & (0x10 << UNIT(drive))) || (FDCS->dor & 3) != UNIT(drive) || fdc != FDC(drive)) { @@ -1063,7 +1064,7 @@ static int fd_wait_for_completion(unsign return 1; } - if ((signed)(jiffies - delay) < 0) { + if (time_before(jiffies, delay)) { del_timer(&fd_timer); fd_timer.function = function; fd_timer.expires = delay; @@ -1523,7 +1524,7 @@ static void setup_rw_floppy(void) * again just before spinup completion. Beware that * after scandrives, we must again wait for selection. */ - if ((signed)(ready_date - jiffies) > DP->select_delay) { + if (time_after(ready_date, jiffies + DP->select_delay)) { ready_date -= DP->select_delay; function = (timeout_fn) floppy_start; } else