All of lore.kernel.org
 help / color / mirror / Atom feed
* Add IRQS_PENDING for nested and simple irq handler as well
@ 2012-05-21 16:48 Ning Jiang
  2012-05-21 21:12 ` Thomas Gleixner
  0 siblings, 1 reply; 9+ messages in thread
From: Ning Jiang @ 2012-05-21 16:48 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: rjw, linux-kernel

>From eb72d4c573b482f85b227558deca297d8a8de1df Mon Sep 17 00:00:00 2001
From: Ning Jiang <ning.n.jiang@gmail.com>
Date: Tue, 22 May 2012 00:19:20 +0800
Subject: [PATCH] genirq: Add IRQS_PENDING for nested and simple irq
handler as well

Usually nested and simple irq act as second level in interrupt
distribution tree, in suspend, we need to keep first level irq
functional by irq flag IRQF_NO_SUSPEND and check the 'pending'
state in the second level.

More information can be found in the log of commit:

commit d4dc0f90d243fb54cfbca6601c9a7c5a758e437f
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Wed Apr 25 12:54:54 2012 +0200

    genirq: Allow check_wakeup_irqs to notice level-triggered interrupts

Signed-off-by: Ning Jiang <ning.n.jiang@gmail.com>
---
 kernel/irq/chip.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 741f836..5bec667 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -275,8 +275,10 @@ void handle_nested_irq(unsigned int irq)
 	kstat_incr_irqs_this_cpu(irq, desc);

 	action = desc->action;
-	if (unlikely(!action || irqd_irq_disabled(&desc->irq_data)))
+	if (unlikely(!action || irqd_irq_disabled(&desc->irq_data))) {
+		desc->istate |= IRQS_PENDING;
 		goto out_unlock;
+	}

 	irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
 	raw_spin_unlock_irq(&desc->lock);
@@ -324,8 +326,10 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
 	desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
 	kstat_incr_irqs_this_cpu(irq, desc);

-	if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data)))
+	if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data))) {
+		desc->istate |= IRQS_PENDING;
 		goto out_unlock;
+	}

 	handle_irq_event(desc);

-- 
1.7.1

Thanks,
Ning

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

* Re: Add IRQS_PENDING for nested and simple irq handler as well
  2012-05-21 16:48 Add IRQS_PENDING for nested and simple irq handler as well Ning Jiang
@ 2012-05-21 21:12 ` Thomas Gleixner
  2012-05-22  6:00   ` Ning Jiang
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Gleixner @ 2012-05-21 21:12 UTC (permalink / raw)
  To: Ning Jiang; +Cc: rjw, linux-kernel

On Tue, 22 May 2012, Ning Jiang wrote:

> >From eb72d4c573b482f85b227558deca297d8a8de1df Mon Sep 17 00:00:00 2001
> From: Ning Jiang <ning.n.jiang@gmail.com>
> Date: Tue, 22 May 2012 00:19:20 +0800
> Subject: [PATCH] genirq: Add IRQS_PENDING for nested and simple irq
> handler as well
> 
> Usually nested and simple irq act as second level in interrupt
> distribution tree, in suspend, we need to keep first level irq
> functional by irq flag IRQF_NO_SUSPEND and check the 'pending'
> state in the second level.
> 
> More information can be found in the log of commit:

Please provide a proper explanation why you think that handling the
flag for those interrupts is important as well, rather than refering
to an explanation of something different.
 
Thanks,

	tglx

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

* Re: Add IRQS_PENDING for nested and simple irq handler as well
  2012-05-21 21:12 ` Thomas Gleixner
@ 2012-05-22  6:00   ` Ning Jiang
  2012-05-22  8:49     ` Thomas Gleixner
  0 siblings, 1 reply; 9+ messages in thread
From: Ning Jiang @ 2012-05-22  6:00 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: rjw, linux-kernel

Sorry that I do not make myself clear.

First, we should keep all the handle_*_irq behave in pretty much the
same way even just for the beauty of it. Every interrupt disabled in
suspend operation needs the ability to abort suspend if there is a
pending irq.

Second, let's take look at a example:

              |
       +---------+
        |   INTC  |
       +---------+
                  |  GPIO_IRQ
            +------------+
             | gpio-exp  |
            +------------+
               |            |
   GPIO0_IRQ  GPIO1_IRQ

