]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
DMA: PL330: move filter function into driver
authorThomas Abraham <thomas.abraham@linaro.org>
Mon, 24 Oct 2011 09:43:02 +0000 (11:43 +0200)
committerKukjin Kim <kgene.kim@samsung.com>
Thu, 3 Nov 2011 02:08:50 +0000 (11:08 +0900)
The dma channel selection filter function is moved from plat-samsung
into the pl330 driver. In additon to that, a check is added in the
filter function to ensure that the channel on which the filter has
been invoked is pl330 channel instance (and avoid any incorrect
access of chan->private in a system with multiple types of DMA
drivers).

Suggested-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
arch/arm/plat-samsung/dma-ops.c
drivers/dma/pl330.c
include/linux/amba/pl330.h

index 6e3d9abc9e2e856470e304c78f31794a4f715833..8d18425dfe910699b0e0ff620a3921a89f365e2e 100644 (file)
 
 #include <mach/dma.h>
 
-static inline bool pl330_filter(struct dma_chan *chan, void *param)
-{
-       struct dma_pl330_peri *peri = chan->private;
-       return peri->peri_id == (unsigned)param;
-}
-
 static unsigned samsung_dmadev_request(enum dma_ch dma_ch,
                                struct samsung_dma_info *info)
 {
index 621134fdba4cadd031ccbebd8a52ed34c571ff8f..5f1d24c21177bd2cbac85a7ccd038c4ecdf88edc 100644 (file)
@@ -116,6 +116,9 @@ struct dma_pl330_desc {
        struct dma_pl330_chan *pchan;
 };
 
+/* forward declaration */
+static struct amba_driver pl330_driver;
+
 static inline struct dma_pl330_chan *
 to_pchan(struct dma_chan *ch)
 {
@@ -267,6 +270,18 @@ static void dma_pl330_rqcb(void *token, enum pl330_op_err err)
        tasklet_schedule(&pch->task);
 }
 
+bool pl330_filter(struct dma_chan *chan, void *param)
+{
+       struct dma_pl330_peri *peri;
+
+       if (chan->device->dev->driver != &pl330_driver.drv)
+               return false;
+
+       peri = chan->private;
+       return peri->peri_id == (unsigned)param;
+}
+EXPORT_SYMBOL(pl330_filter);
+
 static int pl330_alloc_chan_resources(struct dma_chan *chan)
 {
        struct dma_pl330_chan *pch = to_pchan(chan);
index d12f077a6dafb7eb505eb5142c13327558001800..6db72dae2f16adf227b3c93dd93a45da07b7f825 100644 (file)
@@ -12,6 +12,7 @@
 #ifndef        __AMBA_PL330_H_
 #define        __AMBA_PL330_H_
 
+#include <linux/dmaengine.h>
 #include <asm/hardware/pl330.h>
 
 struct dma_pl330_peri {
@@ -38,4 +39,5 @@ struct dma_pl330_platdata {
        unsigned mcbuf_sz;
 };
 
+extern bool pl330_filter(struct dma_chan *chan, void *param);
 #endif /* __AMBA_PL330_H_ */