Re: [patch] fix common mistake in polling loops

From: Dmitry Torokhov
Date: Fri Jul 28 2006 - 08:42:04 EST


On 7/28/06, Zed 0xff <zed.0xff@xxxxxxxxx> wrote:
@@ -955,11 +956,15 @@ static void psmouse_resync(void *p)
* repeat our attempts 5 times, otherwise we may be left out with disabled
* mouse.
*/
- for (i = 0; i < 5; i++) {
+ timeout = jiffies + msecs_to_jiffies(1000);
+ for (;;) {
if (!ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE)) {
enabled = 1;
break;
}
+ if (time_after(timeout, jiffies)) {
+ break;
+ }
msleep(200);
}


NAK. Have you read the comment above (that is partially visible in
your diff)? I do not really care about timeout here, I want my mouse
working.

--
Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/