Re: [RFT][PATCH] generic device DMA implementation

Russell King (rmk@arm.linux.org.uk)
Sat, 28 Dec 2002 18:14:38 +0000


I've just been working through the ARM dma stuff, converting it to the
new API, and I foudn this:

> +static inline int
> +pci_dma_supported(struct pci_dev *hwdev, u64 mask)
> +{
> + return dma_supported(&hwdev->dev, mask);
> +}
> (etc)

I'll now pull out a bit from DMA-mapping.txt:

| Using Consistent DMA mappings.
|
| To allocate and map large (PAGE_SIZE or so) consistent DMA regions,
| you should do:
|
| dma_addr_t dma_handle;
|
| cpu_addr = pci_alloc_consistent(dev, size, &dma_handle);
|
| where dev 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.

What happens to &hwdev->dev when you do as detailed there and pass NULL
into these "compatibility" functions? Probably an oops.

I think these "compatibility" functions need to do:

static inline xxx
pci_xxx(struct pci_dev *hwdev, ...)
{
dma_xxxx(hwdev ? &hwdev->dev : NULL, ...)
}

so they remain correct to existing API users expectations.

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/