aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/dmaengine.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 82489923af09..d59b2f417306 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -182,10 +182,9 @@ static void dma_client_chan_alloc(struct dma_client *client)
182 /* we are done once this client rejects 182 /* we are done once this client rejects
183 * an available resource 183 * an available resource
184 */ 184 */
185 if (ack == DMA_ACK) { 185 if (ack == DMA_ACK)
186 dma_chan_get(chan); 186 dma_chan_get(chan);
187 kref_get(&device->refcount); 187 else if (ack == DMA_NAK)
188 } else if (ack == DMA_NAK)
189 return; 188 return;
190 } 189 }
191 } 190 }
@@ -272,11 +271,8 @@ static void dma_clients_notify_removed(struct dma_chan *chan)
272 /* client was holding resources for this channel so 271 /* client was holding resources for this channel so
273 * free it 272 * free it
274 */ 273 */
275 if (ack == DMA_ACK) { 274 if (ack == DMA_ACK)
276 dma_chan_put(chan); 275 dma_chan_put(chan);
277 kref_put(&chan->device->refcount,
278 dma_async_device_cleanup);
279 }
280 } 276 }
281 277
282 mutex_unlock(&dma_list_mutex); 278 mutex_unlock(&dma_list_mutex);
@@ -316,11 +312,8 @@ void dma_async_client_unregister(struct dma_client *client)
316 ack = client->event_callback(client, chan, 312 ack = client->event_callback(client, chan,
317 DMA_RESOURCE_REMOVED); 313 DMA_RESOURCE_REMOVED);
318 314
319 if (ack == DMA_ACK) { 315 if (ack == DMA_ACK)
320 dma_chan_put(chan); 316 dma_chan_put(chan);
321 kref_put(&chan->device->refcount,
322 dma_async_device_cleanup);
323 }
324 } 317 }
325 318
326 list_del(&client->global_node); 319 list_del(&client->global_node);
@@ -397,6 +390,8 @@ int dma_async_device_register(struct dma_device *device)
397 goto err_out; 390 goto err_out;
398 } 391 }
399 392
393 /* One for the channel, one of the class device */
394 kref_get(&device->refcount);
400 kref_get(&device->refcount); 395 kref_get(&device->refcount);
401 kref_init(&chan->refcount); 396 kref_init(&chan->refcount);
402 chan->slow_ref = 0; 397 chan->slow_ref = 0;