All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: pxa: irq: fix handling of ICMR registers in suspend/resume
@ 2018-07-06 20:15 Daniel Mack
  2018-07-06 21:28 ` Robert Jarzmik
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Mack @ 2018-07-06 20:15 UTC (permalink / raw)
  To: linux-arm-kernel

PXA3xx platforms have 56 interrupts that are stored in two ICMR
registers. The code in pxa_irq_suspend() and pxa_irq_resume() however
does a simple division by 32 which only leads to one register being
saved at suspend and restored at resume time. The NAND interrupt
setting, for instance, is lost.

Fix this by using DIV_ROUND_UP() instead.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 arch/arm/mach-pxa/irq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index 9c10248fadcc..4e8c2116808e 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -185,7 +185,7 @@ static int pxa_irq_suspend(void)
 {
 	int i;
 
-	for (i = 0; i < pxa_internal_irq_nr / 32; i++) {
+	for (i = 0; i < DIV_ROUND_UP(pxa_internal_irq_nr, 32); i++) {
 		void __iomem *base = irq_base(i);
 
 		saved_icmr[i] = __raw_readl(base + ICMR);
@@ -204,7 +204,7 @@ static void pxa_irq_resume(void)
 {
 	int i;
 
-	for (i = 0; i < pxa_internal_irq_nr / 32; i++) {
+	for (i = 0; i < DIV_ROUND_UP(pxa_internal_irq_nr, 32); i++) {
 		void __iomem *base = irq_base(i);
 
 		__raw_writel(saved_icmr[i], base + ICMR);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] ARM: pxa: irq: fix handling of ICMR registers in suspend/resume
  2018-07-06 20:15 [PATCH] ARM: pxa: irq: fix handling of ICMR registers in suspend/resume Daniel Mack
@ 2018-07-06 21:28 ` Robert Jarzmik
  2018-07-06 22:08   ` Daniel Mack
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Jarzmik @ 2018-07-06 21:28 UTC (permalink / raw)
  To: linux-arm-kernel

Daniel Mack <daniel@zonque.org> writes:

> PXA3xx platforms have 56 interrupts that are stored in two ICMR
> registers. The code in pxa_irq_suspend() and pxa_irq_resume() however
> does a simple division by 32 which only leads to one register being
> saved at suspend and restored at resume time. The NAND interrupt
> setting, for instance, is lost.
>
> Fix this by using DIV_ROUND_UP() instead.
>
> Signed-off-by: Daniel Mack <daniel@zonque.org>
> ---
>  arch/arm/mach-pxa/irq.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
> index 9c10248fadcc..4e8c2116808e 100644
> --- a/arch/arm/mach-pxa/irq.c
> +++ b/arch/arm/mach-pxa/irq.c
> @@ -185,7 +185,7 @@ static int pxa_irq_suspend(void)
>  {
>  	int i;
>  
> -	for (i = 0; i < pxa_internal_irq_nr / 32; i++) {
> +	for (i = 0; i < DIV_ROUND_UP(pxa_internal_irq_nr, 32); i++) {
Okay, I get it.  Still, something tells me saved_icmr deserves some love too,
even if the result in the end won't change, it's just for corectness sake.

Of course, while@it I wonder if we couldn't have :
 - pxa_init_irq_common()
 - a kmalloc_array() or similar for saved_icmr[] and saved_ipr[]
That could be in this patch or another one ...

Cheers.

-- 
Robert

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] ARM: pxa: irq: fix handling of ICMR registers in suspend/resume
  2018-07-06 21:28 ` Robert Jarzmik
@ 2018-07-06 22:08   ` Daniel Mack
  2018-07-07 19:29     ` Robert Jarzmik
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Mack @ 2018-07-06 22:08 UTC (permalink / raw)
  To: linux-arm-kernel



On 07/06/2018 11:28 PM, Robert Jarzmik wrote:
> Daniel Mack <daniel@zonque.org> writes:
> 
>> PXA3xx platforms have 56 interrupts that are stored in two ICMR
>> registers. The code in pxa_irq_suspend() and pxa_irq_resume() however
>> does a simple division by 32 which only leads to one register being
>> saved at suspend and restored at resume time. The NAND interrupt
>> setting, for instance, is lost.
>>
>> Fix this by using DIV_ROUND_UP() instead.
>>
>> Signed-off-by: Daniel Mack <daniel@zonque.org>
>> ---
>>  arch/arm/mach-pxa/irq.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
>> index 9c10248fadcc..4e8c2116808e 100644
>> --- a/arch/arm/mach-pxa/irq.c
>> +++ b/arch/arm/mach-pxa/irq.c
>> @@ -185,7 +185,7 @@ static int pxa_irq_suspend(void)
>>  {
>>  	int i;
>>  
>> -	for (i = 0; i < pxa_internal_irq_nr / 32; i++) {
>> +	for (i = 0; i < DIV_ROUND_UP(pxa_internal_irq_nr, 32); i++) {
> Okay, I get it.  Still, something tells me saved_icmr deserves some love too,
> even if the result in the end won't change, it's just for corectness sake.
> 
> Of course, while at it I wonder if we couldn't have :
>  - pxa_init_irq_common()
>  - a kmalloc_array() or similar for saved_icmr[] and saved_ipr[]
> That could be in this patch or another one ...

I'd rather do it in a separate patch then and leave this one as-is.


Thanks,
Daniel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] ARM: pxa: irq: fix handling of ICMR registers in suspend/resume
  2018-07-06 22:08   ` Daniel Mack
@ 2018-07-07 19:29     ` Robert Jarzmik
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Jarzmik @ 2018-07-07 19:29 UTC (permalink / raw)
  To: linux-arm-kernel

Daniel Mack <daniel@zonque.org> writes:

> I'd rather do it in a separate patch then and leave this one as-is.
Queued to pxa/fixes.

Cheers.

-- 
Robert

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-07 19:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-06 20:15 [PATCH] ARM: pxa: irq: fix handling of ICMR registers in suspend/resume Daniel Mack
2018-07-06 21:28 ` Robert Jarzmik
2018-07-06 22:08   ` Daniel Mack
2018-07-07 19:29     ` Robert Jarzmik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.