]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
iio: core: Fix IIO_VAL_FRACTIONAL_LOG2 for negative values
authorNikolaus Schulz <nikolaus.schulz@avionic-design.de>
Fri, 24 Mar 2017 12:41:51 +0000 (13:41 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 21 Apr 2017 08:12:01 +0000 (10:12 +0200)
commitf1172cded5f4f3f2a3cc98d4899e8ac4d8fbcbf7
tree3d5aee68cb0ed3d20d93c2cfc032d165aa1f65a5
parent3c5cdffdc83c6562587ae94fcc5836fc6072f912
iio: core: Fix IIO_VAL_FRACTIONAL_LOG2 for negative values

BugLink: http://bugs.launchpad.net/bugs/1682130
commit 7fd6592d1287046f61bfd3cda3c03cd35be490f7 upstream.

Fix formatting of negative values of type IIO_VAL_FRACTIONAL_LOG2 by
switching from do_div(), which can't handle negative numbers, to
div_s64_rem().  Also use shift_right for shifting, which is safe with
negative values.

Signed-off-by: Nikolaus Schulz <nikolaus.schulz@avionic-design.de>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/iio/industrialio-core.c