In the above diagram, gpio expander has irq number GPIO_IRQ, it is
connected with two sub GPIO pins, GPIO0 and GPIO1.

During suspend, normally we want to set IRQF_NO_SUSPEND for GPIO_IRQ
so that gpio expander driver can handle the sub irq GPIO0_IRQ and
GPIO1_IRQ, and these two irqs themselves are handled by simple or
nested irq in some drivers(typically gpio and mfd driver), if they are
disabled during suspend, we want them to be able to abort suspend too.

2012/5/22 Thomas Gleixner <tglx@linutronix.de>:
> On Tue, 22 May 2012, Ning Jiang wrote:
>
>> >From eb72d4c573b482f85b227558deca297d8a8de1df Mon Sep 17 00:00:00 2001
>> From: Ning Jiang <ning.n.jiang@gmail.com>
>> Date: Tue, 22 May 2012 00:19:20 +0800
>> Subject: [PATCH] genirq: Add IRQS_PENDING for nested and simple irq
>> handler as well
>>
>> Usually nested and simple irq act as second level in interrupt
>> distribution tree, in suspend, we need to keep first level irq
>> functional by irq flag IRQF_NO_SUSPEND and check the 'pending'
>> state in the second level.
>>
>> More information can be found in the log of commit:
>
> Please provide a proper explanation why you think that handling the
> flag for those interrupts is important as well, rather than refering
> to an explanation of something different.
>
> Thanks,
>
>        tglx

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

* Re: Add IRQS_PENDING for nested and simple irq handler as well
  2012-05-22  6:00   ` Ning Jiang
@ 2012-05-22  8:49     ` Thomas Gleixner
  2012-05-22 11:14       ` Ning Jiang
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Gleixner @ 2012-05-22  8:49 UTC (permalink / raw)
  To: Ning Jiang; +Cc: rjw, linux-kernel

On Tue, 22 May 2012, Ning Jiang wrote:

Please do not top post.

> Sorry that I do not make myself clear.
> 
> First, we should keep all the handle_*_irq behave in pretty much the
> same way even just for the beauty of it. Every interrupt disabled in
> suspend operation needs the ability to abort suspend if there is a
> pending irq.
> 
> Second, let's take look at a example:
> 
>               |
>        +---------+
>         |   INTC  |
>        +---------+
>                   |  GPIO_IRQ
>             +------------+
>              | gpio-exp  |
>             +------------+
>                |            |
>    GPIO0_IRQ  GPIO1_IRQ
> 
> In the above diagram, gpio expander has irq number GPIO_IRQ, it is
> connected with two sub GPIO pins, GPIO0 and GPIO1.
> 
> During suspend, normally we want to set IRQF_NO_SUSPEND for GPIO_IRQ
> so that gpio expander driver can handle the sub irq GPIO0_IRQ and
> GPIO1_IRQ, and these two irqs themselves are handled by simple or
> nested irq in some drivers(typically gpio and mfd driver), if they are
> disabled during suspend, we want them to be able to abort suspend too.

Ok, that makes a lot of sense and should be part of the changelog, so
we know in a year from now why we did this change. Care to resend with
a fixed up changelog ?

Thanks,

	tglx

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

* Re: Add IRQS_PENDING for nested and simple irq handler as well
  2012-05-22  8:49     ` Thomas Gleixner
