Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752045AbbD3RAo (ORCPT ); Thu, 30 Apr 2015 13:00:44 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:38176 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751140AbbD3RAl (ORCPT ); Thu, 30 Apr 2015 13:00:41 -0400 From: Ksenija Stanojevic To: gregkh@linuxfoundation.org Cc: micky_ching@realsil.com.cn, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, devel@driverdev.osuosl.org, y2038@lists.linaro.org, Ksenija Stanojevic Subject: [PATCH] Staging: rts5208: Replace timeval with timespec64 Date: Thu, 30 Apr 2015 19:00:23 +0200 Message-Id: <1430413223-8021-1-git-send-email-ksenija.stanojevic@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2145 Lines: 66 struct timeval tv is used to get current time. 32-bit systems using 'struct timeval' will break in the year 2038, so we have to replace that code with more appropriate types. Signed-off-by: Ksenija Stanojevic Reviewed-by: Arnd Bergmann --- drivers/staging/rts5208/rtsx.h | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/staging/rts5208/rtsx.h b/drivers/staging/rts5208/rtsx.h index 9e6ecb7..f768fc0 100644 --- a/drivers/staging/rts5208/rtsx.h +++ b/drivers/staging/rts5208/rtsx.h @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include @@ -151,21 +151,24 @@ static inline struct rtsx_dev *host_to_rtsx(struct Scsi_Host *host) static inline void get_current_time(u8 *timeval_buf, int buf_len) { - struct timeval tv; + struct timespec64 ts64; + u32 tv_usec; if (!timeval_buf || (buf_len < 8)) return; - do_gettimeofday(&tv); + getnstimeofday64(&ts64); - timeval_buf[0] = (u8)(tv.tv_sec >> 24); - timeval_buf[1] = (u8)(tv.tv_sec >> 16); - timeval_buf[2] = (u8)(tv.tv_sec >> 8); - timeval_buf[3] = (u8)(tv.tv_sec); - timeval_buf[4] = (u8)(tv.tv_usec >> 24); - timeval_buf[5] = (u8)(tv.tv_usec >> 16); - timeval_buf[6] = (u8)(tv.tv_usec >> 8); - timeval_buf[7] = (u8)(tv.tv_usec); + tv_usec = ts64.tv_nsec/NSEC_PER_USEC; + + timeval_buf[0] = (u8)(ts64.tv_sec >> 24); + timeval_buf[1] = (u8)(ts64.tv_sec >> 16); + timeval_buf[2] = (u8)(ts64.tv_sec >> 8); + timeval_buf[3] = (u8)(ts64.tv_sec); + timeval_buf[4] = (u8)(tv_usec >> 24); + timeval_buf[5] = (u8)(tv_usec >> 16); + timeval_buf[6] = (u8)(tv_usec >> 8); + timeval_buf[7] = (u8)(tv_usec); } /* The scsi_lock() and scsi_unlock() macros protect the sm_state and the -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/