aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChunyan Zhang <zhang.chunyan@linaro.org>2017-11-06 09:06:10 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-14 10:35:27 -0500
commit1edba6484b19d288e11722d72b55a4b919fb059e (patch)
tree5417bb53998d9eeefdb22146d9f83e0ea25c5d06
parent4957133fe32fec9a5fc57ce95b6107e976dcc251 (diff)
media: rc: Replace timeval with ktime_t in imon.c
This patch changes the 32-bit time type (timeval) to the 64-bit one (ktime_t), since 32-bit time types will break in the year 2038. I use ktime_t instead of all uses of timeval in imon.c This patch also changes do_gettimeofday() to ktime_get() accordingly, since ktime_get returns a ktime_t, but do_gettimeofday returns a struct timeval, and the other reason is that ktime_get() uses the monotonic clock. Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/rc/imon.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index eb943e862515..c7a19a8fa77e 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -27,6 +27,7 @@
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/ktime.h>
30#include <linux/module.h> 31#include <linux/module.h>
31#include <linux/slab.h> 32#include <linux/slab.h>
32#include <linux/uaccess.h> 33#include <linux/uaccess.h>
@@ -37,7 +38,6 @@
37#include <linux/usb/input.h> 38#include <linux/usb/input.h>
38#include <media/rc-core.h> 39#include <media/rc-core.h>
39 40
40#include <linux/time.h>
41#include <linux/timer.h> 41#include <linux/timer.h>
42 42
43#define MOD_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" 43#define MOD_AUTHOR "Jarod Wilson <jarod@wilsonet.com>"
@@ -1201,16 +1201,16 @@ static inline int tv2int(const struct timeval *a, const struct timeval *b)
1201 */ 1201 */
1202static int stabilize(int a, int b, u16 timeout, u16 threshold) 1202static int stabilize(int a, int b, u16 timeout, u16 threshold)
1203{ 1203{
1204 struct timeval ct; 1204 ktime_t ct;
1205 static struct timeval prev_time = {0, 0}; 1205 static ktime_t prev_time;
1206 static struct timeval hit_time = {0, 0}; 1206 static ktime_t hit_time;
1207 static int x, y, prev_result, hits; 1207 static int x, y, prev_result, hits;
1208 int result = 0; 1208 int result = 0;
1209 int msec, msec_hit; 1209 long msec, msec_hit;
1210 1210
1211 do_gettimeofday(&ct); 1211 ct = ktime_get();
1212 msec = tv2int(&ct, &prev_time); 1212 msec = ktime_ms_delta(ct, prev_time);
1213 msec_hit = tv2int(&ct, &hit_time); 1213 msec_hit = ktime_ms_delta(ct, hit_time);
1214 1214
1215 if (msec > 100) { 1215 if (msec > 100) {
1216 x = 0; 1216 x = 0;
@@ -1688,9 +1688,9 @@ static void imon_incoming_scancode(struct imon_context *ictx,
1688 u32 kc; 1688 u32 kc;
1689 u64 scancode; 1689 u64 scancode;
1690 int press_type = 0; 1690 int press_type = 0;
1691 int msec; 1691 long msec;
1692 struct timeval t; 1692 ktime_t t;
1693 static struct timeval prev_time = { 0, 0 }; 1693 static ktime_t prev_time;
1694 u8 ktype; 1694 u8 ktype;
1695 1695
1696 /* filter out junk data on the older 0xffdc imon devices */ 1696 /* filter out junk data on the older 0xffdc imon devices */
@@ -1783,10 +1783,10 @@ static void imon_incoming_scancode(struct imon_context *ictx,
1783 /* Only panel type events left to process now */ 1783 /* Only panel type events left to process now */
1784 spin_lock_irqsave(&ictx->kc_lock, flags); 1784 spin_lock_irqsave(&ictx->kc_lock, flags);
1785 1785
1786 do_gettimeofday(&t); 1786 t = ktime_get();
1787 /* KEY_MUTE repeats from knob need to be suppressed */ 1787 /* KEY_MUTE repeats from knob need to be suppressed */
1788 if (ictx->kc == KEY_MUTE && ictx->kc == ictx->last_keycode) { 1788 if (ictx->kc == KEY_MUTE && ictx->kc == ictx->last_keycode) {
1789 msec = tv2int(&t, &prev_time); 1789 msec = ktime_ms_delta(t, prev_time);
1790 if (msec < ictx->idev->rep[REP_DELAY]) { 1790 if (msec < ictx->idev->rep[REP_DELAY]) {
1791 spin_unlock_irqrestore(&ictx->kc_lock, flags); 1791 spin_unlock_irqrestore(&ictx->kc_lock, flags);
1792 return; 1792 return;