2009-04-09 06:33:22

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: Tree for April 9

Hi all,

There will not be another -next tree until April 14 (my time) due to
holidays here.

Changes since 20090408:

This tree will not build a powerpc allyesconfig.

Linus' tree lost 1 build failure.

The usb.current tree lost its build failure.

The tip-core tree gained a build failure on sparc64 for which a applied a
patch.

The block tree gained a build failure so I reverted a commit.

----------------------------------------------------------------------------

I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git
(patches at
http://www.kernel.org/pub/linux/kernel/people/sfr/linux-next/). If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one. You should use "git fetch" as mentioned in the FAQ on the wiki
(see below).

You can see which trees have been included by looking in the Next/Trees
file in the source. There are also quilt-import.log and merge.log files
in the Next directory. Between each merge, the tree was built with
a ppc64_defconfig for powerpc and an allmodconfig for x86_64. After the
final fixups (if any), it is also built with powerpc allnoconfig (32 and
64 bit), ppc44x_defconfig and allyesconfig (minus
CONFIG_PROFILE_ALL_BRANCHES) and i386, sparc and sparc64 defconfig.
These builds also have CONFIG_ENABLE_WARN_DEPRECATED,
CONFIG_ENABLE_MUST_CHECK and CONFIG_DEBUG_INFO disabled when necessary.

Below is a summary of the state of the merge.

We are up to 132 trees (counting Linus' and 18 trees of patches pending for
Linus' tree), more are welcome (even if they are currently empty).
Thanks to those who have contributed, and to those who haven't, please do.

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next . If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Jan Dittmer for adding the linux-next tree to his build tests
at http://l4x.org/k/ , the guys at http://test.kernel.org/ and Randy
Dunlap for doing many randconfig builds.

There is a wiki covering stuff to do with linux-next at
http://linux.f-seidel.de/linux-next/pmwiki/ . Thanks to Frank Seidel.

--
Cheers,
Stephen Rothwell [email protected]

$ git checkout master
$ git reset --hard stable
Merging origin/master
Merging arm-current/master
Merging m68k-current/for-linus
Merging powerpc-merge/merge
Merging sparc-current/master
Merging scsi-rc-fixes/master
Merging net-current/master
Merging sound-current/for-linus
Merging pci-current/for-linus
Merging wireless-current/master
Merging kbuild-current/master
Merging quilt/driver-core.current
Merging quilt/usb.current
Merging cpufreq-current/fixes
Merging input-current/for-linus
Merging md-current/for-linus
Merging audit-current/for-linus
Merging crypto-current/master
Merging dwmw2/master
Merging arm/devel
Merging avr32/avr32-arch
Merging blackfin/for-linus
Merging cris/for-next
Merging ia64/test
Merging m68k/for-next
Merging m68knommu/for-next
Merging mips/mips-for-linux-next
Merging parisc/master
Merging powerpc/next
Merging 4xx/next
Merging galak/next
Merging pxa/for-next
Merging s390/features
Merging sh/master
Merging sparc/master
Merging x86/auto-x86-next
Merging xtensa/master
Merging tip-core/auto-core-next
Merging cpus4096/auto-cpus4096-next
Merging tracing/auto-tracing-next
Merging genirq/auto-genirq-next
Merging safe-poison-pointers/auto-safe-poison-pointers-next
Merging sched/auto-sched-next
Merging stackprotector/auto-stackprotector-next
Merging timers/auto-timers-next
Merging pci/linux-next
Merging quilt/device-mapper
Merging hid/for-next
Merging quilt/i2c
Merging quilt/jdelvare-hwmon
Merging quilt/kernel-doc
Merging v4l-dvb/master
CONFLICT (add/add): Merge conflict in drivers/media/video/cx231xx/cx231xx-audio.c
Merging quota/for_next
CONFLICT (content): merge conflict in fs/quota/dquot.c
CONFLICT (content): Merge conflict in fs/ext4/ext4.h
CONFLICT (content): Merge conflict in fs/ext4/inode.c
CONFLICT (content): Merge conflict in fs/reiserfs/namei.c
CONFLICT (content): Merge conflict in fs/reiserfs/stree.c
CONFLICT (content): Merge conflict in fs/udf/balloc.c
Merging jfs/next
Merging kbuild/master
Merging quilt/ide
Merging libata/NEXT
Merging nfs/linux-next
Merging xfs/master
Merging infiniband/for-next
Merging acpi/test
Merging nfsd/nfsd-next
Merging ieee1394/for-next
Merging ubi/linux-next
Merging kvm/master
Merging dlm/next
Merging scsi/master
Merging ocfs2/linux-next
Merging ext4/next
Merging async_tx/next
Merging udf/for_next
Merging net/master
Merging wireless/master
Merging mtd/master
Merging crypto/master
Merging vfs/for-next
Merging sound/for-next
Merging cpufreq/next
Merging v9fs/for-next
CONFLICT (content): Merge conflict in net/9p/protocol.c
Merging quilt/rr
CONFLICT (content): Merge conflict in kernel/extable.c
CONFLICT (content): Merge conflict in kernel/module.c
CONFLICT (content): Merge conflict in kernel/params.c
Merging cifs/master
Merging mmc/next
Merging gfs2/master
Merging input/next
Merging bkl-removal/bkl-removal
Merging ubifs/linux-next
Merging lsm/for-next
Merging block/for-next
[master 44623a9] Revert "Document and move the various READ/WRITE types"
Merging embedded/master
Merging firmware/master
CONFLICT (content): Merge conflict in firmware/WHENCE
Merging pcmcia/master
Merging battery/master
Merging leds/for-mm
Merging backlight/for-mm
Merging kgdb/kgdb-next
Merging slab/for-next
Merging uclinux/for-next
Merging md/for-next
Merging mfd/for-next
Merging hdlc/hdlc-next
Merging drm/drm-next
Merging voltage/for-next
Merging security-testing/next
Merging lblnet/master
Merging quilt/ttydev
CONFLICT (content): Merge conflict in drivers/serial/8250_pci.c
CONFLICT (content): Merge conflict in fs/devpts/inode.c
Merging agp/agp-next
Merging generic-ipi/auto-generic-ipi-next
Merging oprofile/auto-oprofile-next
Merging fastboot/auto-fastboot-next
Merging sparseirq/auto-sparseirq-next
Merging iommu/auto-iommu-next
Merging uwb/for-upstream
Merging watchdog/master
Merging bdev/master
Merging dwmw2-iommu/master
Merging cputime/cputime
Merging osd/linux-next
Merging fatfs/master
Merging fuse/for-next
Merging jc_docs/docs-next
Merging nommu/master
Merging trivial/for-next
Merging audit/for-next
Merging squashfs/master
Merging omap/for-next
Merging quilt/aoe
Merging kmemleak/kmemleak
CONFLICT (content): Merge conflict in Documentation/kernel-parameters.txt
CONFLICT (content): Merge conflict in MAINTAINERS
CONFLICT (content): Merge conflict in init/main.c
CONFLICT (content): Merge conflict in lib/Kconfig.debug
CONFLICT (content): Merge conflict in mm/slob.c
Merging suspend/linux-next
Merging quilt/driver-core
Merging quilt/usb
Merging quilt/staging
Merging scsi-post-merge/master
Applying: sparc64: update for restart_block size change
[master cbfae14] Revert "parport: Use the PCI IRQ if offered"


Attachments:
(No filename) (6.79 kB)
(No filename) (197.00 B)
Download all attachments

2009-04-09 10:09:35

by Sachin Sant

[permalink] [raw]
Subject: Next April 9 : x86 allmodconfig media/video/cx88 build break

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

2009-04-09 10:30:11

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: Re: Next April 9 : x86 allmodconfig media/video/cx88 build break

On Thu, 09 Apr 2009 15:38:59 +0530
Sachin Sant <[email protected]> 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

2009-04-09 15:51:53

by Sachin Sant

[permalink] [raw]
Subject: [CFQ/OOPS] rb_erase with April 9 next tree

Oops: Kernel access of bad area, sig: 11 [#1]
SMP NR_CPUS=1024 NUMA pSeries
Modules linked in: ipv6(F) fuse(F) loop(F) dm_mod(F) ehea(F)
NIP: c0000000002ee1b0 LR: c0000000002e14d0 CTR: c0000000002e35ac
REGS: c0000000f20d2940 TRAP: 0300 Tainted: GF (2.6.30-rc1-next-20090409)
MSR: 8000000000009032 <EE,ME,IR,DR> CR: 44024448 XER: 00000001
DAR: 0000000000000010, DSISR: 0000000040000000
TASK = c0000000f9346a00[3684] 'sh' THREAD: c0000000f20d0000 CPU: 1
GPR00: c0000000f941f030 c0000000f20d2bc0 c0000000009986e8 c0000000fbe91c50
GPR04: c0000000fb8af038 fffffffffffffff0 0000000000000001 c0000000f941edb0
GPR08: c0000000f941edb0 0000000000000001 c0000000fbb3cb50 0000000000000000
GPR12: c0000000f975ed00 c000000000a92500 c0000000f20d0080 c0000000f20d34c0
GPR16: c0000000006d2c92 0000000000000000 0000000000000004 c0000000f20d3010
GPR20: c0000000f20d2ff0 0000000000800000 0000000002c8bc82 0000000000800005
GPR24: c0000000fbaf0000 0000000000000000 c0000000f98ef010 c0000000fb8af000
GPR28: c0000000fb8af038 c0000000fb8af038 c000000000923360 0000000000000000
NIP [c0000000002ee1b0] .rb_erase+0x16c/0x3b4
LR [c0000000002e14d0] .cfq_prio_tree_add+0x58/0x120
Call Trace:
[c0000000f20d2bc0] [c0000000002e1450] .cfq_service_tree_add+0x23c/0x264 (unreliable)
[c0000000f20d2c50] [c0000000002e14d0] .cfq_prio_tree_add+0x58/0x120
[c0000000f20d2cf0] [c0000000002e16c8] .__cfq_slice_expired+0xc8/0x11c
[c0000000f20d2d80] [c0000000002e3920] .cfq_insert_request+0x374/0x3f4
[c0000000f20d2e20] [c0000000002cf448] .elv_insert+0x234/0x348
[c0000000f20d2ec0] [c0000000002d3348] .__make_request+0x514/0x5b0
[c0000000f20d2f80] [c0000000002d1348] .generic_make_request+0x430/0x4c8
[c0000000f20d30b0] [c0000000002d14dc] .submit_bio+0xfc/0x124
[c0000000f20d3170] [c000000000156998] .submit_bh+0x14c/0x198
[c0000000f20d3200] [c000000000158814] .bh_submit_read+0x70/0xd0
[c0000000f20d3290] [c0000000001dbf6c] .read_block_bitmap+0xb8/0x238
[c0000000f20d3330] [c0000000001dc2d4] .ext3_free_blocks_sb+0x178/0x5e4
[c0000000f20d3450] [c0000000001dc780] .ext3_free_blocks+0x40/0xe4
[c0000000f20d34e0] [c0000000001e3e70] .ext3_clear_blocks+0x1d8/0x21c
[c0000000f20d35a0] [c0000000001e3fcc] .ext3_free_data+0x118/0x190
[c0000000f20d3650] [c0000000001e49c0] .ext3_truncate+0x670/0xa80
[c0000000f20d37b0] [c0000000000fda70] .vmtruncate+0xf0/0x134
[c0000000f20d3850] [c0000000001457c0] .inode_setattr+0x44/0x180
[c0000000f20d38f0] [c0000000001e15e8] .ext3_setattr+0x1ec/0x298
[c0000000f20d39a0] [c000000000145afc] .notify_change+0x200/0x3dc
[c0000000f20d3a60] [c00000000012905c] .do_truncate+0x84/0xbc
[c0000000f20d3b40] [c000000000137630] .may_open+0x1fc/0x2f4
[c0000000f20d3be0] [c00000000013a5c4] .do_filp_open+0x400/0x95c
[c0000000f20d3d80] [c000000000127e68] .do_sys_open+0x80/0x140
[c0000000f20d3e30] [c0000000000084ac] syscall_exit+0x0/0x40
Instruction dump:
e8090010 7fa01800 409e000c f9090010 48000010 f9090008 48000008 f91d0000
2f860001 7cff3b78 409e0238 48000200 <e95f0010> 7faa4000 409e00ec e95f0008



Attachments:
oops_message (2.93 kB)

2009-04-09 17:29:31

by Jens Axboe

[permalink] [raw]
Subject: Re: [CFQ/OOPS] rb_erase with April 9 next tree

On Thu, Apr 09 2009, Sachin Sant wrote:
> I had Next 09 booted on a powerpc box and was compiling a kernel.
> That's when i ran into this oops.
>
> Unable to handle kernel paging request for data at address 0x00000010.
> Faulting instruction address: 0xc0000000002ee1b0...................
> 0:mon> e
> cpu 0x0: Vector: 300 (Data Access) at [c0000000d6cf63c0]
> pc: c0000000002ee1b0: .rb_erase+0x16c/0x3b4
> lr: c0000000002e14d0: .cfq_prio_tree_add+0x58/0x120
> sp: c0000000d6cf6640
> msr: 8000000000009032
> dar: 10
> dsisr: 40000000
> current = 0xc0000000fbdf5880
> paca = 0xc000000000a92300
> pid = 1867, comm = ld
> 0:mon> t
> [c0000000d6cf66d0] c0000000002e14d0 .cfq_prio_tree_add+0x58/0x120
> [c0000000d6cf6770] c0000000002e16c8 .__cfq_slice_expired+0xc8/0x11c
> [c0000000d6cf6800] c0000000002e3920 .cfq_insert_request+0x374/0x3f4
> [c0000000d6cf68a0] c0000000002cf448 .elv_insert+0x234/0x348
> [c0000000d6cf6940] c0000000002d3348 .__make_request+0x514/0x5b0
> [c0000000d6cf6a00] c0000000002d1348 .generic_make_request+0x430/0x4c8
> [c0000000d6cf6b30] c0000000002d14dc .submit_bio+0xfc/0x124
> [c0000000d6cf6bf0] c000000000156998 .submit_bh+0x14c/0x198
> [c0000000d6cf6c80] c00000000015ba78 .block_read_full_page+0x394/0x40c
> [c0000000d6cf7180] c000000000163080 .do_mpage_readpage+0x680/0x688
> [c0000000d6cf7690] c000000000163200 .mpage_readpages+0x104/0x190
> [c0000000d6cf77f0] c0000000001e2aac .ext3_readpages+0x28/0x40
> [c0000000d6cf7870] c0000000000ebd20 .__do_page_cache_readahead+0x180/0x278
> [c0000000d6cf7960] c0000000000ec16c .ondemand_readahead+0x1ac/0x1d8
> [c0000000d6cf7a00] c0000000000e1f28 .generic_file_aio_read+0x260/0x6b0
> [c0000000d6cf7b40] c000000000129f74 .do_sync_read+0xcc/0x130
> [c0000000d6cf7ce0] c00000000012af44 .vfs_read+0xd0/0x1bc
> [c0000000d6cf7d80] c00000000012b138 .SyS_read+0x58/0xa0
> [c0000000d6cf7e30] c0000000000084ac syscall_exit+0x0/0x40

Just ran into this myself, too. I'll pull that bad patch from -next
asap. I wont be able to fix this before next week.

--
Jens Axboe

2009-04-09 17:44:35

by Jens Axboe

[permalink] [raw]
Subject: Re: [CFQ/OOPS] rb_erase with April 9 next tree

On Thu, Apr 09 2009, Jens Axboe wrote:
> On Thu, Apr 09 2009, Sachin Sant wrote:
> > I had Next 09 booted on a powerpc box and was compiling a kernel.
> > That's when i ran into this oops.
> >
> > Unable to handle kernel paging request for data at address 0x00000010.
> > Faulting instruction address: 0xc0000000002ee1b0...................
> > 0:mon> e
> > cpu 0x0: Vector: 300 (Data Access) at [c0000000d6cf63c0]
> > pc: c0000000002ee1b0: .rb_erase+0x16c/0x3b4
> > lr: c0000000002e14d0: .cfq_prio_tree_add+0x58/0x120
> > sp: c0000000d6cf6640
> > msr: 8000000000009032
> > dar: 10
> > dsisr: 40000000
> > current = 0xc0000000fbdf5880
> > paca = 0xc000000000a92300
> > pid = 1867, comm = ld
> > 0:mon> t
> > [c0000000d6cf66d0] c0000000002e14d0 .cfq_prio_tree_add+0x58/0x120
> > [c0000000d6cf6770] c0000000002e16c8 .__cfq_slice_expired+0xc8/0x11c
> > [c0000000d6cf6800] c0000000002e3920 .cfq_insert_request+0x374/0x3f4
> > [c0000000d6cf68a0] c0000000002cf448 .elv_insert+0x234/0x348
> > [c0000000d6cf6940] c0000000002d3348 .__make_request+0x514/0x5b0
> > [c0000000d6cf6a00] c0000000002d1348 .generic_make_request+0x430/0x4c8
> > [c0000000d6cf6b30] c0000000002d14dc .submit_bio+0xfc/0x124
> > [c0000000d6cf6bf0] c000000000156998 .submit_bh+0x14c/0x198
> > [c0000000d6cf6c80] c00000000015ba78 .block_read_full_page+0x394/0x40c
> > [c0000000d6cf7180] c000000000163080 .do_mpage_readpage+0x680/0x688
> > [c0000000d6cf7690] c000000000163200 .mpage_readpages+0x104/0x190
> > [c0000000d6cf77f0] c0000000001e2aac .ext3_readpages+0x28/0x40
> > [c0000000d6cf7870] c0000000000ebd20 .__do_page_cache_readahead+0x180/0x278
> > [c0000000d6cf7960] c0000000000ec16c .ondemand_readahead+0x1ac/0x1d8
> > [c0000000d6cf7a00] c0000000000e1f28 .generic_file_aio_read+0x260/0x6b0
> > [c0000000d6cf7b40] c000000000129f74 .do_sync_read+0xcc/0x130
> > [c0000000d6cf7ce0] c00000000012af44 .vfs_read+0xd0/0x1bc
> > [c0000000d6cf7d80] c00000000012b138 .SyS_read+0x58/0xa0
> > [c0000000d6cf7e30] c0000000000084ac syscall_exit+0x0/0x40
>
> Just ran into this myself, too. I'll pull that bad patch from -next
> asap. I wont be able to fix this before next week.

Can you see if this fixes it for you?

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index e01b103..64de5c0 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1654,6 +1654,7 @@ retry:
}

RB_CLEAR_NODE(&cfqq->rb_node);
+ RB_CLEAR_NODE(&cfqq->p_node);
INIT_LIST_HEAD(&cfqq->fifo);

atomic_set(&cfqq->ref, 0);

--
Jens Axboe

2009-04-10 06:40:27

by Sachin Sant

[permalink] [raw]
Subject: Re: [CFQ/OOPS] rb_erase with April 9 next tree

Jens Axboe wrote:
>
> Can you see if this fixes it for you?
>
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index e01b103..64de5c0 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -1654,6 +1654,7 @@ retry:
> }
>
> RB_CLEAR_NODE(&cfqq->rb_node);
> + RB_CLEAR_NODE(&cfqq->p_node);
> INIT_LIST_HEAD(&cfqq->fifo);
>
> atomic_set(&cfqq->ref, 0);
>
Yes. The above patch fixed this oops. Thanks

Regards
-Sachin

--

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

2009-04-11 06:17:00

by Andrew Morton

[permalink] [raw]
Subject: Re: linux-next: Tree for April 9

On Thu, 9 Apr 2009 16:33:05 +1000 Stephen Rothwell <[email protected]> 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.

2009-04-11 11:10:31

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: Re: linux-next: Tree for April 9

On Fri, 10 Apr 2009 23:11:58 -0700
Andrew Morton <[email protected]> wrote:

> On Thu, 9 Apr 2009 16:33:05 +1000 Stephen Rothwell <[email protected]> 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

2009-04-11 12:05:36

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: Tree for April 9

Hi Mauro,

On Sat, 11 Apr 2009 08:09:53 -0300 Mauro Carvalho Chehab <[email protected]> wrote:
>
> On Fri, 10 Apr 2009 23:11:58 -0700
> Andrew Morton <[email protected]> wrote:
>
> > On Thu, 9 Apr 2009 16:33:05 +1000 Stephen Rothwell <[email protected]> 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 [email protected]
http://www.canb.auug.org.au/~sfr/

commit ec0a97d2dd33e156283dd04c37d77603cb4dbaf7
Author: Miroslav Sustek <[email protected]>
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 <[email protected]>
[mchehab.redhat.com: CodingStyle fixes]
Signed-off-by: Mauro Carvalho Chehab <[email protected]>

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)