OSDN Git Service

iio: hid-sensor-attributes: Fix divisions for 32-bit platforms
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 5 Sep 2019 11:27:59 +0000 (14:27 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Sep 2019 06:09:34 +0000 (08:09 +0200)
commitf6897deef4fc94812338bcf33c9f03854cc19cdb
tree17d8e2d4e7a28799dbb2206074a190150ee2d3db
parent618f40ea026bda2866b2b1bc8ae2c7343a3d7a22
iio: hid-sensor-attributes: Fix divisions for 32-bit platforms

The commit 473d12f7638c

  ("iio: hid-sensor-attributes: Convert to use int_pow()")

converted to use generic int_pow() helper. Though, the generic one returns
64-bit value and, in cases when it is used as divisor, it compels 64-bit
division from compiler.

In order to fix this, introduce a temporary 32-bit variable to hold the result
of int_pow() and use it as divisor afterwards.

In couple of cases, replace int_pow() with a predefined unit factors for time
and frequency.

Fixes: 473d12f7638c ("iio: hid-sensor-attributes: Convert to use int_pow()")
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20190905112759.13035-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/common/hid-sensors/hid-sensor-attributes.c