summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2016-12-12 15:54:03 +0000
committerMark Brown <broonie@kernel.org>2016-12-12 15:54:03 +0000
commitcc939939d81e787fd6a5e86cf81b2ad1cd600bd4 (patch)
treeb46f9297566db3673de626dcb5ea8bc1c22bf262 /drivers/spi/spi.c
parent05232669503f54babf9f899748baf02934fd1051 (diff)
parent8dd4a0163e7315d196e54780591b7426fa78e1fa (diff)
downloadlinux-cc939939d81e787fd6a5e86cf81b2ad1cd600bd4.tar.bz2
Merge remote-tracking branch 'spi/topic/dma' into spi-next
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 91b25314ba03..8cf466524442 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -725,6 +725,7 @@ static int spi_map_buf(struct spi_master *master, struct device *dev,
int desc_len;
int sgs;
struct page *vm_page;
+ struct scatterlist *sg;
void *sg_buf;
size_t min;
int i, ret;
@@ -743,6 +744,7 @@ static int spi_map_buf(struct spi_master *master, struct device *dev,
if (ret != 0)
return ret;
+ sg = &sgt->sgl[0];
for (i = 0; i < sgs; i++) {
if (vmalloced_buf || kmap_buf) {
@@ -756,16 +758,17 @@ static int spi_map_buf(struct spi_master *master, struct device *dev,
sg_free_table(sgt);
return -ENOMEM;
}
- sg_set_page(&sgt->sgl[i], vm_page,
+ sg_set_page(sg, vm_page,
min, offset_in_page(buf));
} else {
min = min_t(size_t, len, desc_len);
sg_buf = buf;
- sg_set_buf(&sgt->sgl[i], sg_buf, min);
+ sg_set_buf(sg, sg_buf, min);
}
buf += min;
len -= min;
+ sg = sg_next(sg);
}
ret = dma_map_sg(dev, sgt->sgl, sgt->nents, dir);