Skip to contentSkip to conversation

drivers/ide/ide-tape.c : Use of time_after macro

PATCH In review Marcelo Feitoza Parisi 2 participants 4 messages Jul 8, 2005 – Jul 16, 2005 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/ide/ide-tape.c : Use of time_after macro

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

drivers/ide/ide-tape.c +2 -1
@@ -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;

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw
Quoted 10 lines · Alexey Dobriyan
Quoted 2 lines · Marcelo Feitoza Parisi

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

OK, you're using Thunderbird, but at least include description of what patch does into attachment.

Re-sending patch, with description in the attachment.

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

drivers/ide/ide-tape.c +2 -1
@@ -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;

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw

PATCH 1/1 drivers/ide/ide-tape.c : Use of the time_after() macro

In reply to Marcelo Feitoza Parisi

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

drivers/ide/ide-tape.c +2 -1
@@ -2495,7 +2495,8 @@
 			} 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;

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors