public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roman Fietze <roman.fietze@telemotive.de>
To: linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com,
	Alessandro Zummo <a.zummo@towertech.it>
Subject: [PATCH 1/2] Allow to override the hctosys RTC using a kernel parameter
Date: Mon, 07 Jul 2014 13:30:08 +0200	[thread overview]
Message-ID: <5132579.sMfE4ssjXf@rfietze> (raw)

Hello RTC maintainers and list members,

I would like to hear your criticism about the following two small
patches.

These patches allow to overwrite the hctosys RTC specified in the
kernel config using CONFIG_RTC_HCTOSYS_DEVICE.

The background ist, that we have two almost identical x86 boards from
MEN in Nuernberg. The first one buffers the CMOS RTC, the other one
buffers an additional Epson RX8581 I2C RTC. We would like to use the
same kernel, but the only parameter we could not overwrite when
starting the kernel or system was the RTC used to initialize the
system clock.


>From 1e302072919594da0f5e71b38e7254ebfa4243f7 Mon Sep 17 00:00:00 2001
From: Roman Fietze <roman.fietze@telemotive.de>
Date: Thu, 3 Jul 2014 14:20:40 +0200
Subject: [PATCH 1/2] rtc: define maximum size of RTC device name in rtc.h

Signed-off-by: Roman Fietze <roman.fietze@telemotive.de>
---
 drivers/rtc/rtc-proc.c | 10 ++++------
 include/linux/rtc.h    |  1 +
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c
index ffa69e1..a77ca46 100644
--- a/drivers/rtc/rtc-proc.c
+++ b/drivers/rtc/rtc-proc.c
@@ -18,19 +18,17 @@
 
 #include "rtc-core.h"
 
-#define NAME_SIZE	10
-
 #if defined(CONFIG_RTC_HCTOSYS_DEVICE)
 static bool is_rtc_hctosys(struct rtc_device *rtc)
 {
 	int size;
-	char name[NAME_SIZE];
+	char name[RTC_HCTOSYS_DEVICE_SIZE];
 
-	size = scnprintf(name, NAME_SIZE, "rtc%d", rtc->id);
-	if (size > NAME_SIZE)
+	size = scnprintf(name, RTC_HCTOSYS_DEVICE_SIZE, "rtc%d", rtc->id);
+	if (size > RTC_HCTOSYS_DEVICE_SIZE)
 		return false;
 
-	return !strncmp(name, CONFIG_RTC_HCTOSYS_DEVICE, NAME_SIZE);
+	return !strncmp(name, rtc_hctosys_device, RTC_HCTOSYS_DEVICE_SIZE);
 }
 #else
 static bool is_rtc_hctosys(struct rtc_device *rtc)
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index c2c2897..0a115b5 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -192,6 +192,7 @@ static inline bool is_leap_year(unsigned int year)
 }
 
 #ifdef CONFIG_RTC_HCTOSYS_DEVICE
+#define RTC_HCTOSYS_DEVICE_SIZE	10
 extern int rtc_hctosys_ret;
 #else
 #define rtc_hctosys_ret -ENODEV
-- 
1.8.4.5



Roman

-- 
Roman Fietze              Telemotive AG Buero Muehlhausen
Breitwiesen                             73347 Muehlhausen
Tel.: +49 7335 18493-45          http://www.telemotive.de


             reply	other threads:[~2014-07-07 11:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-07 11:30 Roman Fietze [this message]
2014-07-07 11:50 ` [PATCH 2/2] Allow to override the hctosys RTC using a kernel parameter Roman Fietze
2014-07-07 13:01   ` Alexander Holler
2014-07-15 23:15   ` [rtc-linux] " Andrew Morton
2014-07-07 12:20 ` [rtc-linux] [PATCH 1/2] " Alexander Holler

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=5132579.sMfE4ssjXf@rfietze \
    --to=roman.fietze@telemotive.de \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    /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