@ 2012-05-22 11:14       ` Ning Jiang
  2012-05-23 16:02         ` Ning Jiang
  2012-05-24 20:52         ` [tip:irq/core] genirq: Add IRQS_PENDING for nested and simple irq tip-bot for Ning Jiang
  0 siblings, 2 replies; 9+ messages in thread
From: Ning Jiang @ 2012-05-22 11:14 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: rjw, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 4141 bytes --]

2012/5/22 Thomas Gleixner <tglx@linutronix.de>:
> On Tue, 22 May 2012, Ning Jiang wrote:
>
> Please do not top post.
>
>> Sorry that I do not make myself clear.
>>
>> First, we should keep all the handle_*_irq behave in pretty much the
>> same way even just for the beauty of it. Every interrupt disabled in
>> suspend operation needs the ability to abort suspend if there is a
>> pending irq.
>>
>> Second, let's take look at a example:
>>
>>               |
>>        +---------+
>>         |   INTC  |
>>        +---------+
>>                   |  GPIO_IRQ
>>             +------------+
>>              | gpio-exp  |
>>             +------------+
>>                |            |
>>    GPIO0_IRQ  GPIO1_IRQ
>>
>> In the above diagram, gpio expander has irq number GPIO_IRQ, it is
>> connected with two sub GPIO pins, GPIO0 and GPIO1.
>>
>> During suspend, normally we want to set IRQF_NO_SUSPEND for GPIO_IRQ
>> so that gpio expander driver can handle the sub irq GPIO0_IRQ and
>> GPIO1_IRQ, and these two irqs themselves are handled by simple or
>> nested irq in some drivers(typically gpio and mfd driver), if they are
>> disabled during suspend, we want them to be able to abort suspend too.
>
> Ok, that makes a lot of sense and should be part of the changelog, so
> we know in a year from now why we did this change. Care to resend with
> a fixed up changelog ?
>
> Thanks,
>
>        tglx

Thanks for your guidance on commit changelog. It's really helpful.
Here is the comments formatted patch, please help to review.


>From 40c31a11049726761fe5c7c629200f48950d4229 Mon Sep 17 00:00:00 2001
From: Ning Jiang <ning.n.jiang@gmail.com>
Date: Tue, 22 May 2012 00:19:20 +0800
Subject: [PATCH] genirq: Add IRQS_PENDING for nested and simple irq
handler as well

We should keep all the handle_*_irq behave in pretty much the same
way even just for the beauty of it. Every interrupt disabled in
suspend operation needs the ability to abort suspend if there is a
pending irq.

Let's take look at an example:

            |
       +---------+
       |   INTC  |
       +---------+
               | GPIO_IRQ
            +------------+
            |  gpio-exp  |
            +------------+
              |        |
         GPIO0_IRQ  GPIO1_IRQ

In the above diagram, gpio expander has irq number GPIO_IRQ, it is
connected with two sub GPIO pins, GPIO0 and GPIO1.

During suspend, normally we want to set IRQF_NO_SUSPEND for GPIO_IRQ
so that gpio expander driver can handle the sub irq GPIO0_IRQ and
GPIO1_IRQ, and these two irqs themselves can further be handled by
simple or nested irq in some drivers(typically gpio and mfd driver).
If they are disabled during suspend and used as wakeup sources, we
want them to be able to abort suspend too.

Set IRQS_PENDING flag in handle_nested_irq() and handle_simple_irq()
when the irq is disabled will make check_wakeup_irqs() check for irqs
like GPIO0_IRQ and GPIO1_IRQ to abort suspend.

Signed-off-by: Ning Jiang <ning.n.jiang@gmail.com>
---
 kernel/irq/chip.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 741f836..5bec667 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -275,8 +275,10 @@ void handle_nested_irq(unsigned int irq)
 	kstat_incr_irqs_this_cpu(irq, desc);

 	action = desc->action;
-	if (unlikely(!action || irqd_irq_disabled(&desc->irq_data)))
+	if (unlikely(!action || irqd_irq_disabled(&desc->irq_data))) {
+		desc->istate |= IRQS_PENDING;
 		goto out_unlock;
+	}

 	irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
 	raw_spin_unlock_irq(&desc->lock);
@@ -324,8 +326,10 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
 	desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
 	kstat_incr_irqs_this_cpu(irq, desc);

-	if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data)))
+	if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data))) {
+		desc->istate |= IRQS_PENDING;
 		goto out_unlock;
+	}

 	handle_irq_event(desc);

-- 
1.7.1

Thanks,
Ning

[-- Attachment #2: 0001-genirq-Add-IRQS_PENDING-for-nested-and-simple-irq-ha.patch --]
[-- Type: application/octet-stream, Size: 2481 bytes --]

From 40c31a11049726761fe5c7c629200f48950d4229 Mon Sep 17 00:00:00 2001
From: Ning Jiang <ning.n.jiang@gmail.com>
Date: Tue, 22 May 2012 00:19:20 +0800
Subject: [PATCH] genirq: Add IRQS_PENDING for nested and simple irq handler as well

We should keep all the handle_*_irq behave in pretty much the same
way even just for the beauty of it. Every interrupt disabled in
suspend operation needs the ability to abort suspend if there is a
pending irq.

Let's take look at an example:

            |
       +---------+
       |   INTC  |
       +---------+
               | GPIO_IRQ
            +------------+
            |  gpio-exp  |
            +------------+
              |        |
         GPIO0_IRQ  GPIO1_IRQ

In the above diagram, gpio expander has irq number GPIO_IRQ, it is
connected with two sub GPIO pins, GPIO0 and GPIO1.

During suspend, normally we want to set IRQF_NO_SUSPEND for GPIO_IRQ
so that gpio expander driver can handle the sub irq GPIO0_IRQ and
GPIO1_IRQ, and these two irqs themselves can further be handled by
simple or nested irq in some drivers(typically gpio and mfd driver).
If they are disabled during suspend and used as wakeup sources, we
want them to be able to abort suspend too.

Set IRQS_PENDING flag in handle_nested_irq() and handle_simple_irq()
when the irq is disabled will make check_wakeup_irqs() check for irqs
like GPIO0_IRQ and GPIO1_IRQ to abort suspend.

Signed-off-by: Ning Jiang <ning.n.jiang@gmail.com>
---
 kernel/irq/chip.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 741f836..5bec667 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -275,8 +275,10 @@ void handle_nested_irq(unsigned int irq)
 	kstat_incr_irqs_this_cpu(irq, desc);
 
 	action = desc->action;
-	if (unlikely(!action || irqd_irq_disabled(&desc->irq_data)))
+	if (unlikely(!action || irqd_irq_disabled(&desc->irq_data))) {
+		desc->istate |= IRQS_PENDING;
 		goto out_unlock;
+	}
 
 	irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
 	raw_spin_unlock_irq(&desc->lock);
@@ -324,8 +326,10 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
 	desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
 	kstat_incr_irqs_this_cpu(irq, desc);
 
-	if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data)))
+	if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data))) {
+		desc->istate |= IRQS_PENDING;
 		goto out_unlock;
+	}
 
 	handle_irq_event(desc);
 
-- 
1.7.1


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

* Re: Add IRQS_PENDING for nested and simple irq handler as well
  2012-05-22 11:14       ` Ning Jiang
