Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 137858
b: refs/heads/master
c: 230b65f
h: refs/heads/master
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent f8c63e8 commit bbc27ce
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eae4d69b6a337d29060dcad3a4e19e3e8ace3e70
refs/heads/master: 230b65f9945b468c23188572144b4f066af8f98c
14 changes: 7 additions & 7 deletions trunk/drivers/media/common/saa7146_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,16 +363,13 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
ERR(("out of memory.\n"));
goto out;
}
err = v4l2_device_register(&pci->dev, &dev->v4l2_dev);
if (err)
goto err_free;

DEB_EE(("pci:%p\n",pci));

err = pci_enable_device(pci);
if (err < 0) {
ERR(("pci_enable_device() failed.\n"));
goto err_unreg;
goto err_free;
}

/* enable bus-mastering */
Expand Down Expand Up @@ -480,6 +477,10 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
DEB_D(("ext->attach() failed for %p. skipping device.\n",dev));
goto err_free_i2c;
}
/* V4L extensions will set the pci drvdata to the v4l2_device in the
attach() above. So for those cards that do not use V4L we have to
set it explicitly. */
pci_set_drvdata(pci, &dev->v4l2_dev);

INIT_LIST_HEAD(&dev->item);
list_add_tail(&dev->item,&saa7146_devices);
Expand All @@ -506,8 +507,6 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
pci_release_region(pci, 0);
err_disable:
pci_disable_device(pci);
err_unreg:
v4l2_device_unregister(&dev->v4l2_dev);
err_free:
kfree(dev);
goto out;
Expand All @@ -530,7 +529,8 @@ static void saa7146_remove_one(struct pci_dev *pdev)
DEB_EE(("dev:%p\n",dev));

dev->ext->detach(dev);
v4l2_device_unregister(&dev->v4l2_dev);
/* Zero the PCI drvdata after use. */
pci_set_drvdata(pdev, NULL);

/* shut down all video dma transfers */
saa7146_write(dev, MC1, 0x00ff0000);
Expand Down
11 changes: 9 additions & 2 deletions trunk/drivers/media/common/saa7146_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,11 +446,17 @@ static void vv_callback(struct saa7146_dev *dev, unsigned long status)

int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
{
struct saa7146_vv *vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL);
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) {
ERR(("out of memory. aborting.\n"));
return -1;
return -ENOMEM;
}
ext_vv->ops = saa7146_video_ioctl_ops;
ext_vv->core_ops = &saa7146_video_ioctl_ops;
Expand Down Expand Up @@ -496,6 +502,7 @@ int saa7146_vv_release(struct saa7146_dev* dev)

DEB_EE(("dev:%p\n",dev));

v4l2_device_unregister(&dev->v4l2_dev);
pci_free_consistent(dev->pci, SAA7146_CLIPPING_MEM, vv->d_clipping.cpu_addr, vv->d_clipping.dma_handle);
kfree(vv);
dev->vv_data = NULL;
Expand Down

0 comments on commit bbc27ce

Please sign in to comment.