scsi: ips: fix firmware timestamps for 32-bit
do_gettimeofday() is deprecated since it will stop working in 2038 on 32-bit platforms, leading to incorrect times passed to the firmware. On 64-bit platforms the current code appears to be fine, as the calculation passes an 8-bit century number into the firmware that can represent times long in the future (possibly until 25599). Using ktime_get_real_seconds() to get a 64-bit seconds value and time64_to_tm() to convert it into the firmware format greatly simplifies the ips timekeeping code, makes 32-bit and 64-bit behave the same way here, and gets us closer to removing the deprecated interfaces. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:

committed by
Martin K. Petersen

부모
feeeca4ce2
커밋
f990bee3f1
@@ -402,16 +402,7 @@
|
||||
#define IPS_BIOS_HEADER 0xC0
|
||||
|
||||
/* time oriented stuff */
|
||||
#define IPS_IS_LEAP_YEAR(y) (((y % 4 == 0) && ((y % 100 != 0) || (y % 400 == 0))) ? 1 : 0)
|
||||
#define IPS_NUM_LEAP_YEARS_THROUGH(y) ((y) / 4 - (y) / 100 + (y) / 400)
|
||||
|
||||
#define IPS_SECS_MIN 60
|
||||
#define IPS_SECS_HOUR 3600
|
||||
#define IPS_SECS_8HOURS 28800
|
||||
#define IPS_SECS_DAY 86400
|
||||
#define IPS_DAYS_NORMAL_YEAR 365
|
||||
#define IPS_DAYS_LEAP_YEAR 366
|
||||
#define IPS_EPOCH_YEAR 1970
|
||||
|
||||
/*
|
||||
* Scsi_Host Template
|
||||
@@ -1054,7 +1045,7 @@ typedef struct ips_ha {
|
||||
uint8_t active;
|
||||
int ioctl_reset; /* IOCTL Requested Reset Flag */
|
||||
uint16_t reset_count; /* number of resets */
|
||||
time_t last_ffdc; /* last time we sent ffdc info*/
|
||||
time64_t last_ffdc; /* last time we sent ffdc info*/
|
||||
uint8_t slot_num; /* PCI Slot Number */
|
||||
int ioctl_len; /* size of ioctl buffer */
|
||||
dma_addr_t ioctl_busaddr; /* dma address of ioctl buffer*/
|
||||
|
Reference in New Issue
Block a user