Skip to contentSkip to conversation

dma_alloc_coherent

DISCUSSION Robert Hancock 2 participants 2 messages Apr 4, 2006 – Apr 5, 2006 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 7 lines · Kartik Babu

I'm trying to replace consistent_alloc in a driver that was written for
the 2.4 kernel with dma_alloc_coherent. My question is that I do not use a struct device * pointer at all. Browsing through the source for the 2.6.12 on ARM XScale PXA255, I see that this argument may be NULL.

Still, I'd like to know if passing NULL has any side effects. If so, what are they?

I do however have a cdev structure taht I use for device registration, but I do not see how that would help.

What kind of a device is it? If it's a PCI device, the struct device can be accessed with the dev pointer inside the struct pci_dev.

Signature · 3 lines
Robert Hancock      Saskatoon, SK, Canada
To email, remove "nospam" from [email protected]
Home Page: http://www.roberthancock.com/
#2 lore raw

Its a char device driver Im using to control the SPI port on the PXA255 processor. I transfer fixed sized packets over this bus, and hence DMA is a good option instead of interrupt driven IO.

it seems that the dma_pool_create function explicitly handles both cases dev = NULL and dev != NULL.

However, the dma_alloc_coherent function only checks if dev is not NULL, and apparently uses the valu in one case without checking it.

My understanding is that the dev pointer is needed only to check the mask for accesible DMA locations correct?

Kartik

Quoted 11 lines · Robert Hancock
Quoted 7 lines · Kartik Babu

I'm trying to replace consistent_alloc in a driver that was written
for the 2.4 kernel with dma_alloc_coherent. My question is that I do not use a struct device * pointer at all. Browsing through the source for the 2.6.12 on ARM XScale PXA255, I see that this argument may be NULL.

Still, I'd like to know if passing NULL has any side effects. If so, what are they?

I do however have a cdev structure taht I use for device registration, but I do not see how that would help.

What kind of a device is it? If it's a PCI device, the struct device can be accessed with the dev pointer inside the struct pci_dev.