All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH] drivers/cdrom/sonycd535.c : Use of the time_before()
@ 2005-07-16  7:23 Marcelo Feitoza Parisi
  0 siblings, 0 replies; only message in thread
From: Marcelo Feitoza Parisi @ 2005-07-16  7:23 UTC (permalink / raw)
  To: kernel-janitors

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



[-- Attachment #2: sonycd535.patch --]
[-- Type: text/x-patch, Size: 1402 bytes --]

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

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

--- linux/drivers/cdrom/sonycd535.c	2005-07-13 17:53:26.000000000 -0300
+++ linux-kj/drivers/cdrom/sonycd535.c	2005-07-15 15:51:46.557015728 -0300
@@ -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;

[-- 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] only message in thread

only message in thread, other threads:[~2005-07-16  7:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-16  7:23 [KJ] [PATCH] drivers/cdrom/sonycd535.c : Use of the time_before() 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.