mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
dma40: unify src/dst addr check
Acked-by: Per Forlin <per.forlin@stericsson.com> Acked-by: Jonas Aaberg <jonas.aberg@stericsson.com> Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
cc31b6f794
commit
822c567639
1 changed files with 16 additions and 13 deletions
|
@ -1635,11 +1635,9 @@ static u32 stedma40_residue(struct dma_chan *chan)
|
|||
static int
|
||||
d40_prep_sg_log(struct d40_chan *chan, struct d40_desc *desc,
|
||||
struct scatterlist *sg_src, struct scatterlist *sg_dst,
|
||||
unsigned int sg_len, enum dma_data_direction direction,
|
||||
dma_addr_t dev_addr)
|
||||
unsigned int sg_len, dma_addr_t src_dev_addr,
|
||||
dma_addr_t dst_dev_addr)
|
||||
{
|
||||
dma_addr_t src_dev_addr = direction == DMA_FROM_DEVICE ? dev_addr : 0;
|
||||
dma_addr_t dst_dev_addr = direction == DMA_TO_DEVICE ? dev_addr : 0;
|
||||
struct stedma40_chan_cfg *cfg = &chan->dma_cfg;
|
||||
struct stedma40_half_channel_info *src_info = &cfg->src_info;
|
||||
struct stedma40_half_channel_info *dst_info = &cfg->dst_info;
|
||||
|
@ -1665,11 +1663,9 @@ d40_prep_sg_log(struct d40_chan *chan, struct d40_desc *desc,
|
|||
static int
|
||||
d40_prep_sg_phy(struct d40_chan *chan, struct d40_desc *desc,
|
||||
struct scatterlist *sg_src, struct scatterlist *sg_dst,
|
||||
unsigned int sg_len, enum dma_data_direction direction,
|
||||
dma_addr_t dev_addr)
|
||||
unsigned int sg_len, dma_addr_t src_dev_addr,
|
||||
dma_addr_t dst_dev_addr)
|
||||
{
|
||||
dma_addr_t src_dev_addr = direction == DMA_FROM_DEVICE ? dev_addr : 0;
|
||||
dma_addr_t dst_dev_addr = direction == DMA_TO_DEVICE ? dev_addr : 0;
|
||||
struct stedma40_chan_cfg *cfg = &chan->dma_cfg;
|
||||
struct stedma40_half_channel_info *src_info = &cfg->src_info;
|
||||
struct stedma40_half_channel_info *dst_info = &cfg->dst_info;
|
||||
|
@ -1757,7 +1753,8 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src,
|
|||
enum dma_data_direction direction, unsigned long dma_flags)
|
||||
{
|
||||
struct d40_chan *chan = container_of(dchan, struct d40_chan, chan);
|
||||
dma_addr_t dev_addr = 0;
|
||||
dma_addr_t src_dev_addr = 0;
|
||||
dma_addr_t dst_dev_addr = 0;
|
||||
struct d40_desc *desc;
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
@ -1773,15 +1770,21 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src,
|
|||
if (desc == NULL)
|
||||
goto err;
|
||||
|
||||
if (direction != DMA_NONE)
|
||||
dev_addr = d40_get_dev_addr(chan, direction);
|
||||
if (direction != DMA_NONE) {
|
||||
dma_addr_t dev_addr = d40_get_dev_addr(chan, direction);
|
||||
|
||||
if (direction == DMA_FROM_DEVICE)
|
||||
src_dev_addr = dev_addr;
|
||||
else if (direction == DMA_TO_DEVICE)
|
||||
dst_dev_addr = dev_addr;
|
||||
}
|
||||
|
||||
if (chan_is_logical(chan))
|
||||
ret = d40_prep_sg_log(chan, desc, sg_src, sg_dst,
|
||||
sg_len, direction, dev_addr);
|
||||
sg_len, src_dev_addr, dst_dev_addr);
|
||||
else
|
||||
ret = d40_prep_sg_phy(chan, desc, sg_src, sg_dst,
|
||||
sg_len, direction, dev_addr);
|
||||
sg_len, src_dev_addr, dst_dev_addr);
|
||||
|
||||
if (ret) {
|
||||
chan_err(chan, "Failed to prepare %s sg job: %d\n",
|
||||
|
|
Loading…
Reference in a new issue