aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/common/rtctime.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/common/rtctime.c')
-rw-r--r--arch/arm/common/rtctime.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/arch/arm/common/rtctime.c b/arch/arm/common/rtctime.c
index c397e71f938d..72b03f201eb9 100644
--- a/arch/arm/common/rtctime.c
+++ b/arch/arm/common/rtctime.c
@@ -141,10 +141,10 @@ void rtc_next_alarm_time(struct rtc_time *next, struct rtc_time *now, struct rtc
141 next->tm_sec = alrm->tm_sec; 141 next->tm_sec = alrm->tm_sec;
142} 142}
143 143
144static inline void rtc_read_time(struct rtc_ops *ops, struct rtc_time *tm) 144static inline int rtc_read_time(struct rtc_ops *ops, struct rtc_time *tm)
145{ 145{
146 memset(tm, 0, sizeof(struct rtc_time)); 146 memset(tm, 0, sizeof(struct rtc_time));
147 ops->read_time(tm); 147 return ops->read_time(tm);
148} 148}
149 149
150static inline int rtc_set_time(struct rtc_ops *ops, struct rtc_time *tm) 150static inline int rtc_set_time(struct rtc_ops *ops, struct rtc_time *tm)
@@ -163,8 +163,7 @@ static inline int rtc_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)
163 int ret = -EINVAL; 163 int ret = -EINVAL;
164 if (ops->read_alarm) { 164 if (ops->read_alarm) {
165 memset(alrm, 0, sizeof(struct rtc_wkalrm)); 165 memset(alrm, 0, sizeof(struct rtc_wkalrm));
166 ops->read_alarm(alrm); 166 ret = ops->read_alarm(alrm);
167 ret = 0;
168 } 167 }
169 return ret; 168 return ret;
170} 169}
@@ -283,7 +282,9 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
283 break; 282 break;
284 283
285 case RTC_RD_TIME: 284 case RTC_RD_TIME:
286 rtc_read_time(ops, &tm); 285 ret = rtc_read_time(ops, &tm);
286 if (ret)
287 break;
287 ret = copy_to_user(uarg, &tm, sizeof(tm)); 288 ret = copy_to_user(uarg, &tm, sizeof(tm));
288 if (ret) 289 if (ret)
289 ret = -EFAULT; 290 ret = -EFAULT;
@@ -424,15 +425,15 @@ static int rtc_read_proc(char *page, char **start, off_t off, int count, int *eo
424 struct rtc_time tm; 425 struct rtc_time tm;
425 char *p = page; 426 char *p = page;
426 427
427 rtc_read_time(ops, &tm); 428 if (rtc_read_time(ops, &tm) == 0) {
428 429 p += sprintf(p,
429 p += sprintf(p, 430 "rtc_time\t: %02d:%02d:%02d\n"
430 "rtc_time\t: %02d:%02d:%02d\n" 431 "rtc_date\t: %04d-%02d-%02d\n"
431 "rtc_date\t: %04d-%02d-%02d\n" 432 "rtc_epoch\t: %04lu\n",
432 "rtc_epoch\t: %04lu\n", 433 tm.tm_hour, tm.tm_min, tm.tm_sec,
433 tm.tm_hour, tm.tm_min, tm.tm_sec, 434 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
434 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 435 rtc_epoch);
435 rtc_epoch); 436 }
436 437
437 if (rtc_read_alarm(ops, &alrm) == 0) { 438 if (rtc_read_alarm(ops, &alrm) == 0) {
438 p += sprintf(p, "alrm_time\t: "); 439 p += sprintf(p, "alrm_time\t: ");