• Arnd Bergmann's avatar
    net: sfc: avoid using timespec · 090e2edb
    Arnd Bergmann authored
    The sfc driver internally uses a time format based on 32-bit (unsigned)
    seconds and 32-bit nanoseconds. This means it will overflow in 2106,
    but the value we pass into it is a signed 32-bit tv_sec that already
    overflows in 2038 to a negative value.
    
    This patch changes the logic to use the lower 32 bits of the timespec64
    tv_sec in efx_ptp_ns_to_s_ns, which will have the correct value beyond the overflow.
    While this does not change any of the register values, it lets us
    keep using the driver after we deprecate the use of the timespec type
    in the kernel.
    
    In the efx_ptp_process_times function, the change to use timespec64
    is similar, in that the tv_sec portion is ignored anyway and we only
    care about the nanosecond portion that remains unchanged.
    Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
    Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
    Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
    090e2edb
ptp.c 56.7 KB