From patchwork Tue Nov 7 10:43:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 118148 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3813578qgn; Tue, 7 Nov 2017 02:44:46 -0800 (PST) X-Google-Smtp-Source: ABhQp+RSPlEEBtPr9sA/YR5nGRAW/t5EtsRSwsO+M2y8BCnl+rqhMf3dySkDszl547TSuQ5171no X-Received: by 10.84.233.197 with SMTP id m5mr17410193pln.305.1510051486769; Tue, 07 Nov 2017 02:44:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510051486; cv=none; d=google.com; s=arc-20160816; b=ywJ78BIoyZRW03Frv0Fs+7xBjFQWkbqn0VyQp2qKDuIEahLAhc7HJoa1jYwS2eSzdH 0hmquAMIh3C0CT/mOpkeYoBAJP1BTd8+Sukb1QhN+xLBxwjeCftm/JSz8vGxecm3pYVs knGSQiolfRDmSJquWtcuG4ns9JHV45ZO051zYuTGpAxplb09zeko+/YIq1UmCaSLAhqq QsHfN3LabKi+PKboBJKWUyFe9VYppKyquBgTWsP/OqGnFhBuJbtGhbsfcoTlLDAHBh5q CIKZ3EbEtzsTPGicwnj6mM4miON4YP1HOUVyrwMug0OIZyk7+YsAkveI8AcsMotgLY7O FKzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=dE2sujwCUxQraD+JT1DhAgfoTc5fjpJJOmt2LlAwXcU=; b=j9ou6s4dIxJB8O09XUxNZPDxLHjEUMYiVXkUZmvQUtXOxykOx75Kju9zCVSXLseLaz WyURF7JC3Ztri/QmPn1k4JQxdmUfp/IVI8yX6xPpFdjCbFAMasm/1Yo6J/qufC9ENhok oXDzKUnwc+3OOtYgvhb1juGut+5QzxwvRLQELVfuAjjZo2sgOOD8Pguu2wj4WOC6Tan+ X9MkJVpuQFpY0F3MCERlHiWYILrWpTz5AI9b8htOGoc/LqKr+KFf0SoFwOjVq5CljBDa Id33WZsRHMfbFAeikwCwMlnukTqyGp1uyogoStp3Jm9eYL1PNod1w1n+FYvmXzdkooT/ P2Kg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b8si860997pgv.728.2017.11.07.02.44.46; Tue, 07 Nov 2017 02:44:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757311AbdKGKon (ORCPT + 26 others); Tue, 7 Nov 2017 05:44:43 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:63430 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750854AbdKGKoj (ORCPT ); Tue, 7 Nov 2017 05:44:39 -0500 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0Lx70L-1fHuub3Sht-016h01; Tue, 07 Nov 2017 11:44:21 +0100 From: Arnd Bergmann To: Greg Kroah-Hartman , Kalle Valo , Larry Finger , Ping-Ke Shih Cc: Arnd Bergmann , shaofu , "Tobin C. Harding" , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: rtlwifi: rtlwifi: use ktime_get_real_seconds() for suspend time Date: Tue, 7 Nov 2017 11:43:34 +0100 Message-Id: <20171107104415.3041680-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:2t6hP8NW71BBCFw3raQHvfpy7I+zK9q5eTxtOHIVaF52Wf5lsP7 W1ZJibhPXzzNpL86wvcMZ9lRo0Me4Z8PyrTnrx8wMyTKgEnTD4mktF1U6WhIB20/Hl7p1jv JSQVf5AUNGzVk6Ih4uwczxpU6V5xyvtfCbLDyVjj8Jp6f9PEGthGGsh18zDGeZ9ppkmulpD qiKALOZJOBNOYpUcDCcmw== X-UI-Out-Filterresults: notjunk:1; V01:K0:7rwE2sHrdjU=:47RuBbgxSdz4YocmvrSyE/ rRYG0/ywfMu9prU0N6E2qdE7SdF4Y505sH9FrPqMnCzhznLH730EkCCvJUSmsDhN2UYvQXLbV 8rWhoJ4+2P99dPvWxoSmws8YhPkqyengQwA2YB5PZz5lGOrf7V6uzYUJA0KB0ADugba9jOaTU e+C8jM/UB2jidfdiS7YcY9dL8CYKcTs8wF6gVnktmIcN1xkY9HjA+7AHJMajuxOs8n9hX2P1P FrcaHlulr22PqWlt4dU0n1Udaxx5FYRJcIZ7Vdc3aqh8Bx+XYO3wYT4EXukpIgYWKd6znV85u IM5CdqIc3ZKMdVa0vFFvsBqQ2WkBTvp1OERkvu2R2vl739IlZm+jJu9rXsibJcp2lBQAVZgUu IC8OlCFR1hvTBTgSII2zS2oGwjInoV9NmQygPNI7O+9qtYnElDwQBOUxwiZiJvvV2NfvGUVG1 W6OGiDucxDyfQb0tThvLTOmKhCZPj0aJXs/EIBOE8j/uKgn2mgLIdmMevBJ2LF8WQdDTmdv3D oTUA7qok6AZ1UN8aejFR1AohvOp2nNjmpPFJL0bjWc6MjOQ7kmUb3CcTxEZiZykIGxoeZJc9e d3f84tZ3Y4LQf/USQHD/eayt1wSbyYxTi2Qp2hwk/KsRqF4yDSAioGfYDxjtsV0x8Ltt7liWd X9J1LbJxVqlDiGoJBvx83qWFe8gmkSos/muAG35uXy/2idm5A/XyQQwzPoHqREXyojg6ioUC6 YikQ+Iy1t2ger742HeRhkMvaqM01t0bO84Mwsw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org do_gettimeofday() is deprecated and slower than necessary for the purpose of reading the seconds. This changes rtl_op_suspend/resume to use ktime_get_real_seconds() instead, which is simpler and avoids confusion about whether it is y2038-safe or not. Signed-off-by: Arnd Bergmann --- This duplicates what I did for the regular (non-staging) rtlwifi driver --- drivers/staging/rtlwifi/core.c | 8 ++------ drivers/staging/rtlwifi/wifi.h | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) -- 2.9.0 diff --git a/drivers/staging/rtlwifi/core.c b/drivers/staging/rtlwifi/core.c index b00e51df984f..a43d37452e8b 100644 --- a/drivers/staging/rtlwifi/core.c +++ b/drivers/staging/rtlwifi/core.c @@ -509,15 +509,13 @@ static int rtl_op_suspend(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_hal *rtlhal = rtl_hal(rtlpriv); struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct timeval ts; RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, "\n"); if (WARN_ON(!wow)) return -EINVAL; /* to resolve s4 can not wake up*/ - do_gettimeofday(&ts); - rtlhal->last_suspend_sec = ts.tv_sec; + rtlhal->last_suspend_sec = ktime_get_real_seconds(); if ((ppsc->wo_wlan_mode & WAKE_ON_PATTERN_MATCH) && wow->n_patterns) _rtl_add_wowlan_patterns(hw, wow); @@ -536,7 +534,6 @@ static int rtl_op_resume(struct ieee80211_hw *hw) struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_hal *rtlhal = rtl_hal(rtlpriv); struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct timeval ts; RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, "\n"); rtlhal->driver_is_goingto_unload = false; @@ -544,8 +541,7 @@ static int rtl_op_resume(struct ieee80211_hw *hw) rtlhal->wake_from_pnp_sleep = true; /* to resovle s4 can not wake up*/ - do_gettimeofday(&ts); - if (ts.tv_sec - rtlhal->last_suspend_sec < 5) + if (ktime_get_real_seconds() - rtlhal->last_suspend_sec < 5) return -1; rtl_op_start(hw); diff --git a/drivers/staging/rtlwifi/wifi.h b/drivers/staging/rtlwifi/wifi.h index eb91c130b245..ca0243fa2e66 100644 --- a/drivers/staging/rtlwifi/wifi.h +++ b/drivers/staging/rtlwifi/wifi.h @@ -1670,7 +1670,7 @@ struct rtl_hal { bool enter_pnp_sleep; bool wake_from_pnp_sleep; bool wow_enabled; - __kernel_time_t last_suspend_sec; + time64_t last_suspend_sec; u32 wowlan_fwsize; u8 *wowlan_firmware;