aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/kpc2000/kpc_dma/dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/kpc2000/kpc_dma/dma.c')
-rw-r--r--drivers/staging/kpc2000/kpc_dma/dma.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/staging/kpc2000/kpc_dma/dma.c b/drivers/staging/kpc2000/kpc_dma/dma.c
index 2053316009bc..ac842fa38c64 100644
--- a/drivers/staging/kpc2000/kpc_dma/dma.c
+++ b/drivers/staging/kpc2000/kpc_dma/dma.c
@@ -27,6 +27,7 @@ void ndd_irq_worker(struct work_struct *ws)
{
struct kpc_dma_descriptor *cur;
struct kpc_dma_device *eng = container_of(ws, struct kpc_dma_device, irq_work);
+
lock_engine(eng);
if (GetEngineCompletePtr(eng) == 0)
@@ -67,7 +68,6 @@ void ndd_irq_worker(struct work_struct *ws)
unlock_engine(eng);
}
-
/********** DMA Engine Init/Teardown **********/
void start_dma_engine(struct kpc_dma_device *eng)
{
@@ -91,6 +91,7 @@ int setup_dma_engine(struct kpc_dma_device *eng, u32 desc_cnt)
dma_addr_t head_handle;
unsigned int i;
int rv;
+
dev_dbg(&eng->pldev->dev, "Setting up DMA engine [%p]\n", eng);
caps = GetEngineCapabilities(eng);
@@ -159,6 +160,7 @@ int setup_dma_engine(struct kpc_dma_device *eng, u32 desc_cnt)
void stop_dma_engine(struct kpc_dma_device *eng)
{
unsigned long timeout;
+
dev_dbg(&eng->pldev->dev, "Destroying DMA engine [%p]\n", eng);
// Disable the descriptor engine
@@ -220,6 +222,7 @@ void destroy_dma_engine(struct kpc_dma_device *eng)
for (i = 0 ; i < eng->desc_pool_cnt ; i++) {
struct kpc_dma_descriptor *next = cur->Next;
dma_addr_t next_handle = cur->DescNextDescPtr;
+
dma_pool_free(eng->desc_pool, cur, cur_handle);
cur_handle = next_handle;
cur = next;
@@ -230,13 +233,12 @@ void destroy_dma_engine(struct kpc_dma_device *eng)
free_irq(eng->irq, eng);
}
-
-
/********** Helper Functions **********/
int count_descriptors_available(struct kpc_dma_device *eng)
{
u32 count = 0;
struct kpc_dma_descriptor *cur = eng->desc_next;
+
while (cur != eng->desc_completed) {
BUG_ON(cur == NULL);
count++;