Date:2010-03-24 23:09:55 (12 years 6 months ago)
Author:Hans Verkuil
Commit:03b1930efd3c2320b1dcba76c8af15f7e454919d
Message: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>
Files: drivers/media/common/saa7146_fops.c (1 diff)
drivers/media/video/hexium_gemini.c (1 diff)
drivers/media/video/hexium_orion.c (1 diff)
drivers/media/video/mxb.c (4 diffs)
include/media/saa7146_vv.h (1 diff)

Change Details

drivers/media/common/saa7146_fops.c
423423    }
424424}
425425
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
432426int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
433427{
434428    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;
435434
436435    vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL);
437436    if (vv == NULL) {
drivers/media/video/hexium_gemini.c
356356
357357    DEB_EE((".\n"));
358358
359    ret = saa7146_vv_devinit(dev);
360    if (ret)
361        return ret;
362359    hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
363360    if (NULL == hexium) {
364361        printk("hexium_gemini: not enough kernel memory in hexium_attach().\n");
drivers/media/video/hexium_orion.c
216216        return -EFAULT;
217217    }
218218
219    err = saa7146_vv_devinit(dev);
220    if (err)
221        return err;
222
223219    hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
224220    if (NULL == hexium) {
225221        printk("hexium_orion: hexium_probe: not enough kernel memory.\n");
drivers/media/video/mxb.c
169169static int mxb_probe(struct saa7146_dev *dev)
170170{
171171    struct mxb *mxb = NULL;
172    int err;
173172
174    err = saa7146_vv_devinit(dev);
175    if (err)
176        return err;
177173    mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL);
178174    if (mxb == NULL) {
179175        DEB_D(("not enough kernel memory.\n"));
...... 
699695/* this function only gets called when the probing was successful */
700696static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info)
701697{
702    struct mxb *mxb = (struct mxb *)dev->ext_priv;
698    struct mxb *mxb;
703699
704700    DEB_EE(("dev:%p\n", dev));
705701
706    /* checking for i2c-devices can be omitted here, because we
707       already did this in "mxb_vl42_probe" */
708
709702    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
710709    vv_data.ops.vidioc_queryctrl = vidioc_queryctrl;
711710    vv_data.ops.vidioc_g_ctrl = vidioc_g_ctrl;
712711    vv_data.ops.vidioc_s_ctrl = vidioc_s_ctrl;
...... 
726725    vv_data.ops.vidioc_default = vidioc_default;
727726    if (saa7146_register_device(&mxb->video_dev, dev, "mxb", VFL_TYPE_GRABBER)) {
728727        ERR(("cannot register capture v4l2 device. skipping.\n"));
728        saa7146_vv_release(dev);
729729        return -1;
730730    }
731731
...... 
846846    .pci_tbl = &pci_tbl[0],
847847    .module = THIS_MODULE,
848848
849    .probe = mxb_probe,
850849    .attach = mxb_attach,
851850    .detach = mxb_detach,
852851
include/media/saa7146_vv.h
188188void saa7146_dma_free(struct saa7146_dev* dev,struct videobuf_queue *q,
189189                        struct saa7146_buf *buf);
190190
191int saa7146_vv_devinit(struct saa7146_dev *dev);
192191int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv);
193192int saa7146_vv_release(struct saa7146_dev* dev);
194193

Archive Download the corresponding diff file



interactive