[media] staging: media: lirc: Replace timeval with ktime_t in lirc_serial.c
authorArnd Bergmann <arnd@arndb.de>
Wed, 25 Nov 2015 15:11:55 +0000 (13:11 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 3 Dec 2015 18:17:57 +0000 (16:17 -0200)
commit8459503295d9ed3aaf5a2089a2fbdbdb5e9a9576
tree4d307898eedb66a025c607542c4471dffee2ecfc
parent21312f6ddb1710750761c4b140b7367208b4f89e
[media] staging: media: lirc: Replace timeval with ktime_t in lirc_serial.c

'struct timeval tv' is used to get current time.
'static struct timeval lasttv' is used to get last interrupt time.

32-bit systems using 'struct timeval' will break in the year 2038,
so we have to replace that code with more appropriate types.
This patch changes the lirc_serial.c file of media: lirc to use
ktime_t.

ktime_get() is  better than using do_gettimeofday(),
because it uses the monotonic clock. ktime_sub is used
to subtract two ktime variables. The check to test time
going backwards is also removed. Intialization to static
variable is also removed. ktime_to_us() is used to convert
ktime_t to microsecond value. deltv is changed to delkt, a
ktime_t type varibale from long to assign the ktime_sub value
directly. ktime_compare is used to compare delkt with 15
seconds, which is changed to a nanosecond value by using
ktime_set().

Build tested it.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/staging/media/lirc/lirc_serial.c