diff options
author | David Wong <davidtlwong@gmail.com> | 2009-12-03 08:57:02 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:42:22 -0500 |
commit | 92fda216b439932bf7511e6381bbe1d42ba98875 (patch) | |
tree | 981e31b9a2d27997c9b931e636edd83b995b750f /drivers/media/dvb/frontends | |
parent | 7fee03e487e87a196deb5602ee3c7676511995c9 (diff) |
V4L/DVB (13541): atbm8830: replace 64-bit division and floating point usage
Randy Dunlap wrote:
> On Mon, 30 Nov 2009 10:07:21 -0800 Randy Dunlap wrote:
>
>> Stephen Rothwell wrote:
>>> Hi all,
>>>
>>> Changes since 20091127:
>>>
>>> The v4l-dvb tree lost its conflict.
>>
>> on i386 (X86_32):
>>
>> a 'double' variable is used, causing:
>>
>> ERROR: "__floatunsidf" [drivers/media/common/tuners/max2165.ko] undefined!
>> ERROR: "__adddf3" [drivers/media/common/tuners/max2165.ko] undefined!
>> ERROR: "__fixunsdfsi" [drivers/media/common/tuners/max2165.ko] undefined!
>
>
> linux-next-20091202:
>
> still have this one (above) and similar with
> drivers/media/dvb/frontends/atbm8830.c:
>
> drivers/built-in.o: In function `atbm8830_init':
> atbm8830.c:(.text+0x9012f9): undefined reference to `__udivdi3'
> atbm8830.c:(.text+0x901384): undefined reference to `__floatunsidf'
> atbm8830.c:(.text+0x901395): undefined reference to `__muldf3'
> atbm8830.c:(.text+0x9013a5): undefined reference to `__floatunsidf'
> atbm8830.c:(.text+0x9013b2): undefined reference to `__divdf3'
> atbm8830.c:(.text+0x9013c3): undefined reference to `__muldf3'
> atbm8830.c:(.text+0x9013cd): undefined reference to `__fixunsdfsi'
>
> ---
> ~Randy
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
This patch replace 64-bit division by do_div() macro and remove usage of
floating point variable
Signed-off-by: David T. L. Wong <davidtlwong@gmail.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends')
-rw-r--r-- | drivers/media/dvb/frontends/atbm8830.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/media/dvb/frontends/atbm8830.c b/drivers/media/dvb/frontends/atbm8830.c index d77684893d99..59881a5944eb 100644 --- a/drivers/media/dvb/frontends/atbm8830.c +++ b/drivers/media/dvb/frontends/atbm8830.c | |||
@@ -19,6 +19,7 @@ | |||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <asm/div64.h> | ||
22 | #include "dvb_frontend.h" | 23 | #include "dvb_frontend.h" |
23 | 24 | ||
24 | #include "atbm8830.h" | 25 | #include "atbm8830.h" |
@@ -102,8 +103,12 @@ static inline int atbm8830_reglatch_lock(struct atbm_state *priv, int lock) | |||
102 | static int set_osc_freq(struct atbm_state *priv, u32 freq /*in kHz*/) | 103 | static int set_osc_freq(struct atbm_state *priv, u32 freq /*in kHz*/) |
103 | { | 104 | { |
104 | u32 val; | 105 | u32 val; |
106 | u64 t; | ||
105 | 107 | ||
106 | val = (u64)0x100000 * freq / 30400; | 108 | /* 0x100000 * freq / 30.4MHz */ |
109 | t = (u64)0x100000 * freq; | ||
110 | do_div(t, 30400); | ||
111 | val = t; | ||
107 | 112 | ||
108 | atbm8830_write_reg(priv, REG_OSC_CLK, val); | 113 | atbm8830_write_reg(priv, REG_OSC_CLK, val); |
109 | atbm8830_write_reg(priv, REG_OSC_CLK + 1, val >> 8); | 114 | atbm8830_write_reg(priv, REG_OSC_CLK + 1, val >> 8); |
@@ -116,14 +121,18 @@ static int set_if_freq(struct atbm_state *priv, u32 freq /*in kHz*/) | |||
116 | { | 121 | { |
117 | 122 | ||
118 | u32 fs = priv->config->osc_clk_freq; | 123 | u32 fs = priv->config->osc_clk_freq; |
119 | double t; | 124 | u64 t; |
120 | u32 val; | 125 | u32 val; |
121 | u8 dat; | 126 | u8 dat; |
122 | 127 | ||
123 | t = 2 * 3.141593 * (freq - fs) / fs * (1 << 22); | ||
124 | val = t; | ||
125 | |||
126 | if (freq != 0) { | 128 | if (freq != 0) { |
129 | /* 2 * PI * (freq - fs) / fs * (2 ^ 22) */ | ||
130 | t = (u64) 2 * 31416 * (freq - fs); | ||
131 | t <<= 22; | ||
132 | do_div(t, fs); | ||
133 | do_div(t, 1000); | ||
134 | val = t; | ||
135 | |||
127 | atbm8830_write_reg(priv, REG_TUNER_BASEBAND, 1); | 136 | atbm8830_write_reg(priv, REG_TUNER_BASEBAND, 1); |
128 | atbm8830_write_reg(priv, REG_IF_FREQ, val); | 137 | atbm8830_write_reg(priv, REG_IF_FREQ, val); |
129 | atbm8830_write_reg(priv, REG_IF_FREQ+1, val >> 8); | 138 | atbm8830_write_reg(priv, REG_IF_FREQ+1, val >> 8); |