Linux Media Controller development
 help / color / mirror / Atom feed
* Next April 9 : x86 allmodconfig media/video/cx88 build break
       [not found] <20090409163305.8c7a0371.sfr@canb.auug.org.au>
@ 2009-04-09 10:08 ` Sachin Sant
  2009-04-09 10:28   ` Mauro Carvalho Chehab
  2009-04-11  6:11 ` linux-next: Tree for April 9 Andrew Morton
  1 sibling, 1 reply; 5+ messages in thread
From: Sachin Sant @ 2009-04-09 10:08 UTC (permalink / raw)
  To: linux-media; +Cc: Stephen Rothwell, linux-next, LKML

Today's Next tree allmodconfig build on x86 failed with

ERROR: __divdi3 [drivers/media/video/cx88/cx88xx.ko] undefined!

Thanks
-Sachin

-- 

---------------------------------
Sachin Sant
IBM Linux Technology Center
India Systems and Technology Labs
Bangalore, India
---------------------------------


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

* Re: Next April 9 : x86 allmodconfig media/video/cx88 build break
  2009-04-09 10:08 ` Next April 9 : x86 allmodconfig media/video/cx88 build break Sachin Sant
@ 2009-04-09 10:28   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2009-04-09 10:28 UTC (permalink / raw)
  To: Sachin Sant; +Cc: linux-media, Stephen Rothwell, linux-next, LKML

On Thu, 09 Apr 2009 15:38:59 +0530
Sachin Sant <sachinp@in.ibm.com> wrote:

> Today's Next tree allmodconfig build on x86 failed with
> 
> ERROR: __divdi3 [drivers/media/video/cx88/cx88xx.ko] undefined!
> 
> Thanks
> -Sachin
> 
Hi Sachin,

Thanks for warning about this. This error happens only with some gcc versions.
Yet, I'm adding a patch to use do_div() to avoid such troubles. It should be
there for today's linux-next.

Cheers,
Mauro

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

* Re: linux-next: Tree for April 9
       [not found] <20090409163305.8c7a0371.sfr@canb.auug.org.au>
  2009-04-09 10:08 ` Next April 9 : x86 allmodconfig media/video/cx88 build break Sachin Sant
@ 2009-04-11  6:11 ` Andrew Morton
  2009-04-11 11:09   ` Mauro Carvalho Chehab
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2009-04-11  6:11 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: linux-next, LKML, Marton Balint, Mauro Carvalho Chehab,
	linux-media

On Thu, 9 Apr 2009 16:33:05 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> I have created today's linux-next tree at
> git://git.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git

It has a link failure with i386 allmodconfig due to missing __divdi3.

It's due to this statement in drivers/media/video/cx88/cx88-dsp.c's
int_goertzel():

        return (u32)(((s64)s_prev2*s_prev2 + (s64)s_prev*s_prev -
                      (s64)coeff*s_prev2*s_prev/32768)/N/N);

that gem will need to be converted to use div64() or similar, please.

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

* Re: linux-next: Tree for April 9
  2009-04-11  6:11 ` linux-next: Tree for April 9 Andrew Morton
@ 2009-04-11 11:09   ` Mauro Carvalho Chehab
  2009-04-11 12:05     ` Stephen Rothwell
  0 siblings, 1 reply; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2009-04-11 11:09 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Stephen Rothwell, linux-next, LKML, Marton Balint, linux-media

On Fri, 10 Apr 2009 23:11:58 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Thu, 9 Apr 2009 16:33:05 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> 
> > I have created today's linux-next tree at
> > git://git.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git
> 
> It has a link failure with i386 allmodconfig due to missing __divdi3.
> 
> It's due to this statement in drivers/media/video/cx88/cx88-dsp.c's
> int_goertzel():
> 
>         return (u32)(((s64)s_prev2*s_prev2 + (s64)s_prev*s_prev -
>                       (s64)coeff*s_prev2*s_prev/32768)/N/N);
> 
> that gem will need to be converted to use div64() or similar, please.

Updated to use do_div().


Cheers,
Mauro

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

