Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Convert read_persistent_clock() to read_persistent_clock64()

Since struct timespec is not y2038 safe on 32bit machines, this patch
converts read_persistent_clock() to read_persistent_clock64() using
struct timespec64, as well as converting mktime() to mktime64().

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Paul Burton <paul.burton@mips.com>
Cc: linux-mips@linux-mips.org
Signed-off-by: James Hogan <jhogan@kernel.org>

authored by

Baolin Wang and committed by
James Hogan
09adad17 d7c72c57

+16 -16
+2 -2
arch/mips/dec/time.c
··· 19 19 #include <asm/dec/ioasic.h> 20 20 #include <asm/dec/machtype.h> 21 21 22 - void read_persistent_clock(struct timespec *ts) 22 + void read_persistent_clock64(struct timespec64 *ts) 23 23 { 24 24 unsigned int year, mon, day, hour, min, sec, real_year; 25 25 unsigned long flags; ··· 54 54 55 55 year += real_year - 72 + 2000; 56 56 57 - ts->tv_sec = mktime(year, mon, day, hour, min, sec); 57 + ts->tv_sec = mktime64(year, mon, day, hour, min, sec); 58 58 ts->tv_nsec = 0; 59 59 } 60 60
+2 -2
arch/mips/include/asm/mc146818-time.h
··· 86 86 return retval; 87 87 } 88 88 89 - static inline unsigned long mc146818_get_cmos_time(void) 89 + static inline time64_t mc146818_get_cmos_time(void) 90 90 { 91 91 unsigned int year, mon, day, hour, min, sec; 92 92 unsigned long flags; ··· 113 113 spin_unlock_irqrestore(&rtc_lock, flags); 114 114 year = mc146818_decode_year(year); 115 115 116 - return mktime(year, mon, day, hour, min, sec); 116 + return mktime64(year, mon, day, hour, min, sec); 117 117 } 118 118 119 119 #endif /* __ASM_MC146818_TIME_H */
+1 -1
arch/mips/lasat/ds1603.c
··· 136 136 lasat_ndelay(1000); 137 137 } 138 138 139 - void read_persistent_clock(struct timespec *ts) 139 + void read_persistent_clock64(struct timespec64 *ts) 140 140 { 141 141 unsigned long word; 142 142 unsigned long flags;
+1 -1
arch/mips/loongson64/common/time.c
··· 29 29 #endif 30 30 } 31 31 32 - void read_persistent_clock(struct timespec *ts) 32 + void read_persistent_clock64(struct timespec64 *ts) 33 33 { 34 34 ts->tv_sec = mc146818_get_cmos_time(); 35 35 ts->tv_nsec = 0;
+1 -1
arch/mips/mti-malta/malta-time.c
··· 134 134 } 135 135 } 136 136 137 - void read_persistent_clock(struct timespec *ts) 137 + void read_persistent_clock64(struct timespec64 *ts) 138 138 { 139 139 ts->tv_sec = mc146818_get_cmos_time(); 140 140 ts->tv_nsec = 0;
+2 -2
arch/mips/sibyte/swarm/rtc_m41t81.c
··· 188 188 return 0; 189 189 } 190 190 191 - unsigned long m41t81_get_time(void) 191 + time64_t m41t81_get_time(void) 192 192 { 193 193 unsigned int year, mon, day, hour, min, sec; 194 194 unsigned long flags; ··· 218 218 219 219 year += 2000; 220 220 221 - return mktime(year, mon, day, hour, min, sec); 221 + return mktime64(year, mon, day, hour, min, sec); 222 222 } 223 223 224 224 int m41t81_probe(void)
+2 -2
arch/mips/sibyte/swarm/rtc_xicor1241.c
··· 168 168 return 0; 169 169 } 170 170 171 - unsigned long xicor_get_time(void) 171 + time64_t xicor_get_time(void) 172 172 { 173 173 unsigned int year, mon, day, hour, min, sec, y2k; 174 174 unsigned long flags; ··· 201 201 202 202 year += (y2k * 100); 203 203 204 - return mktime(year, mon, day, hour, min, sec); 204 + return mktime64(year, mon, day, hour, min, sec); 205 205 } 206 206 207 207 int xicor_probe(void)
+5 -5
arch/mips/sibyte/swarm/setup.c
··· 58 58 59 59 extern int xicor_probe(void); 60 60 extern int xicor_set_time(unsigned long); 61 - extern unsigned long xicor_get_time(void); 61 + extern time64_t xicor_get_time(void); 62 62 63 63 extern int m41t81_probe(void); 64 64 extern int m41t81_set_time(unsigned long); 65 - extern unsigned long m41t81_get_time(void); 65 + extern time64_t m41t81_get_time(void); 66 66 67 67 const char *get_system_type(void) 68 68 { ··· 87 87 88 88 enum swarm_rtc_type swarm_rtc_type; 89 89 90 - void read_persistent_clock(struct timespec *ts) 90 + void read_persistent_clock64(struct timespec64 *ts) 91 91 { 92 - unsigned long sec; 92 + time64_t sec; 93 93 94 94 switch (swarm_rtc_type) { 95 95 case RTC_XICOR: ··· 102 102 103 103 case RTC_NONE: 104 104 default: 105 - sec = mktime(2000, 1, 1, 0, 0, 0); 105 + sec = mktime64(2000, 1, 1, 0, 0, 0); 106 106 break; 107 107 } 108 108 ts->tv_sec = sec;