Skip to contentSkip to conversation

polling loops: change exit condition to

PATCH In review Marcin Slusarz 1 participant 1 message Dec 4, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 9/21 polling loops: change exit condition to

INPUT (KEYBOARD, MOUSE, JOYSTICK) DRIVERS
P: Vojtech Pavlik
M: [email protected]

drivers/input/joystick/analog.c +3 -1
diff -upr -X linux-2.6.15-rc4/Documentation/dontdiff linux-2.6.15-rc4-orig/drivers/input/joystick/analog.c linux-2.6.15-rc4/drivers/input/joystick/analog.c
@@ -576,6 +576,7 @@ static int analog_init_masks(struct anal
 static int analog_init_port(struct gameport *gameport, struct gameport_driver *drv, struct analog_port *port)
 {
 	int i, t, u, v;
+	unsigned long end_time;
 
 	port->gameport = gameport;
 
@@ -591,7 +592,8 @@ static int analog_init_port(struct gamep
 		port->mask = (gameport_read(gameport) ^ t) & t & 0xf;
 		port->fuzz = (port->speed * ANALOG_FUZZ_MAGIC) / port->loop / 1000 + ANALOG_FUZZ_BITS;
 
-		for (i = 0; i < ANALOG_INIT_RETRIES; i++) {
+		end_time = jiffies + msecs_to_jiffies(ANALOG_MAX_TIME * ANALOG_INIT_RETRIES);
+		while (time_before(jiffies, end_time)) {
 			if (!analog_cooked_read(port))
 				break;
 			msleep(ANALOG_MAX_TIME);

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