From patchwork Mon Dec 4 00:55:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 10089487 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 305E360327 for ; Mon, 4 Dec 2017 00:56:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12DBA28D5D for ; Mon, 4 Dec 2017 00:56:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0788728D61; Mon, 4 Dec 2017 00:56:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3D8128D5D for ; Mon, 4 Dec 2017 00:56:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752927AbdLDA4h (ORCPT ); Sun, 3 Dec 2017 19:56:37 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:45571 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752895AbdLDA4f (ORCPT ); Sun, 3 Dec 2017 19:56:35 -0500 Received: by mail-pg0-f68.google.com with SMTP id m25so7017834pgv.12; Sun, 03 Dec 2017 16:56:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=O17v3ZPKA+QxfoyJbxKKfHoY9u4QukZ5yTvm/ZjQxGQ=; b=t+8UCjMuKrrlqnkrG7462H+fJfJqyLmKiY0H+MPpEPH2PPhoVMvKnLtA+2Hal6jFk+ ZnEG8BACEYBS150/Xa3XJlbF/YeQc+LEZ6y03+Jx+p0HZzpTRIwJT7AnW2Wdt/84U2FM 8wuHiYdUWA9YSK6BxudOWwbYmyOSX9JXmFiKqTTVrJSnfyhGpD8x5yHvEhsQtBCcJ/Y5 JTQEb3kuDmUUSjDVZOv6KQHD93Z9BEmOiDZh8N+tkY4DFZiyUro5nmT9hHk08tor/Nsd /zm2y2PbWgWO/gT/SLtfGVaI+MQe7XbXx24ytvGa1tjuH/nyLvzc98dUh6n8xWcBTOEJ OQxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=O17v3ZPKA+QxfoyJbxKKfHoY9u4QukZ5yTvm/ZjQxGQ=; b=EZz1JFI2K/Sf9njYJ+tcclWhd1YDSWVMKkKKcByOq6dnPgWnNpsVe5iRkpAEwCG/FD hdfUuvkGer0wHmt1MTUOn9o4XG84usTkkVz2kytB4gMMrfOD7XxHfb4XWbEgx7uSwvsb 8ImvjVy9bGv2ZFS2SDlw5auDIlmssdZtveaik/9ThKKsvhMYYy2eRfWxjZZ6CZoP160s p6Z7JPJfabcq958Y3ZOErQXSZFankRyEIhKNgYPO55Jn3AJQJvfuXLwpBeoYfAfsbiyl EvNrHh1hXmGR9kV/gY+MhZYLErTsywV0N3r30o/hf7zrrK0DoWLI3X3XpzHvEHOrOf02 FDOQ== X-Gm-Message-State: AJaThX7mc6lyIw/GUhrLL6aTUTw6HVeY01KrIqu+fzGE7d0jBNW3AlPA htiNemzOGJwsu6spcyffwf4= X-Google-Smtp-Source: AGs4zMYbEJJFP6/PsN5RaR2SK2a18mQUlezKT0lrOp+Zt5slZG5gTwf3If4HI13tmS3e0x61FuzAPw== X-Received: by 10.98.76.90 with SMTP id z87mr17781382pfa.194.1512348994625; Sun, 03 Dec 2017 16:56:34 -0800 (PST) Received: from deepa-ubuntu.hsd1.ca.comcast.net ([2601:647:5000:6620:3092:62ad:3bb4:62e5]) by smtp.gmail.com with ESMTPSA id b67sm22056121pfm.19.2017.12.03.16.56.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Dec 2017 16:56:34 -0800 (PST) From: Deepa Dinamani To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, y2038@lists.linaro.org Subject: [PATCH v3 2/4] input: evdev: Replace timeval with timespec64 Date: Sun, 3 Dec 2017 16:55:43 -0800 Message-Id: <20171204005545.23325-3-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171204005545.23325-1-deepa.kernel@gmail.com> References: <20171204005545.23325-1-deepa.kernel@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP struct timeval is not y2038 safe. All references to timeval in the kernel will be replaced by y2038 safe structures. Replace all references to timeval with y2038 safe struct timespec64 here. struct input_event will be changed in a different patch. Signed-off-by: Deepa Dinamani Reviewed-by: Arnd Bergmann --- drivers/input/evdev.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 925571475005..e5dbfc5ff1b0 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -156,15 +156,22 @@ static void __evdev_flush_queue(struct evdev_client *client, unsigned int type) static void __evdev_queue_syn_dropped(struct evdev_client *client) { struct input_event ev; - ktime_t time; + struct timespec64 ts; - time = client->clk_type == EV_CLK_REAL ? - ktime_get_real() : - client->clk_type == EV_CLK_MONO ? - ktime_get() : - ktime_get_boottime(); + switch (client->clk_type) { + case EV_CLK_REAL: + ktime_get_real_ts64(&ts); + break; + case EV_CLK_MONO: + ktime_get_ts64(&ts); + break; + case EV_CLK_BOOT: + get_monotonic_boottime64(&ts); + break; + } - ev.time = ktime_to_timeval(time); + ev.time.tv_sec = ts.tv_sec; + ev.time.tv_usec = ts.tv_nsec / NSEC_PER_USEC; ev.type = EV_SYN; ev.code = SYN_DROPPED; ev.value = 0; @@ -257,17 +264,20 @@ static void __pass_event(struct evdev_client *client, static void evdev_pass_values(struct evdev_client *client, const struct input_value *vals, unsigned int count, - ktime_t *ev_time) + struct timespec64 *ev_time) { struct evdev *evdev = client->evdev; const struct input_value *v; struct input_event event; + struct timespec64 ts; bool wakeup = false; if (client->revoked) return; - event.time = ktime_to_timeval(ev_time[client->clk_type]); + ts = ev_time[client->clk_type]; + event.time.tv_sec = ts.tv_sec; + event.time.tv_usec = ts.tv_nsec / NSEC_PER_USEC; /* Interrupts are disabled, just acquire the lock. */ spin_lock(&client->buffer_lock); @@ -304,12 +314,11 @@ static void evdev_events(struct input_handle *handle, { struct evdev *evdev = handle->private; struct evdev_client *client; - ktime_t ev_time[EV_CLK_MAX]; + struct timespec64 ev_time[EV_CLK_MAX]; - ev_time[EV_CLK_MONO] = ktime_get(); - ev_time[EV_CLK_REAL] = ktime_mono_to_real(ev_time[EV_CLK_MONO]); - ev_time[EV_CLK_BOOT] = ktime_mono_to_any(ev_time[EV_CLK_MONO], - TK_OFFS_BOOT); + ktime_get_ts64(&ev_time[EV_CLK_MONO]); + ktime_get_real_ts64(&ev_time[EV_CLK_REAL]); + get_monotonic_boottime64(&ev_time[EV_CLK_BOOT]); rcu_read_lock();