diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-02-20 10:23:17 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-02-20 10:23:17 +0100 |
commit | 59142f808a5e8722e66ab1753532ed5d300a34dd (patch) | |
tree | c8c613f06b54dceca67f4ebe0719910de0f4be24 /lib | |
parent | 54ef5b9db76767e91f77b0588245e6e87d891548 (diff) | |
parent | d6ad805844c52d256c2a3ff3d60daa10d27a8b64 (diff) | |
download | linux-stable-59142f808a5e8722e66ab1753532ed5d300a34dd.tar.gz linux-stable-59142f808a5e8722e66ab1753532ed5d300a34dd.tar.bz2 linux-stable-59142f808a5e8722e66ab1753532ed5d300a34dd.zip |
Merge tag 'iio-for-4.17a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
First round of new devices, features and cleanups for IIO in the 4.17 cycle.
Outside of IIO
* Strongly typed 64bit int_sqrt function needed by the mlx90632
New device support
* adc081s
- New driver supporting adc081s, adc101s and adc121s TI ADCs.
* ad5272
- New driver supproting the ad5272 and ad5274 ADI digital potentiometers
with DT bindings.
* axp20x_adc
- support the AXP813 ADC - includes rework patches to prepare for this.
* mlx90632
- New driver with dt bindings for this IR temperature sensor.
Features
* axp20x_adc
- Add DT bindings and probing.
* dht11
- The sensor has a wider range than advertised in the datasheet - support it.
* st_lsm6dsx
- Add hardware timestamp su9pport.
Cleanups
* ABI docs
- Update email contact for Matt Ranostay
* SPDX changes
- Matt Ranostay has moved his drivers over to SPDX. Currently we are making
this an author choice in IIO.
* ad7192
- Disable burnout current on misconfiguration. No actually effect as
they simply won't work otherwise.
* ad7476
- Drop a license definition that was replicating information in SPDX tag.
* ade7758
- Expand buf_lock to cover both buffer and state protection allowing
unintented uses of mlock in the core to be removed.
* ade7759
- Align parameters to opening parenthesis.
* at91_adc
- Depend on sysfs instead of selecting it - for try wide consistency.
* ccs811
- trivial naming type for a define.
* ep93xx
- Drop a redundant return as a result checking platform_get_resource.
* hts221
- Regmap conversion which simplifies the driver somewhat.
- Clean up some restricted endian cast warnings.
- Drop a trailing whitespace from a comment
- Drop an unnecessary get_unaligned by changing to the right 16bit data type.
* ms5611
- Fix coding style in the probe function (whitespace)
* st_accel
- Use strlcpy instead of strncpy to avoid potentially truncating a string.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/int_sqrt.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/int_sqrt.c b/lib/int_sqrt.c index e2d329099bf7..14436f4ca6bd 100644 --- a/lib/int_sqrt.c +++ b/lib/int_sqrt.c @@ -38,3 +38,33 @@ unsigned long int_sqrt(unsigned long x) return y; } EXPORT_SYMBOL(int_sqrt); + +#if BITS_PER_LONG < 64 +/** + * int_sqrt64 - strongly typed int_sqrt function when minimum 64 bit input + * is expected. + * @x: 64bit integer of which to calculate the sqrt + */ +u32 int_sqrt64(u64 x) +{ + u64 b, m, y = 0; + + if (x <= ULONG_MAX) + return int_sqrt((unsigned long) x); + + m = 1ULL << (fls64(x) & ~1ULL); + while (m != 0) { + b = y + m; + y >>= 1; + + if (x >= b) { + x -= b; + y += m; + } + m >>= 2; + } + + return y; +} +EXPORT_SYMBOL(int_sqrt64); +#endif |