Re: [PATCH 42/44] powerpc/cell: use the dma_supported method for ops switching

From
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date
2017-06-18 09:55:57
Also in
dri-devel, linux-arm-kernel, linux-iommu, linux-mips, linux-s390, linux-samsung-soc, linux-sh, linux-tegra, linuxppc-dev, lkml, sparclinux
Reply to
Christoph Hellwig, 2017-06-18
On Sun, 2017-06-18 at 00:13 -0700, Christoph Hellwig wrote:
On Sun, Jun 18, 2017 at 06:50:27AM +1000, Benjamin Herrenschmidt wrote:
quoted
What is your rationale here ? (I have missed patch 0 it seems).
Less code duplication, more modular dma_map_ops insteance.
quoted
dma_supported() was supposed to be pretty much a "const" function
simply informing whether a given setup is possible. Having it perform
an actual switch of ops seems to be pushing it...
dma_supported() is already gone from the public DMA API as it doesn't
make sense to be called separately from set_dma_mask.  It will be
entirely gone in the next series after this one.
Ah ok, in that case it makes much more sense, we can rename it then.
quoted
What if a driver wants to test various dma masks and then pick one ?

Where does the API documents that if a driver calls dma_supported() it
then *must* set the corresponding mask and use that ?
Where is the API document for _any_ of the dma routines? (A: work in
progress by me, but I need to clean up the mess of arch hooks before
it can make any sense)
Heh fair enough.
quoted
I don't like a function that is a "boolean query" like this one to have
such a major side effect.
quoted
From an API standpoint, dma_set_mask() is when the mask is established,
and thus when the ops switch should happen.
And that's exactly what happens at the driver API level.  It just turns
out the dma_capable method is they way better place to actually
implement it, as the ->set_dma_mask method requires lots of code
duplication while not offering any actual benefit over ->dma_capable.
And because of that it's gone after this series.

In theory we could rename ->dma_capable now, but it would require a
_lot_ of churn.  Give me another merge window or two and we should
be down to be about 2 handful of dma_map_ops instance, at which point
we could do all this gratious renaming a lot more easily :)
Sure, I get it now, as long as it's not publicly exposed to drivers
we are fine.

Cheers,
Ben.

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thread (64 messages) 64 messages, 8 authors, last reply 2017-06-26
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help