aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/shdma.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2010-04-21 11:36:49 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-04-26 02:50:50 -0400
commit5bac942db3d2c4738df04104240d65a5d1eaec6a (patch)
tree253c75407764fc5cb3483283941b14a99fad389a /drivers/dma/shdma.c
parent6b6b18e62cfba44ce7b6489c7100f12b199232d7 (diff)
SH: constify multiple DMA related objects and references to them
Lists of DMA channels and slaves are not changed, make them constant. Besides, SH7724 channel and slave configuration of both DMA controllers is identical, remove the extra copy of the configuration data. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/dma/shdma.c')
-rw-r--r--drivers/dma/shdma.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index 7a18b580f626..aab352a63a4a 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -188,7 +188,7 @@ static int dmae_set_dmars(struct sh_dmae_chan *sh_chan, u16 val)
188 struct sh_dmae_device *shdev = container_of(sh_chan->common.device, 188 struct sh_dmae_device *shdev = container_of(sh_chan->common.device,
189 struct sh_dmae_device, common); 189 struct sh_dmae_device, common);
190 struct sh_dmae_pdata *pdata = shdev->pdata; 190 struct sh_dmae_pdata *pdata = shdev->pdata;
191 struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->id]; 191 const struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->id];
192 u16 __iomem *addr = shdev->dmars + chan_pdata->dmars / sizeof(u16); 192 u16 __iomem *addr = shdev->dmars + chan_pdata->dmars / sizeof(u16);
193 int shift = chan_pdata->dmars_bit; 193 int shift = chan_pdata->dmars_bit;
194 194
@@ -264,7 +264,7 @@ static struct sh_desc *sh_dmae_get_desc(struct sh_dmae_chan *sh_chan)
264 return NULL; 264 return NULL;
265} 265}
266 266
267static struct sh_dmae_slave_config *sh_dmae_find_slave( 267static const struct sh_dmae_slave_config *sh_dmae_find_slave(
268 struct sh_dmae_chan *sh_chan, struct sh_dmae_slave *param) 268 struct sh_dmae_chan *sh_chan, struct sh_dmae_slave *param)
269{ 269{
270 struct dma_device *dma_dev = sh_chan->common.device; 270 struct dma_device *dma_dev = sh_chan->common.device;
@@ -296,7 +296,7 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
296 * never runs concurrently with itself or free_chan_resources. 296 * never runs concurrently with itself or free_chan_resources.
297 */ 297 */
298 if (param) { 298 if (param) {
299 struct sh_dmae_slave_config *cfg; 299 const struct sh_dmae_slave_config *cfg;
300 300
301 cfg = sh_dmae_find_slave(sh_chan, param); 301 cfg = sh_dmae_find_slave(sh_chan, param);
302 if (!cfg) 302 if (!cfg)
@@ -557,12 +557,14 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
557{ 557{
558 struct sh_dmae_slave *param; 558 struct sh_dmae_slave *param;
559 struct sh_dmae_chan *sh_chan; 559 struct sh_dmae_chan *sh_chan;
560 dma_addr_t slave_addr;
560 561
561 if (!chan) 562 if (!chan)
562 return NULL; 563 return NULL;
563 564
564 sh_chan = to_sh_chan(chan); 565 sh_chan = to_sh_chan(chan);
565 param = chan->private; 566 param = chan->private;
567 slave_addr = param->config->addr;
566 568
567 /* Someone calling slave DMA on a public channel? */ 569 /* Someone calling slave DMA on a public channel? */
568 if (!param || !sg_len) { 570 if (!param || !sg_len) {
@@ -575,7 +577,7 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
575 * if (param != NULL), this is a successfully requested slave channel, 577 * if (param != NULL), this is a successfully requested slave channel,
576 * therefore param->config != NULL too. 578 * therefore param->config != NULL too.
577 */ 579 */
578 return sh_dmae_prep_sg(sh_chan, sgl, sg_len, &param->config->addr, 580 return sh_dmae_prep_sg(sh_chan, sgl, sg_len, &slave_addr,
579 direction, flags); 581 direction, flags);
580} 582}
581 583
@@ -856,7 +858,7 @@ static int __devinit sh_dmae_chan_probe(struct sh_dmae_device *shdev, int id,
856 int irq, unsigned long flags) 858 int irq, unsigned long flags)
857{ 859{
858 int err; 860 int err;
859 struct sh_dmae_channel *chan_pdata = &shdev->pdata->channel[id]; 861 const struct sh_dmae_channel *chan_pdata = &shdev->pdata->channel[id];
860 struct platform_device *pdev = to_platform_device(shdev->common.dev); 862 struct platform_device *pdev = to_platform_device(shdev->common.dev);
861 struct sh_dmae_chan *new_sh_chan; 863 struct sh_dmae_chan *new_sh_chan;
862 864