RFC: DMA API: use client data in dma_callback function instead of dma dev #8928
Labels
area: API
Changes to public APIs
area: DMA
Direct Memory Access
Enhancement
Changes/Updates/Additions to existing features
In DMA API's data structure (within include/dma.h):
The first argument of the callback function
dma_callback
is set as the pointer to the DMA driver device in all current DMA drivers. However, the owner of the callback function implementation usually is another device driver, like UART, SPI, etc, which has no idea how the parameterdev
can be useful to it given that those devices don't know much about the DMA device only fromstruct device *dev
. However, when the callee's callback function is called, it could need to access its context parameter to retrieve its private data which is actually absent in the callback arguments.To address this request, suggest to change the callback API to the following:
Here, a new member
void * client_data
is introduced to thestruct dma_config
and will be assigned by the DMA client, and passed to the callback functiondma_callback
as the first argument which replaces the current argumentstruct device *dev
. In this way, the DMA client can access its private data when its callback function is called by the DMA driver.The text was updated successfully, but these errors were encountered: