alistair23-linux/drivers/staging/media/lirc
Arnd Bergmann 0dbf41a3c8 [media] staging: media: lirc: Replace timeval with ktime_t in lirc_parallel.c
'struct timeval tv' and 'struct timeval now' is used to calculate the
elapsed time. 'LIRC_SFH506_DELAY' is a delay t_phl in usecs.

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_parallel.c file of  media: lirc driver
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. ktime_to_us() is used to
convert ktime to microsecond.

New ktime_t variable timeout, is added in lirc_off(),to improve
clarity. Introduced a new ktime_t variable in lirc_lirc_irq_handler()
function, to avoid the use of signal variable for storing
seconds in the first part of this function as later it uses
a time unit that is defined by the global "timer" variable.
This makes it more clear.

ktime_set() is used to set a value in seconds to a value in
nanosecond so that ktime_compare() can be used appropriately.
ktime_compare() is used to compare two ktime values.
ktime_add_ns() is used to increment a ktime value by 1 sec.

One comment is also shifted a line up, as it was creating a 80
character warning.

Build tested it. Also tested it with sparse.

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>
2015-12-03 16:21:58 -02:00
..
Kconfig [media] lirc_igorplugusb: remove 2014-11-03 12:19:30 -02:00
lirc_bt829.c staging: media: lirc: lirc_bt829.c: replace dprintk by dev_dbg 2014-10-29 15:36:36 +08:00
lirc_imon.c [media] lirc_imon: do not leave imon_probe() with mutex held 2015-11-19 11:29:28 -02:00
lirc_parallel.c [media] staging: media: lirc: Replace timeval with ktime_t in lirc_parallel.c 2015-12-03 16:21:58 -02:00
lirc_parallel.h
lirc_sasem.c [media] staging: media: lirc: Replace timeval with ktime_t in lirc_sasem.c 2015-12-03 16:19:36 -02:00
lirc_serial.c [media] staging: media: lirc: Replace timeval with ktime_t in lirc_serial.c 2015-12-03 16:17:57 -02:00
lirc_sir.c [media] Staging: media: lirc: Replace timeval with ktime_t 2015-06-09 18:45:59 -03:00
lirc_zilog.c [media] staging: media: lirc: Export I2C module alias information 2015-08-11 17:57:09 -03:00
Makefile [media] lirc_igorplugusb: remove 2014-11-03 12:19:30 -02:00
TODO
TODO.lirc_zilog