diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2010-05-10 16:01:15 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2010-06-07 11:59:26 -0400 |
commit | 22d48269984fc93a71f65a54aa422aacf5fdb926 (patch) | |
tree | 0258830a93632bba7831d990cef04b01c7dd9e63 | |
parent | bfc5501f6d816082274e10cd45a2d5f32603b328 (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.h | 4 | ||||
-rw-r--r-- | lib/swiotlb.c | 23 |
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 | ||
44 | extern int | 44 | extern int |
45 | swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, | 45 | swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, |
46 | int direction); | 46 | enum dma_data_direction dir); |
47 | 47 | ||
48 | extern void | 48 | extern void |
49 | swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, | 49 | swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, |
50 | int direction); | 50 | enum dma_data_direction dir); |
51 | 51 | ||
52 | extern int | 52 | extern int |
53 | swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, | 53 | swiotlb_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 | ||
376 | void *swiotlb_tbl_map_single(struct device *hwdev, dma_addr_t tbl_dma_addr, | 376 | void *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 | ||
483 | static void * | 484 | static void * |
484 | map_single(struct device *hwdev, phys_addr_t phys, size_t size, int dir) | 485 | map_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 | */ |
494 | static void | 496 | static void |
495 | swiotlb_tbl_unmap_single(struct device *hwdev, char *dma_addr, size_t size, | 497 | swiotlb_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 | ||
535 | static void | 537 | static void |
536 | swiotlb_tbl_sync_single(struct device *hwdev, char *dma_addr, size_t size, | 538 | swiotlb_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, | |||
624 | EXPORT_SYMBOL(swiotlb_free_coherent); | 626 | EXPORT_SYMBOL(swiotlb_free_coherent); |
625 | 627 | ||
626 | static void | 628 | static void |
627 | swiotlb_full(struct device *dev, size_t size, int dir, int do_panic) | 629 | swiotlb_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 | */ |
704 | static void unmap_single(struct device *hwdev, dma_addr_t dev_addr, | 707 | static 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 | */ |
746 | static void | 749 | static void |
747 | swiotlb_sync_single(struct device *hwdev, dma_addr_t dev_addr, | 750 | swiotlb_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 | ||
833 | int | 836 | int |
834 | swiotlb_map_sg(struct device *hwdev, struct scatterlist *sgl, int nelems, | 837 | swiotlb_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 | ||
860 | void | 863 | void |
861 | swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sgl, int nelems, | 864 | swiotlb_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 | */ |
875 | static void | 878 | static void |
876 | swiotlb_sync_sg(struct device *hwdev, struct scatterlist *sgl, | 879 | swiotlb_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; |