DMA: Move dma_pool_destroy to free channel
authorShreyas Neerebailoor <shreyasx.neerebailoor@intel.com>
Fri, 20 Apr 2012 10:22:43 +0000 (15:52 +0530)
committerbuildbot <buildbot@intel.com>
Thu, 26 Apr 2012 06:21:57 +0000 (23:21 -0700)
BZ: 31979

The DMA pool for LLI is destroyed in atomic context.
This function might sleep and it should not be called in atomic
context.

Moved the destroying of the DMA pool to free channel resource
function.

Change-Id: I7624a69de3d8a3815fb0b3733cf441a246aea045
Signed-off-by: Shreyas Neerebailoor <shreyasx.neerebailoor@intel.com>
Reviewed-on: http://android.intel.com:8080/44152
Reviewed-by: Abdullah, Omair M <omair.m.abdullah@intel.com>
Reviewed-by: Bensaid, Selma <selma.bensaid@intel.com>
Reviewed-by: Babu, Ramesh <ramesh.babu@intel.com>
Reviewed-by: Koul, Vinod <vinod.koul@intel.com>
Reviewed-by: Gupta, ArvindX K <arvindx.k.gupta@intel.com>
Reviewed-by: M, Arulselvan <arulselvan.m@intel.com>
Tested-by: M, Arulselvan <arulselvan.m@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/dma/intel_mid_dma.c
drivers/dma/intel_mid_dma_regs.h

index f5ea7fa..73b1567 100644 (file)
@@ -339,7 +339,6 @@ static void midc_descriptor_complete(struct intel_mid_dma_chan *midc,
                if (desc->lli != NULL && desc->lli->llp != NULL) {
                        pci_pool_free(desc->lli_pool, desc->lli,
                                                desc->lli_phys);
-                       pci_pool_destroy(desc->lli_pool);
                }
                list_move(&desc->desc_node, &midc->free_list);
                midc->busy = false;
@@ -843,6 +842,7 @@ static struct dma_async_tx_descriptor *intel_mid_dma_chan_prep_desc(
                pr_err("MID_DMA:LLI pool create failed\n");
                return NULL;
        }
+       midc->lli_pool = desc->lli_pool;
 
        desc->lli = pci_pool_alloc(desc->lli_pool, GFP_KERNEL, &desc->lli_phys);
        if (!desc->lli) {
@@ -958,7 +958,14 @@ static void intel_mid_dma_free_chan_resources(struct dma_chan *chan)
                list_del(&desc->desc_node);
                pci_pool_free(mid->dma_pool, desc, desc->txd.phys);
        }
+
        spin_unlock_bh(&midc->lock);
+
+       if (midc->lli_pool) {
+               pci_pool_destroy(midc->lli_pool);
+               midc->lli_pool = NULL;
+       }
+
        midc->in_use = false;
        midc->busy = false;
        /* Disable CH interrupts */
index 02db4bd..12e9057 100644 (file)
@@ -194,6 +194,7 @@ struct intel_mid_dma_chan {
        u32                     raw_tfr;
        u32                     raw_block;
        struct intel_mid_dma_slave *mid_slave;
+       struct dma_pool         *lli_pool;
 };
 
 static inline struct intel_mid_dma_chan *to_intel_mid_dma_chan(