Commit 03b1930efd3c2320b1dcba76c8af15f7e454919d

Authored by Hans Verkuil
Committed by Mauro Carvalho Chehab
1 parent d2f2d6d0a1

V4L/DVB: saa7146: fix regression of the av7110/budget-av driver

An earlier regression fix for the mxb driver (V4L/DVB: saa7146_vv: fix
regression where v4l2_device was registered too late) caused a new
regression in the av7110 driver.

Reverted the old fix and fixed the problem in the mxb driver instead.
Tested on mxb and budget-av cards.

The real problem is that the saa7146 framework has separate probe()
and attach() driver callbacks which should be rolled into one. This
is now done for the mxb driver, but others should do the same. Lack
of hardware makes this hard to do, though. I hope to get hold of some
hexium cards and then I can try to improve the framework to prevent
this from happening again.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

Showing 5 changed files with 13 additions and 23 deletions Side-by-side Diff

drivers/media/common/saa7146_fops.c
... ... @@ -423,15 +423,14 @@
423 423 }
424 424 }
425 425  
426   -int saa7146_vv_devinit(struct saa7146_dev *dev)
427   -{
428   - return v4l2_device_register(&dev->pci->dev, &dev->v4l2_dev);
429   -}
430   -EXPORT_SYMBOL_GPL(saa7146_vv_devinit);
431   -
432 426 int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
433 427 {
434 428 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;
435 434  
436 435 vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL);
437 436 if (vv == NULL) {
drivers/media/video/hexium_gemini.c
... ... @@ -356,9 +356,6 @@
356 356  
357 357 DEB_EE((".\n"));
358 358  
359   - ret = saa7146_vv_devinit(dev);
360   - if (ret)
361   - return ret;
362 359 hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
363 360 if (NULL == hexium) {
364 361 printk("hexium_gemini: not enough kernel memory in hexium_attach().\n");
drivers/media/video/hexium_orion.c
... ... @@ -216,10 +216,6 @@
216 216 return -EFAULT;
217 217 }
218 218  
219   - err = saa7146_vv_devinit(dev);
220   - if (err)
221   - return err;
222   -
223 219 hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
224 220 if (NULL == hexium) {
225 221 printk("hexium_orion: hexium_probe: not enough kernel memory.\n");
drivers/media/video/mxb.c
... ... @@ -169,11 +169,7 @@
169 169 static int mxb_probe(struct saa7146_dev *dev)
170 170 {
171 171 struct mxb *mxb = NULL;
172   - int err;
173 172  
174   - err = saa7146_vv_devinit(dev);
175   - if (err)
176   - return err;
177 173 mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL);
178 174 if (mxb == NULL) {
179 175 DEB_D(("not enough kernel memory.\n"));
180 176  
181 177  
... ... @@ -699,14 +695,17 @@
699 695 /* this function only gets called when the probing was successful */
700 696 static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info)
701 697 {
702   - struct mxb *mxb = (struct mxb *)dev->ext_priv;
  698 + struct mxb *mxb;
703 699  
704 700 DEB_EE(("dev:%p\n", dev));
705 701  
706   - /* checking for i2c-devices can be omitted here, because we
707   - already did this in "mxb_vl42_probe" */
708   -
709 702 saa7146_vv_init(dev, &vv_data);
  703 + if (mxb_probe(dev)) {
  704 + saa7146_vv_release(dev);
  705 + return -1;
  706 + }
  707 + mxb = (struct mxb *)dev->ext_priv;
  708 +
710 709 vv_data.ops.vidioc_queryctrl = vidioc_queryctrl;
711 710 vv_data.ops.vidioc_g_ctrl = vidioc_g_ctrl;
712 711 vv_data.ops.vidioc_s_ctrl = vidioc_s_ctrl;
... ... @@ -726,6 +725,7 @@
726 725 vv_data.ops.vidioc_default = vidioc_default;
727 726 if (saa7146_register_device(&mxb->video_dev, dev, "mxb", VFL_TYPE_GRABBER)) {
728 727 ERR(("cannot register capture v4l2 device. skipping.\n"));
  728 + saa7146_vv_release(dev);
729 729 return -1;
730 730 }
731 731  
... ... @@ -846,7 +846,6 @@
846 846 .pci_tbl = &pci_tbl[0],
847 847 .module = THIS_MODULE,
848 848  
849   - .probe = mxb_probe,
850 849 .attach = mxb_attach,
851 850 .detach = mxb_detach,
852 851  
include/media/saa7146_vv.h
... ... @@ -188,7 +188,6 @@
188 188 void saa7146_dma_free(struct saa7146_dev* dev,struct videobuf_queue *q,
189 189 struct saa7146_buf *buf);
190 190  
191   -int saa7146_vv_devinit(struct saa7146_dev *dev);
192 191 int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv);
193 192 int saa7146_vv_release(struct saa7146_dev* dev);
194 193