aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Feitoza Parisi <marcelo@feitoza.com.br>2006-03-28 04:56:44 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-28 12:16:06 -0500
commit50297cbf07427b47f0fff5ade8e21cdabf860249 (patch)
tree8d95f3c79f091c17ff78ba0ba0d7015166f6a52b
parentf45e4656ac0609437267b242953c07d523649f8d (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>
-rw-r--r--drivers/block/DAC960.c17
-rw-r--r--drivers/block/floppy.c9
2 files changed, 14 insertions, 12 deletions
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index 49c7cd558ddf..45bcda544880 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -41,6 +41,7 @@
41#include <linux/timer.h> 41#include <linux/timer.h>
42#include <linux/pci.h> 42#include <linux/pci.h>
43#include <linux/init.h> 43#include <linux/init.h>
44#include <linux/jiffies.h>
44#include <linux/random.h> 45#include <linux/random.h>
45#include <asm/io.h> 46#include <asm/io.h>
46#include <asm/uaccess.h> 47#include <asm/uaccess.h>
@@ -3654,8 +3655,8 @@ static void DAC960_V1_ProcessCompletedCommand(DAC960_Command_T *Command)
3654 (NewEnquiry->EventLogSequenceNumber != 3655 (NewEnquiry->EventLogSequenceNumber !=
3655 OldEnquiry->EventLogSequenceNumber) || 3656 OldEnquiry->EventLogSequenceNumber) ||
3656 Controller->MonitoringTimerCount == 0 || 3657 Controller->MonitoringTimerCount == 0 ||
3657 (jiffies - Controller->SecondaryMonitoringTime 3658 time_after_eq(jiffies, Controller->SecondaryMonitoringTime
3658 >= DAC960_SecondaryMonitoringInterval)) 3659 + DAC960_SecondaryMonitoringInterval))
3659 { 3660 {
3660 Controller->V1.NeedLogicalDriveInformation = true; 3661 Controller->V1.NeedLogicalDriveInformation = true;
3661 Controller->V1.NewEventLogSequenceNumber = 3662 Controller->V1.NewEventLogSequenceNumber =
@@ -5640,8 +5641,8 @@ static void DAC960_MonitoringTimerFunction(unsigned long TimerData)
5640 unsigned int StatusChangeCounter = 5641 unsigned int StatusChangeCounter =
5641 Controller->V2.HealthStatusBuffer->StatusChangeCounter; 5642 Controller->V2.HealthStatusBuffer->StatusChangeCounter;
5642 boolean ForceMonitoringCommand = false; 5643 boolean ForceMonitoringCommand = false;
5643 if (jiffies - Controller->SecondaryMonitoringTime 5644 if (time_after(jiffies, Controller->SecondaryMonitoringTime
5644 > DAC960_SecondaryMonitoringInterval) 5645 + DAC960_SecondaryMonitoringInterval))
5645 { 5646 {
5646 int LogicalDriveNumber; 5647 int LogicalDriveNumber;
5647 for (LogicalDriveNumber = 0; 5648 for (LogicalDriveNumber = 0;
@@ -5669,8 +5670,8 @@ static void DAC960_MonitoringTimerFunction(unsigned long TimerData)
5669 ControllerInfo->ConsistencyChecksActive + 5670 ControllerInfo->ConsistencyChecksActive +
5670 ControllerInfo->RebuildsActive + 5671 ControllerInfo->RebuildsActive +
5671 ControllerInfo->OnlineExpansionsActive == 0 || 5672 ControllerInfo->OnlineExpansionsActive == 0 ||
5672 jiffies - Controller->PrimaryMonitoringTime 5673 time_before(jiffies, Controller->PrimaryMonitoringTime
5673 < DAC960_MonitoringTimerInterval) && 5674 + DAC960_MonitoringTimerInterval)) &&
5674 !ForceMonitoringCommand) 5675 !ForceMonitoringCommand)
5675 { 5676 {
5676 Controller->MonitoringTimer.expires = 5677 Controller->MonitoringTimer.expires =
@@ -5807,8 +5808,8 @@ static void DAC960_Message(DAC960_MessageLevel_T MessageLevel,
5807 Controller->ProgressBufferLength = Length; 5808 Controller->ProgressBufferLength = Length;
5808 if (Controller->EphemeralProgressMessage) 5809 if (Controller->EphemeralProgressMessage)
5809 { 5810 {
5810 if (jiffies - Controller->LastProgressReportTime 5811 if (time_after_eq(jiffies, Controller->LastProgressReportTime
5811 >= DAC960_ProgressReportingInterval) 5812 + DAC960_ProgressReportingInterval))
5812 { 5813 {
5813 printk("%sDAC960#%d: %s", DAC960_MessageLevelMap[MessageLevel], 5814 printk("%sDAC960#%d: %s", DAC960_MessageLevelMap[MessageLevel],
5814 Controller->ControllerNumber, Buffer); 5815 Controller->ControllerNumber, Buffer);
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 }