Patchwork [1/3] rtc-lib: rtc_time const pointers in functions not modifying it

login
register
mail settings
Submitter Roman Fietze
Date Feb. 24, 2011, 3:26 p.m.
Message ID <201102241626.09346.roman.fietze@telemotive.de>
Download mbox | patch
Permalink /patch/84405/
State New
Headers show

Comments

Roman Fietze - Feb. 24, 2011, 3:26 p.m.
Hello John,

Here's number 1.

From a560e113ae70cf7f030409fb018028942dee18ca Mon Sep 17 00:00:00 2001
From: Roman Fietze <roman.fietze@telemotive.de>
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 <roman.fietze@telemotive.de>
---
 drivers/rtc/rtc-lib.c |    4 ++--
 include/linux/rtc.h   |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Patch

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);