diff options
author | Marcelo Feitoza Parisi <marcelo@feitoza.com.br> | 2006-03-28 04:56:46 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-28 12:16:07 -0500 |
commit | 9bae1ff3e7926fe5e92db2f3c6d8832f18f777bc (patch) | |
tree | 587f3223c048d6e06f8e61936eaa8baa69b482e0 /drivers/ide/ide-tape.c | |
parent | 05613bdd8647bfc4535b0dcc8f1b95c8b39be394 (diff) |
[PATCH] ide-tape: use time_after(), time_after_eq()
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: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r-- | drivers/ide/ide-tape.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index ebc59064b475..f04791a58df0 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -433,6 +433,7 @@ | |||
433 | #include <linux/timer.h> | 433 | #include <linux/timer.h> |
434 | #include <linux/mm.h> | 434 | #include <linux/mm.h> |
435 | #include <linux/interrupt.h> | 435 | #include <linux/interrupt.h> |
436 | #include <linux/jiffies.h> | ||
436 | #include <linux/major.h> | 437 | #include <linux/major.h> |
437 | #include <linux/devfs_fs_kernel.h> | 438 | #include <linux/devfs_fs_kernel.h> |
438 | #include <linux/errno.h> | 439 | #include <linux/errno.h> |
@@ -2336,7 +2337,7 @@ static ide_startstop_t idetape_rw_callback (ide_drive_t *drive) | |||
2336 | } | 2337 | } |
2337 | if (time_after(jiffies, tape->insert_time)) | 2338 | if (time_after(jiffies, tape->insert_time)) |
2338 | tape->insert_speed = tape->insert_size / 1024 * HZ / (jiffies - tape->insert_time); | 2339 | tape->insert_speed = tape->insert_size / 1024 * HZ / (jiffies - tape->insert_time); |
2339 | if (jiffies - tape->avg_time >= HZ) { | 2340 | if (time_after_eq(jiffies, tape->avg_time + HZ)) { |
2340 | tape->avg_speed = tape->avg_size * HZ / (jiffies - tape->avg_time) / 1024; | 2341 | tape->avg_speed = tape->avg_size * HZ / (jiffies - tape->avg_time) / 1024; |
2341 | tape->avg_size = 0; | 2342 | tape->avg_size = 0; |
2342 | tape->avg_time = jiffies; | 2343 | tape->avg_time = jiffies; |
@@ -2497,7 +2498,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
2497 | } else { | 2498 | } else { |
2498 | return ide_do_reset(drive); | 2499 | return ide_do_reset(drive); |
2499 | } | 2500 | } |
2500 | } else if (jiffies - tape->dsc_polling_start > IDETAPE_DSC_MA_THRESHOLD) | 2501 | } else if (time_after(jiffies, tape->dsc_polling_start + IDETAPE_DSC_MA_THRESHOLD)) |
2501 | tape->dsc_polling_frequency = IDETAPE_DSC_MA_SLOW; | 2502 | tape->dsc_polling_frequency = IDETAPE_DSC_MA_SLOW; |
2502 | idetape_postpone_request(drive); | 2503 | idetape_postpone_request(drive); |
2503 | return ide_stopped; | 2504 | return ide_stopped; |