Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934834AbcJ0B5R (ORCPT ); Wed, 26 Oct 2016 21:57:17 -0400 Received: from leo.clearchain.com ([199.73.29.74]:39194 "EHLO mail.clearchain.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932707AbcJ0B5P (ORCPT ); Wed, 26 Oct 2016 21:57:15 -0400 Date: Thu, 27 Oct 2016 11:34:33 +1000 From: Peter Hutterer To: Deepa Dinamani Cc: Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org Subject: Re: [PATCH v2 2/4] input: evdev: Replace timeval with timespec64 Message-ID: <20161027013433.GA14832@jelly> References: <1476761253-13450-1-git-send-email-deepa.kernel@gmail.com> <1476761253-13450-3-git-send-email-deepa.kernel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1476761253-13450-3-git-send-email-deepa.kernel@gmail.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.4.3 (mail.clearchain.com [127.0.0.1]); Thu, 27 Oct 2016 12:10:20 +1030 (CST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3295 Lines: 105 On Mon, Oct 17, 2016 at 08:27:31PM -0700, Deepa Dinamani wrote: > 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 e9ae3d5..b4e3171 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; you have ktime_get_* helpers below but you don't have one for timespec64 to struct timeval? That seems like a bug waitig to happen. Cheers, Peter > > /* 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(); > > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-input" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >