Re: [PATCH] Re: More than 2Gb problem (dvb related) ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



e9hack wrote:
> Oliver Endriss wrote:
> > Jon Burgess wrote:
> >> It appears the problem is that the driver is using streamed PCI and
> >> needs to explicitly sync the data otherwise it breaks when the SWIOTLB
> >> is in use. A call to pci_unmap_sg() was missing too.
> >>
> >> This patch is against the current v4l-dvb HG tree.
> >>
> >> I've only tested the change with a budget-ci card.
> > 
> > Has anyone a problem with this patch?
> > If not I'll apply it tomorrow...
> 
> If saa7146_pgtable_build_single() returns an error in saa7146_vmalloc_build_pgtable(), pci_free_consistent() should be
> also called.

Correct, and pci_unmap_sg(), kfree() and vfree() must also be called.

What about re-writing saa7146_vmalloc_build_pgtable():

char *saa7146_vmalloc_build_pgtable(struct pci_dev *pci, long length, struct saa7146_pgtable *pt)
{
        int pages = (length+PAGE_SIZE-1)/PAGE_SIZE;
        char *mem = vmalloc_32(length);
        int slen = 0;

        if (NULL == mem)
                return NULL;

        if (!(pt->slist = vmalloc_to_sg(mem, pages)))
                goto err_1;

        if (saa7146_pgtable_alloc(pci, pt))
                goto err_2;

        slen = pci_map_sg(pci, pt->slist, pages, PCI_DMA_FROMDEVICE);
        if (0 != saa7146_pgtable_build_single(pci, pt, pt->slist, slen))
                goto err_3;

        pt->nents = pages;
        return mem;

err_3:
        pci_free_consistent(pci, pt->size, pt->cpu, pt->dma);
        pci_unmap_sg(pci, pt->slist, pages, PCI_DMA_FROMDEVICE);
        pt->cpu = NULL;
err_2:
        kfree(pt->slist);
        pt->slist = NULL;
err_1:
        vfree(mem);
        return NULL;
}

Ok?

CU

Oliver

-- 
--------------------------------------------------------
VDR Remote Plugin 0.3.9 available at
http://www.escape-edv.de/endriss/vdr/
--------------------------------------------------------


_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux