diff mbox series

[v2] swiotlb-xen: Convert to use macro

Message ID 1567413598-4477-1-git-send-email-jrdr.linux@gmail.com (mailing list archive)
State Accepted
Commit e6fa0dc86734f99b037b36b8682133efc2b6e16b
Headers show
Series [v2] swiotlb-xen: Convert to use macro | expand

Commit Message

Souptick Joarder Sept. 2, 2019, 8:39 a.m. UTC
Rather than using static int max_dma_bits, this
can be coverted to use as macro.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
---
 drivers/xen/swiotlb-xen.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Souptick Joarder Sept. 6, 2019, 12:27 p.m. UTC | #1
On Mon, Sep 2, 2019 at 2:04 PM Souptick Joarder <jrdr.linux@gmail.com> wrote:
>
> Rather than using static int max_dma_bits, this
> can be coverted to use as macro.
>
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> Reviewed-by: Juergen Gross <jgross@suse.com>

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

> ---
>  drivers/xen/swiotlb-xen.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
> index ae1df49..d1eced5 100644
> --- a/drivers/xen/swiotlb-xen.c
> +++ b/drivers/xen/swiotlb-xen.c
> @@ -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
>
Boris Ostrovsky Sept. 6, 2019, 1:32 p.m. UTC | #2
On 9/6/19 8:27 AM, Souptick Joarder wrote:
> On Mon, Sep 2, 2019 at 2:04 PM Souptick Joarder <jrdr.linux@gmail.com> wrote:
>> Rather than using static int max_dma_bits, this
>> can be coverted to use as macro.
>>
>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>> Reviewed-by: Juergen Gross <jgross@suse.com>
> If it is still not late, can we get this patch in queue for 5.4 ?


Yes, I will queue it later today.

-boris
Souptick Joarder Sept. 6, 2019, 1:35 p.m. UTC | #3
On Fri, Sep 6, 2019 at 7:02 PM Boris Ostrovsky
<boris.ostrovsky@oracle.com> wrote:
>
> On 9/6/19 8:27 AM, Souptick Joarder wrote:
> > On Mon, Sep 2, 2019 at 2:04 PM Souptick Joarder <jrdr.linux@gmail.com> wrote:
> >> Rather than using static int max_dma_bits, this
> >> can be coverted to use as macro.
> >>
> >> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> >> Reviewed-by: Juergen Gross <jgross@suse.com>
> > 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.
diff mbox series

Patch

diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
index ae1df49..d1eced5 100644
--- a/drivers/xen/swiotlb-xen.c
+++ b/drivers/xen/swiotlb-xen.c
@@ -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;