Skip to contentSkip to conversation

linux-next: Tree for January 5

PATCH In review Stephen Rothwell 8 participants 21 messages Jan 5, 2009 – Jan 11, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hi all,

This tree will not build a powerpc ppc4xx_defconfig due to a kvm problem.

Changes since 20090102:

Removed tree:
rr_cpumask (served it purpose)

Undropped tree:
driver-core
kvm

Dropped trees (temporarily):
usb (build problem)
rr (complex conflicts)
semaphore-removal (due to unfixed conflicts against Linus' tree) cpu_alloc (build problem)
audit (difficult conflicts)
staging (depends on usb)

The device-mapper tree lost its conflict.

The kvm tree is back but it won't build for ppc4xx_deconfig.

The ext4 tree gained a conflict against Linus' tree.

The rr tree gained several conflicts and was dropped.

The ttydev tree lost its conflict.

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

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, 44x_defconfig and allyesconfig (minus CONFIG_PROFILE_ALL_BRANCHES) and i386, sparc and sparc64 defconfig.

Below is a summary of the state of the merge.

We are up to 130 trees (counting Linus' and 15 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.

Signature · 169 lines
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
CONFLICT (content): Merge conflict in drivers/char/tty_audit.c
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 quilt/driver-core
CONFLICT (content): Merge conflict in arch/powerpc/platforms/85xx/mpc85xx_mds.c
CONFLICT (content): Merge conflict in drivers/virtio/virtio_pci.c
Merging quilt/usb
CONFLICT (content): Merge conflict in Documentation/DocBook/networking.tmpl
CONFLICT (content): Merge conflict in drivers/usb/wusbcore/rh.c
$ git reset --hard HEAD^
Merging tip-core/auto-core-next
Merging cpus4096/auto-cpus4096-next
CONFLICT (content): Merge conflict in kernel/rcuclassic.c
Merging ftrace/auto-ftrace-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
CONFLICT (content): Merge conflict in kernel/time/tick-common.c
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
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
CONFLICT (content): Merge conflict in drivers/scsi/scsi_ioctl.c
Merging ocfs2/linux-next
Merging ext4/next
CONFLICT (content): Merge conflict in fs/ext4/ialloc.c
Merging async_tx/next
Applying: net: async_tx merge fix
Merging udf/for_next
Merging net/master
Merging mtd/master
CONFLICT (content): Merge conflict in arch/arm/mach-pxa/corgi.c
CONFLICT (content): Merge conflict in arch/arm/mach-pxa/poodle.c
CONFLICT (content): Merge conflict in arch/arm/mach-pxa/spitz.c
CONFLICT (content): Merge conflict in drivers/mtd/devices/m25p80.c
CONFLICT (content): Merge conflict in drivers/mtd/devices/mtd_dataflash.c
Merging wireless/master
Merging crypto/master
Merging vfs/for-next
Merging sound/for-next
Merging cpufreq/next
Merging v9fs/for-next
Merging quilt/rr
CONFLICT (content): Merge conflict in arch/x86/include/asm/percpu.h
CONFLICT (content): Merge conflict in include/asm-generic/percpu.h
CONFLICT (content): Merge conflict in include/linux/percpu.h
CONFLICT (content): Merge conflict in init/main.c
CONFLICT (content): Merge conflict in kernel/module.c
$ git reset --hard
Merging cifs/master
Merging mmc/next
Merging gfs2/master
Merging input/next
Merging semaphore/semaphore
Merging bkl-removal/bkl-removal
CONFLICT (content): Merge conflict in fs/ioctl.c
Merging ubifs/linux-next
Merging lsm/for-next
Merging block/for-next
Merging embedded/master
Merging firmware/master
CONFLICT (content): Merge conflict in drivers/net/tg3.c
CONFLICT (content): Merge conflict in firmware/Makefile
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 kmemcheck/auto-kmemcheck-next
CONFLICT (content): Merge conflict in MAINTAINERS
Merging generic-ipi/auto-generic-ipi-next
Merging mfd/for-next
Merging hdlc/hdlc-next
Merging drm/drm-next
Merging voltage/for-next
Merging security-testing/next
Merging lblnet/master
CONFLICT (content): Merge conflict in Documentation/feature-removal-schedule.txt
Merging quilt/ttydev
Merging agp/agp-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 proc/proc
Merging bdev/master
Merging dwmw2-iommu/master
CONFLICT (content): Merge conflict in drivers/pci/intel-iommu.c
Merging cputime/cputime
Merging osd/linux-next
Merging fatfs/master
Merging fuse/for-next
Merging jc_docs/docs-next
Merging nommu/master
CONFLICT (content): Merge conflict in kernel/fork.c
Merging trivial/for-next
Merging quilt/staging
CONFLICT (content): Merge conflict in Documentation/DocBook/networking.tmpl
CONFLICT (content): Merge conflict in drivers/i2c/chips/Kconfig
CONFLICT (content): Merge conflict in drivers/i2c/chips/Makefile
CONFLICT (delete/modify): drivers/staging/winbond/linux/wbusb.c deleted in quilt/staging and modified in HEAD. Version HEAD of drivers/staging/winbond/linux/wbusb.c left in tree.
CONFLICT (content): Merge conflict in drivers/staging/wlan-ng/p80211netdev.c
CONFLICT (content): Merge conflict in drivers/staging/wlan-ng/p80211wext.c
CONFLICT (content): Merge conflict in drivers/usb/wusbcore/rh.c
$ git reset --hard
#1 lore raw

Re: linux-next: Tree for January 5 (dm-target)

Quoted 21 lines · On Mon, 5 Jan 2009 17:35:17 +1100 Stephen Rothwell wrote:

Hi all,

This tree will not build a powerpc ppc4xx_defconfig due to a kvm problem.

Changes since 20090102:

Removed tree:
rr_cpumask (served it purpose)

Undropped tree:
driver-core
kvm

Dropped trees (temporarily):
usb (build problem)
rr (complex conflicts)
semaphore-removal (due to unfixed conflicts against Linus' tree) cpu_alloc (build problem)
audit (difficult conflicts)
staging (depends on usb)

Quoted 1 line

The device-mapper tree lost its conflict.

When CONFIG_MODULE_UNLOAD=n (or CONFIG_MODULES=n):

linux-next-20090105/drivers/md/dm-target.c:106: error: implicit declaration of function 'module_refcount'

---
~Randy

#2 lore raw

Re: Re: linux-next: Tree for January 5 (dm-target)

Quoted 23 lines · Randy Dunlap
Quoted 21 lines · On Mon, 5 Jan 2009 17:35:17 +1100 Stephen Rothwell wrote:

Hi all,

This tree will not build a powerpc ppc4xx_defconfig due to a kvm problem.

Changes since 20090102:

Removed tree:
rr_cpumask (served it purpose)

Undropped tree:
driver-core
kvm

Dropped trees (temporarily):
usb (build problem)
rr (complex conflicts)
semaphore-removal (due to unfixed conflicts against Linus' tree) cpu_alloc (build problem)
audit (difficult conflicts)
staging (depends on usb)

Quoted 7 lines
Quoted 1 line

The device-mapper tree lost its conflict.

When CONFIG_MODULE_UNLOAD=n (or CONFIG_MODULES=n):

linux-next-20090105/drivers/md/dm-target.c:106: error: implicit declaration of function 'module_refcount'

This has been reported when linus was pulling,

http://lkml.org/lkml/2009/1/5/576

and will be fixed right once.

Quoted 10 lines

---
~Randy

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

Signature · 3 lines
Cheng Renquan, Shenzhen, China
Paula Poundstone  - "I don't have a bank account because I don't know
my mother's maiden name."
#3 lore raw

Re: linux-next: Tree for January 5 (multimedia build errors)

In reply to Stephen Rothwell
Quoted 5 lines · On Mon, 5 Jan 2009 17:35:17 +1100 Stephen Rothwell wrote:

Hi all,

This tree will not build a powerpc ppc4xx_defconfig due to a kvm problem.

Changes since 20090102:

With CONFIG_INPUT=m and CONFIG_DVB_DM1105=y:

drivers/built-in.o: In function `input_sync':
dm1105.c:(.text+0x120c33): undefined reference to input_event' drivers/built-in.o: In function dm1105_emit_key':
dm1105.c:(.text+0x120c6c): undefined reference to input_event' dm1105.c:(.text+0x120c82): undefined reference to input_event' dm1105.c:(.text+0x120cb2): undefined reference to input_event' dm1105.c:(.text+0x120cd1): undefined reference to input_event' drivers/built-in.o: In function `dm1105_ir_init':
(.devinit.text+0xd8ae): undefined reference to input_allocate_device' drivers/built-in.o: In function dm1105_ir_init':
(.devinit.text+0xd9f6): undefined reference to input_register_device' drivers/built-in.o: In function dm1105_ir_init':
(.devinit.text+0xda09): undefined reference to input_free_device' drivers/built-in.o: In function dm1105_ir_exit':
(.devexit.text+0xcde): undefined reference to `input_unregister_device'

---
~Randy

#4 lore raw

Re: linux-next: Tree for January 5 (multimedia build errors)

Quoted 11 lines · On Mon, 5 Jan 2009 12:04:30 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 5 lines · On Mon, 5 Jan 2009 17:35:17 +1100 Stephen Rothwell wrote:

Hi all,

This tree will not build a powerpc ppc4xx_defconfig due to a kvm problem.

Changes since 20090102:

With CONFIG_INPUT=m and CONFIG_DVB_DM1105=y:

Fixed. I'll add on my -next tree later today.

Cheers,
Mauro

#5 lore raw

Re: linux-next: Tree for January 5 (multimedia #2)

In reply to Stephen Rothwell
Quoted 5 lines · On Mon, 5 Jan 2009 17:35:17 +1100 Stephen Rothwell wrote:

Hi all,

This tree will not build a powerpc ppc4xx_defconfig due to a kvm problem.

Changes since 20090102:

With CONFIG_INPUT=n and
CONFIG_DVB_DM1105=m
CONFIG_DVB_FIREDTV=m:

ERROR: "input_event" [drivers/media/dvb/firesat/firedtv.ko] undefined!
ERROR: "input_register_device" [drivers/media/dvb/firesat/firedtv.ko] undefined!
ERROR: "input_free_device" [drivers/media/dvb/firesat/firedtv.ko] undefined!
ERROR: "input_unregister_device" [drivers/media/dvb/firesat/firedtv.ko] undefined!
ERROR: "input_allocate_device" [drivers/media/dvb/firesat/firedtv.ko] undefined!
ERROR: "input_event" [drivers/media/dvb/dm1105/dm1105.ko] undefined!
ERROR: "input_free_device" [drivers/media/dvb/dm1105/dm1105.ko] undefined!
ERROR: "input_register_device" [drivers/media/dvb/dm1105/dm1105.ko] undefined!
ERROR: "input_allocate_device" [drivers/media/dvb/dm1105/dm1105.ko] undefined!
ERROR: "input_unregister_device" [drivers/media/dvb/dm1105/dm1105.ko] undefined!

---
~Randy

#6 lore raw

Re: linux-next: Tree for January 5 (multimedia #2)

Quoted 12 lines · On Mon, 5 Jan 2009 12:06:57 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 5 lines · On Mon, 5 Jan 2009 17:35:17 +1100 Stephen Rothwell wrote:

Hi all,

This tree will not build a powerpc ppc4xx_defconfig due to a kvm problem.

Changes since 20090102:

With CONFIG_INPUT=n and
CONFIG_DVB_DM1105=m
CONFIG_DVB_FIREDTV=m:

Quoted 11 lines

ERROR: "input_event" [drivers/media/dvb/firesat/firedtv.ko] undefined!
ERROR: "input_register_device" [drivers/media/dvb/firesat/firedtv.ko] undefined!
ERROR: "input_free_device" [drivers/media/dvb/firesat/firedtv.ko] undefined!
ERROR: "input_unregister_device" [drivers/media/dvb/firesat/firedtv.ko] undefined!
ERROR: "input_allocate_device" [drivers/media/dvb/firesat/firedtv.ko] undefined!
ERROR: "input_event" [drivers/media/dvb/dm1105/dm1105.ko] undefined!
ERROR: "input_free_device" [drivers/media/dvb/dm1105/dm1105.ko] undefined!
ERROR: "input_register_device" [drivers/media/dvb/dm1105/dm1105.ko] undefined!
ERROR: "input_allocate_device" [drivers/media/dvb/dm1105/dm1105.ko] undefined!
ERROR: "input_unregister_device" [drivers/media/dvb/dm1105/dm1105.ko] undefined!

Also fixed by the same patch for the previous report. It were just a matter to make DVB_DM1105 dependent of INPUT.

Cheers,
Mauro

#7 lore raw

Re: linux-next: Tree for January 5 (multimedia #3)

In reply to Stephen Rothwell
Quoted 5 lines · On Mon, 5 Jan 2009 17:35:17 +1100 Stephen Rothwell wrote:

Hi all,

This tree will not build a powerpc ppc4xx_defconfig due to a kvm problem.

Changes since 20090102:

drivers/built-in.o: In function `cx88_call_i2c_clients':
(.text+0x20af17): undefined reference to videobuf_dvb_get_frontend' drivers/built-in.o: In function cx8802_probe':
cx88-mpeg.c:(.devinit.text+0x268c4): undefined reference to videobuf_dvb_alloc_frontend' cx88-mpeg.c:(.devinit.text+0x268ea): undefined reference to videobuf_dvb_dealloc_frontends'

config attached.

---
~Randy

#8 lore raw

Re: linux-next: Tree for January 5 (multimedia #3)

Quoted 6 lines · On Mon, 5 Jan 2009 12:09:27 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 4 lines · On Mon, 5 Jan 2009 17:35:17 +1100 Stephen Rothwell wrote:

Hi all,

This tree will not build a powerpc ppc4xx_defconfig due to a kvm problem.

Quoted 8 lines
Quoted 1 line

Changes since 20090102:

drivers/built-in.o: In function `cx88_call_i2c_clients':
(.text+0x20af17): undefined reference to videobuf_dvb_get_frontend' drivers/built-in.o: In function cx8802_probe':
cx88-mpeg.c:(.devinit.text+0x268c4): undefined reference to videobuf_dvb_alloc_frontend' cx88-mpeg.c:(.devinit.text+0x268ea): undefined reference to videobuf_dvb_dealloc_frontends'

This one were trickier. Patch enclosed.

Cheers,
Mauro

---

cx88: Fix some Kbuild troubles

As Randy Dunlap <[email protected]> reported, cx88 has some compilation issues:

drivers/built-in.o: In function `cx88_call_i2c_clients':
(.text+0x20af17): undefined reference to videobuf_dvb_get_frontend' drivers/built-in.o: In function cx8802_probe':
cx88-mpeg.c:(.devinit.text+0x268c4): undefined reference to videobuf_dvb_alloc_frontend' cx88-mpeg.c:(.devinit.text+0x268ea): undefined reference to videobuf_dvb_dealloc_frontends'

With those configs:

CONFIG_VIDEO_CX88=y
CONFIG_VIDEO_CX88_BLACKBIRD=y
CONFIG_VIDEO_CX88_DVB=m
CONFIG_DVB_CORE=m

After carefully examining the code, with the current code, several cx88 drivers (cx8800, cx8802, cx88_dvb and cx88_blackbird) should be compiled as a module, if one of them is marked as such. Just fixing Kconfig could create a very complex set of rules. Also, this hides a problem with the current approach where the dvb functionality weren't confined inside dvb module.

What happens is that:
- cx88-i2c (part of cx8800) has some special rules if DVB;
- cx88-mpeg (cx8802 module) has also part of DVB init code;
- cx88-dvb has the rest of the dvb code;
- cx88-blackbird can be used with cx88-mpeg, having cx88-dvb or not.

So, instead of doing some tricks at Kconfig and wait for a next breakage, this patch moves the dvb code inside cx88-i2c and cx88-mpeg into cx88-dvb.

Another problem is that cx8802 were being compiled, even without cx88-dvb and cx88-blackbird modules.

While on this code, let's fix also a reported problem:
http://www.linuxtv.org/pipermail/linux-dvb/2009-January/031225.html

A solution for the issue were proposed here:
http://www.mail-archive.com/[email protected]/msg00021.html

Thanks to Randy, Andy, Gregoire and Thomas for helping us to detect and solve the issues.

drivers/media/video/cx88/Kconfig +6 -0
index b0f8375..69ad968 100644
@@ -69,6 +69,12 @@ config VIDEO_CX88_DVB
 	  To compile this driver as a module, choose M here: the
 	  module will be called cx88-dvb.
 
+config VIDEO_CX88_MPEG
+	tristate
+	depends on VIDEO_CX88_DVB
+	depends on VIDEO_CX88_BLACKBIRD
+	default y
+
 config VIDEO_CX88_VP3054
 	tristate "VP-3054 Secondary I2C Bus Support"
 	default m
drivers/media/video/cx88/Makefile +2 -1
index 6ec30f2..b06b127 100644
@@ -3,7 +3,8 @@ cx88xx-objs	:= cx88-cards.o cx88-core.o cx88-i2c.o cx88-tvaudio.o \
 cx8800-objs	:= cx88-video.o cx88-vbi.o
 cx8802-objs	:= cx88-mpeg.o
 
-obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o cx8802.o
+obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o
+obj-$(CONFIG_VIDEO_CX88_MPEG) += cx8802.o
 obj-$(CONFIG_VIDEO_CX88_ALSA) += cx88-alsa.o
 obj-$(CONFIG_VIDEO_CX88_BLACKBIRD) += cx88-blackbird.o
 obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o
drivers/media/video/cx88/cx88-dvb.c +46 -0

82 lines not on this page · raw message

drivers/media/video/cx88/cx88-i2c.c +5 -19
index 1ab691d..c0ff230 100644
@@ -116,30 +116,16 @@ static int detach_inform(struct i2c_client *client)
 
 void cx88_call_i2c_clients(struct cx88_core *core, unsigned int cmd, void *arg)
 {
-#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
-	struct videobuf_dvb_frontends *f = &core->dvbdev->frontends;
-	struct videobuf_dvb_frontend *fe = NULL;
-#endif
 	if (0 != core->i2c_rc)
 		return;
 
-#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
-	if (core->dvbdev && f) {
-		if(f->gate <= 1) /* undefined or fe0 */
-			fe = videobuf_dvb_get_frontend(f, 1);
-		else
-			fe = videobuf_dvb_get_frontend(f, f->gate);
+	if (core->gate_ctrl)
+		core->gate_ctrl(core, 1);
 
-		if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl)
-			fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, 1);
+	i2c_clients_command(&core->i2c_adap, cmd, arg);
 
-		i2c_clients_command(&core->i2c_adap, cmd, arg);
-
-		if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl)
-			fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, 0);
-	} else
-#endif
-		i2c_clients_command(&core->i2c_adap, cmd, arg);
+	if (core->gate_ctrl)
+		core->gate_ctrl(core, 0);
 }
 
 static const struct i2c_algo_bit_data cx8800_i2c_algo_template = {
drivers/media/video/cx88/cx88-mpeg.c +4 -26
index 59164fc..b295b76 100644
@@ -787,6 +787,9 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
 	dev->pci = pci_dev;
 	dev->core = core;
 
+	/* Maintain a reference so cx88-video can query the 8802 device. */
+	core->dvbdev = dev;
+
 	err = cx8802_init_common(dev);
 	if (err != 0)
 		goto fail_free;
@@ -794,32 +797,6 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
 	INIT_LIST_HEAD(&dev->drvlist);
 	list_add_tail(&dev->devlist,&cx8802_devlist);
 
-#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
-	mutex_init(&dev->frontends.lock);
-	INIT_LIST_HEAD(&dev->frontends.felist);
-
-	if (core->board.num_frontends) {
-		struct videobuf_dvb_frontend *fe;
-		int i;
-
-		printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__,
-			core->board.num_frontends);
-		for (i = 1; i <= core->board.num_frontends; i++) {
-			fe = videobuf_dvb_alloc_frontend(&dev->frontends, i);
-			if(fe == NULL) {
-				printk(KERN_ERR "%s() failed to alloc\n",
-					__func__);
-				videobuf_dvb_dealloc_frontends(&dev->frontends);
-				err = -ENOMEM;
-				goto fail_free;
-			}
-		}
-	}
-#endif
-
-	/* Maintain a reference so cx88-video can query the 8802 device. */
-	core->dvbdev = dev;
-
 	/* now autoload cx88-dvb or cx88-blackbird */
 	request_modules(dev);
 	return 0;
@@ -827,6 +804,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
  fail_free:
 	kfree(dev);
  fail_core:
+	core->dvbdev = NULL;
 	cx88_core_put(core,pci_dev);
 	return err;
 }
drivers/media/video/cx88/cx88.h +3 -1
index eb9ce30..60a8b31 100644
@@ -302,6 +302,7 @@ struct cx88_dmaqueue {
 	struct btcx_riscmem    stopper;
 	u32                    count;
 };
+struct cx88_core;
 
 struct cx88_core {
 	struct list_head           devlist;
@@ -334,7 +335,8 @@ struct cx88_core {
 
 	/* config info -- dvb */
 #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
-	int 			   (*prev_set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
+	int 			   (*prev_set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage);
+	void			   (*gate_ctrl)(struct cx88_core  *core, int open);
 #endif
 
 	/* state info */
#9 lore raw

Re: linux-next: Tree for January 5 (multimedia #3)

Quoted 17 lines · Mauro Carvalho Chehab
Quoted 6 lines · On Mon, 5 Jan 2009 12:09:27 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 4 lines · On Mon, 5 Jan 2009 17:35:17 +1100 Stephen Rothwell wrote:

Hi all,

This tree will not build a powerpc ppc4xx_defconfig due to a kvm problem.

Quoted 7 lines
Quoted 1 line

Changes since 20090102:

drivers/built-in.o: In function `cx88_call_i2c_clients':
(.text+0x20af17): undefined reference to videobuf_dvb_get_frontend' drivers/built-in.o: In function cx8802_probe':
cx88-mpeg.c:(.devinit.text+0x268c4): undefined reference to videobuf_dvb_alloc_frontend' cx88-mpeg.c:(.devinit.text+0x268ea): undefined reference to videobuf_dvb_dealloc_frontends'

Quoted 4 lines

This one were trickier. Patch enclosed.

Cheers,
Mauro

Hi Mauro,

After applying this patch, now I get these build errors:

drivers/built-in.o: In function `mpeg_release':
cx88-blackbird.c:(.text+0x21096d): undefined reference to cx8802_cancel_buffers' cx88-blackbird.c:(.text+0x2109a3): undefined reference to cx8802_get_device' cx88-blackbird.c:(.text+0x2109bd): undefined reference to cx8802_get_driver' drivers/built-in.o: In function bb_buf_queue':
cx88-blackbird.c:(.text+0x210a06): undefined reference to cx8802_buf_queue' drivers/built-in.o: In function bb_buf_prepare':
cx88-blackbird.c:(.text+0x210a25): undefined reference to cx8802_buf_prepare' drivers/built-in.o: In function mpeg_open':
cx88-blackbird.c:(.text+0x210a59): undefined reference to cx8802_get_device' cx88-blackbird.c:(.text+0x210aa2): undefined reference to cx8802_get_driver' drivers/built-in.o: In function `blackbird_init':
cx88-blackbird.c:(.text+0x210d18): undefined reference to cx8802_register_driver' drivers/built-in.o: In function blackbird_fini':
cx88-blackbird.c:(.text+0x210fbc): undefined reference to `cx8802_unregister_driver'

Quoted 287 lines

---

cx88: Fix some Kbuild troubles

As Randy Dunlap <[email protected]> reported, cx88 has some compilation issues:

drivers/built-in.o: In function `cx88_call_i2c_clients':
(.text+0x20af17): undefined reference to videobuf_dvb_get_frontend' drivers/built-in.o: In function cx8802_probe':
cx88-mpeg.c:(.devinit.text+0x268c4): undefined reference to videobuf_dvb_alloc_frontend' cx88-mpeg.c:(.devinit.text+0x268ea): undefined reference to videobuf_dvb_dealloc_frontends'

With those configs:

CONFIG_VIDEO_CX88=y
CONFIG_VIDEO_CX88_BLACKBIRD=y
CONFIG_VIDEO_CX88_DVB=m
CONFIG_DVB_CORE=m

After carefully examining the code, with the current code, several cx88 drivers (cx8800, cx8802, cx88_dvb and cx88_blackbird) should be compiled as a module, if one of them is marked as such. Just fixing Kconfig could create a very complex set of rules. Also, this hides a problem with the current approach where the dvb functionality weren't confined inside dvb module.

What happens is that:
- cx88-i2c (part of cx8800) has some special rules if DVB;
- cx88-mpeg (cx8802 module) has also part of DVB init code;
- cx88-dvb has the rest of the dvb code;
- cx88-blackbird can be used with cx88-mpeg, having cx88-dvb or not.

So, instead of doing some tricks at Kconfig and wait for a next breakage, this patch moves the dvb code inside cx88-i2c and cx88-mpeg into cx88-dvb.

Another problem is that cx8802 were being compiled, even without cx88-dvb and cx88-blackbird modules.

While on this code, let's fix also a reported problem:
http://www.linuxtv.org/pipermail/linux-dvb/2009-January/031225.html

A solution for the issue were proposed here:
http://www.mail-archive.com/[email protected]/msg00021.html

Thanks to Randy, Andy, Gregoire and Thomas for helping us to detect and solve the issues.

drivers/media/video/cx88/Kconfig +6 -0
index b0f8375..69ad968 100644
@@ -69,6 +69,12 @@ config VIDEO_CX88_DVB
 	  To compile this driver as a module, choose M here: the
 	  module will be called cx88-dvb.
 
+config VIDEO_CX88_MPEG
+	tristate
+	depends on VIDEO_CX88_DVB
+	depends on VIDEO_CX88_BLACKBIRD
+	default y
+
 config VIDEO_CX88_VP3054
 	tristate "VP-3054 Secondary I2C Bus Support"
 	default m
drivers/media/video/cx88/Makefile +2 -1
index 6ec30f2..b06b127 100644
@@ -3,7 +3,8 @@ cx88xx-objs	:= cx88-cards.o cx88-core.o cx88-i2c.o cx88-tvaudio.o \
 cx8800-objs	:= cx88-video.o cx88-vbi.o
 cx8802-objs	:= cx88-mpeg.o
 
-obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o cx8802.o
+obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o
+obj-$(CONFIG_VIDEO_CX88_MPEG) += cx8802.o
 obj-$(CONFIG_VIDEO_CX88_ALSA) += cx88-alsa.o
 obj-$(CONFIG_VIDEO_CX88_BLACKBIRD) += cx88-blackbird.o
 obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o
drivers/media/video/cx88/cx88-dvb.c +46 -0
index da4dd49..613dfea 100644
@@ -138,6 +138,28 @@ static int cx88_dvb_bus_ctrl(struct dvb_frontend* fe, int acquire)
 	return ret;
 }
 
+static void cx88_dvb_gate_ctrl(struct cx88_core  *core, int open)
+{
+	struct videobuf_dvb_frontends *f;
+	struct videobuf_dvb_frontend *fe;
+
+	if (!core->dvbdev)
+		return;
+
+	f = &core->dvbdev->frontends;
+
+	if (!f)
+		return;
+
+	if (f->gate <= 1) /* undefined or fe0 */
+		fe = videobuf_dvb_get_frontend(f, 1);
+	else
+		fe = videobuf_dvb_get_frontend(f, f->gate);
+
+	if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl)
+		fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, open);
+}
+
 /* ------------------------------------------------------------------ */
 
 static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe)
@@ -597,12 +619,30 @@ static int dvb_register(struct cx8802_dev *dev)
 	struct cx88_core *core = dev->core;
 	struct videobuf_dvb_frontend *fe0, *fe1 = NULL;
 	int mfe_shared = 0; /* bus not shared by default */
+	int i;
 
 	if (0 != core->i2c_rc) {
 		printk(KERN_ERR "%s/2: no i2c-bus available, cannot attach dvb drivers\n", core->name);
 		goto frontend_detach;
 	}
 
+	if (!core->board.num_frontends)
+		return -EINVAL;
+
+	mutex_init(&dev->frontends.lock);
+	INIT_LIST_HEAD(&dev->frontends.felist);
+
+	printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__,
+			 core->board.num_frontends);
+	for (i = 1; i <= core->board.num_frontends; i++) {
+		fe0 = videobuf_dvb_alloc_frontend(&dev->frontends, i);
+		if (!fe0) {
+			printk(KERN_ERR "%s() failed to alloc\n", __func__);
+			videobuf_dvb_dealloc_frontends(&dev->frontends);
+			goto frontend_detach;
+		}
+	}
+
 	/* Get the first frontend */
 	fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
 	if (!fe0)
@@ -611,6 +651,9 @@ static int dvb_register(struct cx8802_dev *dev)
 	/* multi-frontend gate control is undefined or defaults to fe0 */
 	dev->frontends.gate = 0;
 
+	/* Sets the gate control callback to be used by i2c command calls */
+	core->gate_ctrl = cx88_dvb_gate_ctrl;
+
 	/* init frontend(s) */
 	switch (core->boardnr) {
 	case CX88_BOARD_HAUPPAUGE_DVB_T1:
@@ -1109,6 +1152,7 @@ static int dvb_register(struct cx8802_dev *dev)
 		&dev->pci->dev, adapter_nr, mfe_shared);
 
 frontend_detach:
+	core->gate_ctrl = NULL;
 	videobuf_dvb_dealloc_frontends(&dev->frontends);
 	return -EINVAL;
 }
@@ -1270,6 +1314,8 @@ static int cx8802_dvb_remove(struct cx8802_driver *drv)
 
 	vp3054_i2c_remove(dev);
 
+	core->gate_ctrl = NULL;
+
 	return 0;
 }
 
drivers/media/video/cx88/cx88-i2c.c +5 -19
index 1ab691d..c0ff230 100644
@@ -116,30 +116,16 @@ static int detach_inform(struct i2c_client *client)
 
 void cx88_call_i2c_clients(struct cx88_core *core, unsigned int cmd, void *arg)
 {
-#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
-	struct videobuf_dvb_frontends *f = &core->dvbdev->frontends;
-	struct videobuf_dvb_frontend *fe = NULL;
-#endif
 	if (0 != core->i2c_rc)
 		return;
 
-#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
-	if (core->dvbdev && f) {
-		if(f->gate <= 1) /* undefined or fe0 */
-			fe = videobuf_dvb_get_frontend(f, 1);
-		else
-			fe = videobuf_dvb_get_frontend(f, f->gate);
+	if (core->gate_ctrl)
+		core->gate_ctrl(core, 1);
 
-		if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl)
-			fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, 1);
+	i2c_clients_command(&core->i2c_adap, cmd, arg);
 
-		i2c_clients_command(&core->i2c_adap, cmd, arg);
-
-		if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl)
-			fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, 0);
-	} else
-#endif
-		i2c_clients_command(&core->i2c_adap, cmd, arg);
+	if (core->gate_ctrl)
+		core->gate_ctrl(core, 0);
 }
 
 static const struct i2c_algo_bit_data cx8800_i2c_algo_template = {
drivers/media/video/cx88/cx88-mpeg.c +4 -26
index 59164fc..b295b76 100644
@@ -787,6 +787,9 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
 	dev->pci = pci_dev;
 	dev->core = core;
 
+	/* Maintain a reference so cx88-video can query the 8802 device. */
+	core->dvbdev = dev;
+
 	err = cx8802_init_common(dev);
 	if (err != 0)
 		goto fail_free;
@@ -794,32 +797,6 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
 	INIT_LIST_HEAD(&dev->drvlist);
 	list_add_tail(&dev->devlist,&cx8802_devlist);
 
-#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
-	mutex_init(&dev->frontends.lock);
-	INIT_LIST_HEAD(&dev->frontends.felist);
-
-	if (core->board.num_frontends) {
-		struct videobuf_dvb_frontend *fe;
-		int i;
-
-		printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__,
-			core->board.num_frontends);
-		for (i = 1; i <= core->board.num_frontends; i++) {
-			fe = videobuf_dvb_alloc_frontend(&dev->frontends, i);
-			if(fe == NULL) {
-				printk(KERN_ERR "%s() failed to alloc\n",
-					__func__);
-				videobuf_dvb_dealloc_frontends(&dev->frontends);
-				err = -ENOMEM;
-				goto fail_free;
-			}
-		}
-	}
-#endif
-
-	/* Maintain a reference so cx88-video can query the 8802 device. */
-	core->dvbdev = dev;
-
 	/* now autoload cx88-dvb or cx88-blackbird */
 	request_modules(dev);
 	return 0;
@@ -827,6 +804,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
  fail_free:
 	kfree(dev);
  fail_core:
+	core->dvbdev = NULL;
 	cx88_core_put(core,pci_dev);
 	return err;
 }
drivers/media/video/cx88/cx88.h +3 -1
index eb9ce30..60a8b31 100644
@@ -302,6 +302,7 @@ struct cx88_dmaqueue {
 	struct btcx_riscmem    stopper;
 	u32                    count;
 };
+struct cx88_core;
 
 struct cx88_core {
 	struct list_head           devlist;
@@ -334,7 +335,8 @@ struct cx88_core {
 
 	/* config info -- dvb */
 #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
-	int 			   (*prev_set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
+	int 			   (*prev_set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage);
+	void			   (*gate_ctrl)(struct cx88_core  *core, int open);
 #endif
 
 	/* state info */
Signature · 1 line
~Randy
#10 lore raw

Re: linux-next: Tree for January 5 (multimedia #3)

Quoted 27 lines · On Wed, 07 Jan 2009 10:34:11 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 17 lines · Mauro Carvalho Chehab
Quoted 6 lines · On Mon, 5 Jan 2009 12:09:27 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 4 lines · On Mon, 5 Jan 2009 17:35:17 +1100 Stephen Rothwell wrote:

Hi all,

This tree will not build a powerpc ppc4xx_defconfig due to a kvm problem.

Quoted 7 lines
Quoted 1 line

Changes since 20090102:

drivers/built-in.o: In function `cx88_call_i2c_clients':
(.text+0x20af17): undefined reference to videobuf_dvb_get_frontend' drivers/built-in.o: In function cx8802_probe':
cx88-mpeg.c:(.devinit.text+0x268c4): undefined reference to videobuf_dvb_alloc_frontend' cx88-mpeg.c:(.devinit.text+0x268ea): undefined reference to videobuf_dvb_dealloc_frontends'

Quoted 4 lines

This one were trickier. Patch enclosed.

Cheers,
Mauro

Hi Mauro,

After applying this patch, now I get these build errors:

Quoted 15 lines

drivers/built-in.o: In function `mpeg_release':
cx88-blackbird.c:(.text+0x21096d): undefined reference to cx8802_cancel_buffers' cx88-blackbird.c:(.text+0x2109a3): undefined reference to cx8802_get_device' cx88-blackbird.c:(.text+0x2109bd): undefined reference to cx8802_get_driver' drivers/built-in.o: In function bb_buf_queue':
cx88-blackbird.c:(.text+0x210a06): undefined reference to cx8802_buf_queue' drivers/built-in.o: In function bb_buf_prepare':
cx88-blackbird.c:(.text+0x210a25): undefined reference to cx8802_buf_prepare' drivers/built-in.o: In function mpeg_open':
cx88-blackbird.c:(.text+0x210a59): undefined reference to cx8802_get_device' cx88-blackbird.c:(.text+0x210aa2): undefined reference to cx8802_get_driver' drivers/built-in.o: In function `blackbird_init':
cx88-blackbird.c:(.text+0x210d18): undefined reference to cx8802_register_driver' drivers/built-in.o: In function blackbird_fini':
cx88-blackbird.c:(.text+0x210fbc): undefined reference to `cx8802_unregister_driver'

Sorry, I sent the wrong version. The correct one is here. Btw, I've committed it yesterday on my linux-next tree. It is likely that it were already added upstream.

Cheers,
Mauro.

commit 3adb75fc5c8b2b0401e51067db07992d616c7711

Author: Mauro Carvalho Chehab <[email protected]>
Date:   Tue Jan 6 16:06:07 2009 -0300

V4L/DVB (10190): cx88: Fix some Kbuild troubles

As Randy Dunlap <[email protected]> reported, cx88 has some compilation issues:

drivers/built-in.o: In function `cx88_call_i2c_clients':
(.text+0x20af17): undefined reference to videobuf_dvb_get_frontend' drivers/built-in.o: In function cx8802_probe':
cx88-mpeg.c:(.devinit.text+0x268c4): undefined reference to videobuf_dvb_alloc_frontend' cx88-mpeg.c:(.devinit.text+0x268ea): undefined reference to videobuf_dvb_dealloc_frontends'

With those configs:

CONFIG_VIDEO_CX88=y
CONFIG_VIDEO_CX88_BLACKBIRD=y
CONFIG_VIDEO_CX88_DVB=m
CONFIG_DVB_CORE=m

After carefully examining the code, with the current code, several cx88 drivers (cx8800, cx8802, cx88_dvb and cx88_blackbird) should be compiled as a module, if one of them is marked as such. Just fixing Kconfig could create a very complex set of rules. Also, this hides a problem with the current approach where the dvb functionality weren't confined inside dvb module.

What happens is that:
- cx88-i2c (part of cx8800) has some special rules if DVB;
- cx88-mpeg (cx8802 module) has also part of DVB init code;
- cx88-dvb has the rest of the dvb code;
- cx88-blackbird can be used with cx88-mpeg, having cx88-dvb or not.

So, instead of doing some tricks at Kconfig and wait for a next breakage, this patch moves the dvb code inside cx88-i2c and cx88-mpeg into cx88-dvb.

Another problem is that cx8802 were being compiled, even without cx88-dvb and cx88-blackbird modules.

While on this code, let's fix also a reported problem:
http://www.linuxtv.org/pipermail/linux-dvb/2009-January/031225.html

A solution for the issue were proposed here:
http://www.mail-archive.com/[email protected]/msg00021.html

Thanks to Randy, Andy, Gregoire and Thomas for helping us to detect and solve the issues.

drivers/media/video/cx88/Kconfig +5 -0
index b0f8375..2d250a2 100644
@@ -69,6 +69,11 @@ config VIDEO_CX88_DVB
 	  To compile this driver as a module, choose M here: the
 	  module will be called cx88-dvb.
 
+config VIDEO_CX88_MPEG
+	tristate
+	depends on VIDEO_CX88_DVB || VIDEO_CX88_BLACKBIRD
+	default y
+
 config VIDEO_CX88_VP3054
 	tristate "VP-3054 Secondary I2C Bus Support"
 	default m
drivers/media/video/cx88/Makefile +2 -1
index 6ec30f2..b06b127 100644
@@ -3,7 +3,8 @@ cx88xx-objs	:= cx88-cards.o cx88-core.o cx88-i2c.o cx88-tvaudio.o \
 cx8800-objs	:= cx88-video.o cx88-vbi.o
 cx8802-objs	:= cx88-mpeg.o
 
-obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o cx8802.o
+obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o
+obj-$(CONFIG_VIDEO_CX88_MPEG) += cx8802.o
 obj-$(CONFIG_VIDEO_CX88_ALSA) += cx88-alsa.o
 obj-$(CONFIG_VIDEO_CX88_BLACKBIRD) += cx88-blackbird.o
 obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o
drivers/media/video/cx88/cx88-dvb.c +46 -0

82 lines not on this page · raw message

drivers/media/video/cx88/cx88-i2c.c +5 -19
index 1ab691d..c0ff230 100644
@@ -116,30 +116,16 @@ static int detach_inform(struct i2c_client *client)
 
 void cx88_call_i2c_clients(struct cx88_core *core, unsigned int cmd, void *arg)
 {
-#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
-	struct videobuf_dvb_frontends *f = &core->dvbdev->frontends;
-	struct videobuf_dvb_frontend *fe = NULL;
-#endif
 	if (0 != core->i2c_rc)
 		return;
 
-#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
-	if (core->dvbdev && f) {
-		if(f->gate <= 1) /* undefined or fe0 */
-			fe = videobuf_dvb_get_frontend(f, 1);
-		else
-			fe = videobuf_dvb_get_frontend(f, f->gate);
+	if (core->gate_ctrl)
+		core->gate_ctrl(core, 1);
 
-		if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl)
-			fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, 1);
+	i2c_clients_command(&core->i2c_adap, cmd, arg);
 
-		i2c_clients_command(&core->i2c_adap, cmd, arg);
-
-		if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl)
-			fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, 0);
-	} else
-#endif
-		i2c_clients_command(&core->i2c_adap, cmd, arg);
+	if (core->gate_ctrl)
+		core->gate_ctrl(core, 0);
 }
 
 static const struct i2c_algo_bit_data cx8800_i2c_algo_template = {
drivers/media/video/cx88/cx88-mpeg.c +4 -26
index 59164fc..b295b76 100644
@@ -787,6 +787,9 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
 	dev->pci = pci_dev;
 	dev->core = core;
 
+	/* Maintain a reference so cx88-video can query the 8802 device. */
+	core->dvbdev = dev;
+
 	err = cx8802_init_common(dev);
 	if (err != 0)
 		goto fail_free;
@@ -794,32 +797,6 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
 	INIT_LIST_HEAD(&dev->drvlist);
 	list_add_tail(&dev->devlist,&cx8802_devlist);
 
-#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
-	mutex_init(&dev->frontends.lock);
-	INIT_LIST_HEAD(&dev->frontends.felist);
-
-	if (core->board.num_frontends) {
-		struct videobuf_dvb_frontend *fe;
-		int i;
-
-		printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__,
-			core->board.num_frontends);
-		for (i = 1; i <= core->board.num_frontends; i++) {
-			fe = videobuf_dvb_alloc_frontend(&dev->frontends, i);
-			if(fe == NULL) {
-				printk(KERN_ERR "%s() failed to alloc\n",
-					__func__);
-				videobuf_dvb_dealloc_frontends(&dev->frontends);
-				err = -ENOMEM;
-				goto fail_free;
-			}
-		}
-	}
-#endif
-
-	/* Maintain a reference so cx88-video can query the 8802 device. */
-	core->dvbdev = dev;
-
 	/* now autoload cx88-dvb or cx88-blackbird */
 	request_modules(dev);
 	return 0;
