aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-06-16 01:08:09 -0400
committerPaul Mundt <lethal@linux-sh.org>2011-06-16 02:03:36 -0400
commitc4e0dd7835d12d9765a372b586a5020ac29cc706 (patch)
treeaf369cefba6bdef916b44d4ef6f040495d8d1213 /drivers/dma
parent19a1166fa2352f9c07a5ab34a3c2aab462cff35d (diff)
dmaengine: shdma: add to_sh_dev define
This patch adds "to_sh_dev" macro, and clean up codes. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/shdma.c13
-rw-r--r--drivers/dma/shdma.h2
2 files changed, 6 insertions, 9 deletions
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index 2a638f9f09a2..d2fb16d31bb9 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -130,8 +130,7 @@ static bool dmae_is_busy(struct sh_dmae_chan *sh_chan)
130 130
131static unsigned int calc_xmit_shift(struct sh_dmae_chan *sh_chan, u32 chcr) 131static unsigned int calc_xmit_shift(struct sh_dmae_chan *sh_chan, u32 chcr)
132{ 132{
133 struct sh_dmae_device *shdev = container_of(sh_chan->common.device, 133 struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
134 struct sh_dmae_device, common);
135 struct sh_dmae_pdata *pdata = shdev->pdata; 134 struct sh_dmae_pdata *pdata = shdev->pdata;
136 int cnt = ((chcr & pdata->ts_low_mask) >> pdata->ts_low_shift) | 135 int cnt = ((chcr & pdata->ts_low_mask) >> pdata->ts_low_shift) |
137 ((chcr & pdata->ts_high_mask) >> pdata->ts_high_shift); 136 ((chcr & pdata->ts_high_mask) >> pdata->ts_high_shift);
@@ -144,8 +143,7 @@ static unsigned int calc_xmit_shift(struct sh_dmae_chan *sh_chan, u32 chcr)
144 143
145static u32 log2size_to_chcr(struct sh_dmae_chan *sh_chan, int l2size) 144static u32 log2size_to_chcr(struct sh_dmae_chan *sh_chan, int l2size)
146{ 145{
147 struct sh_dmae_device *shdev = container_of(sh_chan->common.device, 146 struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
148 struct sh_dmae_device, common);
149 struct sh_dmae_pdata *pdata = shdev->pdata; 147 struct sh_dmae_pdata *pdata = shdev->pdata;
150 int i; 148 int i;
151 149
@@ -209,8 +207,7 @@ static int dmae_set_chcr(struct sh_dmae_chan *sh_chan, u32 val)
209 207
210static int dmae_set_dmars(struct sh_dmae_chan *sh_chan, u16 val) 208static int dmae_set_dmars(struct sh_dmae_chan *sh_chan, u16 val)
211{ 209{
212 struct sh_dmae_device *shdev = container_of(sh_chan->common.device, 210 struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
213 struct sh_dmae_device, common);
214 struct sh_dmae_pdata *pdata = shdev->pdata; 211 struct sh_dmae_pdata *pdata = shdev->pdata;
215 const struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->id]; 212 const struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->id];
216 u16 __iomem *addr = shdev->dmars; 213 u16 __iomem *addr = shdev->dmars;
@@ -296,9 +293,7 @@ static struct sh_desc *sh_dmae_get_desc(struct sh_dmae_chan *sh_chan)
296static const struct sh_dmae_slave_config *sh_dmae_find_slave( 293static const struct sh_dmae_slave_config *sh_dmae_find_slave(
297 struct sh_dmae_chan *sh_chan, struct sh_dmae_slave *param) 294 struct sh_dmae_chan *sh_chan, struct sh_dmae_slave *param)
298{ 295{
299 struct dma_device *dma_dev = sh_chan->common.device; 296 struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
300 struct sh_dmae_device *shdev = container_of(dma_dev,
301 struct sh_dmae_device, common);
302 struct sh_dmae_pdata *pdata = shdev->pdata; 297 struct sh_dmae_pdata *pdata = shdev->pdata;
303 int i; 298 int i;
304 299
diff --git a/drivers/dma/shdma.h b/drivers/dma/shdma.h
index 5ae9fc512180..6c73b654a5c3 100644
--- a/drivers/dma/shdma.h
+++ b/drivers/dma/shdma.h
@@ -52,5 +52,7 @@ struct sh_dmae_device {
52#define to_sh_chan(chan) container_of(chan, struct sh_dmae_chan, common) 52#define to_sh_chan(chan) container_of(chan, struct sh_dmae_chan, common)
53#define to_sh_desc(lh) container_of(lh, struct sh_desc, node) 53#define to_sh_desc(lh) container_of(lh, struct sh_desc, node)
54#define tx_to_sh_desc(tx) container_of(tx, struct sh_desc, async_tx) 54#define tx_to_sh_desc(tx) container_of(tx, struct sh_desc, async_tx)
55#define to_sh_dev(chan) container_of(chan->common.device,\
56 struct sh_dmae_device, common)
55 57
56#endif /* __DMA_SHDMA_H */ 58#endif /* __DMA_SHDMA_H */