Skip to contentSkip to conversation

drivers/cdrom/sonycd535.c : Use of the time_before()

PATCH New Marcelo Feitoza Parisi 1 participant 1 message Jul 16, 2005 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/cdrom/sonycd535.c : Use of the time_before()

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

drivers/cdrom/sonycd535.c +4 -3
@@ -130,6 +130,7 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/delay.h>
+#include <linux/jiffies.h>
 
 #define REALLY_SLOW_IO
 #include <asm/system.h>
@@ -384,7 +385,7 @@
 	int read_status;
 
 	snap = jiffies;
-	while (jiffies-snap < SONY_JIFFIES_TIMEOUT) {
+	while (time_before(jiffies, snap + SONY_JIFFIES_TIMEOUT)) {
 		read_status = inb(read_status_reg);
 		if ((read_status & SONY535_RESULT_NOT_READY_BIT) == 0) {
 #if DEBUG > 1
@@ -630,7 +631,7 @@
 		/* wait for data to be ready */
 		int data_valid = 0;
 		snap = jiffies;
-		while (jiffies-snap < SONY_JIFFIES_TIMEOUT) {
+		while (time_before(jiffies, snap + SONY_JIFFIES_TIMEOUT)) {
 			read_status = inb(read_status_reg);
 			if ((read_status & SONY535_RESULT_NOT_READY_BIT) == 0) {
 				read_exec_status(status);
@@ -1483,7 +1484,7 @@
 
 	outb(0, read_status_reg);	/* does a reset? */
 	snap = jiffies;
-	while (jiffies-snap < SONY_JIFFIES_TIMEOUT) {
+	while (time_before(jiffies, snap + SONY_JIFFIES_TIMEOUT)) {
 		select_unit(0);
 		if (inb(result_reg) != 0xff) {
 			got_result = 1;

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