Re: [PATCH v2 2/2] drivers: remove force dma flag from buses
From: Greg KH
Date: Wed Mar 21 2018 - 05:35:38 EST
On Wed, Mar 21, 2018 at 12:25:23PM +0530, Nipun Gupta wrote:
> With each bus implementing its own DMA configuration callback,
> there is no need for bus to explicitly have force_dma in its
> global structure. This patch modifies of_dma_configure API to
> accept an input parameter which specifies if implicit DMA
> configuration is required even when it is not described by the
> firmware.
Having to "remember" what that bool variable means on the end of the
function call is a royal pain over time, right?
Why not just create a new function:
dma_common_configure_force(dma)
that always does this? Leave "dma_common_configure()" alone, and then
wrap the old code with these two helper functions that call the 'core'
code with the bool set properly?
That way you do not have to "know" what that parameter is, the function
name just documents it automatically, so when you see it in the
bus-specific code, no need to go and have to hunt for anything. And if
you are reading the dma core code, it's obvious what is happening as the
functions are all right there.
thanks,
greg k-h