diff options
author | Jon Burgess <jburgess777@googlemail.com> | 2007-05-03 11:23:44 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-05-09 09:12:42 -0400 |
commit | 87c3019d7b1acb7704a257d78c482112e9b0c227 (patch) | |
tree | 312478a0bed426b3ca89bf4fae1880fed9986bd2 /drivers/media/dvb/ttpci/av7110.c | |
parent | 32a1db42480dc972e8e92be68d9e604f6aff5381 (diff) |
V4L/DVB (5592): DMA: Correctly free resources on error, sync PCI streamed data
I added saa7146_vmalloc_destroy_pgtable() which frees the resources
allocated by saa7146_vmalloc_build_pgtable() and updated the callers in
budget-core.c and av7110.c. I have also been through the updated
functions and updated the error paths to ensure they free all allocated
resources on error.
I also realised that there are other callers to saa7146_pgtable_free()
which did not have any sg DMA mapped so it seems wrong to add the
pci_unmap_sg() into that function. Instead I created
saa7146_vmalloc_destroy_pgtable() to do this.
Also included in this patch are the previous fixes for pci_unmap_sg()
and syncing the PCI streamed data to work with a SWIOTLB and match the
requirements documented in DMA-API.txt.
Signed-off-by: Jon Burgess <jburgess777@googlemail.com>
Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/ttpci/av7110.c')
-rw-r--r-- | drivers/media/dvb/ttpci/av7110.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index 67becdd4db60..ef1108c0bf11 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c | |||
@@ -1246,6 +1246,9 @@ static void vpeirq(unsigned long data) | |||
1246 | if (!budget->feeding1 || (newdma == olddma)) | 1246 | if (!budget->feeding1 || (newdma == olddma)) |
1247 | return; | 1247 | return; |
1248 | 1248 | ||
1249 | /* Ensure streamed PCI data is synced to CPU */ | ||
1250 | pci_dma_sync_sg_for_cpu(budget->dev->pci, budget->pt.slist, budget->pt.nents, PCI_DMA_FROMDEVICE); | ||
1251 | |||
1249 | #if 0 | 1252 | #if 0 |
1250 | /* track rps1 activity */ | 1253 | /* track rps1 activity */ |
1251 | printk("vpeirq: %02x Event Counter 1 0x%04x\n", | 1254 | printk("vpeirq: %02x Event Counter 1 0x%04x\n", |
@@ -2679,8 +2682,8 @@ err_iobuf_vfree_6: | |||
2679 | err_pci_free_5: | 2682 | err_pci_free_5: |
2680 | pci_free_consistent(pdev, 8192, av7110->debi_virt, av7110->debi_bus); | 2683 | pci_free_consistent(pdev, 8192, av7110->debi_virt, av7110->debi_bus); |
2681 | err_saa71466_vfree_4: | 2684 | err_saa71466_vfree_4: |
2682 | if (!av7110->grabbing) | 2685 | if (av7110->grabbing) |
2683 | saa7146_pgtable_free(pdev, &av7110->pt); | 2686 | saa7146_vfree_destroy_pgtable(pdev, av7110->grabbing, &av7110->pt); |
2684 | err_i2c_del_3: | 2687 | err_i2c_del_3: |
2685 | i2c_del_adapter(&av7110->i2c_adap); | 2688 | i2c_del_adapter(&av7110->i2c_adap); |
2686 | err_dvb_unregister_adapter_2: | 2689 | err_dvb_unregister_adapter_2: |
@@ -2710,7 +2713,7 @@ static int __devexit av7110_detach(struct saa7146_dev* saa) | |||
2710 | SAA7146_ISR_CLEAR(saa, MASK_10); | 2713 | SAA7146_ISR_CLEAR(saa, MASK_10); |
2711 | msleep(50); | 2714 | msleep(50); |
2712 | tasklet_kill(&av7110->vpe_tasklet); | 2715 | tasklet_kill(&av7110->vpe_tasklet); |
2713 | saa7146_pgtable_free(saa->pci, &av7110->pt); | 2716 | saa7146_vfree_destroy_pgtable(saa->pci, av7110->grabbing, &av7110->pt); |
2714 | } | 2717 | } |
2715 | av7110_exit_v4l(av7110); | 2718 | av7110_exit_v4l(av7110); |
2716 | 2719 | ||