Re: [RFC] SPI core -- revisited

Vitaly Wool
2005-06-27T09:13:19Z

Arjan van de Ven wrote:

>>Nothing's gonna work in DMA case if he kills the wrappers.
>>
>>
>
>how is that??
>
>
These functions are not exactly *wrappers*, there's some little
additional logic inside.
spi-pnx0105_atmel.c uses spi_pnx_msg_buff_t structure to embed physical
and virtual address and length of the memory area allocated by
consistent_alloc, so if we just get rid of the alloc/free functions,
we'll copy wrong data from the userspace and nothing'll work.

Let's look at it from another point. When a read request comes from the
userspace to spi-dev, spi-dev should allocate memory and copy the user
data in there. The problem is it is not (and shouldn't be) aware whether
the transfer is gonna be DMA or not so spi-dev can't choose
theappropriate method of memory allocation. Therefore it's reasonable to
let algorithm provide routines to do that.