linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: linux-next: Tree for November 30 (media/common/tuners/max2165)
       [not found] <20091130175346.3f3345ed.sfr@canb.auug.org.au>
@ 2009-11-30 18:07 ` Randy Dunlap
  2009-12-02 18:04   ` Randy Dunlap
  0 siblings, 1 reply; 6+ messages in thread
From: Randy Dunlap @ 2009-11-30 18:07 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-next, LKML, linux-media

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!


-- 
~Randy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: linux-next: Tree for November 30 (media/common/tuners/max2165)
  2009-11-30 18:07 ` linux-next: Tree for November 30 (media/common/tuners/max2165) Randy Dunlap
@ 2009-12-02 18:04   ` Randy Dunlap
  2009-12-03 13:54     ` [PATCH] max2165 32bit build patch David T. L. Wong
  2009-12-03 13:57     ` [PATCH] atbm8830: replace 64-bit division and floating point usage David T. L. Wong
  0 siblings, 2 replies; 6+ messages in thread
From: Randy Dunlap @ 2009-12-02 18:04 UTC (permalink / raw)
  To: linux-next; +Cc: Stephen Rothwell, LKML, linux-media

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] max2165 32bit build patch
  2009-12-02 18:04   ` Randy Dunlap
@ 2009-12-03 13:54     ` David T. L. Wong
  2009-12-03 17:24       ` Randy Dunlap
  2009-12-03 13:57     ` [PATCH] atbm8830: replace 64-bit division and floating point usage David T. L. Wong
  1 sibling, 1 reply; 6+ messages in thread
From: David T. L. Wong @ 2009-12-03 13:54 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: linux-next, Stephen Rothwell, LKML, linux-media,
	Mauro Carvalho Chehab

[-- Attachment #1: Type: text/plain, Size: 1484 bytes --]

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 drops usage of floating point variable for 32bit build

Signed-off-by: David T. L. Wong <davidtlwong@gmail.com>

[-- Attachment #2: max2165_no_float.patch --]
[-- Type: text/x-patch, Size: 582 bytes --]

diff --git a/linux/drivers/media/common/tuners/max2165.c b/linux/drivers/media/common/tuners/max2165.c
--- a/linux/drivers/media/common/tuners/max2165.c
+++ b/linux/drivers/media/common/tuners/max2165.c
@@ -193,7 +193,7 @@
 {
 	u8 tf;
 	u8 tf_ntch;
-	double t;
+	u32 t;
 	u32 quotient, fraction;
 
 	/* Set PLL divider according to RF frequency */
@@ -217,9 +217,6 @@
 	t += (priv->tf_balun_hi_ref - priv->tf_balun_low_ref)
 		* (freq / 1000 - 470000) / (780000 - 470000);
 
-#if 0
-	tf = t + 0.5; /* round up */
-#endif
 	tf = t;
 	dprintk("tf = %X\n", tf);
 	tf |= tf_ntch << 4;


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] atbm8830: replace 64-bit division and floating point usage
  2009-12-02 18:04   ` Randy Dunlap
  2009-12-03 13:54     ` [PATCH] max2165 32bit build patch David T. L. Wong
@ 2009-12-03 13:57     ` David T. L. Wong
  2009-12-03 17:25       ` Randy Dunlap
  1 sibling, 1 reply; 6+ messages in thread
From: David T. L. Wong @ 2009-12-03 13:57 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: linux-next, Stephen Rothwell, LKML, linux-media,
	Mauro Carvalho Chehab

[-- Attachment #1: Type: text/plain, Size: 1516 bytes --]

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>

[-- Attachment #2: atbm8830_32bit.patch --]
[-- Type: text/x-patch, Size: 1237 bytes --]

diff --git a/linux/drivers/media/dvb/frontends/atbm8830.c b/linux/drivers/media/dvb/frontends/atbm8830.c
--- a/linux/drivers/media/dvb/frontends/atbm8830.c
+++ b/linux/drivers/media/dvb/frontends/atbm8830.c
@@ -19,6 +19,7 @@
  *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <asm/div64.h>
 #include "dvb_frontend.h"
 
 #include "atbm8830.h"
@@ -102,8 +103,12 @@
 static int set_osc_freq(struct atbm_state *priv, u32 freq /*in kHz*/)
 {
 	u32 val;
+	u64 t;
 
-	val = (u64)0x100000 * freq / 30400;
+	/* 0x100000 * freq / 30.4MHz */
+	t = (u64)0x100000 * freq;
+	do_div(t, 30400);
+	val = t;
 
 	atbm8830_write_reg(priv, REG_OSC_CLK, val);
 	atbm8830_write_reg(priv, REG_OSC_CLK + 1, val >> 8);
@@ -116,14 +121,18 @@
 {
 	
 	u32 fs = priv->config->osc_clk_freq;
-	double t;
+	u64 t;
 	u32 val;
 	u8 dat;
 
-	t = 2 * 3.141593 * (freq - fs) / fs * (1 << 22);
-	val = t;
+	if (freq != 0) {
+		/* 2 * PI * (freq - fs) / fs * (2 ^ 22) */
+		t = (u64) 2 * 31416 * (freq - fs);
+		t <<= 22;
+		do_div(t, fs);
+		do_div(t, 1000);
+		val = t;
 
-	if (freq != 0) {
 		atbm8830_write_reg(priv, REG_TUNER_BASEBAND, 1);
 		atbm8830_write_reg(priv, REG_IF_FREQ, val);
 		atbm8830_write_reg(priv, REG_IF_FREQ+1, val >> 8);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] max2165 32bit build patch
  2009-12-03 13:54     ` [PATCH] max2165 32bit build patch David T. L. Wong
@ 2009-12-03 17:24       ` Randy Dunlap
  0 siblings, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2009-12-03 17:24 UTC (permalink / raw)
  To: David T. L. Wong
  Cc: linux-next, Stephen Rothwell, LKML, linux-media,
	Mauro Carvalho Chehab

On Thu, 03 Dec 2009 21:54:25 +0800 David T. L. Wong wrote:

> 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'
> > 
> > ---
> 
> This patch drops usage of floating point variable for 32bit build
> 
> Signed-off-by: David T. L. Wong <davidtlwong@gmail.com>

Acked-by: Randy Dunlap <randy.dunlap@oracle.com>

Please generate patches so that they can be applied by using
$ patch -p1
at the top of the kernel source tree.

Thanks.
---
~Randy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] atbm8830: replace 64-bit division and floating point usage
  2009-12-03 13:57     ` [PATCH] atbm8830: replace 64-bit division and floating point usage David T. L. Wong
@ 2009-12-03 17:25       ` Randy Dunlap
  0 siblings, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2009-12-03 17:25 UTC (permalink / raw)
  To: David T. L. Wong
  Cc: linux-next, Stephen Rothwell, LKML, linux-media,
	Mauro Carvalho Chehab

On Thu, 03 Dec 2009 21:57:02 +0800 David T. L. Wong wrote:

> 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'
> > 
> > ---
> 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>

---
~Randy

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-12-03 17:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20091130175346.3f3345ed.sfr@canb.auug.org.au>
2009-11-30 18:07 ` linux-next: Tree for November 30 (media/common/tuners/max2165) Randy Dunlap
2009-12-02 18:04   ` Randy Dunlap
2009-12-03 13:54     ` [PATCH] max2165 32bit build patch David T. L. Wong
2009-12-03 17:24       ` Randy Dunlap
2009-12-03 13:57     ` [PATCH] atbm8830: replace 64-bit division and floating point usage David T. L. Wong
2009-12-03 17:25       ` Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).