]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: es1968: Replace timeval with ktime_t
authorTina Ruchandani <ruchandani.tina@gmail.com>
Wed, 29 Oct 2014 17:48:10 +0000 (10:48 -0700)
committerTakashi Iwai <tiwai@suse.de>
Thu, 30 Oct 2014 07:04:33 +0000 (08:04 +0100)
commitbef46003a7c99e8e10c9da0c153e9a516cade5a8
treef2f12766db018055cd7dcac8374e3e976fbd1714
parentce5123ac100cf514784b4b8efe375db4ee47cb83
ALSA: es1968: Replace timeval with ktime_t

es1968_measure_clock uses struct timeval, which on 32-bit systems will overflow
in 2038, leading to incorrect interpretation of time.This patch changes the
function to use ktime_t instead of struct timeval, which implies:
- no y2038: ktime_t uses a 64-bit datatype explicitly.
- efficent subtraction: The earlier version computes the difference in usecs
  while dealing with secs and nsecs. It requires checks to see if the nsecs of
  stop is less than start. This patch uses a direct subtract of ktime_t and
  converts to usecs.
- use of monotonic clock (ktime_get) over real time (do_gettimeofday),
  which simplifies timekeeping, as it does not have to deal with cases
  where stop_time is less than start_time.

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/es1968.c