Re: [PATCH 3/6] [RFC] rtc: rtc-cmos: Add pm_stay_awake/pm_relaxcalls around IRQ

From: NeilBrown
Date: Sat Oct 01 2011 - 17:32:20 EST


On Mon, 26 Sep 2011 12:13:51 -0700 John Stultz <john.stultz@xxxxxxxxxx> wrote:

> Flag the rtc-cmos IRQ event as a wakeup event using pm_stay_awake
> and pm_relax()

It seems that only the 0/6 patch in this sequence was given any attention.
However it appears to me that 3, 4, and 5 stand on their own and are clearly
bug-fixes - the bug being that the wake-up event generated by the CMOS rtc is
not being counted as a wakeup event by the power core.

I'm less clear on 5, but that is probably simply that I don't understand this
code very well yet.

So maybe resend 4,5,6 by themselves and get them accepted? Or maybe Rafael
could just pick them up and review/apply them as they are ???

Thanks,
NeilBrown


>
> CC: Rafael J. Wysocki <rjw@xxxxxxx>
> CC: arve@xxxxxxxxxxx
> CC: markgross@xxxxxxxxxxx
> CC: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> CC: amit.kucheria@xxxxxxxxxx
> CC: farrowg@xxxxxxxxxx
> CC: Dmitry Fink (Palm GBU) <Dmitry.Fink@xxxxxxxx>
> CC: linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx
> CC: khilman@xxxxxx
> CC: Magnus Damm <damm@xxxxxxxxxxxxx>
> CC: mjg@xxxxxxxxxx
> CC: peterz@xxxxxxxxxxxxx
> Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
> ---
> drivers/rtc/rtc-cmos.c | 13 +++++++++++--
> 1 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
> index 05beb6c..1cc4688 100644
> --- a/drivers/rtc/rtc-cmos.c
> +++ b/drivers/rtc/rtc-cmos.c
> @@ -538,11 +538,15 @@ static struct bin_attribute nvram = {
>
> static struct cmos_rtc cmos_rtc;
>
> +static struct wakeup_source *rtc_cmos_wakelock;
> +
> static irqreturn_t cmos_interrupt(int irq, void *p)
> {
> u8 irqstat;
> u8 rtc_control;
>
> + __pm_stay_awake(rtc_cmos_wakelock);
> +
> spin_lock(&rtc_lock);
>
> /* When the HPET interrupt handler calls us, the interrupt
> @@ -573,9 +577,12 @@ static irqreturn_t cmos_interrupt(int irq, void *p)
>
> if (is_intr(irqstat)) {
> rtc_update_irq(p, 1, irqstat);
> + __pm_relax(rtc_cmos_wakelock);
> return IRQ_HANDLED;
> - } else
> - return IRQ_NONE;
> + }
> +
> + __pm_relax(rtc_cmos_wakelock);
> + return IRQ_NONE;
> }
>
> #ifdef CONFIG_PNP
> @@ -1153,6 +1160,8 @@ static int __init cmos_init(void)
> {
> int retval = 0;
>
> + rtc_cmos_wakelock = wakeup_source_register("rtc_cmos");
> +
> #ifdef CONFIG_PNP
> retval = pnp_register_driver(&cmos_pnp_driver);
> if (retval == 0)

Attachment: signature.asc
Description: PGP signature