From: Frank Mori Hess Date: Thu, 17 Feb 2005 22:48:11 +0000 (+0000) Subject: patch from Ian Abbott : X-Git-Tag: r0_7_70~50 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=f7fac0af71efa75d5796c7999dbe38fd7d939f4d;p=comedi.git patch from Ian Abbott : This patch improves the "early exit" test in the i8253_cascade_ns_to_timer_2div function (comedi/drivers/8253.h) to take account of a divisor of 65536 being represented by 0. --- diff --git a/comedi/drivers/8253.h b/comedi/drivers/8253.h index 734f7f77..97066b71 100644 --- a/comedi/drivers/8253.h +++ b/comedi/drivers/8253.h @@ -131,9 +131,11 @@ static inline void i8253_cascade_ns_to_timer_2div(int i8253_osc_base, /* exit early if everything is already correct (this can save time * since this function may be called repeatedly during command tests * and execution) */ - if(*d1 * *d2 * i8253_osc_base == *nanosec && - *d1 > 1 && *d1 < 0x10000 && - *d2 > 1 && *d2 < 0x10000) + div1 = *d1 ? *d1 : 0x10000; + div2 = *d2 ? *d2 : 0x10000; + if(div1 * div2 * i8253_osc_base == *nanosec && + div1 > 1 && div1 <= 0x10000 && + div2 > 1 && div2 <= 0x10000) { return; }