aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2010-05-10 16:01:15 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2010-06-07 11:59:26 -0400
commit22d48269984fc93a71f65a54aa422aacf5fdb926 (patch)
tree0258830a93632bba7831d990cef04b01c7dd9e63
parentbfc5501f6d816082274e10cd45a2d5f32603b328 (diff)
swiotlb: search and replace "int dir" with "enum dma_data_direction dir"
.. to catch anybody doing something funky. See "swiotlb: swiotlb: add swiotlb_tbl_map_single library function" for full description of patchset. [v2: swiotlb_sync_single_range_* no more - removed usage] [v3: enum dma_data_direction direction -> enum dma_data_direction dir] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Tested-by: Albert Herranz <albert_herranz@yahoo.es>
-rw-r--r--include/linux/swiotlb.h4
-rw-r--r--lib/swiotlb.c23
2 files changed, 15 insertions, 12 deletions
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index b406261d8887..250d766f17f7 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -43,11 +43,11 @@ extern void swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
43 43
44extern int 44extern int
45swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, 45swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
46 int direction); 46 enum dma_data_direction dir);
47 47
48extern void 48extern void
49swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, 49swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
50 int direction); 50 enum dma_data_direction dir);
51 51
52extern int 52extern int
53swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, 53swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 1fc15bf63945..5f60157f31d8 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -374,7 +374,8 @@ static void swiotlb_bounce(phys_addr_t phys, char *dma_addr, size_t size,
374} 374}
375 375
376void *swiotlb_tbl_map_single(struct device *hwdev, dma_addr_t tbl_dma_addr, 376void *swiotlb_tbl_map_single(struct device *hwdev, dma_addr_t tbl_dma_addr,
377 phys_addr_t phys, size_t size, int dir) 377 phys_addr_t phys, size_t size,
378 enum dma_data_direction dir)
378{ 379{
379 unsigned long flags; 380 unsigned long flags;
380 char *dma_addr; 381 char *dma_addr;
@@ -481,7 +482,8 @@ found:
481 */ 482 */
482 483
483static void * 484static void *
484map_single(struct device *hwdev, phys_addr_t phys, size_t size, int dir) 485map_single(struct device *hwdev, phys_addr_t phys, size_t size,
486 enum dma_data_direction dir)
485{ 487{
486 dma_addr_t start_dma_addr = swiotlb_virt_to_bus(hwdev, io_tlb_start); 488 dma_addr_t start_dma_addr = swiotlb_virt_to_bus(hwdev, io_tlb_start);
487 489
@@ -493,7 +495,7 @@ map_single(struct device *hwdev, phys_addr_t phys, size_t size, int dir)
493 */ 495 */
494static void 496static void
495swiotlb_tbl_unmap_single(struct device *hwdev, char *dma_addr, size_t size, 497swiotlb_tbl_unmap_single(struct device *hwdev, char *dma_addr, size_t size,
496 int dir) 498 enum dma_data_direction dir)
497{ 499{
498 unsigned long flags; 500 unsigned long flags;
499 int i, count, nslots = ALIGN(size, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT; 501 int i, count, nslots = ALIGN(size, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT;
@@ -534,7 +536,7 @@ swiotlb_tbl_unmap_single(struct device *hwdev, char *dma_addr, size_t size,
534 536
535static void 537static void
536swiotlb_tbl_sync_single(struct device *hwdev, char *dma_addr, size_t size, 538swiotlb_tbl_sync_single(struct device *hwdev, char *dma_addr, size_t size,
537 int dir, int target) 539 enum dma_data_direction dir, int target)
538{ 540{
539 int index = (dma_addr - io_tlb_start) >> IO_TLB_SHIFT; 541 int index = (dma_addr - io_tlb_start) >> IO_TLB_SHIFT;
540 phys_addr_t phys = io_tlb_orig_addr[index]; 542 phys_addr_t phys = io_tlb_orig_addr[index];
@@ -624,7 +626,8 @@ swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr,
624EXPORT_SYMBOL(swiotlb_free_coherent); 626EXPORT_SYMBOL(swiotlb_free_coherent);
625 627
626static void 628static void
627swiotlb_full(struct device *dev, size_t size, int dir, int do_panic) 629swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir,
630 int do_panic)
628{ 631{
629 /* 632 /*
630 * Ran out of IOMMU space for this operation. This is very bad. 633 * Ran out of IOMMU space for this operation. This is very bad.
@@ -702,7 +705,7 @@ EXPORT_SYMBOL_GPL(swiotlb_map_page);
702 * whatever the device wrote there. 705 * whatever the device wrote there.
703 */ 706 */
704static void unmap_single(struct device *hwdev, dma_addr_t dev_addr, 707static void unmap_single(struct device *hwdev, dma_addr_t dev_addr,
705 size_t size, int dir) 708 size_t size, enum dma_data_direction dir)
706{ 709{
707 phys_addr_t paddr = dma_to_phys(hwdev, dev_addr); 710 phys_addr_t paddr = dma_to_phys(hwdev, dev_addr);
708 711
@@ -745,7 +748,7 @@ EXPORT_SYMBOL_GPL(swiotlb_unmap_page);
745 */ 748 */
746static void 749static void
747swiotlb_sync_single(struct device *hwdev, dma_addr_t dev_addr, 750swiotlb_sync_single(struct device *hwdev, dma_addr_t dev_addr,
748 size_t size, int dir, int target) 751 size_t size, enum dma_data_direction dir, int target)
749{ 752{
750 phys_addr_t paddr = dma_to_phys(hwdev, dev_addr); 753 phys_addr_t paddr = dma_to_phys(hwdev, dev_addr);
751 754
@@ -832,7 +835,7 @@ EXPORT_SYMBOL(swiotlb_map_sg_attrs);
832 835
833int 836int
834swiotlb_map_sg(struct device *hwdev, struct scatterlist *sgl, int nelems, 837swiotlb_map_sg(struct device *hwdev, struct scatterlist *sgl, int nelems,
835 int dir) 838 enum dma_data_direction dir)
836{ 839{
837 return swiotlb_map_sg_attrs(hwdev, sgl, nelems, dir, NULL); 840 return swiotlb_map_sg_attrs(hwdev, sgl, nelems, dir, NULL);
838} 841}
@@ -859,7 +862,7 @@ EXPORT_SYMBOL(swiotlb_unmap_sg_attrs);
859 862
860void 863void
861swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sgl, int nelems, 864swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sgl, int nelems,
862 int dir) 865 enum dma_data_direction dir)
863{ 866{
864 return swiotlb_unmap_sg_attrs(hwdev, sgl, nelems, dir, NULL); 867 return swiotlb_unmap_sg_attrs(hwdev, sgl, nelems, dir, NULL);
865} 868}
@@ -874,7 +877,7 @@ EXPORT_SYMBOL(swiotlb_unmap_sg);
874 */ 877 */
875static void 878static void
876swiotlb_sync_sg(struct device *hwdev, struct scatterlist *sgl, 879swiotlb_sync_sg(struct device *hwdev, struct scatterlist *sgl,
877 int nelems, int dir, int target) 880 int nelems, enum dma_data_direction dir, int target)
878{ 881{
879 struct scatterlist *sg; 882 struct scatterlist *sg;
880 int i; 883 int i;