From: John Stultz <john.stultz@linaro.org>
To: lkml <linux-kernel@vger.kernel.org>
Cc: John Stultz <john.stultz@linaro.org>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
arve@android.com, markgross@thegnar.org,
Alan Stern <stern@rowland.harvard.edu>,
amit.kucheria@linaro.org, farrowg@sg.ibm.com,
"Dmitry Fink (Palm GBU)" <Dmitry.Fink@palm.com>,
linux-pm@lists.linux-foundation.org, khilman@ti.com,
Magnus Damm <damm@opensource.se>,
mjg@redhat.com, peterz@infradead.org
Subject: [PATCH 4/6] [RFC] rtc: interface: Add pm_stay_awake/pm_relax chaining rtc workqueue processing
Date: Mon, 26 Sep 2011 12:13:52 -0700 [thread overview]
Message-ID: <1317064434-1829-5-git-send-email-john.stultz@linaro.org> (raw)
In-Reply-To: <1317064434-1829-1-git-send-email-john.stultz@linaro.org>
To ensure suspend events don't trigger between the irq and the
rtc workqueue function running, use pm_stay_awake/pm_relax.
CC: Rafael J. Wysocki <rjw@sisk.pl>
CC: arve@android.com
CC: markgross@thegnar.org
CC: Alan Stern <stern@rowland.harvard.edu>
CC: amit.kucheria@linaro.org
CC: farrowg@sg.ibm.com
CC: Dmitry Fink (Palm GBU) <Dmitry.Fink@palm.com>
CC: linux-pm@lists.linux-foundation.org
CC: khilman@ti.com
CC: Magnus Damm <damm@opensource.se>
CC: mjg@redhat.com
CC: peterz@infradead.org
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
drivers/rtc/interface.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 44e91e5..ba1c437 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -19,6 +19,15 @@
static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer);
static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer);
+static struct wakeup_source *rtc_interface_wakelock;
+static int __init rtc_interface_wakelock_init(void)
+{
+ rtc_interface_wakelock = wakeup_source_register("rtc_interface");
+ return 0;
+}
+core_initcall(rtc_interface_wakelock_init);
+
+
static int __rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm)
{
int err;
@@ -563,6 +572,7 @@ enum hrtimer_restart rtc_pie_update_irq(struct hrtimer *timer)
void rtc_update_irq(struct rtc_device *rtc,
unsigned long num, unsigned long events)
{
+ __pm_stay_awake(rtc_interface_wakelock);
schedule_work(&rtc->irqwork);
}
EXPORT_SYMBOL_GPL(rtc_update_irq);
@@ -751,9 +761,10 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer)
alarm.time = rtc_ktime_to_tm(timer->node.expires);
alarm.enabled = 1;
err = __rtc_set_alarm(rtc, &alarm);
- if (err == -ETIME)
+ if (err == -ETIME) {
+ __pm_stay_awake(rtc_interface_wakelock);
schedule_work(&rtc->irqwork);
- else if (err) {
+ } else if (err) {
timerqueue_del(&rtc->timerqueue, &timer->node);
timer->enabled = 0;
return err;
@@ -849,6 +860,7 @@ again:
}
mutex_unlock(&rtc->ops_lock);
+ __pm_relax(rtc_interface_wakelock);
}
--
1.7.3.2.146.gca209
next prev parent reply other threads:[~2011-09-26 19:14 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-26 19:13 [PATCH 0/6] [RFC] Proposal for optimistic suspend idea John Stultz
2011-09-26 19:13 ` [PATCH 1/6] [RFC] suspend: Block suspend when wakeups are in-progress John Stultz
2011-09-26 19:13 ` [PATCH 2/6] [RFC] sched: Add support for SCHED_STAYAWAKE flag John Stultz
2011-09-26 19:13 ` [PATCH 3/6] [RFC] rtc: rtc-cmos: Add pm_stay_awake/pm_relax calls around IRQ John Stultz
2011-10-01 21:31 ` NeilBrown
2011-09-26 19:13 ` John Stultz [this message]
2011-09-26 19:13 ` [PATCH 5/6] [RFC] alarmtimer: Add pm_stay_awake /pm_relax calls John Stultz
2011-09-26 19:13 ` [PATCH 6/6] [RFC] alarmtimer: Deboost on nanosleep John Stultz
2011-09-26 20:16 ` [PATCH 0/6] [RFC] Proposal for optimistic suspend idea Peter Zijlstra
2011-09-26 22:27 ` John Stultz
2011-09-27 10:37 ` Peter Zijlstra
2011-09-27 22:56 ` John Stultz
2011-09-28 7:51 ` Peter Zijlstra
2011-09-28 7:57 ` Richard Cochran
2011-09-28 8:02 ` Peter Zijlstra
2011-09-28 8:19 ` Peter Zijlstra
2011-09-29 3:07 ` John Stultz
2011-09-28 8:19 ` Peter Zijlstra
2011-09-29 3:27 ` John Stultz
2011-09-28 8:40 ` Peter Zijlstra
2011-09-28 8:59 ` Peter Zijlstra
2011-09-29 3:45 ` John Stultz
2011-09-28 9:16 ` Peter Zijlstra
2011-09-28 10:45 ` Borislav Petkov
2011-09-28 21:02 ` Rafael J. Wysocki
2011-09-28 0:09 ` Thomas Gleixner
2011-09-28 1:19 ` John Stultz
2011-09-28 8:18 ` Thomas Gleixner
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=1317064434-1829-5-git-send-email-john.stultz@linaro.org \
--to=john.stultz@linaro.org \
--cc=Dmitry.Fink@palm.com \
--cc=amit.kucheria@linaro.org \
--cc=arve@android.com \
--cc=damm@opensource.se \
--cc=farrowg@sg.ibm.com \
--cc=khilman@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=markgross@thegnar.org \
--cc=mjg@redhat.com \
--cc=peterz@infradead.org \
--cc=rjw@sisk.pl \
--cc=stern@rowland.harvard.edu \
/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
Powered by JetHome