aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIulia Manda <iulia.manda21@gmail.com>2014-10-23 13:29:59 +0300
committerJosh Triplett <josh@joshtriplett.org>2014-10-29 14:47:10 -0700
commitd4fc343ec0936d1d31a0cec55fae4e913d9bb2d1 (patch)
tree598da4510fb3dd3aefec906be9e5cd95004e7d35
parentf114040e3ea6e07372334ade75d1ee0775c355e1 (diff)
downloadlinux-tiny/no-rtc-x86-cmos-systohc.tar.gz
x86: rtc: Make writing time to RTC optionaltiny/no-rtc-x86-cmos-systohc
This patch makes writing time to the hardware clock configurable for x86. It makes the mach_set_rtc_mmss function a no-op. Also, by making this function empty, RTC_LIB is not needed anymore, therefore it is not compiled. bloat-o-meter output: add/remove: 0/9 grow/shrink: 0/2 up/down: 0/-1651 (-1651) function old new delta rtc_days_in_month 12 - -12 rtc_tm_to_ktime 26 - -26 rtc_ydays 52 - -52 rtc_tm_to_time 80 - -80 rtc_month_days 85 - -85 rtc_ktime_to_tm 96 - -96 rtc_year_days 109 - -109 rtc_valid_tm 183 - -183 rtc_time_to_tm 414 - -414 mach_set_rtc_mmss 489 3 -486 Signed-off-by: Iulia Manda <iulia.manda21@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Josh Triplett <josh@joshtriplett.org>
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/kernel/rtc.c4
-rw-r--r--drivers/char/rtc.c2
-rw-r--r--drivers/rtc/Kconfig15
4 files changed, 19 insertions, 3 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index f2327e88e07cc6..17631cba89b607 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -126,7 +126,6 @@ config X86
select OLD_SIGSUSPEND3 if X86_32 || IA32_EMULATION
select OLD_SIGACTION if X86_32
select COMPAT_OLD_SIGACTION if IA32_EMULATION
- select RTC_LIB
select HAVE_DEBUG_STACKOVERFLOW
select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64
select HAVE_CC_STACKPROTECTOR
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index ca9622a25e95a6..94a760c94bbdfe 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -40,9 +40,10 @@ EXPORT_SYMBOL(rtc_lock);
*/
int mach_set_rtc_mmss(const struct timespec *now)
{
+ int retval = 0;
+#ifdef CONFIG_RTC_X86_CMOS_SYSTOHC
unsigned long nowtime = now->tv_sec;
struct rtc_time tm;
- int retval = 0;
rtc_time_to_tm(nowtime, &tm);
if (!rtc_valid_tm(&tm)) {
@@ -56,6 +57,7 @@ int mach_set_rtc_mmss(const struct timespec *now)
__FUNCTION__, nowtime);
retval = -EINVAL;
}
+#endif
return retval;
}
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 35259961cc38f7..55c21061aea3a5 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -189,7 +189,7 @@ static int rtc_proc_open(struct inode *inode, struct file *file);
* timer (but you would need to have an awful timing before you'd trip on it)
*/
static unsigned long rtc_status; /* bitmapped status byte. */
-static unsigned long rtc_freq; /* Current periodic IRQ rate */
+static unsigned long __maybe_unused rtc_freq; /* Current periodic IRQ rate */
static unsigned long rtc_irq_data; /* our output to the world */
static unsigned long rtc_max_user_freq = 64; /* > this, need CAP_SYS_RESOURCE */
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 8cd0beebdc3f04..f3a73cbbc00139 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -5,6 +5,21 @@
config RTC_LIB
bool
+config RTC_X86_CMOS_SYSTOHC
+ bool "Enable writing time to hwclock"
+ depends on GENERIC_CMOS_UPDATE
+ default y
+ select RTC_LIB
+ help
+ If you say yes here, and you synchronize your system clock with NTP,
+ the kernel will periodically write the NTP-synchronized system clock
+ to the RTC in CMOS.
+
+ This option enables special-case support for the PC RTC in CMOS. You
+ can instead enable CONFIG_RTC_SYSTOHC for a generic solution that
+ works with any RTC, and enable CONFIG_RTC_DRV_CMOS for the rtc-cmos
+ driver.
+
menuconfig RTC_CLASS
bool "Real Time Clock"
default n