aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2010-02-20 05:56:25 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 13:11:05 -0500
commitcd7d9beb09d89d62bc3c6336e4cb9a2ee3da6163 (patch)
tree94ed5180b0cfac0f1f256bbb5ed9e0fb2643d93f /drivers/media
parent8d55662512127c84ac90873fb68ba44842e2c426 (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.c11
-rw-r--r--drivers/media/video/hexium_gemini.c9
-rw-r--r--drivers/media/video/hexium_orion.c4
-rw-r--r--drivers/media/video/mxb.c4
4 files changed, 21 insertions, 7 deletions
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index 7364b9642d00..fd8e1f45be36 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)
423 } 423 }
424} 424}
425 425
426int saa7146_vv_devinit(struct saa7146_dev *dev)
427{
428 return v4l2_device_register(&dev->pci->dev, &dev->v4l2_dev);
429}
430EXPORT_SYMBOL_GPL(saa7146_vv_devinit);
431
426int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) 432int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
427{ 433{
428 struct saa7146_vv *vv; 434 struct saa7146_vv *vv;
429 int err;
430
431 err = v4l2_device_register(&dev->pci->dev, &dev->v4l2_dev);
432 if (err)
433 return err;
434 435
435 vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL); 436 vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL);
436 if (vv == NULL) { 437 if (vv == NULL) {
diff --git a/drivers/media/video/hexium_gemini.c b/drivers/media/video/hexium_gemini.c
index 60d992ee2589..e620a3a92f25 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;
352static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) 352static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info)
353{ 353{
354 struct hexium *hexium = (struct hexium *) dev->ext_priv; 354 struct hexium *hexium = (struct hexium *) dev->ext_priv;
355 int ret;
355 356
356 DEB_EE((".\n")); 357 DEB_EE((".\n"));
357 358
359 ret = saa7146_vv_devinit(dev);
360 if (ret)
361 return ret;
358 hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); 362 hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
359 if (NULL == hexium) { 363 if (NULL == hexium) {
360 printk("hexium_gemini: not enough kernel memory in hexium_attach().\n"); 364 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
400 vv_data.ops.vidioc_enum_input = vidioc_enum_input; 404 vv_data.ops.vidioc_enum_input = vidioc_enum_input;
401 vv_data.ops.vidioc_g_input = vidioc_g_input; 405 vv_data.ops.vidioc_g_input = vidioc_g_input;
402 vv_data.ops.vidioc_s_input = vidioc_s_input; 406 vv_data.ops.vidioc_s_input = vidioc_s_input;
403 if (0 != saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER)) { 407 ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER);
408 if (ret < 0) {
404 printk("hexium_gemini: cannot register capture v4l2 device. skipping.\n"); 409 printk("hexium_gemini: cannot register capture v4l2 device. skipping.\n");
405 return -1; 410 return ret;
406 } 411 }
407 412
408 printk("hexium_gemini: found 'hexium gemini' frame grabber-%d.\n", hexium_num); 413 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 938a1f8f880a..fe596a1c12a8 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)
216 return -EFAULT; 216 return -EFAULT;
217 } 217 }
218 218
219 err = saa7146_vv_devinit(dev);
220 if (err)
221 return err;
222
219 hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); 223 hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
220 if (NULL == hexium) { 224 if (NULL == hexium) {
221 printk("hexium_orion: hexium_probe: not enough kernel memory.\n"); 225 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 c1fc6dc776f5..823f126b89cc 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -169,7 +169,11 @@ static struct saa7146_extension extension;
169static int mxb_probe(struct saa7146_dev *dev) 169static int mxb_probe(struct saa7146_dev *dev)
170{ 170{
171 struct mxb *mxb = NULL; 171 struct mxb *mxb = NULL;
172 int err;
172 173
174 err = saa7146_vv_devinit(dev);
175 if (err)
176 return err;
173 mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL); 177 mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL);
174 if (mxb == NULL) { 178 if (mxb == NULL) {
175 DEB_D(("not enough kernel memory.\n")); 179 DEB_D(("not enough kernel memory.\n"));