diff options
author | Alison Schofield | 2015-11-09 20:34:20 +0100 |
---|---|---|
committer | Martin K. Petersen | 2015-11-12 02:51:04 +0100 |
commit | 9c9bd593f30fc8a4d6e70d72b49b5651fa492e65 (patch) | |
tree | 3d92a7bd095e43985f94a271105f3e24c68ee8a5 /drivers/message/fusion/mptctl.c | |
parent | mvumi: 64bit value for seconds_since1970 (diff) | |
download | kernel-qcow2-linux-9c9bd593f30fc8a4d6e70d72b49b5651fa492e65.tar.gz kernel-qcow2-linux-9c9bd593f30fc8a4d6e70d72b49b5651fa492e65.tar.xz kernel-qcow2-linux-9c9bd593f30fc8a4d6e70d72b49b5651fa492e65.zip |
scsi: pmcraid: replace struct timeval with ktime_get_real_seconds()
Replace the use of struct timeval and do_gettimeofday() with
64 bit ktime_get_real_seconds. Prevents 32-bit type overflow
in year 2038 on 32-bit systems.
Driver was using the seconds portion of struct timeval (.tv_secs)
to pass a millseconds timestamp to the firmware. This change maintains
that same behavior using ktime_get_real_seconds.
The structure used to pass the timestamp to firmware is 48 bits and
works fine as long as the top 16 bits are zero and they will be zero
for a long time..ie. thousands of years.
Alternative Change: Add sub second granularity to timestamp
As noted above, the driver only used the seconds portion of timeval,
ignores the microseconds portion, and by multiplying by 1000 effectively
does a <<10 and always writes zero into timestamp[0].
The alternative change would pass all the bits to the firmware:
struct timespec64 ts;
ktime_get_real_ts64(&ts);
timestamp = ts.tv_sec * MSEC_PER_SEC + ts.tv_nsec / NSEC_PER_MSEC;
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/message/fusion/mptctl.c')
0 files changed, 0 insertions, 0 deletions