@ 2012-05-23 16:02         ` Ning Jiang
  2012-05-23 19:04           ` Thomas Gleixner
  2012-05-24 20:52         ` [tip:irq/core] genirq: Add IRQS_PENDING for nested and simple irq tip-bot for Ning Jiang
  1 sibling, 1 reply; 9+ messages in thread
From: Ning Jiang @ 2012-05-23 16:02 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: rjw, linux-kernel

2012/5/22 Ning Jiang <ning.n.jiang@gmail.com>:
> 2012/5/22 Thomas Gleixner <tglx@linutronix.de>:
>> On Tue, 22 May 2012, Ning Jiang wrote:
>>
>> Please do not top post.
>>
>>> Sorry that I do not make myself clear.
>>>
>>> First, we should keep all the handle_*_irq behave in pretty much the
>>> same way even just for the beauty of it. Every interrupt disabled in
>>> suspend operation needs the ability to abort suspend if there is a
>>> pending irq.
>>>
>>> Second, let's take look at a example:
>>>
>>>               |
>>>        +---------+
>>>         |   INTC  |
>>>        +---------+
>>>                   |  GPIO_IRQ
>>>             +------------+
>>>              | gpio-exp  |
>>>             +------------+
>>>                |            |
>>>    GPIO0_IRQ  GPIO1_IRQ
>>>
>>> In the above diagram, gpio expander has irq number GPIO_IRQ, it is
>>> connected with two sub GPIO pins, GPIO0 and GPIO1.
>>>
>>> During suspend, normally we want to set IRQF_NO_SUSPEND for GPIO_IRQ
>>> so that gpio expander driver can handle the sub irq GPIO0_IRQ and
>>> GPIO1_IRQ, and these two irqs themselves are handled by simple or
>>> nested irq in some drivers(typically gpio and mfd driver), if they are
>>> disabled during suspend, we want them to be able to abort suspend too.
>>
>> Ok, that makes a lot of sense and should be part of the changelog, so
>> we know in a year from now why we did this change. Care to resend with
>> a fixed up changelog ?
>>
>> Thanks,
>>
>>        tglx
>
> Thanks for your guidance on commit changelog. It's really helpful.
> Here is the comments formatted patch, please help to review.
>
>
> From 40c31a11049726761fe5c7c629200f48950d4229 Mon Sep 17 00:00:00 2001
> From: Ning Jiang <ning.n.jiang@gmail.com>
> Date: Tue, 22 May 2012 00:19:20 +0800
> Subject: [PATCH] genirq: Add IRQS_PENDING for nested and simple irq
> handler as well
>
> We should keep all the handle_*_irq behave in pretty much the same
> way even just for the beauty of it. Every interrupt disabled in
> suspend operation needs the ability to abort suspend if there is a
> pending irq.
>
> Let's take look at an example:
>
>            |
>       +---------+
>       |   INTC  |
>       +---------+
>               | GPIO_IRQ
>            +------------+
>            |  gpio-exp  |
>            +------------+
>              |        |
>         GPIO0_IRQ  GPIO1_IRQ
>
> In the above diagram, gpio expander has irq number GPIO_IRQ, it is
> connected with two sub GPIO pins, GPIO0 and GPIO1.
>
> During suspend, normally we want to set IRQF_NO_SUSPEND for GPIO_IRQ
> so that gpio expander driver can handle the sub irq GPIO0_IRQ and
> GPIO1_IRQ, and these two irqs themselves can further be handled by
> simple or nested irq in some drivers(typically gpio and mfd driver).
> If they are disabled during suspend and used as wakeup sources, we
> want them to be able to abort suspend too.
>
> Set IRQS_PENDING flag in handle_nested_irq() and handle_simple_irq()
> when the irq is disabled will make check_wakeup_irqs() check for irqs
> like GPIO0_IRQ and GPIO1_IRQ to abort suspend.
>
> Signed-off-by: Ning Jiang <ning.n.jiang@gmail.com>
> ---
>  kernel/irq/chip.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
> index 741f836..5bec667 100644
> --- a/kernel/irq/chip.c
> +++ b/kernel/irq/chip.c
> @@ -275,8 +275,10 @@ void handle_nested_irq(unsigned int irq)
>        kstat_incr_irqs_this_cpu(irq, desc);
>
>        action = desc->action;
> -       if (unlikely(!action || irqd_irq_disabled(&desc->irq_data)))
> +       if (unlikely(!action || irqd_irq_disabled(&desc->irq_data))) {
> +               desc->istate |= IRQS_PENDING;
>                goto out_unlock;
> +       }
>
>        irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
>        raw_spin_unlock_irq(&desc->lock);
> @@ -324,8 +326,10 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
>        desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
>        kstat_incr_irqs_this_cpu(irq, desc);
>
> -       if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data)))
> +       if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data))) {
> +               desc->istate |= IRQS_PENDING;
>                goto out_unlock;
> +       }
>
>        handle_irq_event(desc);
>
> --
> 1.7.1
>
> Thanks,
> Ning

Hi Thomas,
Is there any problem to merge this patch?

Thanks,
Ning

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

* Re: Add IRQS_PENDING for nested and simple irq handler as well
  2012-05-23 16:02         ` Ning Jiang
