Skip to contentSkip to conversation

polling loops: change exit condition to

PATCH In review Marcin Slusarz 2 participants 3 messages Dec 4, 2005 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 7/21 polling loops: change exit condition to

IEEE 1394 SBP2
P: Ben Collins
M: [email protected]
P: Stefan Richter
M: [email protected]

drivers/ieee1394/sbp2.c +5 -4
diff -upr -X linux-2.6.15-rc4/Documentation/dontdiff linux-2.6.15-rc4-orig/drivers/ieee1394/sbp2.c linux-2.6.15-rc4/drivers/ieee1394/sbp2.c
@@ -360,13 +360,14 @@ static void sbp2util_packet_dump(void *b
  */
 static int sbp2util_down_timeout(atomic_t *done, int timeout)
 {
-	int i;
+	unsigned long end_time;
 
-	for (i = timeout; (i > 0 && atomic_read(done) = 0); i-= HZ/10) {
+	end_time = jiffies + msecs_to_jiffies(timeout);
+	while (time_before(jiffies, end_time) && atomic_read(done) = 0) {
 		if (msleep_interruptible(100))	/* 100ms */
-			return(1);
+			return 1;
 	}
-	return ((i > 0) ? 0:1);
+	return (time_before(jiffies, end_time) ? 0 : 1);
 }
 
 /* Free's an allocated packet */

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

#1 lore raw

time_after / time_before
Message-Id: <[email protected]>
X-Mailer: Sylpheed version 2.1.7 (GTK+ 2.8.8; i686-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Patch for: drivers/ieee1394/sbp2.c

Are you sure about this line
+ end_time =3D jiffies + msecs_to_jiffies(timeout);

To me it seems timeout means nr of jiffies, not milliseconds.

Look at line 1286 in the file for example..

	/* Wait up to 20 seconds */
	if (sbp2util_down_timeout(blabla, 20*HZ)) {

Best Regards,
Daniel Marjam=E4ki

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

#2 lore raw
In reply to Marcin Slusarz
Quoted 10 lines · Daniel Marjamäki

Patch for: drivers/ieee1394/sbp2.c

Are you sure about this line

drivers/ieee1394/sbp2.c +1 -0
+	end_time = jiffies + msecs_to_jiffies(timeout);

To me it seems timeout means nr of jiffies, not milliseconds.

Look at line 1286 in the file for example..

	/* Wait up to 20 seconds */
	if (sbp2util_down_timeout(blabla, 20*HZ)) {

you are right, this line should look like this:
end_time = jiffies + timeout;

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