summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2016-12-16 14:28:41 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-26 08:24:44 +0100
commit1fd1e6cd63143cf5d198a536d875dfc88ce179bc (patch)
tree7a90a6aa9b9593f183827fe2cd67206b1395acdd /lib
parent776c2b2d165dc64397f3f9b39839920a08578e8f (diff)
swiotlb: Convert swiotlb_force from int to enum
commit ae7871be189cb41184f1e05742b4a99e2c59774d upstream. Convert the flag swiotlb_force from an int to an enum, to prepare for the advent of more possible values. Suggested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/swiotlb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 22e13a0e19d7..68e8f49c7e06 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -53,7 +53,7 @@
*/
#define IO_TLB_MIN_SLABS ((1<<20) >> IO_TLB_SHIFT)
-int swiotlb_force;
+enum swiotlb_force swiotlb_force;
/*
* Used to do a quick range check in swiotlb_tbl_unmap_single and
@@ -107,7 +107,7 @@ setup_io_tlb_npages(char *str)
if (*str == ',')
++str;
if (!strcmp(str, "force"))
- swiotlb_force = 1;
+ swiotlb_force = SWIOTLB_FORCE;
return 0;
}
@@ -749,7 +749,7 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
* we can safely return the device addr and not worry about bounce
* buffering it.
*/
- if (dma_capable(dev, dev_addr, size) && !swiotlb_force)
+ if (dma_capable(dev, dev_addr, size) && swiotlb_force != SWIOTLB_FORCE)
return dev_addr;
trace_swiotlb_bounced(dev, dev_addr, size, swiotlb_force);
@@ -888,7 +888,7 @@ swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
phys_addr_t paddr = sg_phys(sg);
dma_addr_t dev_addr = phys_to_dma(hwdev, paddr);
- if (swiotlb_force ||
+ if (swiotlb_force == SWIOTLB_FORCE ||
!dma_capable(hwdev, dev_addr, sg->length)) {
phys_addr_t map = map_single(hwdev, sg_phys(sg),
sg->length, dir);