From: Deepa Dinamani <deepa.kernel@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: arnd@arndb.de, y2038@lists.linaro.org
Subject: [PATCH 2/4] input: evdev: Replace timeval with timespec64
Date: Tue, 13 Sep 2016 07:10:03 -0700 [thread overview]
Message-ID: <1473775805-2242-3-git-send-email-deepa.kernel@gmail.com> (raw)
In-Reply-To: <1473775805-2242-1-git-send-email-deepa.kernel@gmail.com>
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 <deepa.kernel@gmail.com>
---
drivers/input/evdev.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index e9ae3d5..bda2b61 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -157,6 +157,7 @@ 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() :
@@ -164,7 +165,9 @@ static void __evdev_queue_syn_dropped(struct evdev_client *client)
ktime_get() :
ktime_get_boottime();
- ev.time = ktime_to_timeval(time);
+ ts = ktime_to_timespec64(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;
@@ -262,12 +265,15 @@ static void evdev_pass_values(struct evdev_client *client,
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 = ktime_to_timespec64(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);
--
2.7.4
next prev parent reply other threads:[~2016-09-13 14:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-13 14:10 [PATCH 0/4] Make input drivers y2038 safe Deepa Dinamani
2016-09-13 14:10 ` [PATCH 1/4] uinput: Add ioctl for using monotonic/ boot times Deepa Dinamani
2016-09-13 15:07 ` Arnd Bergmann
2016-09-15 17:11 ` Deepa Dinamani
2016-09-13 14:10 ` Deepa Dinamani [this message]
2016-09-13 15:08 ` [PATCH 2/4] input: evdev: Replace timeval with timespec64 Arnd Bergmann
2016-09-13 14:10 ` [PATCH 3/4] input: Deprecate real timestamps beyond year 2106 Deepa Dinamani
2016-09-13 14:59 ` Arnd Bergmann
2016-09-13 16:06 ` kbuild test robot
2016-09-13 16:34 ` Deepa Dinamani
2016-09-13 20:10 ` Deepa Dinamani
2016-09-13 20:40 ` Arnd Bergmann
2016-09-13 14:10 ` [PATCH 4/4] input: serio: Replace timeval by timespec64 Deepa Dinamani
2016-09-13 15:13 ` Arnd Bergmann
2016-09-15 17:21 ` Deepa Dinamani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1473775805-2242-3-git-send-email-deepa.kernel@gmail.com \
--to=deepa.kernel@gmail.com \
--cc=arnd@arndb.de \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=y2038@lists.linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).