MIPS: Convert update_persistent_clock() to update_persistent_clock64()

Since struct timespec is not y2038 safe on 32bit machines, this patch
converts update_persistent_clock() to update_persistent_clock64() using
struct timespec64.

The rtc_mips_set_time() and rtc_mips_set_mmss() interfaces were using
'unsigned long' type that is not y2038 safe on 32bit machines, moreover
there is only one platform implementing rtc_mips_set_time() and two
platforms implementing rtc_mips_set_mmss(), so we can just make them each
implement update_persistent_clock64() directly, to get that helper out
of the common mips code by removing rtc_mips_set_time() and
rtc_mips_set_mmss() interfaces.

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>
This commit is contained in:
Baolin Wang
2018-05-07 17:28:28 +08:00
committed by James Hogan
parent 09adad1719
commit f06e7aa47f
8 changed files with 30 additions and 39 deletions

View File

@@ -57,11 +57,11 @@ extern void sb1250_setup(void);
#endif
extern int xicor_probe(void);
extern int xicor_set_time(unsigned long);
extern int xicor_set_time(time64_t);
extern time64_t xicor_get_time(void);
extern int m41t81_probe(void);
extern int m41t81_set_time(unsigned long);
extern int m41t81_set_time(time64_t);
extern time64_t m41t81_get_time(void);
const char *get_system_type(void)
@@ -109,8 +109,10 @@ void read_persistent_clock64(struct timespec64 *ts)
ts->tv_nsec = 0;
}
int rtc_mips_set_time(unsigned long sec)
int update_persistent_clock64(struct timespec64 now)
{
time64_t sec = now.tv_sec;
switch (swarm_rtc_type) {
case RTC_XICOR:
return xicor_set_time(sec);