mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 05:48:40 +00:00
Merge remote-tracking branch 'spi/topic/dma' into spi-next
This commit is contained in:
commit
cc939939d8
1 changed files with 5 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue