* [PATCH v2 1/8] OMAP: hwmod: Fix the addr spaces, irq, dma count APIs.
@ 2011-09-09 16:02 sricharan
2011-09-16 15:40 ` Cousson, Benoit
0 siblings, 1 reply; 4+ messages in thread
From: sricharan @ 2011-09-09 16:02 UTC (permalink / raw)
To: linux-omap; +Cc: b-cousson, santosh.shilimkar, paul
The address spaces, irqs and dma reqs count API returns the
number of corresponding entries in a hwmod including a additional
null value or a -1 terminator in the structure introduced
recently. More information here:
212738a4 (omap_hwmod: use a terminator record with omap_hwmod_mpu_irqs arrays)
78183f3f (omap_hwmod: use a null structure record to terminate omap_hwmod_addr_space arrays)
bc614958 (omap_hwmod: use a terminator record with omap_hwmod_dma_info arrays)
The devices which have multiple hwmods and use device_build_ss are
broken with this, as their resources are populated with a
extra null value, subsequently the probe fails. So fix the API not to
include the array terminator in the count.
Signed-off-by: sricharan <r.sricharan@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Kevin Hilman <khilman@ti.com>
---
[v1]
Initial version.
[v2]
1) Added the correction for irq and dma counts along with
addr spaces.
2) Changed the commit log.
arch/arm/mach-omap2/omap_hwmod.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 84cc0bd..c69fbc2 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -745,9 +745,9 @@ static int _count_mpu_irqs(struct omap_hwmod *oh)
if (!oh || !oh->mpu_irqs)
return 0;
- do {
- ohii = &oh->mpu_irqs[i++];
- } while (ohii->irq != -1);
+ ohii = &oh->mpu_irqs[i];
+ while (ohii->irq != -1)
+ ohii = &oh->mpu_irqs[++i];
return i;
}
@@ -768,9 +768,9 @@ static int _count_sdma_reqs(struct omap_hwmod *oh)
if (!oh || !oh->sdma_reqs)
return 0;
- do {
- ohdi = &oh->sdma_reqs[i++];
- } while (ohdi->dma_req != -1);
+ ohdi = &oh->sdma_reqs[i];
+ while (ohdi->dma_req != -1)
+ ohdi = &oh->sdma_reqs[++i];
return i;
}
@@ -791,9 +791,9 @@ static int _count_ocp_if_addr_spaces(struct omap_hwmod_ocp_if *os)
if (!os || !os->addr)
return 0;
- do {
- mem = &os->addr[i++];
- } while (mem->pa_start != mem->pa_end);
+ mem = &os->addr[i];
+ while (mem->pa_start != mem->pa_end)
+ mem = &os->addr[++i];
return i;
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/8] OMAP: hwmod: Fix the addr spaces, irq, dma count APIs.
2011-09-09 16:02 [PATCH v2 1/8] OMAP: hwmod: Fix the addr spaces, irq, dma count APIs sricharan
@ 2011-09-16 15:40 ` Cousson, Benoit
2011-09-18 8:58 ` Santosh
0 siblings, 1 reply; 4+ messages in thread
From: Cousson, Benoit @ 2011-09-16 15:40 UTC (permalink / raw)
To: R, Sricharan
Cc: linux-omap@vger.kernel.org, Shilimkar, Santosh, paul@pswan.com
Hi Sricharan,
On 9/9/2011 6:02 PM, R, Sricharan wrote:
> The address spaces, irqs and dma reqs count API returns the
> number of corresponding entries in a hwmod including a additional
> null value or a -1 terminator in the structure introduced
> recently. More information here:
>
> 212738a4 (omap_hwmod: use a terminator record with omap_hwmod_mpu_irqs arrays)
> 78183f3f (omap_hwmod: use a null structure record to terminate omap_hwmod_addr_space arrays)
> bc614958 (omap_hwmod: use a terminator record with omap_hwmod_dma_info arrays)
>
> The devices which have multiple hwmods and use device_build_ss are
> broken with this, as their resources are populated with a
> extra null value, subsequently the probe fails. So fix the API not to
> include the array terminator in the count.
>
> Signed-off-by: sricharan<r.sricharan@ti.com>
> Signed-off-by: Santosh Shilimkar<santosh.shilimkar@ti.com>
> Cc: Benoit Cousson<b-cousson@ti.com>
> Cc: Paul Walmsley<paul@pwsan.com>
> Cc: Kevin Hilman<khilman@ti.com>
It would have been nice to give me the credit for the bug report on the
other functions, but otherwise:
Acked-by: Benoit Cousson <b-cousson@ti.com>
And I still prefer the return i - 1 :-)
> ---
> [v1]
> Initial version.
> [v2]
> 1) Added the correction for irq and dma counts along with
> addr spaces.
> 2) Changed the commit log.
>
> arch/arm/mach-omap2/omap_hwmod.c | 18 +++++++++---------
> 1 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
> index 84cc0bd..c69fbc2 100644
> --- a/arch/arm/mach-omap2/omap_hwmod.c
> +++ b/arch/arm/mach-omap2/omap_hwmod.c
> @@ -745,9 +745,9 @@ static int _count_mpu_irqs(struct omap_hwmod *oh)
> if (!oh || !oh->mpu_irqs)
> return 0;
>
> - do {
> - ohii =&oh->mpu_irqs[i++];
> - } while (ohii->irq != -1);
> + ohii =&oh->mpu_irqs[i];
> + while (ohii->irq != -1)
> + ohii =&oh->mpu_irqs[++i];
>
> return i;
> }
> @@ -768,9 +768,9 @@ static int _count_sdma_reqs(struct omap_hwmod *oh)
> if (!oh || !oh->sdma_reqs)
> return 0;
>
> - do {
> - ohdi =&oh->sdma_reqs[i++];
> - } while (ohdi->dma_req != -1);
> + ohdi =&oh->sdma_reqs[i];
> + while (ohdi->dma_req != -1)
> + ohdi =&oh->sdma_reqs[++i];
>
> return i;
> }
> @@ -791,9 +791,9 @@ static int _count_ocp_if_addr_spaces(struct omap_hwmod_ocp_if *os)
> if (!os || !os->addr)
> return 0;
>
> - do {
> - mem =&os->addr[i++];
> - } while (mem->pa_start != mem->pa_end);
> + mem =&os->addr[i];
> + while (mem->pa_start != mem->pa_end)
> + mem =&os->addr[++i];
>
> return i;
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/8] OMAP: hwmod: Fix the addr spaces, irq, dma count APIs.
2011-09-16 15:40 ` Cousson, Benoit
@ 2011-09-18 8:58 ` Santosh
2011-09-24 7:53 ` Santosh Shilimkar
0 siblings, 1 reply; 4+ messages in thread
From: Santosh @ 2011-09-18 8:58 UTC (permalink / raw)
To: Cousson, Benoit; +Cc: R, Sricharan, linux-omap@vger.kernel.org, paul@pswan.com
On Friday 16 September 2011 09:10 PM, Cousson, Benoit wrote:
> Hi Sricharan,
>
> On 9/9/2011 6:02 PM, R, Sricharan wrote:
>> The address spaces, irqs and dma reqs count API returns the
>> number of corresponding entries in a hwmod including a additional
>> null value or a -1 terminator in the structure introduced
>> recently. More information here:
>>
>> 212738a4 (omap_hwmod: use a terminator record with
>> omap_hwmod_mpu_irqs arrays)
>> 78183f3f (omap_hwmod: use a null structure record to terminate
>> omap_hwmod_addr_space arrays)
>> bc614958 (omap_hwmod: use a terminator record with
>> omap_hwmod_dma_info arrays)
>>
>> The devices which have multiple hwmods and use device_build_ss are
>> broken with this, as their resources are populated with a
>> extra null value, subsequently the probe fails. So fix the API not to
>> include the array terminator in the count.
>>
>> Signed-off-by: sricharan<r.sricharan@ti.com>
>> Signed-off-by: Santosh Shilimkar<santosh.shilimkar@ti.com>
>> Cc: Benoit Cousson<b-cousson@ti.com>
>> Cc: Paul Walmsley<paul@pwsan.com>
>> Cc: Kevin Hilman<khilman@ti.com>
>
> It would have been nice to give me the credit for the bug report on the
> other functions, but otherwise:
>
Sure. Will add reported-by of yours.
> Acked-by: Benoit Cousson <b-cousson@ti.com>
>
Thanks
> And I still prefer the return i - 1 :-)
>
Let's do "i-1" as you prefer. Maintainer
always have final say !!
Regards,
Santosh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/8] OMAP: hwmod: Fix the addr spaces, irq, dma count APIs.
2011-09-18 8:58 ` Santosh
@ 2011-09-24 7:53 ` Santosh Shilimkar
0 siblings, 0 replies; 4+ messages in thread
From: Santosh Shilimkar @ 2011-09-24 7:53 UTC (permalink / raw)
To: paul@pswan.com; +Cc: Cousson, Benoit, R, Sricharan, linux-omap@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 3686 bytes --]
Paul,
On Sunday 18 September 2011 02:28 PM, Santosh wrote:
> On Friday 16 September 2011 09:10 PM, Cousson, Benoit wrote:
>> Hi Sricharan,
>>
>> On 9/9/2011 6:02 PM, R, Sricharan wrote:
>>> The address spaces, irqs and dma reqs count API returns the
>>> number of corresponding entries in a hwmod including a additional
>>> null value or a -1 terminator in the structure introduced
>>> recently. More information here:
>>>
>>> 212738a4 (omap_hwmod: use a terminator record with
>>> omap_hwmod_mpu_irqs arrays)
>>> 78183f3f (omap_hwmod: use a null structure record to terminate
>>> omap_hwmod_addr_space arrays)
>>> bc614958 (omap_hwmod: use a terminator record with
>>> omap_hwmod_dma_info arrays)
>>>
>>> The devices which have multiple hwmods and use device_build_ss are
>>> broken with this, as their resources are populated with a
>>> extra null value, subsequently the probe fails. So fix the API not to
>>> include the array terminator in the count.
>>>
>>> Signed-off-by: sricharan<r.sricharan@ti.com>
>>> Signed-off-by: Santosh Shilimkar<santosh.shilimkar@ti.com>
>>> Cc: Benoit Cousson<b-cousson@ti.com>
>>> Cc: Paul Walmsley<paul@pwsan.com>
>>> Cc: Kevin Hilman<khilman@ti.com>
>>
>> It would have been nice to give me the credit for the bug report on the
>> other functions, but otherwise:
>>
> Sure. Will add reported-by of yours.
>
>> Acked-by: Benoit Cousson <b-cousson@ti.com>
>>
> Thanks
>
>> And I still prefer the return i - 1 :-)
>>
> Let's do "i-1" as you prefer. Maintainer
> always have final say !!
>
Here is the updated patch with i-1 as agreed
with Benoit. Also attaching it in case mailer
eats spaces.
>From c55f38512e1471b8a9405c2cb45d9377e0c45999 Mon Sep 17 00:00:00 2001
From: sricharan <r.sricharan@ti.com>
Date: Wed, 21 Sep 2011 16:08:46 +0530
Subject: [PATCH 1/8] OMAP: hwmod: Fix the addr space, irq, dma count APIs
The address spaces, irqs and dma reqs count API returns the
number of corresponding entries in a hwmod including a additional
null value or a -1 terminator in the structure introduced
recently. More information here:
- 212738a4 (omap_hwmod: use a terminator record with omap_hwmod_mpu_irqs
arrays)
- 78183f3f (omap_hwmod: use a null structure record to terminate
omap_hwmod_addr_space arrays)
- bc614958 (omap_hwmod: use a terminator record with omap_hwmod_dma_info
arrays)
The issue with irqs and dma info was originally reported by Benoit Cousson.
The devices which have multiple hwmods and use device_build_ss are
broken with this, as their resources are populated with a
extra null value, subsequently the probe fails. So fix the API not to
include the array terminator in the count.
Reported-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: sricharan <r.sricharan@ti.com>
Acked: Benoit Cousson <b-cousson@ti.com>
---
arch/arm/mach-omap2/omap_hwmod.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c
b/arch/arm/mach-omap2/omap_hwmod.c
index 84cc0bd..f396c83 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -749,7 +749,7 @@ static int _count_mpu_irqs(struct omap_hwmod *oh)
ohii = &oh->mpu_irqs[i++];
} while (ohii->irq != -1);
- return i;
+ return i-1;
}
/**
@@ -772,7 +772,7 @@ static int _count_sdma_reqs(struct omap_hwmod *oh)
ohdi = &oh->sdma_reqs[i++];
} while (ohdi->dma_req != -1);
- return i;
+ return i-1;
}
/**
@@ -795,7 +795,7 @@ static int _count_ocp_if_addr_spaces(struct
omap_hwmod_ocp_if *os)
mem = &os->addr[i++];
} while (mem->pa_start != mem->pa_end);
- return i;
+ return i-1;
}
/**
--
1.7.4.1
[-- Attachment #2: 0001-OMAP-hwmod-Fix-the-addr-space-irq-dma-count-APIs.patch --]
[-- Type: text/x-patch, Size: 2047 bytes --]
>From c55f38512e1471b8a9405c2cb45d9377e0c45999 Mon Sep 17 00:00:00 2001
From: sricharan <r.sricharan@ti.com>
Date: Wed, 21 Sep 2011 16:08:46 +0530
Subject: [PATCH 1/8] OMAP: hwmod: Fix the addr space, irq, dma count APIs
The address spaces, irqs and dma reqs count API returns the
number of corresponding entries in a hwmod including a additional
null value or a -1 terminator in the structure introduced
recently. More information here:
- 212738a4 (omap_hwmod: use a terminator record with omap_hwmod_mpu_irqs arrays)
- 78183f3f (omap_hwmod: use a null structure record to terminate omap_hwmod_addr_space arrays)
- bc614958 (omap_hwmod: use a terminator record with omap_hwmod_dma_info arrays)
The issue with irqs and dma info was originally reported by Benoit Cousson.
The devices which have multiple hwmods and use device_build_ss are
broken with this, as their resources are populated with a
extra null value, subsequently the probe fails. So fix the API not to
include the array terminator in the count.
Reported-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: sricharan <r.sricharan@ti.com>
Acked: Benoit Cousson <b-cousson@ti.com>
---
arch/arm/mach-omap2/omap_hwmod.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 84cc0bd..f396c83 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -749,7 +749,7 @@ static int _count_mpu_irqs(struct omap_hwmod *oh)
ohii = &oh->mpu_irqs[i++];
} while (ohii->irq != -1);
- return i;
+ return i-1;
}
/**
@@ -772,7 +772,7 @@ static int _count_sdma_reqs(struct omap_hwmod *oh)
ohdi = &oh->sdma_reqs[i++];
} while (ohdi->dma_req != -1);
- return i;
+ return i-1;
}
/**
@@ -795,7 +795,7 @@ static int _count_ocp_if_addr_spaces(struct omap_hwmod_ocp_if *os)
mem = &os->addr[i++];
} while (mem->pa_start != mem->pa_end);
- return i;
+ return i-1;
}
/**
--
1.7.4.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-09-24 7:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-09 16:02 [PATCH v2 1/8] OMAP: hwmod: Fix the addr spaces, irq, dma count APIs sricharan
2011-09-16 15:40 ` Cousson, Benoit
2011-09-18 8:58 ` Santosh
2011-09-24 7:53 ` Santosh Shilimkar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).