mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-01 14:52:32 +00:00
Merge remote-tracking branch 'spi/topic/dma' into spi-next
This commit is contained in:
commit
cc939939d8
@ -725,6 +725,7 @@ static int spi_map_buf(struct spi_master *master, struct device *dev,
|
|||||||
int desc_len;
|
int desc_len;
|
||||||
int sgs;
|
int sgs;
|
||||||
struct page *vm_page;
|
struct page *vm_page;
|
||||||
|
struct scatterlist *sg;
|
||||||
void *sg_buf;
|
void *sg_buf;
|
||||||
size_t min;
|
size_t min;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
@ -743,6 +744,7 @@ static int spi_map_buf(struct spi_master *master, struct device *dev,
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
sg = &sgt->sgl[0];
|
||||||
for (i = 0; i < sgs; i++) {
|
for (i = 0; i < sgs; i++) {
|
||||||
|
|
||||||
if (vmalloced_buf || kmap_buf) {
|
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);
|
sg_free_table(sgt);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
sg_set_page(&sgt->sgl[i], vm_page,
|
sg_set_page(sg, vm_page,
|
||||||
min, offset_in_page(buf));
|
min, offset_in_page(buf));
|
||||||
} else {
|
} else {
|
||||||
min = min_t(size_t, len, desc_len);
|
min = min_t(size_t, len, desc_len);
|
||||||
sg_buf = buf;
|
sg_buf = buf;
|
||||||
sg_set_buf(&sgt->sgl[i], sg_buf, min);
|
sg_set_buf(sg, sg_buf, min);
|
||||||
}
|
}
|
||||||
|
|
||||||
buf += min;
|
buf += min;
|
||||||
len -= min;
|
len -= min;
|
||||||
|
sg = sg_next(sg);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = dma_map_sg(dev, sgt->sgl, sgt->nents, dir);
|
ret = dma_map_sg(dev, sgt->sgl, sgt->nents, dir);
|
||||||
|
Loading…
Reference in New Issue
Block a user