@@ -827,6 +804,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
  fail_free:
 	kfree(dev);
  fail_core:
+	core->dvbdev = NULL;
 	cx88_core_put(core,pci_dev);
 	return err;
 }
drivers/media/video/cx88/cx88.h +3 -1
index eb9ce30..60a8b31 100644
@@ -302,6 +302,7 @@ struct cx88_dmaqueue {
 	struct btcx_riscmem    stopper;
 	u32                    count;
 };
+struct cx88_core;
 
 struct cx88_core {
 	struct list_head           devlist;
@@ -334,7 +335,8 @@ struct cx88_core {
 
 	/* config info -- dvb */
 #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
-	int 			   (*prev_set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
+	int 			   (*prev_set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage);
+	void			   (*gate_ctrl)(struct cx88_core  *core, int open);
 #endif
 
 	/* state info */

Cheers,
Mauro

#11 lore raw

Re: linux-next: Tree for January 5 (multimedia #3)

Quoted 44 lines · Mauro Carvalho Chehab
Quoted 24 lines · On Wed, 07 Jan 2009 10:34:11 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 15 lines · Mauro Carvalho Chehab
Quoted 4 lines · On Mon, 5 Jan 2009 12:09:27 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 2 lines · On Mon, 5 Jan 2009 17:35:17 +1100 Stephen Rothwell wrote:

Hi all,

Quoted 8 lines
Quoted 3 lines

This tree will not build a powerpc ppc4xx_defconfig due to a kvm problem.

Changes since 20090102:

drivers/built-in.o: In function `cx88_call_i2c_clients':
(.text+0x20af17): undefined reference to videobuf_dvb_get_frontend' drivers/built-in.o: In function cx8802_probe':
cx88-mpeg.c:(.devinit.text+0x268c4): undefined reference to videobuf_dvb_alloc_frontend' cx88-mpeg.c:(.devinit.text+0x268ea): undefined reference to videobuf_dvb_dealloc_frontends'

Quoted 4 lines

This one were trickier. Patch enclosed.

Cheers,
Mauro

Hi Mauro,

After applying this patch, now I get these build errors:

Quoted 15 lines

drivers/built-in.o: In function `mpeg_release':
cx88-blackbird.c:(.text+0x21096d): undefined reference to cx8802_cancel_buffers' cx88-blackbird.c:(.text+0x2109a3): undefined reference to cx8802_get_device' cx88-blackbird.c:(.text+0x2109bd): undefined reference to cx8802_get_driver' drivers/built-in.o: In function bb_buf_queue':
cx88-blackbird.c:(.text+0x210a06): undefined reference to cx8802_buf_queue' drivers/built-in.o: In function bb_buf_prepare':
cx88-blackbird.c:(.text+0x210a25): undefined reference to cx8802_buf_prepare' drivers/built-in.o: In function mpeg_open':
cx88-blackbird.c:(.text+0x210a59): undefined reference to cx8802_get_device' cx88-blackbird.c:(.text+0x210aa2): undefined reference to cx8802_get_driver' drivers/built-in.o: In function `blackbird_init':
cx88-blackbird.c:(.text+0x210d18): undefined reference to cx8802_register_driver' drivers/built-in.o: In function blackbird_fini':
cx88-blackbird.c:(.text+0x210fbc): undefined reference to `cx8802_unregister_driver'

Quoted 2 lines

Sorry, I sent the wrong version. The correct one is here. Btw, I've committed it yesterday on my linux-next tree. It is likely that it were already added upstream.

Ack, that builds cleanly. Thanks.

Quoted 52 lines

Cheers,
Mauro.

commit 3adb75fc5c8b2b0401e51067db07992d616c7711

Author: Mauro Carvalho Chehab <[email protected]>
Date:   Tue Jan 6 16:06:07 2009 -0300

V4L/DVB (10190): cx88: Fix some Kbuild troubles

As Randy Dunlap <[email protected]> reported, cx88 has some compilation issues:

drivers/built-in.o: In function `cx88_call_i2c_clients':
(.text+0x20af17): undefined reference to videobuf_dvb_get_frontend' drivers/built-in.o: In function cx8802_probe':
cx88-mpeg.c:(.devinit.text+0x268c4): undefined reference to videobuf_dvb_alloc_frontend' cx88-mpeg.c:(.devinit.text+0x268ea): undefined reference to videobuf_dvb_dealloc_frontends'

With those configs:

CONFIG_VIDEO_CX88=y
CONFIG_VIDEO_CX88_BLACKBIRD=y
CONFIG_VIDEO_CX88_DVB=m
CONFIG_DVB_CORE=m

After carefully examining the code, with the current code, several cx88 drivers (cx8800, cx8802, cx88_dvb and cx88_blackbird) should be compiled as a module, if one of them is marked as such. Just fixing Kconfig could create a very complex set of rules. Also, this hides a problem with the current approach where the dvb functionality weren't confined inside dvb module.

What happens is that:
- cx88-i2c (part of cx8800) has some special rules if DVB;
- cx88-mpeg (cx8802 module) has also part of DVB init code;
- cx88-dvb has the rest of the dvb code;
- cx88-blackbird can be used with cx88-mpeg, having cx88-dvb or not.

So, instead of doing some tricks at Kconfig and wait for a next breakage, this patch moves the dvb code inside cx88-i2c and cx88-mpeg into cx88-dvb.

Another problem is that cx8802 were being compiled, even without cx88-dvb and cx88-blackbird modules.

While on this code, let's fix also a reported problem:
http://www.linuxtv.org/pipermail/linux-dvb/2009-January/031225.html

A solution for the issue were proposed here:
http://www.mail-archive.com/[email protected]/msg00021.html

Thanks to Randy, Andy, Gregoire and Thomas for helping us to detect and solve the issues.

Signature · 1 line
~Randy
#12 lore raw

PATCH 1/1 jbd2: fix printk format warning

In reply to Stephen Rothwell

From: Randy Dunlap <[email protected]>

Fix jbd2 printk format:

fs/jbd2/journal.c:848: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'uint32_t'

---
 fs/jbd2/journal.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/jbd2/journal.c +2 -1
@@ -845,7 +845,8 @@ static int jbd2_seq_info_show(struct seq
 	seq_printf(seq, "  %ums logging transaction\n",
 	    jiffies_to_msecs(s->stats->u.run.rs_logging / s->stats->ts_tid));
 	seq_printf(seq, "  %luus average transaction commit time\n",
-		   do_div(s->journal->j_average_commit_time, 1000));
+		   (unsigned long)do_div(s->journal->j_average_commit_time,
+					1000));
 	seq_printf(seq, "  %lu handles per transaction\n",
 	    s->stats->u.run.rs_handle_count / s->stats->ts_tid);
 	seq_printf(seq, "  %lu blocks per transaction\n",
#13 lore raw

Re: [PATCH -next] jbd2: fix printk format warning

man, 05 01 2009 kl. 12:11 -0800, skrev Randy Dunlap:

Quoted 15 lines

From: Randy Dunlap <[email protected]>

Fix jbd2 printk format:

fs/jbd2/journal.c:848: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'uint32_t'

---
 fs/jbd2/journal.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

fs/jbd2/journal.c static int jbd2_seq_info_show(struct seq · line 852

Quoted 9 lines
fs/jbd2/journal.c +2 -1
@@ -845,7 +845,8 @@ static int jbd2_seq_info_show(struct seq
 	seq_printf(seq, "  %ums logging transaction\n",
 	    jiffies_to_msecs(s->stats->u.run.rs_logging / s->stats->ts_tid));
 	seq_printf(seq, "  %luus average transaction commit time\n",
-		   do_div(s->journal->j_average_commit_time, 1000));
+		   (unsigned long)do_div(s->journal->j_average_commit_time,
+					1000));
 	seq_printf(seq, "  %lu handles per transaction\n",
 	    s->stats->u.run.rs_handle_count / s->stats->ts_tid);
 	seq_printf(seq, "  %lu blocks per transaction\n",

This patch is just as wrong as the original code. Please don't apply it, but see my "[PATCH] jbd2: fix wrong use of do_div" that I just sent out.

Simon Holm Thøgersen

#14 lore raw

Re: [PATCH -next] jbd2: fix printk format warning

Quoted 13 lines · Simon Holm Thøgersen

man, 05 01 2009 kl. 12:11 -0800, skrev Randy Dunlap:

Quoted 12 lines

From: Randy Dunlap <[email protected]>

Fix jbd2 printk format:

fs/jbd2/journal.c:848: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'uint32_t'

---
 fs/jbd2/journal.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 16 lines

fs/jbd2/journal.c static int jbd2_seq_info_show(struct seq · line 852

Quoted 12 lines
fs/jbd2/journal.c +2 -1
@@ -845,7 +845,8 @@ static int jbd2_seq_info_show(struct seq
 	seq_printf(seq, "  %ums logging transaction\n",
 	    jiffies_to_msecs(s->stats->u.run.rs_logging / s->stats->ts_tid));
 	seq_printf(seq, "  %luus average transaction commit time\n",
-		   do_div(s->journal->j_average_commit_time, 1000));
+		   (unsigned long)do_div(s->journal->j_average_commit_time,
+					1000));
 	seq_printf(seq, "  %lu handles per transaction\n",
 	    s->stats->u.run.rs_handle_count / s->stats->ts_tid);
 	seq_printf(seq, "  %lu blocks per transaction\n",

This patch is just as wrong as the original code. Please don't apply it, but see my "[PATCH] jbd2: fix wrong use of do_div" that I just sent out.

ok, where did you send it? I don't see it...

Signature · 1 line
~Randy
#15 lore raw

Re: [PATCH -next] jbd2: fix printk format warning

søn, 11 01 2009 kl. 11:07 -0800, skrev Randy Dunlap:

Quoted 1 line

ok, where did you send it? I don't see it...

It had a wrong recipient address so it never made it. I've sent it again and verified that it made it this time.

Simon

#16 lore raw

dm_attr_{name,uuid}_show buffer overflow? (was: Re: linux-next: Tree for January 5)

In reply to Stephen Rothwell
Quoted 4 lines · Stephen Rothwell

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.

On m68k, you get http://kisskb.ellerman.id.au/kisskb/buildresult/65466/:

| ERROR: "strlen" [drivers/md/dm-mod.ko] undefined!

which triggered my attention.

drivers/md/dm-sysfs.c:

| static ssize_t dm_attr_name_show(struct mapped_device *md, char *buf)
| {
|         if (dm_copy_name_and_uuid(md, buf, NULL))
|                 return -EIO;
| 
|         strncat(buf, "\n", DM_NAME_LEN);
|         return strnlen(buf, DM_NAME_LEN);
| }

is turned into:

|         .type   dm_attr_name_show, @function
| dm_attr_name_show:
|         move.l %a3,-(%sp)
|         move.l 12(%sp),%a3      | buf, buf
|         clr.l -(%sp)    |
|         move.l %a3,-(%sp)       | buf,
|         move.l 16(%sp),-(%sp)   | md,
|         jbsr dm_copy_name_and_uuid      |
|         lea (12,%sp),%sp        |,
|         tst.l %d0       |
|         jeq .L23        |
|         move.w #-5,%a0  |, D.21217
|         jbra .L25       |
| .L23:
|         move.l %a3,-(%sp)       | buf,
|         jbsr strlen     |
|         addq.l #4,%sp   |,
|         move.w #2560,(%a3,%d0.l)        |,* buf
|         moveq #127,%d0  |, tmp43
|         not.b %d0       | tmp43
|         move.l %a3,%a0  | buf, sc.399
| #APP
| 
| 1:     subq.l  #1,%d0   | count
|        jcs     2f
|        tst.b   (%a0)+   | sc.399
|        jne     1b
|        subq.l  #1,%a0   | sc.399
| 2:
| #NO_APP
|         sub.l %a3,%a0   | buf, D.21217
| .L25:
|         move.l %a0,%d0  | D.21217, <result>
|         move.l (%sp)+,%a3
|         rts
|         .size   dm_attr_name_show, .-dm_attr_name_show

So gcc (version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) in my case) is smart and turns the strncat into a strlen() (without obeying our override of strlen() in <{linux,asm}/string.h>) followed by an _unconditional_ store.

And I think that's the real bug: `strncat(buf, "\n", DM_NAME_LEN);' copies at most DM_NAME_LEN characters from source "\n", which has the known size 2, which is always smaller than DM_NAME_LEN. Hence the check is optimized away, and the "\n" is _always_ appended!

Probably the intention was to limit the string in _buf_ (not the source string "\n") to DM_NAME_LEN? If yes, this may cause a buffer overflow.

The same bug is present in dm_attr_uuid_show().

Fixing it will probably get rid of the undefined reference, too (I hope :-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#17 lore raw

strncat() misuse (was: Re: dm_attr_{name,uuid}_show buffer overflow? (was: Re: linux-next: Tree for January 5))

Quoted 14 lines · Geert Uytterhoeven
Quoted 4 lines · Stephen Rothwell

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.

On m68k, you get http://kisskb.ellerman.id.au/kisskb/buildresult/65466/:

| ERROR: "strlen" [drivers/md/dm-mod.ko] undefined!

which triggered my attention.

drivers/md/dm-sysfs.c:

Quoted 8 lines
| static ssize_t dm_attr_name_show(struct mapped_device *md, char *buf)
| {
|         if (dm_copy_name_and_uuid(md, buf, NULL))
|                 return -EIO;
| 
|         strncat(buf, "\n", DM_NAME_LEN);
|         return strnlen(buf, DM_NAME_LEN);
| }
    [...]
Quoted 9 lines

And I think that's the real bug: `strncat(buf, "\n", DM_NAME_LEN);' copies at most DM_NAME_LEN characters from source "\n", which has the known size 2, which is always smaller than DM_NAME_LEN. Hence the check is optimized away, and the "\n" is _always_ appended!

Probably the intention was to limit the string in _buf_ (not the source string "\n") to DM_NAME_LEN? If yes, this may cause a buffer overflow.

The same bug is present in dm_attr_uuid_show().

A quick `git grep strncat' shows a few more misusers of strncat() that may cause buffer overflows and should be converted to strlcat():

| drivers/media/video/usbvideo/konicawc.c:	strncat(cam->input_physname, "/input0", sizeof(cam->input_physname));
| drivers/media/video/usbvideo/quickcam_messenger.c:	strncat(cam->input_physname, "/input0", sizeof(cam->input_physname));
| drivers/media/video/uvc/uvc_driver.c:		strncat(format->name, buffer[8] & (1 << 7) ? " 60Hz" : " 50Hz",
| usr/gen_init_cpio.c:                       strncat(expanded, getenv(env_var), PATH_MAX);
| usr/gen_init_cpio.c:                       strncat(expanded, end + 1, PATH_MAX);

Let's hope I didn't miss any. Good night! ;-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#18 lore raw

Re: strncat() misuse (was: Re: dm_attr_{name,uuid}_show buffer overflow? (was: Re: linux-next: Tree for January 5))

Quoted 8 lines · Geert Uytterhoeven
Quoted 7 lines · Geert Uytterhoeven

On Mon, 5 Jan 2009, Stephen Rothwell wrote:

|         strncat(buf, "\n", DM_NAME_LEN);
|         return strnlen(buf, DM_NAME_LEN);

Probably the intention was to limit the string in _buf_ (not the source string "\n") to DM_NAME_LEN? If yes, this may cause a buffer overflow.

Both the 'n's look bogus to me as runtime checks. But I think the code happens to work correctly - apart from your compilation problem.

buf is always a page and both strings (name and uuid) are NULL-terminated and the longest possible is 128 chars of uuid plus the "\n" i.e. 130 (except for a bug I noticed on one code path which we'll fix).

Alasdair

Signature · 1 line
[email protected]
#19 lore raw

Re: strncat() misuse (was: Re: dm_attr_{name,uuid}_show buffer overflow? (was: Re: linux-next: Tree for January 5))

Quoted 5 lines · Alasdair G Kergon
Quoted 4 lines · Geert Uytterhoeven
Quoted 3 lines · Geert Uytterhoeven

On Mon, 5 Jan 2009, Stephen Rothwell wrote:

|         strncat(buf, "\n", DM_NAME_LEN);
|         return strnlen(buf, DM_NAME_LEN);

I've edited the patch to use strcat and strlen.

http://git.kernel.org/?p=linux/kernel/git/agk/linux-2.6-dm.git;a=commit;h=911950f88bfd8a6747a1c6da5c5410641845bc64

Alasdair

Signature · 1 line
[email protected]
#20 lore raw

Re: strncat() misuse (was: Re: dm_attr_{name,uuid}_show buffer overflow? (was: Re: linux-next: Tree for January 5))

In reply to Geert Uytterhoeven

Hi Geert,

Quoted 6 lines · Geert Uytterhoeven

A quick `git grep strncat' shows a few more misusers of strncat() that may

cause buffer overflows and should be converted to strlcat():
| drivers/media/video/uvc/uvc_driver.c:
| strncat(format->name, buffer[8] & (1 << 7) ? " 60Hz" : " 50Hz",

Thanks for the report. As both the source length is fixed and the destination buffer length known, I'll just replace strncat with strcat.

Best regards,

Laurent Pinchart