@ 2012-05-23 19:04           ` Thomas Gleixner
  2012-05-24  7:29             ` Ning Jiang
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Gleixner @ 2012-05-23 19:04 UTC (permalink / raw)
  To: Ning Jiang; +Cc: rjw, linux-kernel

On Thu, 24 May 2012, Ning Jiang wrote:
> Hi Thomas,
> Is there any problem to merge this patch?

Yes, the problem is that I'm not a robot and that my day has a limited
number of work hours.

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

* Re: Add IRQS_PENDING for nested and simple irq handler as well
  2012-05-23 19:04           ` Thomas Gleixner
@ 2012-05-24  7:29             ` Ning Jiang
  0 siblings, 0 replies; 9+ messages in thread
From: Ning Jiang @ 2012-05-24  7:29 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: rjw, linux-kernel

2012/5/24 Thomas Gleixner <tglx@linutronix.de>:
> On Thu, 24 May 2012, Ning Jiang wrote:
>> Hi Thomas,
>> Is there any problem to merge this patch?
>
> Yes, the problem is that I'm not a robot and that my day has a limited
> number of work hours.

Not pushing, just like to know the latest status :-)

Thanks,
Ning

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

* [tip:irq/core] genirq: Add IRQS_PENDING for nested and simple irq
  2012-05-22 11:14       ` Ning Jiang
  2012-05-23 16:02         ` Ning Jiang
