diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-01-06 13:38:14 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-01-06 13:38:14 -0500 |
commit | 6f49a57aa5a0c6d4e4e27c85f7af6c83325a12d1 (patch) | |
tree | afba24357d1f4ff69ccb2b39a19542546590a50b /drivers/dma/dw_dmac.c | |
parent | 07f2211e4fbce6990722d78c4f04225da9c0e9cf (diff) |
dmaengine: up-level reference counting to the module level
Simply, if a client wants any dmaengine channel then prevent all dmaengine
modules from being removed. Once the clients are done re-enable module
removal.
Why?, beyond reducing complication:
1/ Tracking reference counts per-transaction in an efficient manner, as
is currently done, requires a complicated scheme to avoid cache-line
bouncing effects.
2/ Per-transaction ref-counting gives the false impression that a
dma-driver can be gracefully removed ahead of its user (net, md, or
dma-slave)
3/ None of the in-tree dma-drivers talk to hot pluggable hardware, but
if such an engine were built one day we still would not need to notify
clients of remove events. The driver can simply return NULL to a
->prep() request, something that is much easier for a client to handle.
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma/dw_dmac.c')
-rw-r--r-- | drivers/dma/dw_dmac.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index 0778d99aea7c..377dafa37a20 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c | |||
@@ -773,7 +773,7 @@ static int dwc_alloc_chan_resources(struct dma_chan *chan, | |||
773 | dev_vdbg(&chan->dev, "alloc_chan_resources\n"); | 773 | dev_vdbg(&chan->dev, "alloc_chan_resources\n"); |
774 | 774 | ||
775 | /* Channels doing slave DMA can only handle one client. */ | 775 | /* Channels doing slave DMA can only handle one client. */ |
776 | if (dwc->dws || client->slave) { | 776 | if (dwc->dws || (client && client->slave)) { |
777 | if (chan->client_count) | 777 | if (chan->client_count) |
778 | return -EBUSY; | 778 | return -EBUSY; |
779 | } | 779 | } |