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 Cc: Jens Axboe Signed-off-by: Andrew Morton --- drivers/block/DAC960.c | 17 +++++++++-------- drivers/block/floppy.c | 9 +++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff -puN drivers/block/DAC960.c~drivers-block-use-time_after-and-friends drivers/block/DAC960.c --- 25/drivers/block/DAC960.c~drivers-block-use-time_after-and-friends Wed Nov 30 15:25:55 2005 +++ 25-akpm/drivers/block/DAC960.c Wed Nov 30 15:25:55 2005 @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include "DAC960.h" @@ -3657,8 +3658,8 @@ static void DAC960_V1_ProcessCompletedCo (NewEnquiry->EventLogSequenceNumber != OldEnquiry->EventLogSequenceNumber) || Controller->MonitoringTimerCount == 0 || - (jiffies - Controller->SecondaryMonitoringTime - >= DAC960_SecondaryMonitoringInterval)) + time_after_eq(jiffies, Controller->SecondaryMonitoringTime + + DAC960_SecondaryMonitoringInterval)) { Controller->V1.NeedLogicalDriveInformation = true; Controller->V1.NewEventLogSequenceNumber = @@ -5643,8 +5644,8 @@ static void DAC960_MonitoringTimerFuncti unsigned int StatusChangeCounter = Controller->V2.HealthStatusBuffer->StatusChangeCounter; boolean ForceMonitoringCommand = false; - if (jiffies - Controller->SecondaryMonitoringTime - > DAC960_SecondaryMonitoringInterval) + if (time_after(jiffies, Controller->SecondaryMonitoringTime + + DAC960_SecondaryMonitoringInterval)) { int LogicalDriveNumber; for (LogicalDriveNumber = 0; @@ -5672,8 +5673,8 @@ static void DAC960_MonitoringTimerFuncti ControllerInfo->ConsistencyChecksActive + ControllerInfo->RebuildsActive + ControllerInfo->OnlineExpansionsActive == 0 || - jiffies - Controller->PrimaryMonitoringTime - < DAC960_MonitoringTimerInterval) && + time_before(jiffies, Controller->PrimaryMonitoringTime + + DAC960_MonitoringTimerInterval)) && !ForceMonitoringCommand) { Controller->MonitoringTimer.expires = @@ -5810,8 +5811,8 @@ static void DAC960_Message(DAC960_Messag Controller->ProgressBufferLength = Length; if (Controller->EphemeralProgressMessage) { - if (jiffies - Controller->LastProgressReportTime - >= DAC960_ProgressReportingInterval) + if (time_after_eq(jiffies, Controller->LastProgressReportTime + + DAC960_ProgressReportingInterval)) { printk("%sDAC960#%d: %s", DAC960_MessageLevelMap[MessageLevel], Controller->ControllerNumber, Buffer); diff -puN drivers/block/floppy.c~drivers-block-use-time_after-and-friends drivers/block/floppy.c --- 25/drivers/block/floppy.c~drivers-block-use-time_after-and-friends Wed Nov 30 15:25:55 2005 +++ 25-akpm/drivers/block/floppy.c Wed Nov 30 15:25:55 2005 @@ -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. @@ -736,7 +737,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)) { @@ -1064,7 +1065,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; @@ -1524,7 +1525,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 @@ -3812,7 +3813,7 @@ static int check_floppy_change(struct ge if (UTESTF(FD_DISK_CHANGED) || UTESTF(FD_VERIFY)) return 1; - if (UDP->checkfreq < (int)(jiffies - UDRS->last_checked)) { + if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) { if (floppy_grab_irq_and_dma()) { return 1; } _