• Arnd Bergmann's avatar
    m68k: mac: Use time64_t in RTC handling · 5b9bfb8e
    Arnd Bergmann authored
    The real-time clock on m68k (and powerpc) mac systems uses an unsigned
    32-bit value starting in 1904, which overflows in 2040, about two years
    later than everyone else, but this gets wrapped around in the Linux
    code in 2038 already because of the deprecated usage of time_t and/or
    long in the conversion.
    
    Getting rid of the deprecated interfaces makes it work until 2040 as
    documented, and it could be easily extended by reinterpreting
    the resulting time64_t as a positive number. For the moment, I'm
    adding a WARN_ON() that triggers if we encounter a time before 1970
    or after 2040 (the two are indistinguishable).
    
    This brings it in line with the corresponding code that we have on
    powerpc macintosh.
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    [fthain: Adopt __u32 for the union in via_read_time(), consistent with
    	 changes to via_write_time()]
    [fthain: Use lower_32_bits() in via_write_time(), consistent with changes
    	 to pmu_write_time() and cuda_write_time()]
    [fthain: Have via_read_time() return a time64_t, consistent with changes
    	 to pmu_read_time() and cuda_read_time()]
    [fthain: Drop the pointless wraparound conditional in via_read_time()]
    Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
    Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
    [geert: Drop WARN_ON(), as it is reported to trigger on powermac]
    Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
    5b9bfb8e
misc.c 16.6 KB