diff mbox

OMAP3: iovmm: fix compiler warning

Message ID 20090918.125453.179950926.Hiroshi.DOYU@nokia.com (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Hiroshi DOYU Sept. 18, 2009, 9:54 a.m. UTC
None

Comments

Sanjeev Premi Sept. 18, 2009, 10:23 a.m. UTC | #1
> -----Original Message-----
> From: Hiroshi DOYU [mailto:Hiroshi.DOYU@nokia.com] 
> Sent: Friday, September 18, 2009 3:25 PM
> To: Premi, Sanjeev
> Cc: linux-omap@vger.kernel.org
> Subject: Re: [PATCH] OMAP3: iovmm: fix compiler warning
> 
> Hi Premi,
> 
> From: ext Sanjeev Premi <premi@ti.com>
> Subject: [PATCH] OMAP3: iovmm: fix compiler warning
> Date: Fri, 18 Sep 2009 10:56:26 +0200
> 
> > This patch fixes these compiler warnings:
> > 
> > arch/arm/plat-omap/iovmm.c: In function 'vmap_sg':
> > arch/arm/plat-omap/iovmm.c:202: warning: passing argument 1 of
> >  'flush_cache_vmap' makes integer from pointer without a cast
> > arch/arm/plat-omap/iovmm.c:202: warning: passing argument 2 of
> >  'flush_cache_vmap' makes integer from pointer without a cast
> > arch/arm/plat-omap/iovmm.c: In function 'sgtable_fill_vmalloc':
> > arch/arm/plat-omap/iovmm.c:393: warning: passing argument 1 of
> >  'flush_cache_vmap' makes integer from pointer without a cast
> > arch/arm/plat-omap/iovmm.c:393: warning: passing argument 2 of
> >  'flush_cache_vmap' makes integer from pointer without a cast
> > 
> > Signed-off-by: Sanjeev Premi <premi@ti.com>
> > ---
> >  arch/arm/plat-omap/iovmm.c |    5 +++--
> >  1 files changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c
> > index 004fd83..481bf77 100644
> > --- a/arch/arm/plat-omap/iovmm.c
> > +++ b/arch/arm/plat-omap/iovmm.c
> > @@ -199,7 +199,8 @@ static void *vmap_sg(const struct sg_table *sgt)
> >  		va += bytes;
> >  	}
> >  
> > -	flush_cache_vmap(new->addr, new->addr + total);
> > +	flush_cache_vmap((unsigned long) new->addr,
> > +				(unsigned long) (new->addr + total));
> 
> I think that the space after casting isn't necessary.
> 
> >  	return new->addr;
> >  
> >  err_out:
> > @@ -390,7 +391,7 @@ static void sgtable_fill_vmalloc(struct 
> sg_table *sgt, void *_va)
> >  	}
> >  
> >  	va_end = _va + PAGE_SIZE * i;
> > -	flush_cache_vmap(_va, va_end);
> > +	flush_cache_vmap((unsigned long) _va, (unsigned long) va_end);
> >  }
> >  
> >  static inline void sgtable_drain_vmalloc(struct sg_table *sgt)
> 
> If no need for pointer, what about below?

I did not check for the usage of sgtable_drain_vmalloc().
Yes. If the void* isn't MUST then, change below is fine.

~sanjeev
> 
> 	Modified arch/arm/plat-omap/iovmm.c
> diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c
> index 6fc52fc..3ea0cd0 100644
> --- a/arch/arm/plat-omap/iovmm.c
> +++ b/arch/arm/plat-omap/iovmm.c
> @@ -368,12 +368,12 @@ out:
>  }
>  EXPORT_SYMBOL_GPL(da_to_va);
>  
> -static void sgtable_fill_vmalloc(struct sg_table *sgt, void *_va)
> +static void sgtable_fill_vmalloc(struct sg_table *sgt, u32 _va)
>  {
>  	unsigned int i;
>  	struct scatterlist *sg;
> -	void *va = _va;
> -	void *va_end;
> +	u32 va = _va;
> +	u32 va_end;
>  
>  	for_each_sg(sgt->sgl, sg, sgt->nents, i) {
>  		struct page *pg;
> @@ -693,7 +693,7 @@ u32 iommu_vmalloc(struct iommu *obj, u32 
> da, size_t bytes, u32 flags)
>  		da = PTR_ERR(sgt);
>  		goto err_sgt_alloc;
>  	}
> -	sgtable_fill_vmalloc(sgt, va);
> +	sgtable_fill_vmalloc(sgt, (u32)va);
>  
>  	flags &= IOVMF_HW_MASK;
>  	flags |= IOVMF_DISCONT;
> 
> --
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sanjeev Premi Sept. 18, 2009, 2:40 p.m. UTC | #2
> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org 
> [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Premi, Sanjeev
> Sent: Friday, September 18, 2009 3:53 PM
> To: Hiroshi DOYU
> Cc: linux-omap@vger.kernel.org
> Subject: RE: [PATCH] OMAP3: iovmm: fix compiler warning
> 
> > -----Original Message-----
> > From: Hiroshi DOYU [mailto:Hiroshi.DOYU@nokia.com] 
> > Sent: Friday, September 18, 2009 3:25 PM
> > To: Premi, Sanjeev
> > Cc: linux-omap@vger.kernel.org
> > Subject: Re: [PATCH] OMAP3: iovmm: fix compiler warning
> > 
> > Hi Premi,
> > 
> > From: ext Sanjeev Premi <premi@ti.com>
> > Subject: [PATCH] OMAP3: iovmm: fix compiler warning
> > Date: Fri, 18 Sep 2009 10:56:26 +0200
> > 
> > > This patch fixes these compiler warnings:
> > > 
> > > arch/arm/plat-omap/iovmm.c: In function 'vmap_sg':
> > > arch/arm/plat-omap/iovmm.c:202: warning: passing argument 1 of
> > >  'flush_cache_vmap' makes integer from pointer without a cast
> > > arch/arm/plat-omap/iovmm.c:202: warning: passing argument 2 of
> > >  'flush_cache_vmap' makes integer from pointer without a cast
> > > arch/arm/plat-omap/iovmm.c: In function 'sgtable_fill_vmalloc':
> > > arch/arm/plat-omap/iovmm.c:393: warning: passing argument 1 of
> > >  'flush_cache_vmap' makes integer from pointer without a cast
> > > arch/arm/plat-omap/iovmm.c:393: warning: passing argument 2 of
> > >  'flush_cache_vmap' makes integer from pointer without a cast
> > > 
> > > Signed-off-by: Sanjeev Premi <premi@ti.com>
> > > ---
> > >  arch/arm/plat-omap/iovmm.c |    5 +++--
> > >  1 files changed, 3 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/arch/arm/plat-omap/iovmm.c 
> b/arch/arm/plat-omap/iovmm.c
> > > index 004fd83..481bf77 100644
> > > --- a/arch/arm/plat-omap/iovmm.c
> > > +++ b/arch/arm/plat-omap/iovmm.c
> > > @@ -199,7 +199,8 @@ static void *vmap_sg(const struct 
> sg_table *sgt)
> > >  		va += bytes;
> > >  	}
> > >  
> > > -	flush_cache_vmap(new->addr, new->addr + total);
> > > +	flush_cache_vmap((unsigned long) new->addr,
> > > +				(unsigned long) (new->addr + total));
> > 
> > I think that the space after casting isn't necessary.
> > 
> > >  	return new->addr;
> > >  
> > >  err_out:
> > > @@ -390,7 +391,7 @@ static void sgtable_fill_vmalloc(struct 
> > sg_table *sgt, void *_va)
> > >  	}
> > >  
> > >  	va_end = _va + PAGE_SIZE * i;
> > > -	flush_cache_vmap(_va, va_end);
> > > +	flush_cache_vmap((unsigned long) _va, (unsigned long) va_end);
> > >  }
> > >  
> > >  static inline void sgtable_drain_vmalloc(struct sg_table *sgt)
> > 
> > If no need for pointer, what about below?
> 
> I did not check for the usage of sgtable_drain_vmalloc().
> Yes. If the void* isn't MUST then, change below is fine.
> 
> ~sanjeev

On second look, the need for void* is driven backwards from:
     pg = vmalloc_to_page(va);
In function sgtable_fill_vmalloc().

Now we need a typecast from u32 to void*.

Shouldn't we go with the original patch itself?

Or, new go with changes below with additional:
-               pg = vmalloc_to_page(va);
+               pg = vmalloc_to_page((void *)va);

~sanjeev

> > 
> > 	Modified arch/arm/plat-omap/iovmm.c
> > diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c
> > index 6fc52fc..3ea0cd0 100644
> > --- a/arch/arm/plat-omap/iovmm.c
> > +++ b/arch/arm/plat-omap/iovmm.c
> > @@ -368,12 +368,12 @@ out:
> >  }
> >  EXPORT_SYMBOL_GPL(da_to_va);
> >  
> > -static void sgtable_fill_vmalloc(struct sg_table *sgt, void *_va)
> > +static void sgtable_fill_vmalloc(struct sg_table *sgt, u32 _va)
> >  {
> >  	unsigned int i;
> >  	struct scatterlist *sg;
> > -	void *va = _va;
> > -	void *va_end;
> > +	u32 va = _va;
> > +	u32 va_end;
> >  
> >  	for_each_sg(sgt->sgl, sg, sgt->nents, i) {
> >  		struct page *pg;
> > @@ -693,7 +693,7 @@ u32 iommu_vmalloc(struct iommu *obj, u32 
> > da, size_t bytes, u32 flags)
> >  		da = PTR_ERR(sgt);
> >  		goto err_sgt_alloc;
> >  	}
> > -	sgtable_fill_vmalloc(sgt, va);
> > +	sgtable_fill_vmalloc(sgt, (u32)va);
> >  
> >  	flags &= IOVMF_HW_MASK;
> >  	flags |= IOVMF_DISCONT;
> > 
> > --
> To unsubscribe from this list: send the line "unsubscribe 
> linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> --
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren Sept. 22, 2009, 9:36 p.m. UTC | #3
* Hiroshi DOYU <Hiroshi.DOYU@nokia.com> [090918 07:54]:
> Hi Premi,
> 
> From: "ext Premi, Sanjeev" <premi@ti.com>
> Subject: RE: [PATCH] OMAP3: iovmm: fix compiler warning
> Date: Fri, 18 Sep 2009 16:40:29 +0200
> 
> [...]
> 
> > > > > @@ -390,7 +391,7 @@ static void sgtable_fill_vmalloc(struct 
> > > > sg_table *sgt, void *_va)
> > > > >  	}
> > > > >  
> > > > >  	va_end = _va + PAGE_SIZE * i;
> > > > > -	flush_cache_vmap(_va, va_end);
> > > > > +	flush_cache_vmap((unsigned long) _va, (unsigned long) va_end);
> > > > >  }
> > > > >  
> > > > >  static inline void sgtable_drain_vmalloc(struct sg_table *sgt)
> > > > 
> > > > If no need for pointer, what about below?
> > > 
> > > I did not check for the usage of sgtable_drain_vmalloc().
> > > Yes. If the void* isn't MUST then, change below is fine.
> > > 
> > > ~sanjeev
> > 
> > On second look, the need for void* is driven backwards from:
> >      pg = vmalloc_to_page(va);
> > In function sgtable_fill_vmalloc().
> > 
> > Now we need a typecast from u32 to void*.
> > 
> > Shouldn't we go with the original patch itself?
> 
> Right, the original is better, then;)

Can you please specify which one (if any) should be queued?

Do you mean http://patchwork.kernel.org/patch/48467/

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sanjeev Premi Sept. 23, 2009, 4:06 a.m. UTC | #4
> -----Original Message-----
> From: Tony Lindgren [mailto:tony@atomide.com] 
> Sent: Wednesday, September 23, 2009 3:06 AM
> To: Hiroshi DOYU
> Cc: Premi, Sanjeev; linux-omap@vger.kernel.org
> Subject: Re: [PATCH] OMAP3: iovmm: fix compiler warning
> 
> * Hiroshi DOYU <Hiroshi.DOYU@nokia.com> [090918 07:54]:
> > Hi Premi,
> > 
> > From: "ext Premi, Sanjeev" <premi@ti.com>
> > Subject: RE: [PATCH] OMAP3: iovmm: fix compiler warning
> > Date: Fri, 18 Sep 2009 16:40:29 +0200
> > 
> > [...]
> > 

[snip]--[snip]

> > > Shouldn't we go with the original patch itself?
> > 
> > Right, the original is better, then;)
> 
> Can you please specify which one (if any) should be queued?
> 
> Do you mean http://patchwork.kernel.org/patch/48467/

[sp] Yes. That's right.

> 
> Tony
> 
> --
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sanjeev Premi Sept. 23, 2009, 8:29 a.m. UTC | #5
> -----Original Message-----
> From: Hiroshi DOYU [mailto:Hiroshi.DOYU@nokia.com] 
> Sent: Wednesday, September 23, 2009 11:16 AM
> To: Premi, Sanjeev
> Cc: tony@atomide.com; linux-omap@vger.kernel.org
> Subject: Re: [PATCH] OMAP3: iovmm: fix compiler warning
> 
> Hi Premi,
> 
> From: "ext Premi, Sanjeev" <premi@ti.com>
> Subject: RE: [PATCH] OMAP3: iovmm: fix compiler warning
> Date: Wed, 23 Sep 2009 06:06:43 +0200
> 
> > > -----Original Message-----
> > > From: Tony Lindgren [mailto:tony@atomide.com] 
> > > Sent: Wednesday, September 23, 2009 3:06 AM
> > > To: Hiroshi DOYU
> > > Cc: Premi, Sanjeev; linux-omap@vger.kernel.org
> > > Subject: Re: [PATCH] OMAP3: iovmm: fix compiler warning
> > > 
> > > * Hiroshi DOYU <Hiroshi.DOYU@nokia.com> [090918 07:54]:
> > > > Hi Premi,
> > > > 
> > > > From: "ext Premi, Sanjeev" <premi@ti.com>
> > > > Subject: RE: [PATCH] OMAP3: iovmm: fix compiler warning
> > > > Date: Fri, 18 Sep 2009 16:40:29 +0200
> > > > 
> > > > [...]
> > > > 
> > 
> > [snip]--[snip]
> > 
> > > > > Shouldn't we go with the original patch itself?
> > > > 
> > > > Right, the original is better, then;)
> > > 
> > > Can you please specify which one (if any) should be queued?
> > > 
> > > Do you mean http://patchwork.kernel.org/patch/48467/
> > 
> > [sp] Yes. That's right.
> 
> I know it's nitpicky, but it's better to remove a space after casting
> as pointed previously.
> 
> Would it be possible to send the update version?
> 
> 
In few mins...

~sanjeev--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c
index 6fc52fc..3ea0cd0 100644
--- a/arch/arm/plat-omap/iovmm.c
+++ b/arch/arm/plat-omap/iovmm.c
@@ -368,12 +368,12 @@  out:
 }
 EXPORT_SYMBOL_GPL(da_to_va);
 
-static void sgtable_fill_vmalloc(struct sg_table *sgt, void *_va)
+static void sgtable_fill_vmalloc(struct sg_table *sgt, u32 _va)
 {
 	unsigned int i;
 	struct scatterlist *sg;
-	void *va = _va;
-	void *va_end;
+	u32 va = _va;
+	u32 va_end;
 
 	for_each_sg(sgt->sgl, sg, sgt->nents, i) {
 		struct page *pg;
@@ -693,7 +693,7 @@  u32 iommu_vmalloc(struct iommu *obj, u32 da, size_t bytes, u32 flags)
 		da = PTR_ERR(sgt);
 		goto err_sgt_alloc;
 	}
-	sgtable_fill_vmalloc(sgt, va);
+	sgtable_fill_vmalloc(sgt, (u32)va);
 
 	flags &= IOVMF_HW_MASK;
 	flags |= IOVMF_DISCONT;