@ 2012-05-24 20:52         ` tip-bot for Ning Jiang
  1 sibling, 0 replies; 9+ messages in thread
From: tip-bot for Ning Jiang @ 2012-05-24 20:52 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, ning.n.jiang, tglx

Commit-ID:  23812b9d9e497580d38c62ebdc6f308733b0a32a
Gitweb:     http://git.kernel.org/tip/23812b9d9e497580d38c62ebdc6f308733b0a32a
Author:     Ning Jiang <ning.n.jiang@gmail.com>
AuthorDate: Tue, 22 May 2012 00:19:20 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 24 May 2012 22:27:45 +0200

genirq: Add IRQS_PENDING for nested and simple irq

Every interrupt which is an active wakeup source needs the ability to
abort suspend if there is a pending irq. Right now only edge and level
irqs can do that.

            |
       +---------+
       |   INTC  |
       +---------+
               | GPIO_IRQ
            +------------+
            |  gpio-exp  |
            +------------+
              |        |
         GPIO0_IRQ  GPIO1_IRQ

In the above diagram, gpio expander has irq number GPIO_IRQ, it is
connected with two sub GPIO pins, GPIO0 and GPIO1.

During suspend, we set IRQF_NO_SUSPEND for GPIO_IRQ so that gpio
expander driver can handle the sub irq GPIO0_IRQ and GPIO1_IRQ, and
these two irqs themselves can further be handled by simple or nested
irq in some drivers(typically gpio and mfd driver). If they are used
as wakeup sources during suspend, we want them to be able to abort
suspend too.

Setting IRQS_PENDING flag in handle_nested_irq() and handle_simple_irq()
when the irq is disabled allows check_wakeup_irqs() to identify such
irqs as source for aborting suspend.

Signed-off-by: Ning Jiang <ning.n.jiang@gmail.com>
Cc: rjw@sisk.pl
Link: http://lkml.kernel.org/r/CAH3Oq6T905%2B3fkF43NAMMFvJvq7dsk_so6T2vQ8ZJrA5xiU3YA@mail.gmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/irq/chip.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index fc275e4..eebd6d5 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -275,8 +275,10 @@ void handle_nested_irq(unsigned int irq)
 	kstat_incr_irqs_this_cpu(irq, desc);
 
 	action = desc->action;
-	if (unlikely(!action || irqd_irq_disabled(&desc->irq_data)))
+	if (unlikely(!action || irqd_irq_disabled(&desc->irq_data))) {
+		desc->istate |= IRQS_PENDING;
 		goto out_unlock;
+	}
 
 	irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
 	raw_spin_unlock_irq(&desc->lock);
@@ -324,8 +326,10 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
 	desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
 	kstat_incr_irqs_this_cpu(irq, desc);
 
-	if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data)))
+	if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data))) {
+		desc->istate |= IRQS_PENDING;
 		goto out_unlock;
+	}
 
 	handle_irq_event(desc);
 

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

end of thread, other threads:[~2012-05-24 20:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-21 16:48 Add IRQS_PENDING for nested and simple irq handler as well Ning Jiang
2012-05-21 21:12 ` Thomas Gleixner
2012-05-22  6:00   ` Ning Jiang
2012-05-22  8:49     ` Thomas Gleixner
2012-05-22 11:14       ` Ning Jiang
2012-05-23 16:02         ` Ning Jiang
2012-05-23 19:04           ` Thomas Gleixner
2012-05-24  7:29             ` Ning Jiang
2012-05-24 20:52         ` [tip:irq/core] genirq: Add IRQS_PENDING for nested and simple irq tip-bot for Ning Jiang

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.