Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

swiotlb: replace dma_length with sg_dma_len() macro

This patch replace dma_length in "lib/swiotlb.c" to sg_dma_len() macro,
because the build error can occur if CONFIG_NEED_SG_DMA_LENGTH is not
set, and CONFIG_SWIOTLB is set.

Singed-off-by: EunBong Song <eunb.song@samsung.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

authored by

EunBong Song and committed by
Konrad Rzeszutek Wilk
4d86ec7a cd9151e2

+4 -4
+4 -4
lib/swiotlb.c
··· 870 870 swiotlb_full(hwdev, sg->length, dir, 0); 871 871 swiotlb_unmap_sg_attrs(hwdev, sgl, i, dir, 872 872 attrs); 873 - sgl[0].dma_length = 0; 873 + sg_dma_len(sgl) = 0; 874 874 return 0; 875 875 } 876 876 sg->dma_address = phys_to_dma(hwdev, map); 877 877 } else 878 878 sg->dma_address = dev_addr; 879 - sg->dma_length = sg->length; 879 + sg_dma_len(sg) = sg->length; 880 880 } 881 881 return nelems; 882 882 } ··· 904 904 BUG_ON(dir == DMA_NONE); 905 905 906 906 for_each_sg(sgl, sg, nelems, i) 907 - unmap_single(hwdev, sg->dma_address, sg->dma_length, dir); 907 + unmap_single(hwdev, sg->dma_address, sg_dma_len(sg), dir); 908 908 909 909 } 910 910 EXPORT_SYMBOL(swiotlb_unmap_sg_attrs); ··· 934 934 935 935 for_each_sg(sgl, sg, nelems, i) 936 936 swiotlb_sync_single(hwdev, sg->dma_address, 937 - sg->dma_length, dir, target); 937 + sg_dma_len(sg), dir, target); 938 938 } 939 939 940 940 void