Commit 83b819c5 authored by Dave Jones's avatar Dave Jones

[PATCH] jiffies wrap fixes.

Some from 2.4, some from the kernel janitor team,..
parent 775efacb
...@@ -996,7 +996,7 @@ e100_rx(struct net_device *dev) ...@@ -996,7 +996,7 @@ e100_rx(struct net_device *dev)
int i; int i;
#endif #endif
if (!led_active && jiffies > led_next_time) { if (!led_active && time_after(jiffies, led_next_time)) {
/* light the network leds depending on the current speed. */ /* light the network leds depending on the current speed. */
e100_set_network_leds(NETWORK_ACTIVITY); e100_set_network_leds(NETWORK_ACTIVITY);
...@@ -1288,7 +1288,7 @@ e100_hardware_send_packet(char *buf, int length) ...@@ -1288,7 +1288,7 @@ e100_hardware_send_packet(char *buf, int length)
{ {
D(printk("e100 send pack, buf 0x%x len %d\n", buf, length)); D(printk("e100 send pack, buf 0x%x len %d\n", buf, length));
if (!led_active && jiffies > led_next_time) { if (!led_active && time_after(jiffies, led_next_time)) {
/* light the network leds depending on the current speed. */ /* light the network leds depending on the current speed. */
e100_set_network_leds(NETWORK_ACTIVITY); e100_set_network_leds(NETWORK_ACTIVITY);
...@@ -1313,7 +1313,7 @@ e100_hardware_send_packet(char *buf, int length) ...@@ -1313,7 +1313,7 @@ e100_hardware_send_packet(char *buf, int length)
static void static void
e100_clear_network_leds(unsigned long dummy) e100_clear_network_leds(unsigned long dummy)
{ {
if (led_active && jiffies > led_next_time) { if (led_active && jiffies > time_after(jiffies, led_next_time)) {
e100_set_network_leds(NO_NETWORK_ACTIVITY); e100_set_network_leds(NO_NETWORK_ACTIVITY);
/* Set the earliest time we may set the LED */ /* Set the earliest time we may set the LED */
......
...@@ -355,7 +355,7 @@ init_e100_ide (void) ...@@ -355,7 +355,7 @@ init_e100_ide (void)
printk("ide: waiting %d seconds for drives to regain consciousness\n", CONFIG_ETRAX_IDE_DELAY); printk("ide: waiting %d seconds for drives to regain consciousness\n", CONFIG_ETRAX_IDE_DELAY);
h = jiffies + (CONFIG_ETRAX_IDE_DELAY * HZ); h = jiffies + (CONFIG_ETRAX_IDE_DELAY * HZ);
while(jiffies < h) ; while(time_before(jiffies, h)) ;
/* reset the dma channels we will use */ /* reset the dma channels we will use */
......
...@@ -2161,7 +2161,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -2161,7 +2161,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
if (signal_pending(current)) if (signal_pending(current))
break; break;
if (timeout && ((orig_jiffies + timeout) < jiffies)) if (timeout && time_after(jiffies, orig_jiffies + timeout))
break; break;
serial_out(info, UART_ESI_CMD1, ESI_NO_COMMAND); serial_out(info, UART_ESI_CMD1, ESI_NO_COMMAND);
......
...@@ -1330,7 +1330,7 @@ i2DrainOutput(i2ChanStrPtr pCh, int timeout) ...@@ -1330,7 +1330,7 @@ i2DrainOutput(i2ChanStrPtr pCh, int timeout)
// if expires == 0 then timer poped, then do not need to del_timer // if expires == 0 then timer poped, then do not need to del_timer
if ((timeout > 0) && pCh->BookmarkTimer.expires && if ((timeout > 0) && pCh->BookmarkTimer.expires &&
(pCh->BookmarkTimer.expires > jiffies)) { time_before(jiffies, pCh->BookmarkTimer.expires)) {
del_timer( &(pCh->BookmarkTimer) ); del_timer( &(pCh->BookmarkTimer) );
pCh->BookmarkTimer.expires = 0; pCh->BookmarkTimer.expires = 0;
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
/* respectively. This makes sure that the algorithm works. Some chips */ /* respectively. This makes sure that the algorithm works. Some chips */
/* might not like this, as they have an internal timeout of some mils */ /* might not like this, as they have an internal timeout of some mils */
/* /*
#define SLO_IO jif=jiffies;while(jiffies<=jif+i2c_table[minor].veryslow)\ #define SLO_IO jif=jiffies;while(time_before_eq(jiffies, jif+i2c_table[minor].veryslow))\
cond_resched(); cond_resched();
*/ */
...@@ -117,7 +117,7 @@ static inline int sclhi(struct i2c_algo_bit_data *adap) ...@@ -117,7 +117,7 @@ static inline int sclhi(struct i2c_algo_bit_data *adap)
* while they are processing data internally. * while they are processing data internally.
*/ */
setscl(adap,1); setscl(adap,1);
if (start+adap->timeout <= jiffies) { if (time_after_eq(jiffies, start+adap->timeout)) {
return -ETIMEDOUT; return -ETIMEDOUT;
} }
cond_resched(); cond_resched();
......
...@@ -440,7 +440,7 @@ static int sharp_do_wait_for_ready(struct map_info *map, struct flchip *chip, ...@@ -440,7 +440,7 @@ static int sharp_do_wait_for_ready(struct map_info *map, struct flchip *chip,
timeo = jiffies + HZ; timeo = jiffies + HZ;
while(jiffies<timeo){ while(time_before(jiffies, timeo)){
map->write32(map,CMD_READ_STATUS,adr); map->write32(map,CMD_READ_STATUS,adr);
status = map->read32(map,adr); status = map->read32(map,adr);
if((status & SR_READY)==SR_READY){ if((status & SR_READY)==SR_READY){
......
...@@ -179,7 +179,7 @@ extern inline void aurora_long_delay(unsigned long delay) ...@@ -179,7 +179,7 @@ extern inline void aurora_long_delay(unsigned long delay)
#ifdef AURORA_DEBUG #ifdef AURORA_DEBUG
printk("aurora_long_delay: start\n"); printk("aurora_long_delay: start\n");
#endif #endif
for (i = jiffies + delay; i > jiffies; ) ; for (i = jiffies + delay; time_before(jiffies, i); ) ;
#ifdef AURORA_DEBUG #ifdef AURORA_DEBUG
printk("aurora_long_delay: end\n"); printk("aurora_long_delay: end\n");
#endif #endif
......
...@@ -1869,7 +1869,7 @@ NCR53c8xx_run_tests (struct Scsi_Host *host) { ...@@ -1869,7 +1869,7 @@ NCR53c8xx_run_tests (struct Scsi_Host *host) {
*/ */
timeout = jiffies + 5 * HZ / 10; timeout = jiffies + 5 * HZ / 10;
while ((hostdata->test_completed == -1) && jiffies < timeout) { while ((hostdata->test_completed == -1) && time_before(jiffies, timeout)) {
barrier(); barrier();
cpu_relax(); cpu_relax();
} }
...@@ -1955,7 +1955,7 @@ NCR53c8xx_run_tests (struct Scsi_Host *host) { ...@@ -1955,7 +1955,7 @@ NCR53c8xx_run_tests (struct Scsi_Host *host) {
restore_flags(flags); restore_flags(flags);
timeout = jiffies + 5 * HZ; /* arbitrary */ timeout = jiffies + 5 * HZ; /* arbitrary */
while ((hostdata->test_completed == -1) && jiffies < timeout) { while ((hostdata->test_completed == -1) && time_before(jiffies, timeout)) {
barrier(); barrier();
cpu_relax(); cpu_relax();
} }
......
...@@ -1627,7 +1627,7 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) { ...@@ -1627,7 +1627,7 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) {
*/ */
timeout = jiffies + 5 * HZ / 10; timeout = jiffies + 5 * HZ / 10;
while ((hostdata->test_completed == -1) && jiffies < timeout) while ((hostdata->test_completed == -1) && time_before(jiffies, timeout))
barrier(); barrier();
failed = 1; failed = 1;
...@@ -1713,7 +1713,7 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) { ...@@ -1713,7 +1713,7 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) {
restore_flags(flags); restore_flags(flags);
timeout = jiffies + 5 * HZ; /* arbitrary */ timeout = jiffies + 5 * HZ; /* arbitrary */
while ((hostdata->test_completed == -1) && jiffies < timeout) while ((hostdata->test_completed == -1) && time_before(jiffies, timeout))
barrier(); barrier();
NCR53c7x0_write32 (DSA_REG, 0); NCR53c7x0_write32 (DSA_REG, 0);
......
...@@ -1472,7 +1472,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -1472,7 +1472,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
schedule_timeout(char_time); schedule_timeout(char_time);
if (signal_pending(current)) if (signal_pending(current))
break; break;
if (timeout && ((orig_jiffies + timeout) < jiffies)) if (timeout && time_after(jiffies, orig_jiffies + timeout))
break; break;
} }
current->state = TASK_RUNNING; current->state = TASK_RUNNING;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment