All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH] drivers/ide/ide-tape.c : Use of time_after macro
@ 2005-07-08 19:25 Marcelo Feitoza Parisi
  2005-07-08 20:33 ` Marcelo Feitoza Parisi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marcelo Feitoza Parisi @ 2005-07-08 19:25 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 117 bytes --]

Use of the time_after() macro, defined at linux/jiffies.h, which deal
with wrapping correctly and are nicer to read.

[-- Attachment #2: ide-tape.patch --]
[-- Type: text/x-patch, Size: 774 bytes --]

Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>

--- linux/drivers/ide/ide-tape.c	2005-07-07 19:13:15.000000000 -0300
+++ linux-kj/drivers/ide/ide-tape.c	2005-07-07 20:37:14.581539360 -0300
@@ -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>
@@ -2333,7 +2334,7 @@
 	}
 	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;

[-- Attachment #3: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

end of thread, other threads:[~2005-07-16  7:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-08 19:25 [KJ] [PATCH] drivers/ide/ide-tape.c : Use of time_after macro Marcelo Feitoza Parisi
2005-07-08 20:33 ` Marcelo Feitoza Parisi
2005-07-08 20:33 ` Alexey Dobriyan
2005-07-16  7:14 ` [KJ] [PATCH] drivers/ide/ide-tape.c : Use of the time_after() macro Marcelo Feitoza Parisi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.