mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Feng Tang <feng.tang@intel.com>
To: John Stultz <john.stultz@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Alessandro Zummo <a.zummo@towertech.it>,
	linux-kernel@vger.kernel.org
Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>,
	Feng Tang <feng.tang@intel.com>
Subject: [PATCH v2 3/3] timekeeping: Add CONFIG_HAS_PERSISTENT_CLOCK option
Date: Wed, 16 Jan 2013 00:09:49 +0800	[thread overview]
Message-ID: <1358266189-8812-3-git-send-email-feng.tang@intel.com> (raw)
In-Reply-To: <1358266189-8812-1-git-send-email-feng.tang@intel.com>

Make the persistent clock check a kernel config option, so that some
platform can explicitely select it, also make CONFIG_RTC_HCTOSYS depends
on its non-existence, which could prevent the persistent clock and RTC
code from doing similar thing twice during system's init/suspend/resume
phases.

If the CONFIG_HAS_PERSISTENT_CLOCK=n, then no change happens for kernel
which still does the persistent clock check in timekeeping_init().

Cc: Thomas Gleixner <tglx@linutronix.de>
Suggested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Feng Tang <feng.tang@intel.com>
---
 drivers/rtc/Kconfig  |    1 +
 include/linux/time.h |    5 +++++
 kernel/time/Kconfig  |    5 +++++
 3 files changed, 11 insertions(+)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 923a9da..5b963c6 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -20,6 +20,7 @@ if RTC_CLASS
 config RTC_HCTOSYS
 	bool "Set system time from RTC on startup and resume"
 	default y
+	depends on !HAS_PERSISTENT_CLOCK
 	help
 	  If you say yes here, the system time (wall clock) will be set using
 	  the value read from a specified RTC device. This is useful to avoid
diff --git a/include/linux/time.h b/include/linux/time.h
index 2f58603..e08051c 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -116,10 +116,15 @@ static inline bool timespec_valid_strict(const struct timespec *ts)
 }
 
 extern bool persistent_clock_exist;
+
+#ifdef CONFIG_HAS_PERSISTENT_CLOCK
+#define has_persistent_clock()	true
+#else
 static inline bool has_persistent_clock(void)
 {
 	return persistent_clock_exist;
 }
+#endif
 
 extern void read_persistent_clock(struct timespec *ts);
 extern void read_boot_clock(struct timespec *ts);
diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig
index 8601f0d..f7e45b9 100644
--- a/kernel/time/Kconfig
+++ b/kernel/time/Kconfig
@@ -12,6 +12,11 @@ config CLOCKSOURCE_WATCHDOG
 config ARCH_CLOCKSOURCE_DATA
 	bool
 
+# Platforms has a persistent clock
+config HAS_PERSISTENT_CLOCK
+	bool
+	default n
+
 # Timekeeping vsyscall support
 config GENERIC_TIME_VSYSCALL
 	bool
-- 
1.7.9.5


  parent reply	other threads:[~2013-01-15 16:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15 16:09 [PATCH v2 1/3] timekeeping: Add persistent_clock_exist flag Feng Tang
2013-01-15 16:09 ` [PATCH v2 2/3] rtc: Skip the suspend/resume handling if persistent clock exist Feng Tang
2013-01-15 19:49   ` John Stultz
2013-01-15 16:09 ` Feng Tang [this message]
2013-01-15 19:50   ` [PATCH v2 3/3] timekeeping: Add CONFIG_HAS_PERSISTENT_CLOCK option John Stultz
2013-01-22 19:44     ` Jason Gunthorpe
2013-01-22 19:49       ` John Stultz
2013-01-26  1:07         ` John Stultz
2013-01-15 19:48 ` [PATCH v2 1/3] timekeeping: Add persistent_clock_exist flag John Stultz

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=1358266189-8812-3-git-send-email-feng.tang@intel.com \
    --to=feng.tang@intel.com \
    --cc=a.zummo@towertech.it \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --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®