From patchwork Thu Feb 24 15:26:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Fietze X-Patchwork-Id: 84405 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-fx0-f56.google.com (mail-fx0-f56.google.com [209.85.161.56]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 38D80B70D8 for ; Fri, 25 Feb 2011 02:37:29 +1100 (EST) Received: by fxm3 with SMTP id 3sf336819fxm.11 for ; Thu, 24 Feb 2011 07:37:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:x-beenthere:received-spf:comment:from :organization:to:subject:user-agent:cc:references:in-reply-to :mime-version:x-tnefevaluated:message-id:date:x-mimetrack :x-original-sender:x-original-authentication-results :x-google-group-id:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=kLZtxzKVTOS0BF27Ha2PHWVnE/uvdEbgJN6o+oPDVQ0=; b=ISxjRgxeQ1RCaXvSoWdr9tYPg4z7MFjLxgZG9BCdX/cnlWSXqYcJxWLT/wV+XNd0OL cF1j9x/Dip2RkDy4NzyqCw/kn/sEkAgf5c1FUz1uQxwvuY94Y2ztEW9u3WxoW/FubHKP xpRDCRlZnT5RInMPCYcpWBQ+vJqDhNEBa3RSI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:comment:from:organization:to:subject :user-agent:cc:references:in-reply-to:mime-version:x-tnefevaluated :message-id:date:x-mimetrack:x-original-sender :x-original-authentication-results:x-google-group-id:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe:content-type; b=6LEkWjXTQhepCZPbM1Ux6b2vPi79O2agMEEoV5nVv5mh3MdSTbXl+Y2ZcPYicuS2Cw Rq3gUj3lH5TbzfDB48seR4t64S56KxiB+uKsS96U6O+TS7n5HI2voAcAfIHRjugaNNxd 2aoh5iT/BqdS9VD3gpYicouc0yrbErRl3zZK4= Received: by 10.223.108.211 with SMTP id g19mr90552fap.24.1298561173372; Thu, 24 Feb 2011 07:26:13 -0800 (PST) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.204.138.145 with SMTP id a17ls310455bku.1.p; Thu, 24 Feb 2011 07:26:12 -0800 (PST) Received: by 10.204.49.83 with SMTP id u19mr116455bkf.18.1298561172689; Thu, 24 Feb 2011 07:26:12 -0800 (PST) Received: by 10.204.49.83 with SMTP id u19mr116454bkf.18.1298561172669; Thu, 24 Feb 2011 07:26:12 -0800 (PST) Received: from coyote.quickmin.net (coyote.quickmin.net [217.14.112.24]) by gmr-mx.google.com with ESMTPS id f12si1723028bkf.7.2011.02.24.07.26.11 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 24 Feb 2011 07:26:11 -0800 (PST) Received-SPF: neutral (google.com: 217.14.112.24 is neither permitted nor denied by best guess record for domain of roman.fietze@telemotive.de) client-ip=217.14.112.24; Received: (qmail 46647 invoked from network); 24 Feb 2011 16:26:10 +0100 Received: by simscan 1.4.0 ppid: 46644, pid: 46645, t: 0.0136s scanners: clamav: 0.95.2/m:49/d:8609 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys Received: from mail.telemotive.de (62.206.149.210) by coyote.quickmin.net with SMTP; 24 Feb 2011 16:26:10 +0100 Received: from alderan.mit.telemotive.de ([10.96.96.15]) by mail.telemotive.de (Lotus Domino Release 8.0.2FP1) with ESMTP id 2011022416260944-9621 ; Thu, 24 Feb 2011 16:26:09 +0100 Received: from rfietze.mit.telemotive.de (rfietze.mit.telemotive.de [10.96.97.33]) by alderan.mit.telemotive.de (Postfix) with ESMTP id 7E187D56FE; Thu, 24 Feb 2011 16:26:09 +0100 (CET) Received: by rfietze.mit.telemotive.de (Postfix, from userid 10062) id 6F37F20791; Thu, 24 Feb 2011 16:26:09 +0100 (CET) From: Roman Fietze Organization: Telemotive AG To: John Stultz Subject: [rtc-linux] [PATCH 1/3] rtc-lib: rtc_time const pointers in functions not modifying it User-Agent: KMail/1.13.6 (Linux/2.6.34.7-0.7-default; KDE/4.6.0; x86_64; ; ) Cc: rtc-linux@googlegroups.com References: <201102241624.47015.roman.fietze@telemotive.de> In-Reply-To: <201102241624.47015.roman.fietze@telemotive.de> MIME-Version: 1.0 X-TNEFEvaluated: 1 Message-ID: <201102241626.09346.roman.fietze@telemotive.de> Date: Thu, 24 Feb 2011 16:26:09 +0100 X-MIMETrack: Itemize by SMTP Server on muc/Telemotive(Release 8.0.2FP1|January 12, 2009) at 24.02.2011 16:26:09, Serialize by Router on muc/Telemotive(Release 8.0.2FP1|January 12, 2009) at 24.02.2011 16:26:10, Serialize complete at 24.02.2011 16:26:10 X-Original-Sender: roman.fietze@telemotive.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 217.14.112.24 is neither permitted nor denied by best guess record for domain of roman.fietze@telemotive.de) smtp.mail=roman.fietze@telemotive.de; domainkeys=pass header.From=roman.fietze@telemotive.de X-Google-Group-Id: -934837877 Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , Hello John, Here's number 1. From a560e113ae70cf7f030409fb018028942dee18ca Mon Sep 17 00:00:00 2001 From: Roman Fietze Date: Thu, 24 Feb 2011 15:12:14 +0100 Subject: [PATCH 1/3] rtc-lib: rtc_time const pointers in functions not modifying it This allows the functions rtc_valid_tm() and rtc_tm_to_time() being called with const rtc_time's. Signed-off-by: Roman Fietze --- drivers/rtc/rtc-lib.c | 4 ++-- include/linux/rtc.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-lib.c b/drivers/rtc/rtc-lib.c index 075f170..2341ce6 100644 --- a/drivers/rtc/rtc-lib.c +++ b/drivers/rtc/rtc-lib.c @@ -91,7 +91,7 @@ EXPORT_SYMBOL(rtc_time_to_tm); /* * Does the rtc_time represent a valid date/time? */ -int rtc_valid_tm(struct rtc_time *tm) +int rtc_valid_tm(const struct rtc_time *tm) { if (tm->tm_year < 70 || ((unsigned)tm->tm_mon) >= 12 @@ -109,7 +109,7 @@ EXPORT_SYMBOL(rtc_valid_tm); /* * Convert Gregorian date to seconds since 01-01-1970 00:00:00. */ -int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time) +int rtc_tm_to_time(const struct rtc_time *tm, unsigned long *time) { *time = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); diff --git a/include/linux/rtc.h b/include/linux/rtc.h index 89c3e51..9a28fe1 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h @@ -104,8 +104,8 @@ struct rtc_pll_info { extern int rtc_month_days(unsigned int month, unsigned int year); extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year); -extern int rtc_valid_tm(struct rtc_time *tm); -extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time); +extern int rtc_valid_tm(const struct rtc_time *tm); +extern int rtc_tm_to_time(const struct rtc_time *tm, unsigned long *time); extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm); ktime_t rtc_tm_to_ktime(struct rtc_time tm); struct rtc_time rtc_ktime_to_tm(ktime_t kt);