* [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization
@ 2015-06-02 9:14 Xunlei Pang
2015-06-02 9:14 ` [PATCH v2 2/4] sparc: time: Replace update_persistent_clock() with CONFIG_RTC_SYSTOHC Xunlei Pang
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Xunlei Pang @ 2015-06-02 9:14 UTC (permalink / raw)
To: linux-kernel
Cc: rtc-linux, Alessandro Zummo, Alexandre Belloni, John Stultz,
Arnd Bergmann, Xunlei Pang, Paul Bolle
From: Xunlei Pang <pang.xunlei@linaro.org>
Currently, CONFIG_RTC_SYSTOHC uses CONFIG_RTC_HCTOSYS_DEVICE which
is originally used by CONFIG_RTC_HCTOSYS, but this rtc device has
some limiations, for example, it must be battery-backed, be able
to work with irq off and through system suspension, etc.
So add CONFIG_RTC_SYSTOHC_DEVICE used exclusively for CONFIG_RTC_SYSTOHC,
it is more lenient compared to CONFIG_RTC_HCTOSYS_DEVICE, and could
be assigned any available RTC in the system. Default value is "rtc0".
After this patch, NTP will sync up "rtc0" by default.
Cc: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
v1->v2:
Change "depends on RTC_XX = y" to "depends on RTC_XXX".
drivers/rtc/Kconfig | 28 +++++++++++++++++++---------
drivers/rtc/systohc.c | 2 +-
2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 0fe4ad8..f422a46 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -25,17 +25,9 @@ config RTC_HCTOSYS
the value read from a specified RTC device. This is useful to avoid
unnecessary fsck runs at boot time, and to network better.
-config RTC_SYSTOHC
- bool "Set the RTC time based on NTP synchronization"
- default y
- help
- If you say yes here, the system time (wall clock) will be stored
- in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11
- minutes if userspace reports synchronized NTP status.
-
config RTC_HCTOSYS_DEVICE
string "RTC used to set the system time"
- depends on RTC_HCTOSYS = y || RTC_SYSTOHC = y
+ depends on RTC_HCTOSYS
default "rtc0"
help
The RTC device that will be used to (re)initialize the system
@@ -56,6 +48,24 @@ config RTC_HCTOSYS_DEVICE
sleep states. Do not specify an RTC here unless it stays powered
during all this system's supported sleep states.
+config RTC_SYSTOHC
+ bool "Set the RTC time based on NTP synchronization"
+ default y
+ help
+ If you say yes here, the system time (wall clock) will be stored
+ in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11
+ minutes if userspace reports synchronized NTP status.
+
+config RTC_SYSTOHC_DEVICE
+ string "RTC used to synchronize NTP adjustment"
+ depends on RTC_SYSTOHC
+ default "rtc0"
+ help
+ The RTC device used for NTP synchronization. The main difference
+ between RTC_HCTOSYS_DEVICE and RTC_SYSTOHC_DEVICE is that this
+ one can sleep when setting time, because it runs in the workqueue
+ context.
+
config RTC_DEBUG
bool "RTC debug support"
help
diff --git a/drivers/rtc/systohc.c b/drivers/rtc/systohc.c
index 7728d5e..b4a68ff 100644
--- a/drivers/rtc/systohc.c
+++ b/drivers/rtc/systohc.c
@@ -31,7 +31,7 @@ int rtc_set_ntp_time(struct timespec64 now)
else
rtc_time64_to_tm(now.tv_sec + 1, &tm);
- rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);
+ rtc = rtc_class_open(CONFIG_RTC_SYSTOHC_DEVICE);
if (rtc) {
/* rtc_hctosys exclusively uses UTC, so we call set_time here,
* not set_mmss. */
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 2/4] sparc: time: Replace update_persistent_clock() with CONFIG_RTC_SYSTOHC
2015-06-02 9:14 [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization Xunlei Pang
@ 2015-06-02 9:14 ` Xunlei Pang
2015-06-11 19:15 ` Alexandre Belloni
2015-06-02 9:14 ` [PATCH v2 3/4] drivers/rtc/interface.c: Remove rtc_set_mmss() Xunlei Pang
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Xunlei Pang @ 2015-06-02 9:14 UTC (permalink / raw)
To: linux-kernel
Cc: rtc-linux, Alessandro Zummo, Alexandre Belloni, John Stultz,
Arnd Bergmann, Xunlei Pang
From: Xunlei Pang <pang.xunlei@linaro.org>
On Sparc systems, update_persistent_clock() uses RTC drivers to do
the job, it makes more sense to hand it over to CONFIG_RTC_SYSTOHC.
In the long run, all the update_persistent_clock() should migrate to
proper class RTC drivers if any and use CONFIG_RTC_SYSTOHC instead.
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
arch/sparc/Kconfig | 2 +-
arch/sparc/kernel/time_32.c | 21 ---------------------
arch/sparc/kernel/time_64.c | 14 --------------
3 files changed, 1 insertion(+), 36 deletions(-)
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index e49502a..56442d2 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -25,6 +25,7 @@ config SPARC
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
select RTC_CLASS
select RTC_DRV_M48T59
+ select RTC_SYSTOHC
select HAVE_DMA_ATTRS
select HAVE_DMA_API_DEBUG
select HAVE_ARCH_JUMP_LABEL if SPARC64
@@ -35,7 +36,6 @@ config SPARC
select HAVE_BPF_JIT
select HAVE_DEBUG_BUGVERBOSE
select GENERIC_SMP_IDLE_THREAD
- select GENERIC_CMOS_UPDATE
select GENERIC_CLOCKEVENTS
select GENERIC_STRNCPY_FROM_USER
select GENERIC_STRNLEN_USER
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index 8caf45e..c9692f3 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -23,7 +23,6 @@
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/time.h>
-#include <linux/rtc.h>
#include <linux/rtc/m48t59.h>
#include <linux/timex.h>
#include <linux/clocksource.h>
@@ -65,8 +64,6 @@ DEFINE_PER_CPU(struct clock_event_device, sparc32_clockevent);
DEFINE_SPINLOCK(rtc_lock);
EXPORT_SYMBOL(rtc_lock);
-static int set_rtc_mmss(unsigned long);
-
unsigned long profile_pc(struct pt_regs *regs)
{
extern char __copy_user_begin[], __copy_user_end[];
@@ -87,11 +84,6 @@ EXPORT_SYMBOL(profile_pc);
volatile u32 __iomem *master_l10_counter;
-int update_persistent_clock(struct timespec now)
-{
- return set_rtc_mmss(now.tv_sec);
-}
-
irqreturn_t notrace timer_interrupt(int dummy, void *dev_id)
{
if (timer_cs_enabled) {
@@ -362,16 +354,3 @@ void __init time_init(void)
sbus_time_init();
}
-
-static int set_rtc_mmss(unsigned long secs)
-{
- struct rtc_device *rtc = rtc_class_open("rtc0");
- int err = -1;
-
- if (rtc) {
- err = rtc_set_mmss(rtc, secs);
- rtc_class_close(rtc);
- }
-
- return err;
-}
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index edbbeb1..2e6035c 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -28,7 +28,6 @@
#include <linux/cpufreq.h>
#include <linux/percpu.h>
#include <linux/miscdevice.h>
-#include <linux/rtc.h>
#include <linux/rtc/m48t59.h>
#include <linux/kernel_stat.h>
#include <linux/clockchips.h>
@@ -394,19 +393,6 @@ static struct sparc64_tick_ops hbtick_operations __read_mostly = {
static unsigned long timer_ticks_per_nsec_quotient __read_mostly;
-int update_persistent_clock(struct timespec now)
-{
- struct rtc_device *rtc = rtc_class_open("rtc0");
- int err = -1;
-
- if (rtc) {
- err = rtc_set_mmss(rtc, now.tv_sec);
- rtc_class_close(rtc);
- }
-
- return err;
-}
-
unsigned long cmos_regs;
EXPORT_SYMBOL(cmos_regs);
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v2 2/4] sparc: time: Replace update_persistent_clock() with CONFIG_RTC_SYSTOHC
2015-06-02 9:14 ` [PATCH v2 2/4] sparc: time: Replace update_persistent_clock() with CONFIG_RTC_SYSTOHC Xunlei Pang
@ 2015-06-11 19:15 ` Alexandre Belloni
0 siblings, 0 replies; 10+ messages in thread
From: Alexandre Belloni @ 2015-06-11 19:15 UTC (permalink / raw)
To: Xunlei Pang
Cc: linux-kernel, rtc-linux, Alessandro Zummo, John Stultz,
Arnd Bergmann, Xunlei Pang
On 02/06/2015 at 17:14:35 +0800, Xunlei Pang wrote :
> From: Xunlei Pang <pang.xunlei@linaro.org>
>
> On Sparc systems, update_persistent_clock() uses RTC drivers to do
> the job, it makes more sense to hand it over to CONFIG_RTC_SYSTOHC.
>
> In the long run, all the update_persistent_clock() should migrate to
> proper class RTC drivers if any and use CONFIG_RTC_SYSTOHC instead.
>
> Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
I could take that patch but you should probably get an ack for the sparc
maintainer:
"David S. Miller" <davem@davemloft.net> (maintainer:SPARC + UltraSPAR...,commit_signer:2/4=50%)
sparclinux@vger.kernel.org (open list:SPARC + UltraSPAR...)
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 3/4] drivers/rtc/interface.c: Remove rtc_set_mmss()
2015-06-02 9:14 [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization Xunlei Pang
2015-06-02 9:14 ` [PATCH v2 2/4] sparc: time: Replace update_persistent_clock() with CONFIG_RTC_SYSTOHC Xunlei Pang
@ 2015-06-02 9:14 ` Xunlei Pang
2015-06-02 9:14 ` [PATCH v2 4/4] cris: time: Cleanup of persistent clock stuff Xunlei Pang
2015-06-11 19:08 ` [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization Alexandre Belloni
3 siblings, 0 replies; 10+ messages in thread
From: Xunlei Pang @ 2015-06-02 9:14 UTC (permalink / raw)
To: linux-kernel
Cc: rtc-linux, Alessandro Zummo, Alexandre Belloni, John Stultz,
Arnd Bergmann, Xunlei Pang
From: Xunlei Pang <pang.xunlei@linaro.org>
Now rtc_set_mmss() has no users, just remove it.
We still have rtc_set_time() doing similar things.
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
drivers/rtc/interface.c | 45 ---------------------------------------------
include/linux/rtc.h | 1 -
2 files changed, 46 deletions(-)
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 166fc60..b511aa1 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -91,51 +91,6 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
}
EXPORT_SYMBOL_GPL(rtc_set_time);
-int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs)
-{
- int err;
-
- err = mutex_lock_interruptible(&rtc->ops_lock);
- if (err)
- return err;
-
- if (!rtc->ops)
- err = -ENODEV;
- else if (rtc->ops->set_mmss64)
- err = rtc->ops->set_mmss64(rtc->dev.parent, secs);
- else if (rtc->ops->set_mmss)
- err = rtc->ops->set_mmss(rtc->dev.parent, secs);
- else if (rtc->ops->read_time && rtc->ops->set_time) {
- struct rtc_time new, old;
-
- err = rtc->ops->read_time(rtc->dev.parent, &old);
- if (err == 0) {
- rtc_time64_to_tm(secs, &new);
-
- /*
- * avoid writing when we're going to change the day of
- * the month. We will retry in the next minute. This
- * basically means that if the RTC must not drift
- * by more than 1 minute in 11 minutes.
- */
- if (!((old.tm_hour == 23 && old.tm_min == 59) ||
- (new.tm_hour == 23 && new.tm_min == 59)))
- err = rtc->ops->set_time(rtc->dev.parent,
- &new);
- }
- } else {
- err = -EINVAL;
- }
-
- pm_stay_awake(rtc->dev.parent);
- mutex_unlock(&rtc->ops_lock);
- /* A timer might have just expired */
- schedule_work(&rtc->irqwork);
-
- return err;
-}
-EXPORT_SYMBOL_GPL(rtc_set_mmss);
-
static int rtc_read_alarm_internal(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
{
int err;
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 13e4138..2e9b0e2 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -163,7 +163,6 @@ extern void devm_rtc_device_unregister(struct device *dev,
extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm);
extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm);
-extern int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs);
extern int rtc_set_ntp_time(struct timespec64 now);
int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm);
extern int rtc_read_alarm(struct rtc_device *rtc,
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 4/4] cris: time: Cleanup of persistent clock stuff
2015-06-02 9:14 [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization Xunlei Pang
2015-06-02 9:14 ` [PATCH v2 2/4] sparc: time: Replace update_persistent_clock() with CONFIG_RTC_SYSTOHC Xunlei Pang
2015-06-02 9:14 ` [PATCH v2 3/4] drivers/rtc/interface.c: Remove rtc_set_mmss() Xunlei Pang
@ 2015-06-02 9:14 ` Xunlei Pang
2015-06-11 19:19 ` Alexandre Belloni
2015-06-11 19:08 ` [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization Alexandre Belloni
3 siblings, 1 reply; 10+ messages in thread
From: Xunlei Pang @ 2015-06-02 9:14 UTC (permalink / raw)
To: linux-kernel
Cc: rtc-linux, Alessandro Zummo, Alexandre Belloni, John Stultz,
Arnd Bergmann, Xunlei Pang
From: Xunlei Pang <pang.xunlei@linaro.org>
- Remove update_persistent_clock(), as it does nothing now.
- Remove read_persistent_clock(), let it fall back to the weak version.
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
arch/cris/Kconfig | 1 -
arch/cris/kernel/time.c | 25 -------------------------
2 files changed, 26 deletions(-)
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 0314e32..982d562 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -46,7 +46,6 @@ config CRIS
select ARCH_WANT_IPC_PARSE_VERSION
select GENERIC_IRQ_SHOW
select GENERIC_IOMAP
- select GENERIC_CMOS_UPDATE
select MODULES_USE_ELF_RELA
select CLONE_BACKWARDS2
select OLD_SIGSUSPEND
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index 7780d37..2dda6da 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -39,31 +39,6 @@
extern unsigned long loops_per_jiffy; /* init/main.c */
unsigned long loops_per_usec;
-int set_rtc_mmss(unsigned long nowtime)
-{
- D(printk(KERN_DEBUG "set_rtc_mmss(%lu)\n", nowtime));
- return 0;
-}
-
-/* grab the time from the RTC chip */
-unsigned long get_cmos_time(void)
-{
- return 0;
-}
-
-
-int update_persistent_clock(struct timespec now)
-{
- return set_rtc_mmss(now.tv_sec);
-}
-
-void read_persistent_clock(struct timespec *ts)
-{
- ts->tv_sec = 0;
- ts->tv_nsec = 0;
-}
-
-
extern void cris_profile_sample(struct pt_regs* regs);
void
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v2 4/4] cris: time: Cleanup of persistent clock stuff
2015-06-02 9:14 ` [PATCH v2 4/4] cris: time: Cleanup of persistent clock stuff Xunlei Pang
@ 2015-06-11 19:19 ` Alexandre Belloni
0 siblings, 0 replies; 10+ messages in thread
From: Alexandre Belloni @ 2015-06-11 19:19 UTC (permalink / raw)
To: Xunlei Pang
Cc: linux-kernel, rtc-linux, Alessandro Zummo, John Stultz,
Arnd Bergmann, Xunlei Pang
On 02/06/2015 at 17:14:37 +0800, Xunlei Pang wrote :
> From: Xunlei Pang <pang.xunlei@linaro.org>
>
> - Remove update_persistent_clock(), as it does nothing now.
> - Remove read_persistent_clock(), let it fall back to the weak version.
>
> Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
That patch doesn't seem to have any dependencies, it should go through
the cris maintainers tree:
Mikael Starvik <starvik@axis.com> (maintainer:CRIS PORT)
Jesper Nilsson <jesper.nilsson@axis.com> (maintainer:CRIS PORT)
linux-cris-kernel@axis.com (open list:CRIS PORT)
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization
2015-06-02 9:14 [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization Xunlei Pang
` (2 preceding siblings ...)
2015-06-02 9:14 ` [PATCH v2 4/4] cris: time: Cleanup of persistent clock stuff Xunlei Pang
@ 2015-06-11 19:08 ` Alexandre Belloni
3 siblings, 0 replies; 10+ messages in thread
From: Alexandre Belloni @ 2015-06-11 19:08 UTC (permalink / raw)
To: Xunlei Pang
Cc: linux-kernel, rtc-linux, Alessandro Zummo, John Stultz,
Arnd Bergmann, Xunlei Pang, Paul Bolle
Hi,
On 02/06/2015 at 17:14:34 +0800, Xunlei Pang wrote :
> +config RTC_SYSTOHC
> + bool "Set the RTC time based on NTP synchronization"
> + default y
> + help
> + If you say yes here, the system time (wall clock) will be stored
> + in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11
> + minutes if userspace reports synchronized NTP status.
> +
> +config RTC_SYSTOHC_DEVICE
> + string "RTC used to synchronize NTP adjustment"
> + depends on RTC_SYSTOHC
> + default "rtc0"
To make that working nicely with current configurations, I would use:
default RTC_HCTOSYS_DEVICE
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization
@ 2015-05-29 14:46 Xunlei Pang
2015-06-01 8:27 ` Paul Bolle
0 siblings, 1 reply; 10+ messages in thread
From: Xunlei Pang @ 2015-05-29 14:46 UTC (permalink / raw)
To: linux-kernel
Cc: rtc-linux, Alessandro Zummo, John Stultz, Arnd Bergmann,
David S. Miller, sparclinux, linux-cris-kernel, Mikael Starvik,
Jesper Nilsson, Xunlei Pang
From: Xunlei Pang <pang.xunlei@linaro.org>
Currently, CONFIG_RTC_SYSTOHC uses CONFIG_RTC_HCTOSYS_DEVICE which
is originally used by CONFIG_RTC_HCTOSYS, but this rtc device has
some limiations, for example, it must be battery-backed, be able
to work with irq off and through system suspension, etc.
So add CONFIG_RTC_SYSTOHC_DEVICE used exclusively for CONFIG_RTC_SYSTOHC,
it is more lenient compared to CONFIG_RTC_HCTOSYS_DEVICE, and could
be assigned any available RTC in the system. Default value is "rtc0".
After this patch, NTP will sync up "rtc0" by default.
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
drivers/rtc/Kconfig | 28 +++++++++++++++++++---------
drivers/rtc/systohc.c | 2 +-
2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 0fe4ad8..f429e9a 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -25,17 +25,9 @@ config RTC_HCTOSYS
the value read from a specified RTC device. This is useful to avoid
unnecessary fsck runs at boot time, and to network better.
-config RTC_SYSTOHC
- bool "Set the RTC time based on NTP synchronization"
- default y
- help
- If you say yes here, the system time (wall clock) will be stored
- in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11
- minutes if userspace reports synchronized NTP status.
-
config RTC_HCTOSYS_DEVICE
string "RTC used to set the system time"
- depends on RTC_HCTOSYS = y || RTC_SYSTOHC = y
+ depends on RTC_HCTOSYS = y
default "rtc0"
help
The RTC device that will be used to (re)initialize the system
@@ -56,6 +48,24 @@ config RTC_HCTOSYS_DEVICE
sleep states. Do not specify an RTC here unless it stays powered
during all this system's supported sleep states.
+config RTC_SYSTOHC
+ bool "Set the RTC time based on NTP synchronization"
+ default y
+ help
+ If you say yes here, the system time (wall clock) will be stored
+ in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11
+ minutes if userspace reports synchronized NTP status.
+
+config RTC_SYSTOHC_DEVICE
+ string "RTC used to synchronize NTP adjustment"
+ depends on RTC_SYSTOHC = y
+ default "rtc0"
+ help
+ The RTC device used for NTP synchronization. The main difference
+ between RTC_HCTOSYS_DEVICE and RTC_SYSTOHC_DEVICE is that this
+ one can sleep when setting time, because it runs in the workqueue
+ context.
+
config RTC_DEBUG
bool "RTC debug support"
help
diff --git a/drivers/rtc/systohc.c b/drivers/rtc/systohc.c
index 7728d5e..b4a68ff 100644
--- a/drivers/rtc/systohc.c
+++ b/drivers/rtc/systohc.c
@@ -31,7 +31,7 @@ int rtc_set_ntp_time(struct timespec64 now)
else
rtc_time64_to_tm(now.tv_sec + 1, &tm);
- rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);
+ rtc = rtc_class_open(CONFIG_RTC_SYSTOHC_DEVICE);
if (rtc) {
/* rtc_hctosys exclusively uses UTC, so we call set_time here,
* not set_mmss. */
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization
2015-05-29 14:46 Xunlei Pang
@ 2015-06-01 8:27 ` Paul Bolle
2015-06-02 3:18 ` pang.xunlei
0 siblings, 1 reply; 10+ messages in thread
From: Paul Bolle @ 2015-06-01 8:27 UTC (permalink / raw)
To: Xunlei Pang
Cc: linux-kernel, rtc-linux, Alessandro Zummo, John Stultz,
Arnd Bergmann, David S. Miller, sparclinux, linux-cris-kernel,
Mikael Starvik, Jesper Nilsson, Xunlei Pang
On Fri, 2015-05-29 at 22:46 +0800, Xunlei Pang wrote:
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> config RTC_HCTOSYS_DEVICE
> string "RTC used to set the system time"
> - depends on RTC_HCTOSYS = y || RTC_SYSTOHC = y
> + depends on RTC_HCTOSYS = y
RTC_HCTOSYS and RTC_SYSTOHC are bool symbols. The "= y" test is not
needed and the common idiom is to use only
depends on RTC_HCTOSYS
Since you're touching this you might as well switch to that idiom.
> default "rtc0"
> help
> The RTC device that will be used to (re)initialize the system
> minutes if userspace reports synchronized NTP status.
> +config RTC_SYSTOHC_DEVICE
> + string "RTC used to synchronize NTP adjustment"
> + depends on RTC_SYSTOHC = y
Likewise.
> + default "rtc0"
> + help
> + The RTC device used for NTP synchronization. The main difference
> + between RTC_HCTOSYS_DEVICE and RTC_SYSTOHC_DEVICE is that this
> + one can sleep when setting time, because it runs in the workqueue
> + context.
Paul Bolle
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization
2015-06-01 8:27 ` Paul Bolle
@ 2015-06-02 3:18 ` pang.xunlei
0 siblings, 0 replies; 10+ messages in thread
From: pang.xunlei @ 2015-06-02 3:18 UTC (permalink / raw)
To: Paul Bolle
Cc: Alessandro Zummo, Arnd Bergmann, David S. Miller, Jesper Nilsson,
John Stultz, linux-cris-kernel, linux-kernel, Xunlei Pang,
rtc-linux, sparclinux, Mikael Starvik, Xunlei Pang
Hi Paul,
Paul Bolle <pebolle@tiscali.nl> wrote 2015-06-01 PM 04:27:40:
>
> Re: [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP
> synchronization
>
> On Fri, 2015-05-29 at 22:46 +0800, Xunlei Pang wrote:
> > --- a/drivers/rtc/Kconfig
> > +++ b/drivers/rtc/Kconfig
>
> > config RTC_HCTOSYS_DEVICE
> > string "RTC used to set the system time"
> > - depends on RTC_HCTOSYS = y || RTC_SYSTOHC = y
> > + depends on RTC_HCTOSYS = y
>
> RTC_HCTOSYS and RTC_SYSTOHC are bool symbols. The "= y" test is not
> needed and the common idiom is to use only
> depends on RTC_HCTOSYS
>
> Since you're touching this you might as well switch to that idiom.
>
> > default "rtc0"
> > help
> > The RTC device that will be used to (re)initialize the system
> > minutes if userspace reports synchronized NTP status.
>
> > +config RTC_SYSTOHC_DEVICE
> > + string "RTC used to synchronize NTP adjustment"
> > + depends on RTC_SYSTOHC = y
>
> Likewise.
Yea, thanks for pointing this out.
-Xunlei
>
> > + default "rtc0"
> > + help
> > + The RTC device used for NTP synchronization. The main difference
> > + between RTC_HCTOSYS_DEVICE and RTC_SYSTOHC_DEVICE is that this
> > + one can sleep when setting time, because it runs in the
workqueue
> > + context.
>
>
> Paul Bolle
>
--------------------------------------------------------
ZTE Information Security Notice: The information contained in this mail (and any attachment transmitted herewith) is privileged and confidential and is intended for the exclusive use of the addressee(s). If you are not an intended recipient, any disclosure, reproduction, distribution or other dissemination or use of the information contained is strictly prohibited. If you have received this mail in error, please delete it and notify us immediately.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-06-11 19:19 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02 9:14 [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization Xunlei Pang
2015-06-02 9:14 ` [PATCH v2 2/4] sparc: time: Replace update_persistent_clock() with CONFIG_RTC_SYSTOHC Xunlei Pang
2015-06-11 19:15 ` Alexandre Belloni
2015-06-02 9:14 ` [PATCH v2 3/4] drivers/rtc/interface.c: Remove rtc_set_mmss() Xunlei Pang
2015-06-02 9:14 ` [PATCH v2 4/4] cris: time: Cleanup of persistent clock stuff Xunlei Pang
2015-06-11 19:19 ` Alexandre Belloni
2015-06-11 19:08 ` [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization Alexandre Belloni
-- strict thread matches above, loose matches on Subject: below --
2015-05-29 14:46 Xunlei Pang
2015-06-01 8:27 ` Paul Bolle
2015-06-02 3:18 ` pang.xunlei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox