[PATCH v2 2/2] drivers: remove force dma flag from buses
Nipun Gupta
nipun.gupta at nxp.com
Wed Mar 21 16:28:46 UTC 2018
> -----Original Message-----
> From: Greg KH [mailto:gregkh at linuxfoundation.org]
> Sent: Wednesday, March 21, 2018 15:05
> To: Nipun Gupta <nipun.gupta at nxp.com>
> Cc: robin.murphy at arm.com; hch at lst.de; linux at armlinux.org.uk;
> m.szyprowski at samsung.com; bhelgaas at google.com; zajec5 at gmail.com;
> andy.gross at linaro.org; david.brown at linaro.org; dan.j.williams at intel.com;
> vinod.koul at intel.com; thierry.reding at gmail.com; robh+dt at kernel.org;
> frowand.list at gmail.com; jarkko.sakkinen at linux.intel.com;
> rafael.j.wysocki at intel.com; dmitry.torokhov at gmail.com; johan at kernel.org;
> msuchanek at suse.de; linux-kernel at vger.kernel.org; iommu at lists.linux-
> foundation.org; linux-wireless at vger.kernel.org; linux-arm-
> msm at vger.kernel.org; linux-soc at vger.kernel.org; dmaengine at vger.kernel.org;
> dri-devel at lists.freedesktop.org; linux-tegra at vger.kernel.org;
> devicetree at vger.kernel.org; linux-pci at vger.kernel.org; Bharat Bhushan
> <bharat.bhushan at nxp.com>; Leo Li <leoyang.li at nxp.com>
> Subject: Re: [PATCH v2 2/2] drivers: remove force dma flag from buses
>
> 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.
How about we do not pass any flag in 'dma_common_configure()', and inside this
API we pass "true" to 'of_dma_configure()'? I am saying this because currently
both the busses (platform and AMBA) which uses 'dma_common_configure()' passes
"true" value. If we create additional 'dma_common_configure_force()', then
'dma_common_configure()' will not be used anytime and will become redundant.
If someday new busses come and they needs to use similar functionality which
'dma_common_configure()' provides, but with passing "false" to 'of_dma_configure()',
then what you suggests of having two separate such API's will be more reasonable
and can be implemented?
Thanks,
Nipun
>
> thanks,
>
> greg k-h
More information about the dri-devel
mailing list