Commit 22d48269984fc93a71f65a54aa422aacf5fdb926

Authored by Konrad Rzeszutek Wilk
1 parent bfc5501f6d

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>

Showing 2 changed files with 15 additions and 12 deletions Side-by-side Diff

include/linux/swiotlb.h
... ... @@ -43,11 +43,11 @@
43 43  
44 44 extern int
45 45 swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
46   - int direction);
  46 + enum dma_data_direction dir);
47 47  
48 48 extern void
49 49 swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
50   - int direction);
  50 + enum dma_data_direction dir);
51 51  
52 52 extern int
53 53 swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
... ... @@ -374,7 +374,8 @@
374 374 }
375 375  
376 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 380 unsigned long flags;
380 381 char *dma_addr;
... ... @@ -481,7 +482,8 @@
481 482 */
482 483  
483 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 488 dma_addr_t start_dma_addr = swiotlb_virt_to_bus(hwdev, io_tlb_start);
487 489  
... ... @@ -493,7 +495,7 @@
493 495 */
494 496 static void
495 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 500 unsigned long flags;
499 501 int i, count, nslots = ALIGN(size, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT;
... ... @@ -534,7 +536,7 @@
534 536  
535 537 static void
536 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 541 int index = (dma_addr - io_tlb_start) >> IO_TLB_SHIFT;
540 542 phys_addr_t phys = io_tlb_orig_addr[index];
... ... @@ -624,7 +626,8 @@
624 626 EXPORT_SYMBOL(swiotlb_free_coherent);
625 627  
626 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 633 * Ran out of IOMMU space for this operation. This is very bad.
... ... @@ -702,7 +705,7 @@
702 705 * whatever the device wrote there.
703 706 */
704 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 710 phys_addr_t paddr = dma_to_phys(hwdev, dev_addr);
708 711  
... ... @@ -745,7 +748,7 @@
745 748 */
746 749 static void
747 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 753 phys_addr_t paddr = dma_to_phys(hwdev, dev_addr);
751 754  
... ... @@ -832,7 +835,7 @@
832 835  
833 836 int
834 837 swiotlb_map_sg(struct device *hwdev, struct scatterlist *sgl, int nelems,
835   - int dir)
  838 + enum dma_data_direction dir)
836 839 {
837 840 return swiotlb_map_sg_attrs(hwdev, sgl, nelems, dir, NULL);
838 841 }
... ... @@ -859,7 +862,7 @@
859 862  
860 863 void
861 864 swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sgl, int nelems,
862   - int dir)
  865 + enum dma_data_direction dir)
863 866 {
864 867 return swiotlb_unmap_sg_attrs(hwdev, sgl, nelems, dir, NULL);
865 868 }
... ... @@ -874,7 +877,7 @@
874 877 */
875 878 static void
876 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 882 struct scatterlist *sg;
880 883 int i;