diff options
Diffstat (limited to 'drivers/dma/sh/shdma.c')
-rw-r--r-- | drivers/dma/sh/shdma.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/dma/sh/shdma.c b/drivers/dma/sh/shdma.c index f06906f281ac..9f0a2e507ac3 100644 --- a/drivers/dma/sh/shdma.c +++ b/drivers/dma/sh/shdma.c | |||
@@ -291,10 +291,8 @@ static void sh_dmae_setup_xfer(struct shdma_chan *schan, | |||
291 | shdma_chan); | 291 | shdma_chan); |
292 | 292 | ||
293 | if (sslave) { | 293 | if (sslave) { |
294 | struct sh_dmae_slave *slave = container_of(sslave, | ||
295 | struct sh_dmae_slave, shdma_slave); | ||
296 | const struct sh_dmae_slave_config *cfg = | 294 | const struct sh_dmae_slave_config *cfg = |
297 | slave->config; | 295 | sh_chan->config; |
298 | 296 | ||
299 | dmae_set_dmars(sh_chan, cfg->mid_rid); | 297 | dmae_set_dmars(sh_chan, cfg->mid_rid); |
300 | dmae_set_chcr(sh_chan, cfg->chcr); | 298 | dmae_set_chcr(sh_chan, cfg->chcr); |
@@ -326,13 +324,11 @@ static int sh_dmae_set_slave(struct shdma_chan *schan, | |||
326 | { | 324 | { |
327 | struct sh_dmae_chan *sh_chan = container_of(schan, struct sh_dmae_chan, | 325 | struct sh_dmae_chan *sh_chan = container_of(schan, struct sh_dmae_chan, |
328 | shdma_chan); | 326 | shdma_chan); |
329 | struct sh_dmae_slave *slave = container_of(sslave, struct sh_dmae_slave, | ||
330 | shdma_slave); | ||
331 | const struct sh_dmae_slave_config *cfg = dmae_find_slave(sh_chan, sslave->slave_id); | 327 | const struct sh_dmae_slave_config *cfg = dmae_find_slave(sh_chan, sslave->slave_id); |
332 | if (!cfg) | 328 | if (!cfg) |
333 | return -ENODEV; | 329 | return -ENODEV; |
334 | 330 | ||
335 | slave->config = cfg; | 331 | sh_chan->config = cfg; |
336 | 332 | ||
337 | return 0; | 333 | return 0; |
338 | } | 334 | } |
@@ -579,13 +575,12 @@ static int sh_dmae_resume(struct device *dev) | |||
579 | 575 | ||
580 | for (i = 0; i < shdev->pdata->channel_num; i++) { | 576 | for (i = 0; i < shdev->pdata->channel_num; i++) { |
581 | struct sh_dmae_chan *sh_chan = shdev->chan[i]; | 577 | struct sh_dmae_chan *sh_chan = shdev->chan[i]; |
582 | struct sh_dmae_slave *param = sh_chan->shdma_chan.dma_chan.private; | ||
583 | 578 | ||
584 | if (!sh_chan->shdma_chan.desc_num) | 579 | if (!sh_chan->shdma_chan.desc_num) |
585 | continue; | 580 | continue; |
586 | 581 | ||
587 | if (param) { | 582 | if (sh_chan->shdma_chan.slave) { |
588 | const struct sh_dmae_slave_config *cfg = param->config; | 583 | const struct sh_dmae_slave_config *cfg = sh_chan->config; |
589 | dmae_set_dmars(sh_chan, cfg->mid_rid); | 584 | dmae_set_dmars(sh_chan, cfg->mid_rid); |
590 | dmae_set_chcr(sh_chan, cfg->chcr); | 585 | dmae_set_chcr(sh_chan, cfg->chcr); |
591 | } else { | 586 | } else { |
@@ -609,14 +604,15 @@ const struct dev_pm_ops sh_dmae_pm = { | |||
609 | 604 | ||
610 | static dma_addr_t sh_dmae_slave_addr(struct shdma_chan *schan) | 605 | static dma_addr_t sh_dmae_slave_addr(struct shdma_chan *schan) |
611 | { | 606 | { |
612 | struct sh_dmae_slave *param = schan->dma_chan.private; | 607 | struct sh_dmae_chan *sh_chan = container_of(schan, |
608 | struct sh_dmae_chan, shdma_chan); | ||
613 | 609 | ||
614 | /* | 610 | /* |
615 | * Implicit BUG_ON(!param) | 611 | * Implicit BUG_ON(!sh_chan->config) |
616 | * if (param != NULL), this is a successfully requested slave channel, | 612 | * This is an exclusive slave DMA operation, may only be called after a |
617 | * therefore param->config != NULL too. | 613 | * successful slave configuration. |
618 | */ | 614 | */ |
619 | return param->config->addr; | 615 | return sh_chan->config->addr; |
620 | } | 616 | } |
621 | 617 | ||
622 | static struct shdma_desc *sh_dmae_embedded_desc(void *buf, int i) | 618 | static struct shdma_desc *sh_dmae_embedded_desc(void *buf, int i) |