From: Duncan Sands Date: Thu, 23 Jun 2005 07:23:10 +0000 (+0200) Subject: [PATCH] USB ATM: robustify poll throttling X-Git-Tag: v2.6.13-rc3~81 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cd5c08fb7b0d960b7cd48bc977feee7b3bd8b046;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git [PATCH] USB ATM: robustify poll throttling No functional change, but less likely to break in the future. Signed-off-by: Duncan Sands Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c index 992db1c..03a0e99 100644 --- a/drivers/usb/atm/speedtch.c +++ b/drivers/usb/atm/speedtch.c @@ -430,13 +430,11 @@ static void speedtch_check_status(struct speedtch_instance_data *instance) 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]);