Skip to contentSkip to conversation

OMAP3: iovmm: fix compiler warning

PATCH Superseded Sanjeev Premi 3 participants 9 messages Sep 18, 2009 – Sep 23, 2009

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAP3: iovmm: fix compiler warning

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

---
 arch/arm/plat-omap/iovmm.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/plat-omap/iovmm.c +3 -2
index 004fd83..481bf77 100644
@@ -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));
 	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)
Signature · 1 line
1.6.2.2
#1 lore raw

Hi Premi,

From: ext Sanjeev Premi <[email protected]>
Subject: [PATCH] OMAP3: iovmm: fix compiler warning
Date: Fri, 18 Sep 2009 10:56:26 +0200

Quoted 23 lines

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

---
 arch/arm/plat-omap/iovmm.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/plat-omap/iovmm.c +0 -0
index 004fd83..481bf77 100644

arch/arm/plat-omap/iovmm.c static void *vmap_sg(const struct sg_table *sgt) · line 203

Quoted 6 lines
arch/arm/plat-omap/iovmm.c +2 -1
@@ -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.

arch/arm/plat-omap/iovmm.c static void sgtable_fill_vmalloc(struct sg_table *sgt, void *_va) · line 397

Quoted 12 lines
arch/arm/plat-omap/iovmm.c +1 -1
 	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?

Modified arch/arm/plat-omap/iovmm.c

arch/arm/plat-omap/iovmm.c +4 -4
index 6fc52fc..3ea0cd0 100644
@@ -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;
#2 lore raw
Quoted 52 lines

-----Original Message-----
From: Hiroshi DOYU [mailto:[email protected]]
Sent: Friday, September 18, 2009 3:25 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] OMAP3: iovmm: fix compiler warning

Hi Premi,

From: ext Sanjeev Premi <[email protected]>
Subject: [PATCH] OMAP3: iovmm: fix compiler warning
Date: Fri, 18 Sep 2009 10:56:26 +0200

Quoted 23 lines

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

---
 arch/arm/plat-omap/iovmm.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/plat-omap/iovmm.c +0 -0
index 004fd83..481bf77 100644

arch/arm/plat-omap/iovmm.c static void *vmap_sg(const struct sg_table *sgt) · line 203

Quoted 6 lines
arch/arm/plat-omap/iovmm.c +2 -1
@@ -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.

arch/arm/plat-omap/iovmm.c static void sgtable_fill_vmalloc(struct

Quoted 4 lines
arch/arm/plat-omap/iovmm.c +0 -0
 	return new->addr;
 
 err_out:
@@ -390,7 +391,7 @@ static void sgtable_fill_vmalloc(struct 

sg_table *sgt, void *_va)

Quoted 2 lines
arch/arm/plat-omap/iovmm.c +0 -0
 	}
 
Quoted 8 lines

arch/arm/plat-omap/iovmm.c static void sgtable_fill_vmalloc(struct · line 397

Quoted 6 lines
arch/arm/plat-omap/iovmm.c +1 -1
 	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

Quoted 34 lines

Modified arch/arm/plat-omap/iovmm.c

arch/arm/plat-omap/iovmm.c +4 -4
index 6fc52fc..3ea0cd0 100644
@@ -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;

#3 lore raw
Quoted 67 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Premi, Sanjeev
Sent: Friday, September 18, 2009 3:53 PM
To: Hiroshi DOYU
Cc: [email protected]
Subject: RE: [PATCH] OMAP3: iovmm: fix compiler warning

Quoted 26 lines

-----Original Message-----
From: Hiroshi DOYU [mailto:[email protected]]
Sent: Friday, September 18, 2009 3:25 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] OMAP3: iovmm: fix compiler warning

Hi Premi,

From: ext Sanjeev Premi <[email protected]>
Subject: [PATCH] OMAP3: iovmm: fix compiler warning
Date: Fri, 18 Sep 2009 10:56:26 +0200

Quoted 13 lines

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

Quoted 6 lines

Review

Quoted 6 lines
---
 arch/arm/plat-omap/iovmm.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/arch/arm/plat-omap/iovmm.c

Quoted 4 lines

