Commit 3e2ec13a authored by Thomas Abraham's avatar Thomas Abraham Committed by Kukjin Kim

DMA: PL330: move filter function into driver

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: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: default avatarThomas Abraham <thomas.abraham@linaro.org>
Acked-by: default avatarJassi Brar <jassisinghbrar@gmail.com>
Acked-by: default avatarGrant Likely <grant.likely@secretlab.ca>
Acked-by: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarKukjin Kim <kgene.kim@samsung.com>
parent a169a888
...@@ -18,12 +18,6 @@ ...@@ -18,12 +18,6 @@
#include <mach/dma.h> #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, static unsigned samsung_dmadev_request(enum dma_ch dma_ch,
struct samsung_dma_info *info) struct samsung_dma_info *info)
{ {
......
...@@ -116,6 +116,9 @@ struct dma_pl330_desc { ...@@ -116,6 +116,9 @@ struct dma_pl330_desc {
struct dma_pl330_chan *pchan; struct dma_pl330_chan *pchan;
}; };
/* forward declaration */
static struct amba_driver pl330_driver;
static inline struct dma_pl330_chan * static inline struct dma_pl330_chan *
to_pchan(struct dma_chan *ch) to_pchan(struct dma_chan *ch)
{ {
...@@ -267,6 +270,18 @@ static void dma_pl330_rqcb(void *token, enum pl330_op_err err) ...@@ -267,6 +270,18 @@ static void dma_pl330_rqcb(void *token, enum pl330_op_err err)
tasklet_schedule(&pch->task); 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) static int pl330_alloc_chan_resources(struct dma_chan *chan)
{ {
struct dma_pl330_chan *pch = to_pchan(chan); struct dma_pl330_chan *pch = to_pchan(chan);
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#ifndef __AMBA_PL330_H_ #ifndef __AMBA_PL330_H_
#define __AMBA_PL330_H_ #define __AMBA_PL330_H_
#include <linux/dmaengine.h>
#include <asm/hardware/pl330.h> #include <asm/hardware/pl330.h>
struct dma_pl330_peri { struct dma_pl330_peri {
...@@ -38,4 +39,5 @@ struct dma_pl330_platdata { ...@@ -38,4 +39,5 @@ struct dma_pl330_platdata {
unsigned mcbuf_sz; unsigned mcbuf_sz;
}; };
extern bool pl330_filter(struct dma_chan *chan, void *param);
#endif /* __AMBA_PL330_H_ */ #endif /* __AMBA_PL330_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment