iio: dht11: Use new function ktime_get_resolution_ns()
authorHarald Geyer <harald@ccbib.org>
Tue, 7 Jul 2015 13:39:31 +0000 (13:39 +0000)
committerJonathan Cameron <jic23@kernel.org>
Mon, 20 Jul 2015 17:41:20 +0000 (18:41 +0100)
commit081d974031bafb204d64de3e82f398daf1d0b899
tree6859eb7ca8777b832bb39e185f1611bebed3fa9e
parent5fbb0bc466b7b43036b1dd8c9e9166ca9e69e07a
iio: dht11: Use new function ktime_get_resolution_ns()

This cleans up the most ugly workaround in this driver. There are no
functional changes yet in the decoding algorithm, but we improve the
following things:
 * Get rid of spurious warning messages on systems with fast HRTIMER.
 * If the clock is not fast enough for decoding to work, we give
   up immediately.
 * In that case we return EAGAIN instead of EIO, so it's easier to
   discriminate causes of failure.

Returning EAGAIN is somewhat controversial: It's technically correct
as a faster clock might become available. OTOH once all clocks are
enabled this is a permanent error. There is no ECLOCKTOOSLOW error
code.

Signed-off-by: Harald Geyer <harald@ccbib.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/humidity/dht11.c