Skip to contentSkip to conversation

swiotlb-xen: Convert to use macro

PATCH In review Souptick Joarder 2 participants 4 messages Sep 2, 2019 – Sep 6, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 swiotlb-xen: Convert to use macro

Rather than using static int max_dma_bits, this
can be coverted to use as macro.

---
 drivers/xen/swiotlb-xen.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/xen/swiotlb-xen.c +2 -3
index ae1df49..d1eced5 100644
@@ -38,6 +38,7 @@
 #include <asm/xen/page-coherent.h>
 
 #include <trace/events/swiotlb.h>
+#define MAX_DMA_BITS 32
 /*
  * Used to do a quick range check in swiotlb_tbl_unmap_single and
  * swiotlb_tbl_sync_single_*, to see if the memory was in fact allocated by this
@@ -114,8 +115,6 @@ static int is_xen_swiotlb_buffer(dma_addr_t dma_addr)
 	return 0;
 }
 
-static int max_dma_bits = 32;
-
 static int
 xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs)
 {
@@ -135,7 +134,7 @@ static int is_xen_swiotlb_buffer(dma_addr_t dma_addr)
 				p + (i << IO_TLB_SHIFT),
 				get_order(slabs << IO_TLB_SHIFT),
 				dma_bits, &dma_handle);
-		} while (rc && dma_bits++ < max_dma_bits);
+		} while (rc && dma_bits++ < MAX_DMA_BITS);
 		if (rc)
 			return rc;
 
Signature · 6 lines
1.9.1

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#1 lore raw
Quoted 6 lines · Souptick Joarder

Rather than using static int max_dma_bits, this
can be coverted to use as macro.

If it is still not late, can we get this patch in queue for 5.4 ?

Quoted 37 lines
---
 drivers/xen/swiotlb-xen.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/xen/swiotlb-xen.c +2 -4
index ae1df49..d1eced5 100644
@@ -38,6 +38,7 @@
 #include <asm/xen/page-coherent.h>
 
 #include <trace/events/swiotlb.h>
+#define MAX_DMA_BITS 32
 /*
  * Used to do a quick range check in swiotlb_tbl_unmap_single and
  * swiotlb_tbl_sync_single_*, to see if the memory was in fact allocated by this
@@ -114,8 +115,6 @@ static int is_xen_swiotlb_buffer(dma_addr_t dma_addr)
        return 0;
 }
 
-static int max_dma_bits = 32;
-
 static int
 xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs)
 {
@@ -135,7 +134,7 @@ static int is_xen_swiotlb_buffer(dma_addr_t dma_addr)
                                p + (i << IO_TLB_SHIFT),
                                get_order(slabs << IO_TLB_SHIFT),
                                dma_bits, &dma_handle);
-               } while (rc && dma_bits++ < max_dma_bits);
+               } while (rc && dma_bits++ < MAX_DMA_BITS);
                if (rc)
                        return rc;
 
--

1.9.1

#2 lore raw
Quoted 7 lines · Souptick Joarder
Quoted 5 lines · Souptick Joarder

Rather than using static int max_dma_bits, this
can be coverted to use as macro.

If it is still not late, can we get this patch in queue for 5.4 ?

Yes, I will queue it later today.

-boris
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

#3 lore raw
Quoted 6 lines · Boris Ostrovsky
Quoted 4 lines · Souptick Joarder
Quoted 3 lines · Souptick Joarder

Rather than using static int max_dma_bits, this
can be coverted to use as macro.

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

If it is still not late, can we get this patch in queue for 5.4 ?

Yes, I will queue it later today.

Thanks Boris.