Re: [patch v3] doc: DMA-mapping.txt has undeclared variables [Bug 10397]

From: Matthew Wilcox
Date: Mon Apr 28 2008 - 09:06:24 EST


On Mon, Apr 28, 2008 at 05:58:49AM -0700, Matti Linnanvuori wrote:
> From: Matti Linnanvuori <mattilinnanvuori@xxxxxxxxx>
>
> Consistently use pdev as the variable of type struct pci_dev *.
> Update DMA mapping documentation to use 'pdev' rather than 'dev' in
> example code that calls routines expecting 'struct pci_device *', since 'dev'
> might make readers think they're passing 'struct device *' parameters.
> Bug 10397.
>
> Signed-off-by: Matti Linnanvuori <mattilinnanvuori@xxxxxxxxx>

Acked-by: Matthew Wilcox <willy@xxxxxxxxxxxxxxx>

> - cpu_addr = pci_alloc_consistent(dev, size, &dma_handle);
> + cpu_addr = pci_alloc_consistent(pdev, size, &dma_handle);
>
> -where dev is a struct pci_dev *. You should pass NULL for PCI like buses
> +where pdev is a struct pci_dev *. You should pass NULL for PCI like buses
> where devices don't have struct pci_dev (like ISA, EISA). This may be
> called in interrupt context.

The second sentence is misleading (but it's unrelated to this patch).
If you don't have a pdev, you should be using dma_alloc_coherent()
instead (see DMA-API.txt). Want to make another patch? ;-)

--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/