iommu: rk-iovmm: fix back to back sg entries condition

Change-Id: Ie493d3d8b34ac4229b3a5a2a84cd52568425f106
Signed-off-by: Simon <xxm@rock-chips.com>
This commit is contained in:
Simon 2016-03-08 09:48:16 +08:00 committed by Gerrit Code Review
parent e0958c3066
commit 8ad3d6962f

View File

@ -98,17 +98,15 @@ dma_addr_t rockchip_iovmm_map(struct device *dev,
addr = start;
do {
phys_addr_t phys;
struct scatterlist *sg_tmp;
size_t len;
phys = sg_phys(sg);
len = sg->length;
/* if back to back sg entries are contiguous consolidate them */
sg_tmp = sg_next(sg);
while (sg_next(sg) && sg_phys(sg) + sg->length == sg_phys(sg_next(sg))) {
len += sg_tmp->length;
sg = sg_next(sg);
len += sg->length;
}
if (offset > 0) {