From patchwork Mon Jul 7 11:30:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Fietze X-Patchwork-Id: 367499 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-wg0-x23b.google.com (mail-wg0-x23b.google.com [IPv6:2a00:1450:400c:c00::23b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DC1FD1400B8 for ; Mon, 7 Jul 2014 21:30:14 +1000 (EST) Received: by mail-wg0-f59.google.com with SMTP id b13sf513041wgh.4 for ; Mon, 07 Jul 2014 04:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=from:to:subject:date:message-id:organization:user-agent :mime-version:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:sender:list-subscribe:list-unsubscribe:content-type; bh=tpuqEsVUGPELxRiNOflFCdG0TRvH+msfuQ/6SLFJNyQ=; b=e7vRP9Cu32LAzc6BK1IGNQewvOfho2d9CJUMCjbN2ujmZoB1APr5naTYCMdwExL2Wm duZiSZk55/qPN1UOo3nB242sv/SqFreIegtPWmgCWUvYw3/bxqifF2n8sgk9Sby7yij8 Ig+DtYKcD2xFKaHecupbIz81tO6bjYKS06/mgS9WVraNycMF5zmUIbT5rXpuO0edQtAX 3CY41Z1wPzCOyLGPvMKX7T+uPfSGB3q419tGhGEmcrWdDE8QXMTclLza+t5v+9eowKRP ldlk03c6xdiJBuKbSVjLeO9c8EKIRGemp7lxuZRZa5q7O8w9BSFrv3wNuwHbS6HbruOE XbIg== X-Received: by 10.152.8.78 with SMTP id p14mr12046laa.14.1404732609941; Mon, 07 Jul 2014 04:30:09 -0700 (PDT) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.152.203.230 with SMTP id kt6ls298438lac.81.gmail; Mon, 07 Jul 2014 04:30:09 -0700 (PDT) X-Received: by 10.152.22.131 with SMTP id d3mr281698laf.3.1404732609512; Mon, 07 Jul 2014 04:30:09 -0700 (PDT) Received: from coyote.quickmin.net (coyote.quickmin.net. [217.14.112.24]) by gmr-mx.google.com with ESMTPS id b9si1345617wic.2.2014.07.07.04.30.09 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 07 Jul 2014 04:30:09 -0700 (PDT) Received-SPF: none (google.com: roman.fietze@telemotive.de does not designate permitted sender hosts) client-ip=217.14.112.24; Received: (qmail 25901 invoked from network); 7 Jul 2014 13:30:08 +0200 Received: by simscan 1.4.0 ppid: 25897, pid: 25899, t: 0.0372s scanners: clamav: 0.98.1/m:55/d:19167 Received: from h-213.61.108.26.host.de.colt.net (HELO mail.telemotive.de) (213.61.108.26) by coyote.quickmin.net with SMTP; 7 Jul 2014 13:30:08 +0200 Received: from alderan.mit.telemotive.de ([10.96.96.15]) by mail.telemotive.de (Lotus Domino Release 8.5.3FP6HF107) with ESMTP id 2014070713300804-20993 ; Mon, 7 Jul 2014 13:30:08 +0200 Received: from rfietze.mit.telemotive.de (rfietze.mit.telemotive.de [10.96.97.33]) by alderan.mit.telemotive.de (Postfix) with ESMTP id 7774DBC4D8; Mon, 7 Jul 2014 13:30:08 +0200 (CEST) Received: by rfietze.mit.telemotive.de (Postfix, from userid 10062) id 6E5A14F4; Mon, 7 Jul 2014 13:30:08 +0200 (CEST) From: Roman Fietze To: linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com, Alessandro Zummo Subject: [rtc-linux] [PATCH 1/2] Allow to override the hctosys RTC using a kernel parameter Date: Mon, 07 Jul 2014 13:30:08 +0200 Message-ID: <5132579.sMfE4ssjXf@rfietze> Organization: Telemotive AG User-Agent: KMail/4.13.2 (Linux/3.11.10-17-default; KDE/4.13.2; x86_64; ; ) MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on muc/Telemotive(Release 8.5.3FP6HF107 | January 23, 2014) at 07.07.2014 13:30:08, Serialize by Router on muc/Telemotive(Release 8.5.3FP6HF107 | January 23, 2014) at 07.07.2014 13:30:08, Serialize complete at 07.07.2014 13:30:08 X-TNEFEvaluated: 1 X-Original-Sender: roman.fietze@telemotive.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: roman.fietze@telemotive.de does not designate permitted sender hosts) smtp.mail=roman.fietze@telemotive.de Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , 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 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 --- 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