]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Jiffies wrap fixes.
authorDave Jones <davej@suse.de>
Sun, 28 Apr 2002 11:55:06 +0000 (04:55 -0700)
committerJaroslav Kysela <perex@suse.cz>
Sun, 28 Apr 2002 11:55:06 +0000 (04:55 -0700)
drivers/atm/fore200e.c
drivers/net/fc/iph5526.c
drivers/net/rrunner.c
drivers/scsi/cpqfcTSstructs.h
drivers/scsi/gdth_proc.c
drivers/scsi/qlogicfas.c
drivers/scsi/qlogicfc.c
drivers/scsi/sun3_scsi.c
drivers/usb/serial/digi_acceleport.c

index 1a29332ad1eb015d39fe6903d60c96abe27958cb..59e96cf11a5e6fa55df7f35297cec83c78c68d69 100644 (file)
@@ -251,7 +251,7 @@ static void
 fore200e_spin(int msecs)
 {
     unsigned long timeout = jiffies + MSECS(msecs);
-    while (jiffies < timeout);
+    while (time_before(jiffies, timeout));
 }
 
 
@@ -266,7 +266,7 @@ fore200e_poll(struct fore200e* fore200e, volatile u32* addr, u32 val, int msecs)
        if ((ok = (*addr == val)) || (*addr & STATUS_ERROR))
            break;
 
-    } while (jiffies < timeout);
+    } while (time_before(jiffies, timeout));
 
 #if 1
     if (!ok) {
@@ -289,7 +289,7 @@ fore200e_io_poll(struct fore200e* fore200e, volatile u32* addr, u32 val, int mse
        if ((ok = (fore200e->bus->read(addr) == val)))
            break;
 
-    } while (jiffies < timeout);
+    } while (time_before(jiffies, timeout));
 
 #if 1
     if (!ok) {
@@ -2416,7 +2416,7 @@ fore200e_monitor_getc(struct fore200e* fore200e)
     unsigned long      timeout = jiffies + MSECS(50);
     int                c;
 
-    while (jiffies < timeout) {
+    while (time_before(jiffies, timeout)) {
 
        c = (int) fore200e->bus->read(&monitor->soft_uart.recv);
 
index c6a8663a3e76ddc01c89a6a5c7825edd37190372..0819ccc93818ea4f692b193f4afd097ea02ea643 100644 (file)
@@ -3870,8 +3870,11 @@ struct pci_dev *pdev = NULL;
                /* Wait for the Link to come up and the login process 
                 * to complete. 
                 */
-               for(timeout = jiffies + 10*HZ; (timeout > jiffies) && ((fi->g.link_up == FALSE) || (fi->g.port_discovery == TRUE) || (fi->g.explore_fabric == TRUE) || (fi->g.perform_adisc == TRUE));)
+               for(timeout = jiffies + 10*HZ; time_before(jiffies, timeout) && ((fi->g.link_up == FALSE) || (fi->g.port_discovery == TRUE) || (fi->g.explore_fabric == TRUE) || (fi->g.perform_adisc == TRUE));)
+               {
+                       cpu_relax();
                        barrier();
+               }
                
                count++;
                no_of_hosts++;
index a42abd30adddc36b8fab37668b88b238b013585d..9607f2573e9bb28c66a4721780202326503338bf 100644 (file)
@@ -773,7 +773,7 @@ static int rr_init1(struct net_device *dev)
         * Give the FirmWare time to chew on the `get running' command.
         */
        myjif = jiffies + 5 * HZ;
-       while ((jiffies < myjif) && !rrpriv->fw_running);
+       while (time_before(jiffies, myjif) && !rrpriv->fw_running);
 
        netif_start_queue(dev);
 
index a60603a4e978e3148dc43f8a5c0824a9840edf94..f0b8338d925b4651a962ccb462dfa30092b51209 100644 (file)
@@ -27,7 +27,7 @@
 
 #define DbgDelay(secs) { int wait_time; printk( " DbgDelay %ds ", secs); \
                          for( wait_time=jiffies + (secs*HZ); \
-                        wait_time > jiffies ;) ; }
+                        time_before(jiffies, wait_time) ;) ; }
 
 #define CPQFCTS_DRIVER_VER(maj,min,submin) ((maj<<16)|(min<<8)|(submin))
 // don't forget to also change MODULE_DESCRIPTION in cpqfcTSinit.c
index 371e44dbf050e9065d6eb96168fed3b970e45db8..8865612538ac7805eee41bad68661752dbe1c0e1 100644 (file)
@@ -1464,7 +1464,7 @@ static int gdth_update_timeout(int hanum, Scsi_Cmnd *scp, int timeout)
             timer_table[SCSI_TIMER].expires = jiffies + timeout;
             timer_active |= 1 << SCSI_TIMER;
         } else {
-            if (jiffies + timeout < timer_table[SCSI_TIMER].expires)
+            if (time_before(jiffies + timeout, timer_table[SCSI_TIMER].expires))
                 timer_table[SCSI_TIMER].expires = jiffies + timeout;
         }
     }
index 9a96c900c0c09c71080e4e278c9c164b7c3aa19f..6fdb00edcfac88d310a3d38bb632d015b57fb0d0 100644 (file)
@@ -271,11 +271,11 @@ static int        ql_wai(void)
 int    i,k;
        k = 0;
        i = jiffies + WATCHDOG;
-       while ( i > jiffies && !qabort && !((k = inb(qbase + 4)) & 0xe0)) {
+       while (time_before(jiffies, i) && !qabort && !((k = inb(qbase + 4)) & 0xe0)) {
                barrier();
                cpu_relax();
        }
-       if (i <= jiffies)
+       if (time_after_eq(jiffies, i))
                return (DID_TIME_OUT);
        if (qabort)
                return (qabort == 1 ? DID_ABORT : DID_RESET);
@@ -407,8 +407,8 @@ rtrc(2)
        }
 /*** Enter Status (and Message In) Phase ***/
        k = jiffies + WATCHDOG;
-       while ( k > jiffies && !qabort && !(inb(qbase + 4) & 6));       /* wait for status phase */
-       if ( k <= jiffies ) {
+       while ( time_before(jiffies, k) && !qabort && !(inb(qbase + 4) & 6));   /* wait for status phase */
+       if ( time_after_eq(jiffies, k) ) {
                ql_zap();
                return (DID_TIME_OUT << 16);
        }
index 0985faf242b98c7ed70f0761c0f52445fefa2547..32627b9e3c05c4b27c71d168f4965b6dd867a4ea 100644 (file)
@@ -802,7 +802,7 @@ int isp2x00_detect(Scsi_Host_Template * tmpt)
                        outw(HCCR_CLEAR_RISC_INTR, host->io_port + HOST_HCCR);
                        isp2x00_enable_irqs(host);
                        /* wait for the loop to come up */
-                       for (wait_time = jiffies + 10 * HZ; wait_time > jiffies && hostdata->adapter_state == AS_LOOP_DOWN;) {
+                       for (wait_time = jiffies + 10 * HZ; time_before(jiffies, wait_time) && hostdata->adapter_state == AS_LOOP_DOWN;) {
                                barrier();
                                cpu_relax();
                        }
@@ -819,7 +819,7 @@ int isp2x00_detect(Scsi_Host_Template * tmpt)
           some time before recognizing it is attached to a fabric */
 
 #if ISP2x00_FABRIC
-       for (wait_time = jiffies + 5 * HZ; wait_time > jiffies;) {
+       for (wait_time = jiffies + 5 * HZ; time_before(jiffies, wait_time);) {
                barrier();
                cpu_relax();
        }
index a3d4d321605ff92acf754a1b4053d95bb6959468..5ead6e4ec7df7a46255e7db815ca951f276433e0 100644 (file)
@@ -357,7 +357,7 @@ static void sun3_scsi_reset_boot(struct Scsi_Host *instance)
        NCR5380_write( INITIATOR_COMMAND_REG, ICR_BASE );
        NCR5380_read( RESET_PARITY_INTERRUPT_REG );
 
-       for( end = jiffies + AFTER_RESET_DELAY; jiffies < end; )
+       for( end = jiffies + AFTER_RESET_DELAY; time_before(jiffies, end); )
                barrier();
 
        /* switch on SCSI IRQ again */
index 5702d26c5b3022637036d16c43e7c8c7ca779d71..a6d7104a946a12a4ee727ee67380f69a8f7ca9b6 100644 (file)
@@ -732,7 +732,7 @@ count );
        while( count > 0 && ret == 0 ) {
 
                while( (port->write_urb->status == -EINPROGRESS
-               || priv->dp_write_urb_in_use) && jiffies < timeout ) {
+               || priv->dp_write_urb_in_use) && time_before(jiffies, timeout)) {
                        cond_wait_interruptible_timeout_irqrestore(
                                &port->write_wait, DIGI_RETRY_TIMEOUT,
                                &priv->dp_port_lock, flags );
@@ -897,7 +897,7 @@ static int digi_transmit_idle( struct usb_serial_port *port,
 
        spin_lock_irqsave( &priv->dp_port_lock, flags );
 
-       while( jiffies < timeout && !priv->dp_transmit_idle ) {
+       while( time_before(jiffies, timeout) && !priv->dp_transmit_idle ) {
                cond_wait_interruptible_timeout_irqrestore(
                        &priv->dp_transmit_idle_wait, DIGI_RETRY_TIMEOUT,
                        &priv->dp_port_lock, flags );