arch/arm/plat-omap/iovmm.c static void *vmap_sg(const struct

Quoted 4 lines

index 004fd83..481bf77 100644

arch/arm/plat-omap/iovmm.c +0 -0
@@ -199,7 +199,8 @@ static void *vmap_sg(const struct 

sg_table *sgt)

Quoted 21 lines

arch/arm/plat-omap/iovmm.c static void *vmap_sg(const struct · line 203

Quoted 6 lines
arch/arm/plat-omap/iovmm.c +2 -1
 		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.

arch/arm/plat-omap/iovmm.c static void sgtable_fill_vmalloc(struct

Quoted 4 lines
arch/arm/plat-omap/iovmm.c +0 -0
 	return new->addr;
 
 err_out:
@@ -390,7 +391,7 @@ static void sgtable_fill_vmalloc(struct 

sg_table *sgt, void *_va)

Quoted 7 lines
arch/arm/plat-omap/iovmm.c +1 -1
 	}
 
 	va_end = _va + PAGE_SIZE * i;
-	flush_cache_vmap(_va, va_end);
+	flush_cache_vmap((unsigned long) _va, (unsigned long) va_end);
 }
 
Quoted 8 lines
Quoted 3 lines

arch/arm/plat-omap/iovmm.c static void sgtable_fill_vmalloc(struct · line 397

Quoted 1 line
arch/arm/plat-omap/iovmm.c +0 -0
 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

Quoted 40 lines
Quoted 33 lines

Modified arch/arm/plat-omap/iovmm.c

arch/arm/plat-omap/iovmm.c +4 -4
index 6fc52fc..3ea0cd0 100644
@@ -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;

Quoted 1 line

--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Hi Premi,

From: "ext Premi, Sanjeev" <[email protected]>
Subject: RE: [PATCH] OMAP3: iovmm: fix compiler warning
Date: Fri, 18 Sep 2009 16:40:29 +0200

[...]

Quoted 18 lines
Quoted 9 lines
Quoted 9 lines

Review static void sgtable_fill_vmalloc(struct

Quoted 1 line
(quoted diff) +0 -0
@@ -390,7 +391,7 @@ static void sgtable_fill_vmalloc(struct 

sg_table *sgt, void *_va)

Quoted 7 lines
(quoted diff) +1 -1
 	}
 
 	va_end = _va + PAGE_SIZE * i;
-	flush_cache_vmap(_va, va_end);
+	flush_cache_vmap((unsigned long) _va, (unsigned long) va_end);
 }
 
Quoted 8 lines
Quoted 3 lines

Review static void sgtable_fill_vmalloc(struct · line 397

Quoted 1 line
(quoted diff) +0 -0
 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

Quoted 7 lines

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;)

#5 lore raw
Quoted 30 lines · Hiroshi DOYU

Hi Premi,

From: "ext Premi, Sanjeev" <[email protected]>
Subject: RE: [PATCH] OMAP3: iovmm: fix compiler warning
Date: Fri, 18 Sep 2009 16:40:29 +0200

[...]

Quoted 22 lines
Quoted 9 lines
Quoted 9 lines

Review static void sgtable_fill_vmalloc(struct

Quoted 1 line
(quoted diff) +0 -0
@@ -390,7 +391,7 @@ static void sgtable_fill_vmalloc(struct 

sg_table *sgt, void *_va)

Quoted 7 lines
(quoted diff) +1 -1
 	}
 
 	va_end = _va + PAGE_SIZE * i;
-	flush_cache_vmap(_va, va_end);
+	flush_cache_vmap((unsigned long) _va, (unsigned long) va_end);
 }
 
Quoted 8 lines
Quoted 3 lines

Review static void sgtable_fill_vmalloc(struct · line 397

Quoted 1 line
(quoted diff) +0 -0
 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().

Quoted 5 lines
Quoted 3 lines

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

#6 lore raw
Quoted 7 lines

-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Wednesday, September 23, 2009 3:06 AM
To: Hiroshi DOYU
Cc: Premi, Sanjeev; [email protected]
Subject: Re: [PATCH] OMAP3: iovmm: fix compiler warning

Quoted 9 lines
Quoted 8 lines · Hiroshi DOYU

Hi Premi,

From: "ext Premi, Sanjeev" <[email protected]>
Subject: RE: [PATCH] OMAP3: iovmm: fix compiler warning
Date: Fri, 18 Sep 2009 16:40:29 +0200

[...]

[snip]--[snip]

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

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.

Quoted 4 lines

Tony

#7 lore raw

Hi Premi,

From: "ext Premi, Sanjeev" <[email protected]>
Subject: RE: [PATCH] OMAP3: iovmm: fix compiler warning
Date: Wed, 23 Sep 2009 06:06:43 +0200

Quoted 21 lines
Quoted 7 lines

-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Wednesday, September 23, 2009 3:06 AM
To: Hiroshi DOYU
Cc: Premi, Sanjeev; [email protected]
Subject: Re: [PATCH] OMAP3: iovmm: fix compiler warning

Quoted 9 lines
Quoted 8 lines · Hiroshi DOYU

Hi Premi,

From: "ext Premi, Sanjeev" <[email protected]>
Subject: RE: [PATCH] OMAP3: iovmm: fix compiler warning
Date: Fri, 18 Sep 2009 16:40:29 +0200

[...]

[snip]--[snip]

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

Shouldn't we go with the original patch itself?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

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?

#8 lore raw
Quoted 38 lines

-----Original Message-----
From: Hiroshi DOYU [mailto:[email protected]]
Sent: Wednesday, September 23, 2009 11:16 AM
To: Premi, Sanjeev
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] OMAP3: iovmm: fix compiler warning

Hi Premi,

From: "ext Premi, Sanjeev" <[email protected]>
Subject: RE: [PATCH] OMAP3: iovmm: fix compiler warning
Date: Wed, 23 Sep 2009 06:06:43 +0200

Quoted 25 lines
Quoted 7 lines

-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Wednesday, September 23, 2009 3:06 AM
To: Hiroshi DOYU
Cc: Premi, Sanjeev; [email protected]
Subject: Re: [PATCH] OMAP3: iovmm: fix compiler warning

Quoted 9 lines
Quoted 8 lines · Hiroshi DOYU

Hi Premi,

From: "ext Premi, Sanjeev" <[email protected]>
Subject: RE: [PATCH] OMAP3: iovmm: fix compiler warning
Date: Fri, 18 Sep 2009 16:40:29 +0200

[...]

[snip]--[snip]

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

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?

Quoted 10 lines
Quoted 3 lines
Quoted 1 line

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