* Re: linux-next: Tree for April 9
  2009-04-11 11:09   ` Mauro Carvalho Chehab
@ 2009-04-11 12:05     ` Stephen Rothwell
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Rothwell @ 2009-04-11 12:05 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Andrew Morton, linux-next, LKML, Marton Balint, linux-media

Hi Mauro,

On Sat, 11 Apr 2009 08:09:53 -0300 Mauro Carvalho Chehab <mchehab@infradead.org> wrote:
>
> On Fri, 10 Apr 2009 23:11:58 -0700
> Andrew Morton <akpm@linux-foundation.org> wrote:
> 
> > On Thu, 9 Apr 2009 16:33:05 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> > 
> > > I have created today's linux-next tree at
> > > git://git.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git
> > 
> > It has a link failure with i386 allmodconfig due to missing __divdi3.
> > 
> > It's due to this statement in drivers/media/video/cx88/cx88-dsp.c's
> > int_goertzel():
> > 
> >         return (u32)(((s64)s_prev2*s_prev2 + (s64)s_prev*s_prev -
> >                       (s64)coeff*s_prev2*s_prev/32768)/N/N);
> > 
> > that gem will need to be converted to use div64() or similar, please.
> 
> Updated to use do_div().

Thank you.  It will be included in next-20090414.

Andrew, I have included the patch below in case you need it before then.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

commit ec0a97d2dd33e156283dd04c37d77603cb4dbaf7
Author: Miroslav Sustek <sustmidown@centrum.cz>
Date:   Mon Apr 6 20:07:04 2009 -0300

    V4L/DVB (11441): cx88-dsp: fixing 64bit math
    
    cx88-dsp: fixing 64bit math on 32bit kernels
    
    Some gcc versions report the missing of __divdi3
    
    Signed-off-by: Miroslav Sustek <sustmidown@centrum.cz>
    [mchehab.redhat.com: CodingStyle fixes]
    Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

diff --git a/drivers/media/video/cx88/cx88-dsp.c b/drivers/media/video/cx88/cx88-dsp.c
index a78286e..3e5eaf3 100644
--- a/drivers/media/video/cx88/cx88-dsp.c
+++ b/drivers/media/video/cx88/cx88-dsp.c
@@ -22,6 +22,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/jiffies.h>
+#include <asm/div64.h>
 
 #include "cx88.h"
 #include "cx88-reg.h"
@@ -100,13 +101,25 @@ static u32 int_goertzel(s16 x[], u32 N, u32 freq)
 	s32 s_prev2 = 0;
 	s32 coeff = 2*int_cos(freq);
 	u32 i;
+
+	u64 tmp;
+	u32 divisor;
+
 	for (i = 0; i < N; i++) {
 		s32 s = x[i] + ((s64)coeff*s_prev/32768) - s_prev2;
 		s_prev2 = s_prev;
 		s_prev = s;
 	}
-	return (u32)(((s64)s_prev2*s_prev2 + (s64)s_prev*s_prev -
-		      (s64)coeff*s_prev2*s_prev/32768)/N/N);
+
+	tmp = (s64)s_prev2 * s_prev2 + (s64)s_prev * s_prev -
+		      (s64)coeff * s_prev2 * s_prev / 32768;
+
+	/* XXX: N must be low enough so that N*N fits in s32.
+	 * Else we need two divisions. */
+	divisor = N * N;
+	do_div(tmp, divisor);
+
+	return (u32) tmp;
 }
 
 static u32 freq_magnitude(s16 x[], u32 N, u32 freq)

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

end of thread, other threads:[~2009-04-11 12:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20090409163305.8c7a0371.sfr@canb.auug.org.au>
2009-04-09 10:08 ` Next April 9 : x86 allmodconfig media/video/cx88 build break Sachin Sant
2009-04-09 10:28   ` Mauro Carvalho Chehab
2009-04-11  6:11 ` linux-next: Tree for April 9 Andrew Morton
2009-04-11 11:09   ` Mauro Carvalho Chehab
2009-04-11 12:05     ` Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox