From duncan.sands@math.u-psud.fr Thu Jun 23 00:27:33 2005 From: Duncan Sands To: Greg KH Subject: USB ATM: robustify poll throttling Cc: usbatm@lists.infradead.org Date: Thu, 23 Jun 2005 09:23:10 +0200 Message-Id: <200506230923.10294.duncan.sands@math.u-psud.fr> No functional change, but less likely to break in the future. Signed-off-by: Duncan Sands Signed-off-by: Greg Kroah-Hartman --- drivers/usb/atm/speedtch.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) --- gregkh-2.6.orig/drivers/usb/atm/speedtch.c 2005-06-28 13:49:39.000000000 -0700 +++ gregkh-2.6/drivers/usb/atm/speedtch.c 2005-06-28 13:49:42.000000000 -0700 @@ -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]);