LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: Xunlei Pang <pang.xunlei@linaro.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
"rtc-linux@googlegroups.com" <rtc-linux@googlegroups.com>,
Thomas Gleixner <tglx@linutronix.de>,
Alessandro Zummo <a.zummo@towertech.it>,
Arnd Bergmann <arnd.bergmann@linaro.org>
Subject: Re: [PATCH v2 1/3] time: Don't bother to run rtc_resume() for the nonstop clocksource
Date: Thu, 22 Jan 2015 10:30:57 -0800 [thread overview]
Message-ID: <CALAqxLVGquBDT-rgLhPi068Y3BYXLUNJu-okPb4sh4+vTfqFBw@mail.gmail.com> (raw)
In-Reply-To: <1421928077-4698-1-git-send-email-pang.xunlei@linaro.org>
On Thu, Jan 22, 2015 at 4:01 AM, Xunlei Pang <pang.xunlei@linaro.org> wrote:
> If a system does not provide a persistent_clock(), the time
> will be updated on resume by rtc_resume(). With the addition
> of the non-stop clocksources for suspend timing, those systems
> set the time on resume in timekeeping_resume(), but may not
> provide a valid persistent_clock().
>
> This results in the rtc_resume() logic thinking no one has set
> the time and it then will over-write the suspend time again,
> which is not necessary and only increases clock error.
>
> So, fix this for rtc_resume().
>
> Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
> ---
> v1->v2:
> Modify according to Thomas' feedback.
>
> drivers/rtc/class.c | 2 +-
> include/linux/timekeeping.h | 7 +++++++
> kernel/time/timekeeping.c | 16 +++++-----------
> 3 files changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
> index 472a5ad..6100af5 100644
> --- a/drivers/rtc/class.c
> +++ b/drivers/rtc/class.c
> @@ -102,7 +102,7 @@ static int rtc_resume(struct device *dev)
> struct timespec64 sleep_time;
> int err;
>
> - if (has_persistent_clock())
> + if (timekeeping_sleeptime_injected())
> return 0;
>
> rtc_hctosys_ret = -ENODEV;
> diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
> index 9b63d13..2b87c64 100644
> --- a/include/linux/timekeeping.h
> +++ b/include/linux/timekeeping.h
> @@ -238,6 +238,13 @@ extern void getnstime_raw_and_real(struct timespec *ts_raw,
> */
> extern bool persistent_clock_exist;
> extern int persistent_clock_is_local;
> +extern bool timekeeping_sleeptime_inject;
> +
> +/* Used by rtc_resume() */
> +static inline bool timekeeping_sleeptime_injected(void)
> +{
> + return timekeeping_sleeptime_inject;
> +}
>
Again, there's no reason to make this a static inline, nor the
sleeptime_inject variable global.
Just make it a function in timekeeping and provide definition so it
can be used by the rtc resume.
thanks
-john
next prev parent reply other threads:[~2015-01-22 18:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-22 12:01 Xunlei Pang
2015-01-22 12:01 ` [PATCH v2 2/3] rtc: Remove redundant rtc_valid_tm() from rtc_resume() Xunlei Pang
2015-01-22 12:01 ` [PATCH v2 3/3] time: clocksource: Add a comment to CLOCK_SOURCE_SUSPEND_NONSTOP Xunlei Pang
2015-01-22 21:07 ` Thomas Gleixner
2015-01-23 17:53 ` Xunlei Pang
2015-01-24 17:07 ` Thomas Gleixner
2015-01-28 16:00 ` Xunlei Pang
2015-01-22 18:30 ` John Stultz [this message]
2015-01-23 18:00 ` [PATCH v2 1/3] time: Don't bother to run rtc_resume() for the nonstop clocksource Xunlei Pang
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=CALAqxLVGquBDT-rgLhPi068Y3BYXLUNJu-okPb4sh4+vTfqFBw@mail.gmail.com \
--to=john.stultz@linaro.org \
--cc=a.zummo@towertech.it \
--cc=arnd.bergmann@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pang.xunlei@linaro.org \
--cc=rtc-linux@googlegroups.com \
--cc=tglx@linutronix.de \
--subject='Re: [PATCH v2 1/3] time: Don'\''t bother to run rtc_resume() for the nonstop clocksource' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).