···141141 next->tm_sec = alrm->tm_sec;142142}143143144144-static inline void rtc_read_time(struct rtc_ops *ops, struct rtc_time *tm)144144+static inline int rtc_read_time(struct rtc_ops *ops, struct rtc_time *tm)145145{146146 memset(tm, 0, sizeof(struct rtc_time));147147- ops->read_time(tm);147147+ return ops->read_time(tm);148148}149149150150static inline int rtc_set_time(struct rtc_ops *ops, struct rtc_time *tm)···163163 int ret = -EINVAL;164164 if (ops->read_alarm) {165165 memset(alrm, 0, sizeof(struct rtc_wkalrm));166166- ops->read_alarm(alrm);167167- ret = 0;166166+ ret = ops->read_alarm(alrm);168167 }169168 return ret;170169}···282283 break;283284284285 case RTC_RD_TIME:285285- rtc_read_time(ops, &tm);286286+ ret = rtc_read_time(ops, &tm);287287+ if (ret)288288+ break;286289 ret = copy_to_user(uarg, &tm, sizeof(tm));287290 if (ret)288291 ret = -EFAULT;···425424 struct rtc_time tm;426425 char *p = page;427426428428- rtc_read_time(ops, &tm);429429-430430- p += sprintf(p,431431- "rtc_time\t: %02d:%02d:%02d\n"432432- "rtc_date\t: %04d-%02d-%02d\n"433433- "rtc_epoch\t: %04lu\n",434434- tm.tm_hour, tm.tm_min, tm.tm_sec,435435- tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,436436- rtc_epoch);427427+ if (rtc_read_time(ops, &tm) == 0) {428428+ p += sprintf(p,429429+ "rtc_time\t: %02d:%02d:%02d\n"430430+ "rtc_date\t: %04d-%02d-%02d\n"431431+ "rtc_epoch\t: %04lu\n",432432+ tm.tm_hour, tm.tm_min, tm.tm_sec,433433+ tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,434434+ rtc_epoch);435435+ }437436438437 if (rtc_read_alarm(ops, &alrm) == 0) {439438 p += sprintf(p, "alrm_time\t: ");
+12-5
arch/arm/mach-integrator/time.c
···4040 return 1;4141}42424343-static void rtc_read_alarm(struct rtc_wkalrm *alrm)4343+static int rtc_read_alarm(struct rtc_wkalrm *alrm)4444{4545 rtc_time_to_tm(readl(rtc_base + RTC_MR), &alrm->time);4646+ return 0;4647}47484848-static int rtc_set_alarm(struct rtc_wkalrm *alrm)4949+static inline int rtc_set_alarm(struct rtc_wkalrm *alrm)4950{5051 unsigned long time;5152 int ret;52535353- ret = rtc_tm_to_time(&alrm->time, &time);5454+ /*5555+ * At the moment, we can only deal with non-wildcarded alarm times.5656+ */5757+ ret = rtc_valid_tm(&alrm->time);5858+ if (ret == 0)5959+ ret = rtc_tm_to_time(&alrm->time, &time);5460 if (ret == 0)5561 writel(time, rtc_base + RTC_MR);5662 return ret;5763}58645959-static void rtc_read_time(struct rtc_time *tm)6565+static int rtc_read_time(struct rtc_time *tm)6066{6167 rtc_time_to_tm(readl(rtc_base + RTC_DR), tm);6868+ return 0;6269}63706471/*···7669 * edge of the 1Hz clock, we must write the time one second7770 * in advance.7871 */7979-static int rtc_set_time(struct rtc_time *tm)7272+static inline int rtc_set_time(struct rtc_time *tm)8073{8174 unsigned long time;8275 int ret;
+6-2
drivers/char/s3c2410-rtc.c
···116116117117/* Time read/write */118118119119-static void s3c2410_rtc_gettime(struct rtc_time *rtc_tm)119119+static int s3c2410_rtc_gettime(struct rtc_time *rtc_tm)120120{121121 unsigned int have_retried = 0;122122···151151152152 rtc_tm->tm_year += 100;153153 rtc_tm->tm_mon -= 1;154154+155155+ return 0;154156}155157156158···173171 return 0;174172}175173176176-static void s3c2410_rtc_getalarm(struct rtc_wkalrm *alrm)174174+static int s3c2410_rtc_getalarm(struct rtc_wkalrm *alrm)177175{178176 struct rtc_time *alm_tm = &alrm->time;179177 unsigned int alm_en;···233231 }234232235233 /* todo - set alrm->enabled ? */234234+235235+ return 0;236236}237237238238static int s3c2410_rtc_setalarm(struct rtc_wkalrm *alrm)
+2-2
include/asm-arm/rtc.h
···1818 void (*release)(void);1919 int (*ioctl)(unsigned int, unsigned long);20202121- void (*read_time)(struct rtc_time *);2121+ int (*read_time)(struct rtc_time *);2222 int (*set_time)(struct rtc_time *);2323- void (*read_alarm)(struct rtc_wkalrm *);2323+ int (*read_alarm)(struct rtc_wkalrm *);2424 int (*set_alarm)(struct rtc_wkalrm *);2525 int (*proc)(char *buf);2626};