[PATCH] USB ATM: robustify poll throttling

Duncan Sands duncan.sands at math.u-psud.fr
Thu Jun 23 03:23:10 EDT 2005


No functional change, but less likely to break in the future.

Signed-off-by: Duncan Sands <baldrick at free.fr>

Index: Linux/drivers/usb/atm/speedtch.c
===================================================================
--- Linux.orig/drivers/usb/atm/speedtch.c	2005-06-23 09:02:45.508925765 +0200
+++ Linux/drivers/usb/atm/speedtch.c	2005-06-23 09:05:42.564761044 +0200
@@ -430,13 +430,11 @@
 	ret = speedtch_read_status(instance);
 	if (ret < 0) {
 		atm_warn(usbatm, "error %d fetching device status\n", ret);
-		if (instance->poll_delay < MAX_POLL_DELAY)
-			instance->poll_delay *= 2;
+		instance->poll_delay = min(2 * instance->poll_delay, MAX_POLL_DELAY);
 		return;
 	}
 
-	if (instance->poll_delay > MIN_POLL_DELAY)
-		instance->poll_delay /= 2;
+	instance->poll_delay = max(instance->poll_delay / 2, MIN_POLL_DELAY);
 
 	atm_dbg(usbatm, "%s: line state %02x\n", __func__, buf[OFFSET_7]);
 



More information about the Usbatm mailing list