summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/esas2r
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2018-04-20 12:02:09 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2018-04-20 19:40:16 -0400
commitfeeeca4ce2942b92db90e12a8e2baf0e6e3f0191 (patch)
tree5102d3cd2b81e0952564dc94de23fa408d3069df /drivers/scsi/esas2r
parentf9c25ccfc173dff6de4d68bd998e1a9fa93c5cab (diff)
scsi: esas2r: use ktime_get_real_seconds()
do_gettimeofday() is deprecated because of the y2038 overflow. Here, we use the result to pass into a 32-bit field in the firmware, which still risks an overflow, but if the firmware is written to expect unsigned values, it can at least last until y2106, and there is not much we can do about it. This changes do_gettimeofday() to ktime_get_real_seconds(), which at least simplifies the code a bit, and avoids the deprecated interface. I'm adding a comment about the overflow to document what happens. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/esas2r')
-rw-r--r--drivers/scsi/esas2r/esas2r_init.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/scsi/esas2r/esas2r_init.c b/drivers/scsi/esas2r/esas2r_init.c
index 9dffcb28c9b7..9db645dde35e 100644
--- a/drivers/scsi/esas2r/esas2r_init.c
+++ b/drivers/scsi/esas2r/esas2r_init.c
@@ -1202,8 +1202,6 @@ static bool esas2r_format_init_msg(struct esas2r_adapter *a,
1202 case ESAS2R_INIT_MSG_START: 1202 case ESAS2R_INIT_MSG_START:
1203 case ESAS2R_INIT_MSG_REINIT: 1203 case ESAS2R_INIT_MSG_REINIT:
1204 { 1204 {
1205 struct timeval now;
1206 do_gettimeofday(&now);
1207 esas2r_hdebug("CFG init"); 1205 esas2r_hdebug("CFG init");
1208 esas2r_build_cfg_req(a, 1206 esas2r_build_cfg_req(a,
1209 rq, 1207 rq,
@@ -1212,7 +1210,8 @@ static bool esas2r_format_init_msg(struct esas2r_adapter *a,
1212 NULL); 1210 NULL);
1213 ci = (struct atto_vda_cfg_init *)&rq->vrq->cfg.data.init; 1211 ci = (struct atto_vda_cfg_init *)&rq->vrq->cfg.data.init;
1214 ci->sgl_page_size = cpu_to_le32(sgl_page_size); 1212 ci->sgl_page_size = cpu_to_le32(sgl_page_size);
1215 ci->epoch_time = cpu_to_le32(now.tv_sec); 1213 /* firmware interface overflows in y2106 */
1214 ci->epoch_time = cpu_to_le32(ktime_get_real_seconds());
1216 rq->flags |= RF_FAILURE_OK; 1215 rq->flags |= RF_FAILURE_OK;
1217 a->init_msg = ESAS2R_INIT_MSG_INIT; 1216 a->init_msg = ESAS2R_INIT_MSG_INIT;
1218 break; 1217 break;