diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-02-20 07:56:25 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-02-26 15:11:05 -0300 |
commit | cd7d9beb09d89d62bc3c6336e4cb9a2ee3da6163 (patch) | |
tree | 94ed5180b0cfac0f1f256bbb5ed9e0fb2643d93f /drivers/media | |
parent | 8d55662512127c84ac90873fb68ba44842e2c426 (diff) |
V4L/DVB: saa7146_vv: fix regression where v4l2_device was registered too late
v4l2_device_register needs to be called before the i2c subdevs are loaded.
However, it was called afterwards in the saa7146 driver. This caused an oops
when loading the mxb and hexium drivers. The vv_init function is now split
into two: one registers the v4l2_device, the other does the rest of the
initialization. The three drivers that depend on this have been updated to
call the new vv_devinit function.
Thanks to Michael Hunold for reporting this.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/common/saa7146_fops.c | 11 | ||||
-rw-r--r-- | drivers/media/video/hexium_gemini.c | 9 | ||||
-rw-r--r-- | drivers/media/video/hexium_orion.c | 4 | ||||
-rw-r--r-- | drivers/media/video/mxb.c | 4 |
4 files changed, 21 insertions, 7 deletions
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index 7364b9642d0..fd8e1f45be3 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c @@ -423,14 +423,15 @@ static void vv_callback(struct saa7146_dev *dev, unsigned long status) } } +int saa7146_vv_devinit(struct saa7146_dev *dev) +{ + return v4l2_device_register(&dev->pci->dev, &dev->v4l2_dev); +} +EXPORT_SYMBOL_GPL(saa7146_vv_devinit); + int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) { struct saa7146_vv *vv; - int err; - - err = v4l2_device_register(&dev->pci->dev, &dev->v4l2_dev); - if (err) - return err; vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL); if (vv == NULL) { diff --git a/drivers/media/video/hexium_gemini.c b/drivers/media/video/hexium_gemini.c index 60d992ee258..e620a3a92f2 100644 --- a/drivers/media/video/hexium_gemini.c +++ b/drivers/media/video/hexium_gemini.c @@ -352,9 +352,13 @@ static struct saa7146_ext_vv vv_data; static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) { struct hexium *hexium = (struct hexium *) dev->ext_priv; + int ret; DEB_EE((".\n")); + ret = saa7146_vv_devinit(dev); + if (ret) + return ret; hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); if (NULL == hexium) { printk("hexium_gemini: not enough kernel memory in hexium_attach().\n"); @@ -400,9 +404,10 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d vv_data.ops.vidioc_enum_input = vidioc_enum_input; vv_data.ops.vidioc_g_input = vidioc_g_input; vv_data.ops.vidioc_s_input = vidioc_s_input; - if (0 != saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER)) { + ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER); + if (ret < 0) { printk("hexium_gemini: cannot register capture v4l2 device. skipping.\n"); - return -1; + return ret; } printk("hexium_gemini: found 'hexium gemini' frame grabber-%d.\n", hexium_num); diff --git a/drivers/media/video/hexium_orion.c b/drivers/media/video/hexium_orion.c index 938a1f8f880..fe596a1c12a 100644 --- a/drivers/media/video/hexium_orion.c +++ b/drivers/media/video/hexium_orion.c @@ -216,6 +216,10 @@ static int hexium_probe(struct saa7146_dev *dev) return -EFAULT; } + err = saa7146_vv_devinit(dev); + if (err) + return err; + hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); if (NULL == hexium) { printk("hexium_orion: hexium_probe: not enough kernel memory.\n"); diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c index c1fc6dc776f..823f126b89c 100644 --- a/drivers/media/video/mxb.c +++ b/drivers/media/video/mxb.c @@ -169,7 +169,11 @@ static struct saa7146_extension extension; static int mxb_probe(struct saa7146_dev *dev) { struct mxb *mxb = NULL; + int err; + err = saa7146_vv_devinit(dev); + if (err) + return err; mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL); if (mxb == NULL) { DEB_D(("not enough kernel memory.\n")); |