]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
staging: media: lirc: Replace timeval with ktime_t in lirc_sasem.c
authorTapasweni Pathak <tapaswenipathak@gmail.com>
Wed, 5 Nov 2014 03:36:25 +0000 (09:06 +0530)
committerArnd Bergmann <arnd@arndb.de>
Tue, 3 Nov 2015 16:34:44 +0000 (17:34 +0100)
commitef7823227e2f09b4a143ad3f72068b4783473637
tree0ac1a0aed21f34560a8c475511865a9165b94fe3
parent472be9a43604b105733ceab089d7f9c2d8880092
staging: media: lirc: Replace timeval with ktime_t in lirc_sasem.c

'struct timeval presstime' and 'struct timeval tv' is used to
calculate the time since the last button press.

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 media: lirc driver to use ktime_t.

ktime_get() is  better than using do_gettimeofday(), because it uses
the monotonic clock. ktime_sub() are used to subtract two ktime
variables. 'ms' is only used to check how much time has passed by comparing
to 250. So instead of using expensive ktime_to_ms() call, it has been
changed to hold nanoseconds by using ktime_to_ns().

Build tested it. Tested with sparse too.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
drivers/staging/media/lirc/lirc_sasem.c