linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ide-tape: use time_after(), time_after_eq()
@ 2005-11-30 21:41 Alexey Dobriyan
  2005-12-01 11:25 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Dobriyan @ 2005-11-30 21:41 UTC (permalink / raw)
  To: Gadi Oxman; +Cc: Marcelo Feitoza Parisi, Andrew Morton, linux-ide

From: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>

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>
---

 drivers/ide/ide-tape.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -443,6 +443,7 @@
 #include <linux/smp_lock.h>
 #include <linux/completion.h>
 #include <linux/bitops.h>
+#include <linux/jiffies.h>
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
@@ -2335,7 +2336,7 @@ static ide_startstop_t idetape_rw_callba
 	}
 	if (time_after(jiffies, tape->insert_time))
 		tape->insert_speed = tape->insert_size / 1024 * HZ / (jiffies - tape->insert_time);
-	if (jiffies - tape->avg_time >= HZ) {
+	if (time_after_eq(jiffies, tape->avg_time + HZ)) {
 		tape->avg_speed = tape->avg_size * HZ / (jiffies - tape->avg_time) / 1024;
 		tape->avg_size = 0;
 		tape->avg_time = jiffies;
@@ -2496,7 +2497,7 @@ static ide_startstop_t idetape_do_reques
 			} else {
 				return ide_do_reset(drive);
 			}
-		} else if (jiffies - tape->dsc_polling_start > IDETAPE_DSC_MA_THRESHOLD)
+		} else if (time_after(jiffies, tape->dsc_polling_start + IDETAPE_DSC_MA_THRESHOLD))
 			tape->dsc_polling_frequency = IDETAPE_DSC_MA_SLOW;
 		idetape_postpone_request(drive);
 		return ide_stopped;


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ide-tape: use time_after(), time_after_eq()
  2005-11-30 21:41 [PATCH] ide-tape: use time_after(), time_after_eq() Alexey Dobriyan
@ 2005-12-01 11:25 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2005-12-01 11:25 UTC (permalink / raw)
  To: Alexey Dobriyan
  Cc: Gadi Oxman, Marcelo Feitoza Parisi, Andrew Morton, linux-ide

On Thu, Dec 01 2005, Alexey Dobriyan wrote:
> From: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>
> 
> They deal with wrapping correctly and are nicer to read.

The wrapping is actually dealt with just fine in the code you replace
there, however it is nicer/easier to read with the time_* macros.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-12-01 11:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-30 21:41 [PATCH] ide-tape: use time_after(), time_after_eq() Alexey Dobriyan
2005-12-01 11:25 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).