iovmm: fixes for iovmm module
Subsystems (2)
v2 cover iovmm: fixes for iovmm module
iovmm: fixes for iovmm module
Version 2:
* Removed "iovmm: fixes for iovmm module" that patch was already sent.
* Modified "iovmm: fix roundup for next area and end check for the last area" patch, base on Davin Cohen's comments and rename it to a proper name that describes what it is doing now.
Fernando Guzman Lugo (3):
iovmm: no gap checking for fixed address
iovmm: add superpages support to fixed da address
iovmm: replace __iounmap with omap_iounmap
arch/arm/plat-omap/iovmm.c | 67 ++++++++++++++++++++++++++----------------- 1 files changed, 40 insertions(+), 27 deletions(-)
PATCH v2 1/3 iovmm: no gap checking for fixed address
If some fixed da address is wanted to be mapped and the page is freed but it is used as gap, the mapping will fail. This patch is fixing that and olny keeps the gap for not fixed address.
--- arch/arm/plat-omap/iovmm.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/plat-omap/iovmm.c +2 -2
@@ -289,7 +289,7 @@ static struct iovm_struct *alloc_iovm_area(struct iommu *obj, u32 da, prev_end =0 ;list_for_each_entry (tmp, &obj->mmap, list) { -if (prev_end >= start) +if (prev_end > start)break ;if (start + bytes <= tmp->da_start)
@@ -301,7 +301,7 @@ static struct iovm_struct *alloc_iovm_area(struct iommu *obj, u32 da, prev_end = tmp->da_end; } -if ((start > prev_end) && (ULONG_MAX - start >= bytes)) +if ((start >= prev_end) && (ULONG_MAX - start +1 >= bytes)) goto found; dev_dbg(obj->dev, "%s: no space to fit %08x(%x) flags: %08x\n",
Signature · 1 line
1.6.3.3
PATCH v2 2/3 iovmm: add superpages support to fixed da address
This patch adds superpages support to fixed ad address inside iommu_kmap function.
--- arch/arm/plat-omap/iovmm.c | 61 ++++++++++++++++++++++++++----------------- 1 files changed, 37 insertions(+), 24 deletions(-)
arch/arm/plat-omap/iovmm.c +37 -24
@@ -87,27 +87,37 @@ static size_t sgtable_len(const struct sg_table *sgt) }#define sgtable_ok (x) (!!sgtable_len(x)) + +static unsigned max_alignment (u32 addr) +{ +int i; +unsigned pagesize[] = {SZ_16M ,SZ_1M ,SZ_64K ,SZ_4K , }; +for (i =0 ; i <ARRAY_SIZE (pagesize) && addr & (pagesize[i] -1 ); i++) + ; +return (i <ARRAY_SIZE (pagesize)) ? pagesize[i] :0 ; +} + +/* * calculate the optimal number sg elements from total bytes based on * iommu superpages */ -static unsigned int sgtable_nents (size_t bytes) +static unsigned int sgtable_nents (size_t bytes,u32 da,u32 pa) { -int i; -unsigned int nr_entries; -const unsigned long pagesize[] = {SZ_16M ,SZ_1M ,SZ_64K ,SZ_4K , }; +unsigned int nr_entries =0 , ent_sz;if (!IS_ALIGNED (bytes,PAGE_SIZE )) {pr_err ("%s: wrong size %08x\n" , __func__, bytes);return 0 ; } - nr_entries =0 ; -for (i =0 ; i <ARRAY_SIZE (pagesize); i++) { -if (bytes >= pagesize[i]) { - nr_entries += (bytes / pagesize[i]); - bytes %= pagesize[i]; - } +while (bytes) { + ent_sz =max_alignment (da | pa); + ent_sz =min (ent_sz, (unsigned )iopgsz_max (bytes)); + nr_entries++; + da += ent_sz; + pa += ent_sz; + bytes -= ent_sz; }BUG_ON (bytes);
@@ -115,7 +125,8 @@ static unsigned int sgtable_nents(size_t bytes) }/* allocate and initialize sg_table header(a kind of 'superblock') */ -static struct sg_table *sgtable_alloc (const size_t bytes,u32 flags) +static struct sg_table *sgtable_alloc (const size_t bytes,u32 flags, +u32 da,u32 pa) {unsigned int nr_entries;int err;
@@ -127,9 +138,8 @@ static struct sg_table *sgtable_alloc(const size_t bytes, u32 flags)if (!IS_ALIGNED (bytes,PAGE_SIZE ))return ERR_PTR (-EINVAL ); -/* FIXME: IOVMF_DA_FIXED should support 'superpages' */ -if ((flags &IOVMF_LINEAR ) && (flags &IOVMF_DA_ANON )) { - nr_entries =sgtable_nents (bytes); +if (flags &IOVMF_LINEAR ) { + nr_entries =sgtable_nents (bytes, da, pa);if (!nr_entries)return ERR_PTR (-EINVAL ); }else
@@ -409,7 +419,8 @@ static inline void sgtable_drain_vmalloc(struct sg_table *sgt)BUG_ON (!sgt); } -static void sgtable_fill_kmalloc (struct sg_table *sgt,u32 pa,size_t len) +static void sgtable_fill_kmalloc (struct sg_table *sgt,u32 pa,u32 da, +size_t len) {unsigned int i;struct scatterlist *sg;
@@ -420,7 +431,8 @@ static void sgtable_fill_kmalloc(struct sg_table *sgt, u32 pa, size_t len)for_each_sg (sgt->sgl, sg, sgt->nents, i) {size_t bytes; - bytes =iopgsz_max (len); + bytes =max_alignment (da | pa); + bytes =min (bytes, (size_t )iopgsz_max (len));BUG_ON (!iopgsz_ok (bytes));
@@ -429,6 +441,7 @@ static void sgtable_fill_kmalloc(struct sg_table *sgt, u32 pa, size_t len)* 'pa' is cotinuous(linear). */ pa += bytes; + da += bytes; len -= bytes; }BUG_ON (len);
@@ -695,18 +708,18 @@ u32 iommu_vmalloc(struct iommu *obj, u32 da, size_t bytes, u32 flags)if (!va)return -ENOMEM ; - sgt =sgtable_alloc (bytes, flags); + flags &=IOVMF_HW_MASK ; + flags |=IOVMF_DISCONT ; + flags |=IOVMF_ALLOC ; + flags |= (da ?IOVMF_DA_FIXED :IOVMF_DA_ANON ); + + sgt =sgtable_alloc (bytes, flags, da,0 );if (IS_ERR (sgt)) { da =PTR_ERR (sgt); goto err_sgt_alloc; }sgtable_fill_vmalloc (sgt, va); - flags &=IOVMF_HW_MASK ; - flags |=IOVMF_DISCONT ; - flags |=IOVMF_ALLOC ; - flags |= (da ?IOVMF_DA_FIXED :IOVMF_DA_ANON ); - da =__iommu_vmap (obj, da, sgt, va, bytes, flags);if (IS_ERR_VALUE (da)) goto err_iommu_vmap;
@@ -746,11 +759,11 @@ static u32 __iommu_kmap(struct iommu *obj, u32 da, u32 pa, void *va, {struct sg_table *sgt; - sgt =sgtable_alloc (bytes, flags); + sgt =sgtable_alloc (bytes, flags, da, pa);if (IS_ERR (sgt))return PTR_ERR (sgt); -sgtable_fill_kmalloc (sgt, pa, bytes); +sgtable_fill_kmalloc (sgt, pa, da, bytes); da =map_iommu_region (obj, da, sgt, va, bytes, flags);if (IS_ERR_VALUE (da)) {
Signature · 1 line
1.6.3.3
PATCH v2 3/3 iovmm: replace __iounmap with omap_iounmap
Omap platform is omap_iounmap function.
--- arch/arm/plat-omap/iovmm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/plat-omap/iovmm.c +1 -1
@@ -824,7 +824,7 @@ void iommu_kunmap(struct iommu *obj, u32 da)struct sg_table *sgt;typedef void (*func_t )(const void *); - sgt =unmap_vm_area (obj, da, (func_t )__iounmap, + sgt =unmap_vm_area (obj, da, (func_t )omap_iounmap,IOVMF_LINEAR |IOVMF_MMIO );if (!sgt)dev_dbg (obj->dev,"%s: No sgt\n" , __func__);
Signature · 1 line
1.6.3.3
Re: [PATCHv2 2/3] iovmm: add superpages support to fixed da address
In reply to Fernando Guzman LugoQuoted 17 lines · Fernando Guzman Lugo
This patch adds superpages support to fixed ad address inside
iommu_kmapfunction.Signed-off-by Fernando Guzman Lugo <[email protected]>---
arch/arm/plat-omap/iovmm.c | 61 ++++++++++++++++++++++++++-----------------1 files changed, 37 insertions(+), 24 deletions(-)arch/arm/plat-omap/iovmm.c +1
-0@@ -87,27 +87,37 @@ static size_t sgtable_len(const struct sg_table *sgt) } #define sgtable_ok(x) (!!sgtable_len(x)) +
arch/arm/plat-omap/iovmm.c static size_t sgtable_len(const struct sg_table *sgt) · line 100
Quoted 10 lines
arch/arm/plat-omap/iovmm.c +10
-0+static unsigned max_alignment (u32 addr) +{ + int i; + unsigned pagesize[] = { SZ_16M, SZ_1M, SZ_64K, SZ_4K, }; + for (i = 0; i < ARRAY_SIZE(pagesize) && addr & (pagesize[i] - 1); i++) + ; + return (i < ARRAY_SIZE(pagesize)) ? pagesize[i] : 0; +} + +
I don't think those extra spaces make sense.
arch/arm/plat-omap/iovmm.c static size_t sgtable_len(const struct sg_table *sgt) · line 107
Quoted 11 lines
arch/arm/plat-omap/iovmm.c +2
-4/** calculate the optimal number sg elements from total bytes based on * iommu superpages */ -static unsigned int sgtable_nents (size_t bytes) +static unsigned int sgtable_nents (size_t bytes,u32 da,u32 pa) { - int i; - unsigned int nr_entries; - const unsigned long pagesize[] = { SZ_16M, SZ_1M, SZ_64K, SZ_4K, }; + unsigned int nr_entries = 0, ent_sz;
How about s/unsigned int/unsigned/?
Quoted 55 lines
arch/arm/plat-omap/iovmm.c +13
-11if (!IS_ALIGNED(bytes, PAGE_SIZE)) { pr_err("%s: wrong size %08x\n", __func__, bytes); return 0; } - nr_entries = 0; - for (i = 0; i < ARRAY_SIZE(pagesize); i++) { - if (bytes >= pagesize[i]) { - nr_entries += (bytes / pagesize[i]); - bytes %= pagesize[i]; - } + while (bytes) { + ent_sz = max_alignment(da | pa); + ent_sz = min(ent_sz, (unsigned)iopgsz_max(bytes)); + nr_entries++; + da += ent_sz; + pa += ent_sz; + bytes -= ent_sz; } BUG_ON(bytes);@@ -115,7 +125,8 @@ static unsigned int sgtable_nents(size_t bytes) } /* allocate and initialize sg_table header(a kind of 'superblock') */ -static struct sg_table *sgtable_alloc (const size_t bytes,u32 flags) +static struct sg_table *sgtable_alloc (const size_t bytes,u32 flags, + u32 da, u32 pa) { unsigned int nr_entries; int err;@@ -127,9 +138,8 @@ static struct sg_table *sgtable_alloc(const size_t bytes, u32 flags) if (!IS_ALIGNED(bytes, PAGE_SIZE)) return ERR_PTR(-EINVAL); - /* FIXME: IOVMF_DA_FIXED should support 'superpages' */ - if ((flags & IOVMF_LINEAR) && (flags & IOVMF_DA_ANON)) { - nr_entries = sgtable_nents(bytes); + if (flags & IOVMF_LINEAR) { + nr_entries = sgtable_nents(bytes, da, pa); if (!nr_entries) return ERR_PTR(-EINVAL); } else@@ -409,7 +419,8 @@ static inline void sgtable_drain_vmalloc(struct sg_table *sgt) BUG_ON(!sgt); } -static void sgtable_fill_kmalloc (struct sg_table *sgt,u32 pa,size_t len) +static void sgtable_fill_kmalloc (struct sg_table *sgt,u32 pa,u32 da, + size_t len) { unsigned int i; struct scatterlist *sg;
arch/arm/plat-omap/iovmm.c static void sgtable_fill_kmalloc(struct sg_table *sgt, u32 pa, size_t len) · line 435
Quoted 6 lines
arch/arm/plat-omap/iovmm.c +2
-1@@ -420,7 +431,8 @@ static void sgtable_fill_kmalloc(struct sg_table *sgt, u32 pa, size_t len) for_each_sg(sgt->sgl, sg, sgt->nents, i) { size_t bytes; - bytes = iopgsz_max(len); + bytes = max_alignment(da | pa); + bytes = min(bytes, (size_t)iopgsz_max(len));
Why the size_t casting?
Otherwise:
Signature · 1 line
Felipe Contreras
RE: [PATCHv2 2/3] iovmm: add superpages support to fixed da address
Quoted 40 lines
-----Original Message-----
From: Felipe Contreras [mailto:[email protected]]
Sent: Sunday, October 10, 2010 10:22 AM
To: Guzman Lugo, Fernando
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCHv2 2/3] iovmm: add superpages support to fixed da addressReview
Quoted 10 lines · Fernando Guzman Lugo
This patch adds superpages support to fixed ad address inside
iommu_kmapfunction.Signed-off-by Fernando Guzman Lugo <[email protected]>---
arch/arm/plat-omap/iovmm.c | 61
++++++++++++++++++++++++++-----------------1 files changed, 37 insertions(+), 24 deletions(-)(quoted diff) +0
-0
b/arch/arm/plat-omap/iovmm.carch/arm/plat-omap/iovmm.c static size_t sgtable_len(const struct sg_table · line 95
Quoted 13 lines
index 34f0012..8006a19 100644
arch/arm/plat-omap/iovmm.c +5
-0@@ -87,27 +87,37 @@ static size_t sgtable_len(const struct sg_table *sgt) } #define sgtable_ok(x) (!!sgtable_len(x)) + +static unsigned max_alignment(u32 addr) { + int i; + unsigned pagesize[] = { SZ_16M, SZ_1M, SZ_64K, SZ_4K, }; + for (i = 0; i < ARRAY_SIZE(pagesize) && addr &(pagesize[i] -
Quoted 7 lines
arch/arm/plat-omap/iovmm.c static size_t sgtable_len(const struct sg_table *sgt) · line 100
Quoted 5 lines
arch/arm/plat-omap/iovmm.c +5
-0+1); i++) + ; + return (i < ARRAY_SIZE(pagesize)) ? pagesize[i] : 0; } + +I don't think those extra spaces make sense.
Ok, it will be fixed.
Quoted 4 lines
arch/arm/plat-omap/iovmm.c static size_t sgtable_len(const struct sg_table · line 102
Quoted 3 lines
arch/arm/plat-omap/iovmm.c +0
-0/** calculate the optimal number sg elements from total bytes based on
Quoted 12 lines
arch/arm/plat-omap/iovmm.c static size_t sgtable_len(const struct sg_table *sgt) · line 107
Quoted 10 lines
arch/arm/plat-omap/iovmm.c +2
-4* iommu superpages */ -static unsigned int sgtable_nents (size_t bytes) +static unsigned int sgtable_nents (size_t bytes,u32 da,u32 pa) { - int i; - unsigned int nr_entries; - const unsigned long pagesize[] = { SZ_16M, SZ_1M, SZ_64K, SZ_4K, }; + unsigned int nr_entries = 0, ent_sz;How about s/unsigned int/unsigned/?
It is exactly the same, but not problem for me.
Quoted 73 lines
Quoted 24 lines
arch/arm/plat-omap/iovmm.c +7
-6if (!IS_ALIGNED(bytes, PAGE_SIZE)) { pr_err("%s: wrong size %08x\n", __func__, bytes); return 0; } - nr_entries = 0; - for (i = 0; i < ARRAY_SIZE(pagesize); i++) { - if (bytes >= pagesize[i]) { - nr_entries += (bytes / pagesize[i]); - bytes %= pagesize[i]; - } + while (bytes) { + ent_sz = max_alignment(da | pa); + ent_sz = min(ent_sz, (unsigned)iopgsz_max(bytes)); + nr_entries++; + da += ent_sz; + pa += ent_sz; + bytes -= ent_sz; } BUG_ON(bytes);arch/arm/plat-omap/iovmm.c static unsigned int sgtable_nents(size_t bytes) · line 127
Quoted 3 lines
arch/arm/plat-omap/iovmm.c +0
-0@@ -115,7 +125,8 @@ static unsigned int sgtable_nents(size_t bytes) } /* allocate and initialize sg_table header(a kind of'superblock') */
arch/arm/plat-omap/iovmm.c static unsigned int sgtable_nents(size_t bytes) · line 118
Quoted 1 line
arch/arm/plat-omap/iovmm.c +0
-1-static struct sg_table *sgtable_alloc(const size_t bytes,u32 flags)
arch/arm/plat-omap/iovmm.c static unsigned int sgtable_nents(size_t bytes) · line 128
Quoted 1 line
arch/arm/plat-omap/iovmm.c +1
-0+static struct sg_table *sgtable_alloc(const size_t bytes,u32 flags,
arch/arm/plat-omap/iovmm.c static struct sg_table
Quoted 6 lines
arch/arm/plat-omap/iovmm.c +2
-0+ u32 da, u32 +pa) { unsigned int nr_entries;int err;
arch/arm/plat-omap/iovmm.c +0
-0@@ -127,9 +138,8 @@ static struct sg_table*sgtable_alloc(const
size_tQuoted 13 lines
arch/arm/plat-omap/iovmm.c +2
-3bytes, u32 flags) if (!IS_ALIGNED(bytes, PAGE_SIZE)) return ERR_PTR(-EINVAL); - /* FIXME: IOVMF_DA_FIXED should support 'superpages' */ - if ((flags & IOVMF_LINEAR) && (flags & IOVMF_DA_ANON)) { - nr_entries = sgtable_nents(bytes); + if (flags & IOVMF_LINEAR) { + nr_entries = sgtable_nents(bytes, da, pa); if (!nr_entries) return ERR_PTR(-EINVAL);} else
arch/arm/plat-omap/iovmm.c static inline void sgtable_drain_vmalloc(struct · line 413
Quoted 5 lines
arch/arm/plat-omap/iovmm.c +0
-1@@ -409,7 +419,8 @@ static inline void sgtable_drain_vmalloc(struct sg_table *sgt) BUG_ON(!sgt); } -static void sgtable_fill_kmalloc(struct sg_table *sgt, u32pa,
size_tarch/arm/plat-omap/iovmm.c static inline void sgtable_drain_vmalloc(struct · line 426
Quoted 4 lines
arch/arm/plat-omap/iovmm.c +3
-0len) +static void sgtable_fill_kmalloc(struct sg_table *sgt, u32 pa, u32 +da, +
size_tarch/arm/plat-omap/iovmm.c static void sgtable_fill_kmalloc(struct
Quoted 5 lines
+len)
{
unsigned int i;
struct scatterlist *sg;arch/arm/plat-omap/iovmm.c +0
-0@@ -420,7 +431,8 @@ static void sgtable_fill_kmalloc(struct
sg_tableQuoted 4 lines
arch/arm/plat-omap/iovmm.c +0
-0*sgt, u32 pa, size_t len) for_each_sg(sgt->sgl, sg, sgt->nents, i) { size_t bytes;
Quoted 5 lines
arch/arm/plat-omap/iovmm.c static void sgtable_fill_kmalloc(struct sg_table *sgt, u32 pa, size_t len) · line 435
Quoted 3 lines
arch/arm/plat-omap/iovmm.c +2
-1- bytes = iopgsz_max(len); + bytes = max_alignment(da | pa); + bytes = min(bytes, (size_t)iopgsz_max(len));Why the
size_tcasting?
To void this warning:arch/arm/plat-omap/iovmm.c:440: warning: comparison of distinct pointer types lacks a cast
I will update with minor changes and resend.
Thanks and regards,
Fernando.
Quoted 7 lines
Otherwise:
Signed-off-by Felipe Contreras <[email protected]>--
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCHv2 2/3] iovmm: add superpages support to fixed da address
Quoted 6 lines · Fernando
Quoted 6 lines
Review static void sgtable_fill_kmalloc(struct
Quoted 1 line
(quoted diff) +0
-0@@ -420,7 +431,8 @@ static void sgtable_fill_kmalloc(struct
sg_tableQuoted 4 lines
arch/arm/plat-omap/iovmm.c +0
-0*sgt, u32 pa, size_t len) for_each_sg(sgt->sgl, sg, sgt->nents, i) { size_t bytes;
Quoted 8 lines
Quoted 5 lines
arch/arm/plat-omap/iovmm.c static void sgtable_fill_kmalloc(struct sg_table *sgt, u32 pa, size_t len) · line 435
Quoted 3 lines
arch/arm/plat-omap/iovmm.c +2
-1- bytes = iopgsz_max(len); + bytes = max_alignment(da | pa); + bytes = min(bytes, (size_t)iopgsz_max(len));Why the
size_tcasting?To void this warning:
arch/arm/plat-omap/iovmm.c:440: warning: comparison of distinct pointer types lacks a cast
But how is that possible? iopgsz_max is returning constants, like SZ_1M, so they should not need casts, if anything, the cast should be done in iopgsz_max itself.
Signature · 5 lines
Felipe Contreras -- 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
RE: [PATCHv2 2/3] iovmm: add superpages support to fixed da address
Quoted 27 lines
-----Original Message-----
From: Felipe Contreras [mailto:[email protected]]
Sent: Tuesday, October 12, 2010 6:09 AM
To: Guzman Lugo, Fernando
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCHv2 2/3] iovmm: add superpages support to fixed da addressQuoted 12 lines · Fernando
Quoted 11 lines
Review static void sgtable_fill_kmalloc(struct
Quoted 1 line
(quoted diff) +0
-0@@ -420,7 +431,8 @@ static void sgtable_fill_kmalloc(struct
sg_tablearch/arm/plat-omap/iovmm.c static void sgtable_fill_kmalloc(struct sg_table *sgt, u32 pa, size_t len) · line 435
Quoted 7 lines
arch/arm/plat-omap/iovmm.c +2
-1*sgt, u32 pa, size_t len) for_each_sg(sgt->sgl, sg, sgt->nents, i) { size_t bytes; - bytes = iopgsz_max(len); + bytes = max_alignment(da | pa); + bytes = min(bytes, (size_t)iopgsz_max(len));Why the
size_tcasting?
Quoted 7 lines
Quoted 3 lines
To void this warning:
arch/arm/plat-omap/iovmm.c:440: warning: comparison of distinct pointer types lacks a castBut how is that possible?
iopgsz_maxis returning constants, likeSZ_1M, so they should not need casts, if anything, the cast should be done iniopgsz_maxitself.
The min macro make a "typeof" of the parameter, so the typeof of a Constants should be int I think and that's the reason of the warning.
I can use min_t instead to avoid the warning, something like this:
bytes = min_t(size_t, bytes, iopgsz_max(len));
What do you think?
Regards,
Fernando.
Quoted 4 lines
--
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCHv2 2/3] iovmm: add superpages support to fixed da address
Quoted 22 lines · [email protected] wrote:
Quoted 14 lines
Quoted 12 lines · Fernando
Quoted 11 lines
Review static void sgtable_fill_kmalloc(struct
Quoted 1 line
(quoted diff) +0
-0@@ -420,7 +431,8 @@ static void sgtable_fill_kmalloc(struct
sg_tableReview static void sgtable_fill_kmalloc(struct · line 436
Quoted 7 lines
(quoted diff) +2
-1*sgt, u32 pa, size_t len) Â Â Â Â for_each_sg(sgt->sgl, sg, sgt->nents, i) { Â Â Â Â Â Â Â Â size_t bytes; - Â Â Â Â Â Â Â bytes = iopgsz_max(len); + Â Â Â Â Â Â Â bytes = max_alignment(da | pa); + Â Â Â Â Â Â Â bytes = min(bytes, (size_t)iopgsz_max(len));Why the
size_tcasting?Quoted 7 lines
Quoted 3 lines
To void this warning:
arch/arm/plat-omap/iovmm.c:440: warning: comparison of distinct pointer types lacks a castBut how is that possible?
iopgsz_maxis returning constants, likeSZ_1M, so they should not need casts, if anything, the cast should be done iniopgsz_maxitself.
Quoted 8 lines
The min macro make a "typeof" of the parameter, so the typeof of a Constants should be int I think and that's the reason of the warning.
I can use
min_tinstead to avoid the warning, something like this:bytes = min_t(size_t, bytes, iopgsz_max(len));What do you think?
Right, I forgot about that one... much better.
Signature · 1 line
Felipe Contreras