From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Jason Cooper <jason@lakedaemon.net>,
Peter Zijlstra <peterz@infradead.org>,
Mark Rutland <mark.rutland@arm.com>,
linux-kernel@vger.kernel.org,
Nicolas Ferre <nicolas.ferre@atmel.com>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
Alexandre Belloni <alexandre.belloni@free-electrons.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH 2/3] genirq: add helper functions to deal with wakeup on shared IRQF_NO_SUSPEND IRQs
Date: Wed, 25 Feb 2015 23:03:14 +0100 [thread overview]
Message-ID: <2476478.8N4TxgeN3h@vostro.rjw.lan> (raw)
In-Reply-To: <1424771762-16343-3-git-send-email-boris.brezillon@free-electrons.com>
On Tuesday, February 24, 2015 10:56:01 AM Boris Brezillon wrote:
> Add two helper functions to help drivers that are sharing IRQs with
> timer devices (or other devices setting the IRQF_NO_SUSPEND flag) deal
> with system wakeup and state detection.
>
> Such drivers should expect their IRQ handler to be called in 2 different
> contexts:
> 1/ the system is resumed and the handler should act normally
> 2/ the system is suspended and the handler should wake it up, and
> potentially save the received events so that they could be taken care
> of when the resume callback is called
>
> irq_is_wakeup_armed provides mean to test the current state (true means
> the system is suspended).
>
> irq_pm_force_wakeup provides mean to force a system wakeup.
>
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> ---
> include/linux/interrupt.h | 3 +++
> kernel/irq/manage.c | 16 ++++++++++++++++
> kernel/irq/pm.c | 6 ++++++
> 3 files changed, 25 insertions(+)
>
> diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
> index d9b05b5..052a3b2 100644
> --- a/include/linux/interrupt.h
> +++ b/include/linux/interrupt.h
> @@ -356,6 +356,9 @@ static inline int disable_irq_wake(unsigned int irq)
> return irq_set_irq_wake(irq, 0);
> }
>
> +bool irq_is_wakeup_armed(unsigned int irq);
> +
> +void irq_pm_force_wakeup(void);
>
> #ifdef CONFIG_IRQ_FORCED_THREADING
> extern bool force_irqthreads;
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index 196a06f..5424be0 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -551,6 +551,22 @@ int irq_set_irq_wake(unsigned int irq, unsigned int on)
> }
> EXPORT_SYMBOL(irq_set_irq_wake);
>
> +bool irq_is_wakeup_armed(unsigned int irq)
> +{
> + unsigned long flags;
> + struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL);
> + bool ret;
> +
> + if (!desc)
> + return false;
> +
> + ret = irqd_is_wakeup_armed(&desc->irq_data);
> +
> + irq_put_desc_busunlock(desc, flags);
> + return ret;
> +}
> +EXPORT_SYMBOL(irq_is_wakeup_armed);
Ugly that is ...
> +
> /*
> * Internal function that tells the architecture code whether a
> * particular irq has been exclusively allocated or is available
> diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c
> index 1743162..1110a37 100644
> --- a/kernel/irq/pm.c
> +++ b/kernel/irq/pm.c
> @@ -28,6 +28,12 @@ bool irq_pm_check_wakeup(struct irq_desc *desc)
> return false;
> }
>
> +void irq_pm_force_wakeup(void)
> +{
> + pm_system_wakeup();
> +}
> +EXPORT_SYMBOL_GPL(irq_pm_force_wakeup);
Why don't you export pm_system_wakeup() instead and use it directly?
> +
> /*
> * Called from __setup_irq() with desc->lock held after @action has
> * been installed in the action chain.
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
next prev parent reply other threads:[~2015-02-25 21:39 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 9:55 [RFC PATCH 0/3] genirq: mixing IRQF_NO_SUSPEND and wakeup sources on shared IRQs Boris Brezillon
2015-02-24 9:56 ` [RFC PATCH 1/3] genirq: prevent system wakeup when dealing with IRQF_NO_SUSPEND IRQs Boris Brezillon
2015-02-25 22:01 ` Rafael J. Wysocki
2015-02-26 8:06 ` Boris Brezillon
2015-02-24 9:56 ` [RFC PATCH 2/3] genirq: add helper functions to deal with wakeup on shared " Boris Brezillon
2015-02-25 22:03 ` Rafael J. Wysocki [this message]
2015-02-26 8:09 ` Boris Brezillon
2015-02-24 9:56 ` [RFC PATCH 3/3] rtc: at91sam9: properly act when IRQ handler is called in suspended state Boris Brezillon
2015-02-25 22:05 ` Rafael J. Wysocki
2015-02-26 8:12 ` Boris Brezillon
2015-02-25 21:59 ` [RFC PATCH 0/3] genirq: mixing IRQF_NO_SUSPEND and wakeup sources on shared IRQs Rafael J. Wysocki
2015-02-26 8:03 ` Boris Brezillon
2015-02-26 15:44 ` Rafael J. Wysocki
2015-02-26 15:47 ` Boris Brezillon
2015-02-26 18:17 ` Rafael J. Wysocki
2015-02-26 18:17 ` Boris Brezillon
2015-02-26 21:55 ` Rafael J. Wysocki
2015-02-26 23:07 ` [PATCH] genirq / PM: Add flag for shared NO_SUSPEND interrupt lines Rafael J. Wysocki
2015-02-27 8:38 ` Peter Zijlstra
2015-02-27 22:13 ` Rafael J. Wysocki
2015-02-27 22:11 ` Peter Zijlstra
2015-03-04 19:42 ` Mark Rutland
2015-03-04 20:00 ` [PATCH] genirq: describe IRQF_COND_SUSPEND Mark Rutland
2015-03-04 21:55 ` Rafael J. Wysocki
2015-03-04 22:17 ` Alexandre Belloni
2015-03-04 22:27 ` Arnd Bergmann
2015-03-05 11:04 ` Mark Rutland
2015-03-05 11:33 ` Alexandre Belloni
2015-03-05 12:07 ` Mark Rutland
2015-03-06 0:54 ` Rafael J. Wysocki
2015-03-04 21:30 ` [PATCH] genirq / PM: Add flag for shared NO_SUSPEND interrupt lines Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2476478.8N4TxgeN3h@vostro.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=alexandre.belloni@free-electrons.com \
--cc=boris.brezillon@free-electrons.com \
--cc=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=nicolas.ferre@atmel.com \
--cc=peterz@infradead.org \
--cc=plagnioj@jcrosoft.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®