From patchwork Sat Oct 24 04:00:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WEN Pingbo X-Patchwork-Id: 7479801 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 38CA9BEEA4 for ; Sat, 24 Oct 2015 04:01:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C54C20A2B for ; Sat, 24 Oct 2015 04:01:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C1212097D for ; Sat, 24 Oct 2015 04:01:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750818AbbJXEAn (ORCPT ); Sat, 24 Oct 2015 00:00:43 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:32977 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750713AbbJXEAm (ORCPT ); Sat, 24 Oct 2015 00:00:42 -0400 Received: by pabrc13 with SMTP id rc13so134309083pab.0 for ; Fri, 23 Oct 2015 21:00:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OA7mZXnY1G3KI21pF717FyIydcClEbpWPSshQvCfbMc=; b=TMIVUdtNFR9vaSsfbjTNgi+5JcIH85Qz3mnPmck1vrVIjrRiFWTsmSCm0Uklhc/6oL guE26NxFK3NomZvjTwW3YGE+iPR872mybntWd4QwH3bH9ClXinqhrr9tUAJgVnNPj+rY j4hXNsvCUlEqDoyITpNKBQv7fno3Kk9DRtiPZZk9VpWiJ0KDg9MgzyMxWIB/DC3tjGev +9Wqoxvwo3aY1IQcv85Bavn+2ILXboukUP95WL23l6Z2wHQEYYOeCYPiNmu40WCjoA1C 0QHvKXjEDhJL/oJhM4xn4JYQOpa5IsfrnWAIl6W+wI8473bbIopO2ODf/MfvV+0Tq8xS X0zg== X-Gm-Message-State: ALoCoQnBb6UKeT/QOgTf2A5cAzNYrMqbeBR7pTOv3qg5d05coWrLXH1zevbtJ55WA0bM7UL80uEd X-Received: by 10.68.132.166 with SMTP id ov6mr9072085pbb.124.1445659241843; Fri, 23 Oct 2015 21:00:41 -0700 (PDT) Received: from localhost.localdomain (edge03.meizu.com. [202.130.115.78]) by smtp.gmail.com with ESMTPSA id fb1sm21636320pab.9.2015.10.23.21.00.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Oct 2015 21:00:41 -0700 (PDT) From: WEN Pingbo To: arnd@arndb.de Cc: y2038@lists.linaro.org, dmitry.torokhov@gmail.com, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, WEN Pingbo Subject: [PATCH V3 1/2] hil_mlc: convert timeval to time64_t Date: Sat, 24 Oct 2015 12:00:18 +0800 Message-Id: <1445659219-23135-1-git-send-email-pingbo.wen@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <5201254.PnVcGHTDmH@wuerfel> References: <5201254.PnVcGHTDmH@wuerfel> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since mlc->lcv_t is only interested in seconds, directly using time64_t here Signed-off-by: WEN Pingbo --- Version 2: Convert timeval to ktime_t Version 3: Convert it to time64_t, since it's a better choice drivers/input/serio/hil_mlc.c | 8 +++----- include/linux/hil_mlc.h | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/input/serio/hil_mlc.c b/drivers/input/serio/hil_mlc.c index 65605e4..fb297aa 100644 --- a/drivers/input/serio/hil_mlc.c +++ b/drivers/input/serio/hil_mlc.c @@ -274,14 +274,12 @@ static int hilse_match(hil_mlc *mlc, int unused) /* An LCV used to prevent runaway loops, forces 5 second sleep when reset. */ static int hilse_init_lcv(hil_mlc *mlc, int unused) { - struct timeval tv; + time64_t now = ktime_get_seconds(); - do_gettimeofday(&tv); - - if (mlc->lcv && (tv.tv_sec - mlc->lcv_tv.tv_sec) < 5) + if (mlc->lcv && (now - mlc->lcv_t) < 5) return -1; - mlc->lcv_tv = tv; + mlc->lcv_t = now; mlc->lcv = 0; return 0; diff --git a/include/linux/hil_mlc.h b/include/linux/hil_mlc.h index 394a840..29bb5e3 100644 --- a/include/linux/hil_mlc.h +++ b/include/linux/hil_mlc.h @@ -149,7 +149,7 @@ struct hil_mlc { int ddi; /* Last operational device id */ int lcv; /* LCV to throttle loops */ - struct timeval lcv_tv; /* Time loop was started */ + time64_t lcv_t; /* Time loop was started */ int di_map[7]; /* Maps below items to live devs */ struct hil_mlc_devinfo di[HIL_MLC_DEVMEM];