Commit 8412a961 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: 8253.h: remove the unused i8253_cascade_ns_to_timer_*()

None of the comedi drivers use the i8253_cascade_ns_to_timer_2div_old()
or i8253_cascade_ns_to_timer_power() helpers to calculate the cascaded
divisors. Remove them to avoid any confusion.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d33f8858
...@@ -30,99 +30,6 @@ ...@@ -30,99 +30,6 @@
#define I8254_OSC_BASE_2MHZ 500 #define I8254_OSC_BASE_2MHZ 500
#define I8254_OSC_BASE_1MHZ 1000 #define I8254_OSC_BASE_1MHZ 1000
static inline void i8253_cascade_ns_to_timer_2div_old(int i8253_osc_base,
unsigned int *d1,
unsigned int *d2,
unsigned int *nanosec,
int round_mode)
{
int divider;
int div1, div2;
int div1_glb, div2_glb, ns_glb;
int div1_lub, div2_lub, ns_lub;
int ns;
divider = (*nanosec + i8253_osc_base / 2) / i8253_osc_base;
/* find 2 integers 1<={x,y}<=65536 such that x*y is
close to divider */
div1_lub = div2_lub = 0;
div1_glb = div2_glb = 0;
ns_glb = 0;
ns_lub = 0xffffffff;
div2 = 0x10000;
for (div1 = divider / 65536 + 1; div1 < div2; div1++) {
div2 = divider / div1;
ns = i8253_osc_base * div1 * div2;
if (ns <= *nanosec && ns > ns_glb) {
ns_glb = ns;
div1_glb = div1;
div2_glb = div2;
}
div2++;
if (div2 <= 65536) {
ns = i8253_osc_base * div1 * div2;
if (ns > *nanosec && ns < ns_lub) {
ns_lub = ns;
div1_lub = div1;
div2_lub = div2;
}
}
}
*nanosec = div1_lub * div2_lub * i8253_osc_base;
*d1 = div1_lub & 0xffff;
*d2 = div2_lub & 0xffff;
return;
}
static inline void i8253_cascade_ns_to_timer_power(int i8253_osc_base,
unsigned int *d1,
unsigned int *d2,
unsigned int *nanosec,
int round_mode)
{
int div1, div2;
int base;
for (div1 = 2; div1 <= (1 << 16); div1 <<= 1) {
base = i8253_osc_base * div1;
round_mode &= TRIG_ROUND_MASK;
switch (round_mode) {
case TRIG_ROUND_NEAREST:
default:
div2 = (*nanosec + base / 2) / base;
break;
case TRIG_ROUND_DOWN:
div2 = (*nanosec) / base;
break;
case TRIG_ROUND_UP:
div2 = (*nanosec + base - 1) / base;
break;
}
if (div2 < 2)
div2 = 2;
if (div2 <= 65536) {
*nanosec = div2 * base;
*d1 = div1 & 0xffff;
*d2 = div2 & 0xffff;
return;
}
}
/* shouldn't get here */
div1 = 0x10000;
div2 = 0x10000;
*nanosec = div1 * div2 * i8253_osc_base;
*d1 = div1 & 0xffff;
*d2 = div2 & 0xffff;
}
static inline void i8253_cascade_ns_to_timer(int i8253_osc_base, static inline void i8253_cascade_ns_to_timer(int i8253_osc_base,
unsigned int *d1, unsigned int *d1,
unsigned int *d2, unsigned int *d2,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment