smartpqi: fix time handling
Subsystems (2)
PATCH 1/1 smartpqi: fix time handling
When we have turned off RTC support, the smartpqi driver fails to build:
ERROR: "rtc_time64_to_tm" [drivers/scsi/smartpqi/smartpqi.ko] undefined!
This is easily avoided by using the generic 'struct tm' based helper rather than the RTC specific one. While fixing this, I noticed that even though the driver uses time64_t for storing seconds, it gets them from the old 32-bit struct timeval. To address this, we can simplify the code by calling ktime_get_real_seconds() directly.
--- drivers/scsi/smartpqi/smartpqi_init.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/scsi/smartpqi/smartpqi_init.c +3 -5
@@ -534,8 +534,7 @@ static int pqi_write_current_time_to_host_wellness(size_t buffer_length;time64_t local_time;unsigned int year; -struct timeval time; -struct rtc_time tm; +struct tm tm; buffer_length =sizeof (*buffer);
@@ -552,9 +551,8 @@ static int pqi_write_current_time_to_host_wellness(put_unaligned_le16 (sizeof (buffer->time), &buffer->time_length); -do_gettimeofday (&time); - local_time = time.tv_sec - (sys_tz.tz_minuteswest *60 ); -rtc_time64_to_tm (local_time, &tm); + local_time =ktime_get_real_seconds (); +time64_to_tm (local_time, -sys_tz.tz_minuteswest *60 , &tm); year = tm.tm_year +1900 ; buffer->time[0 ] =bin2bcd (tm.tm_hour);
Signature · 1 line
2.9.0
Martin K. Petersen
AppliedQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Arnd" == Arnd Bergmann <[email protected]> writes:
Arnd> When we have turned off RTC support, the smartpqi driver fails to Arnd> build: ERROR: "rtc_time64_to_tm"
Arnd> [drivers/scsi/smartpqi/smartpqi.ko] undefined!
Applied to 4.11/scsi-queue.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering