* [PATCH 5/5] lib/math: remove int_pow()
[not found] <20190919140620.32407-1-linux@rasmusvillemoes.dk>
@ 2019-09-19 14:06 ` Rasmus Villemoes
2019-09-19 14:36 ` Andy Shevchenko
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Rasmus Villemoes @ 2019-09-19 14:06 UTC (permalink / raw)
To: Thierry Reding, Jonathan Corbet
Cc: Rasmus Villemoes, Andy Shevchenko, Andrew Morton, linux-doc,
linux-kernel
No users left.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
Documentation/core-api/kernel-api.rst | 3 ---
include/linux/kernel.h | 1 -
lib/math/Makefile | 2 +-
lib/math/int_pow.c | 32 ---------------------------
4 files changed, 1 insertion(+), 37 deletions(-)
delete mode 100644 lib/math/int_pow.c
diff --git a/Documentation/core-api/kernel-api.rst b/Documentation/core-api/kernel-api.rst
index 08af5caf036d..5f9cf47581b3 100644
--- a/Documentation/core-api/kernel-api.rst
+++ b/Documentation/core-api/kernel-api.rst
@@ -144,9 +144,6 @@ Base 2 log and power Functions
Integer power Functions
-----------------------
-.. kernel-doc:: lib/math/int_pow.c
- :export:
-
.. kernel-doc:: lib/math/int_sqrt.c
:export:
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 4fa360a13c1e..afe7c2cc81aa 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -487,7 +487,6 @@ extern int __kernel_text_address(unsigned long addr);
extern int kernel_text_address(unsigned long addr);
extern int func_ptr_is_kernel_text(void *ptr);
-u64 int_pow(u64 base, unsigned int exp);
unsigned long int_sqrt(unsigned long);
#if BITS_PER_LONG < 64
diff --git a/lib/math/Makefile b/lib/math/Makefile
index be6909e943bd..3e5db680a404 100644
--- a/lib/math/Makefile
+++ b/lib/math/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
-obj-y += div64.o gcd.o lcm.o int_pow.o int_sqrt.o reciprocal_div.o
+obj-y += div64.o gcd.o lcm.o int_sqrt.o reciprocal_div.o
obj-$(CONFIG_CORDIC) += cordic.o
obj-$(CONFIG_PRIME_NUMBERS) += prime_numbers.o
diff --git a/lib/math/int_pow.c b/lib/math/int_pow.c
deleted file mode 100644
index 622fc1ab3c74..000000000000
--- a/lib/math/int_pow.c
+++ /dev/null
@@ -1,32 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * An integer based power function
- *
- * Derived from drivers/video/backlight/pwm_bl.c
- */
-
-#include <linux/export.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-
-/**
- * int_pow - computes the exponentiation of the given base and exponent
- * @base: base which will be raised to the given power
- * @exp: power to be raised to
- *
- * Computes: pow(base, exp), i.e. @base raised to the @exp power
- */
-u64 int_pow(u64 base, unsigned int exp)
-{
- u64 result = 1;
-
- while (exp) {
- if (exp & 1)
- result *= base;
- exp >>= 1;
- base *= base;
- }
-
- return result;
-}
-EXPORT_SYMBOL_GPL(int_pow);
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 5/5] lib/math: remove int_pow()
2019-09-19 14:06 ` [PATCH 5/5] lib/math: remove int_pow() Rasmus Villemoes
@ 2019-09-19 14:36 ` Andy Shevchenko
2019-09-21 15:19 ` kbuild test robot
2019-09-21 15:22 ` kbuild test robot
2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2019-09-19 14:36 UTC (permalink / raw)
To: Rasmus Villemoes
Cc: Thierry Reding, Jonathan Corbet, Andrew Morton, linux-doc,
linux-kernel
On Thu, Sep 19, 2019 at 04:06:20PM +0200, Rasmus Villemoes wrote:
> No users left.
There are in linux-next.
NAK.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 5/5] lib/math: remove int_pow()
2019-09-19 14:06 ` [PATCH 5/5] lib/math: remove int_pow() Rasmus Villemoes
2019-09-19 14:36 ` Andy Shevchenko
@ 2019-09-21 15:19 ` kbuild test robot
2019-09-21 15:22 ` kbuild test robot
2 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2019-09-21 15:19 UTC (permalink / raw)
To: Rasmus Villemoes
Cc: kbuild-all, Thierry Reding, Jonathan Corbet, Rasmus Villemoes,
Andy Shevchenko, Andrew Morton, linux-doc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 5651 bytes --]
Hi Rasmus,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[cannot apply to v5.3 next-20190918]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Rasmus-Villemoes/backlight-pwm_bl-fix-cie1913-comments-and-constant/20190919-225123
config: x86_64-randconfig-s0-201937 (attached as .config)
compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
:::::: branch date: 2 hours ago
:::::: commit date: 2 hours ago
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/iio/common/hid-sensors/hid-sensor-attributes.c: In function 'simple_div':
>> drivers/iio/common/hid-sensors/hid-sensor-attributes.c:94:35: error: implicit declaration of function 'int_pow' [-Werror=implicit-function-declaration]
*micro_frac = (rem / divisor) * int_pow(10, 6 - exp);
^
Cyclomatic Complexity 3 include/linux/hid-sensor-hub.h:hid_sensor_convert_exponent
Cyclomatic Complexity 1 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_convert_timestamp
Cyclomatic Complexity 3 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_batch_mode_supported
Cyclomatic Complexity 4 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_read_poll_value
Cyclomatic Complexity 2 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_get_report_latency
Cyclomatic Complexity 4 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:simple_div
Cyclomatic Complexity 5 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_read_samp_freq_value
Cyclomatic Complexity 1 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:split_micro_fraction
Cyclomatic Complexity 4 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:convert_from_vtf_format
Cyclomatic Complexity 3 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_read_raw_hyst_value
Cyclomatic Complexity 4 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:convert_to_vtf_format
Cyclomatic Complexity 7 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:adjust_exponent_nano
Cyclomatic Complexity 4 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_format_scale
Cyclomatic Complexity 9 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_write_samp_freq_value
Cyclomatic Complexity 6 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_write_raw_hyst_value
Cyclomatic Complexity 1 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_set_report_latency
Cyclomatic Complexity 2 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_get_reporting_interval
Cyclomatic Complexity 2 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_get_report_latency_info
Cyclomatic Complexity 6 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_parse_common_attributes
cc1: some warnings being treated as errors
# https://github.com/0day-ci/linux/commit/d89cf2c7a3840d1691169c9e099c7def0dc16c46
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d89cf2c7a3840d1691169c9e099c7def0dc16c46
vim +/int_pow +94 drivers/iio/common/hid-sensors/hid-sensor-attributes.c
5d02edfc395744 Srinivas Pandruvada 2014-04-19 75
73c6768b710a16 srinivas pandruvada 2012-09-05 76 static void simple_div(int dividend, int divisor, int *whole,
73c6768b710a16 srinivas pandruvada 2012-09-05 77 int *micro_frac)
73c6768b710a16 srinivas pandruvada 2012-09-05 78 {
73c6768b710a16 srinivas pandruvada 2012-09-05 79 int rem;
73c6768b710a16 srinivas pandruvada 2012-09-05 80 int exp = 0;
73c6768b710a16 srinivas pandruvada 2012-09-05 81
73c6768b710a16 srinivas pandruvada 2012-09-05 82 *micro_frac = 0;
73c6768b710a16 srinivas pandruvada 2012-09-05 83 if (divisor == 0) {
73c6768b710a16 srinivas pandruvada 2012-09-05 84 *whole = 0;
73c6768b710a16 srinivas pandruvada 2012-09-05 85 return;
73c6768b710a16 srinivas pandruvada 2012-09-05 86 }
73c6768b710a16 srinivas pandruvada 2012-09-05 87 *whole = dividend/divisor;
73c6768b710a16 srinivas pandruvada 2012-09-05 88 rem = dividend % divisor;
73c6768b710a16 srinivas pandruvada 2012-09-05 89 if (rem) {
73c6768b710a16 srinivas pandruvada 2012-09-05 90 while (rem <= divisor) {
73c6768b710a16 srinivas pandruvada 2012-09-05 91 rem *= 10;
73c6768b710a16 srinivas pandruvada 2012-09-05 92 exp++;
73c6768b710a16 srinivas pandruvada 2012-09-05 93 }
473d12f7638c93 Andy Shevchenko 2019-06-19 @94 *micro_frac = (rem / divisor) * int_pow(10, 6 - exp);
73c6768b710a16 srinivas pandruvada 2012-09-05 95 }
73c6768b710a16 srinivas pandruvada 2012-09-05 96 }
73c6768b710a16 srinivas pandruvada 2012-09-05 97
:::::: The code at line 94 was first introduced by commit
:::::: 473d12f7638c93acbd9296a8cd455b203d5eb528 iio: hid-sensor-attributes: Convert to use int_pow()
:::::: TO: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
:::::: CC: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31905 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 5/5] lib/math: remove int_pow()
2019-09-19 14:06 ` [PATCH 5/5] lib/math: remove int_pow() Rasmus Villemoes
2019-09-19 14:36 ` Andy Shevchenko
2019-09-21 15:19 ` kbuild test robot
@ 2019-09-21 15:22 ` kbuild test robot
2 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2019-09-21 15:22 UTC (permalink / raw)
To: Rasmus Villemoes
Cc: kbuild-all, Thierry Reding, Jonathan Corbet, Rasmus Villemoes,
Andy Shevchenko, Andrew Morton, linux-doc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 5651 bytes --]
Hi Rasmus,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[cannot apply to v5.3 next-20190918]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Rasmus-Villemoes/backlight-pwm_bl-fix-cie1913-comments-and-constant/20190919-225123
config: x86_64-randconfig-s0-201937 (attached as .config)
compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
:::::: branch date: 2 hours ago
:::::: commit date: 2 hours ago
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/iio/common/hid-sensors/hid-sensor-attributes.c: In function 'simple_div':
>> drivers/iio/common/hid-sensors/hid-sensor-attributes.c:94:35: error: implicit declaration of function 'int_pow' [-Werror=implicit-function-declaration]
*micro_frac = (rem / divisor) * int_pow(10, 6 - exp);
^
Cyclomatic Complexity 3 include/linux/hid-sensor-hub.h:hid_sensor_convert_exponent
Cyclomatic Complexity 1 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_convert_timestamp
Cyclomatic Complexity 3 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_batch_mode_supported
Cyclomatic Complexity 4 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_read_poll_value
Cyclomatic Complexity 2 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_get_report_latency
Cyclomatic Complexity 4 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:simple_div
Cyclomatic Complexity 5 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_read_samp_freq_value
Cyclomatic Complexity 1 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:split_micro_fraction
Cyclomatic Complexity 4 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:convert_from_vtf_format
Cyclomatic Complexity 3 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_read_raw_hyst_value
Cyclomatic Complexity 4 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:convert_to_vtf_format
Cyclomatic Complexity 7 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:adjust_exponent_nano
Cyclomatic Complexity 4 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_format_scale
Cyclomatic Complexity 9 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_write_samp_freq_value
Cyclomatic Complexity 6 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_write_raw_hyst_value
Cyclomatic Complexity 1 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_set_report_latency
Cyclomatic Complexity 2 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_get_reporting_interval
Cyclomatic Complexity 2 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_get_report_latency_info
Cyclomatic Complexity 6 drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_parse_common_attributes
cc1: some warnings being treated as errors
# https://github.com/0day-ci/linux/commit/d89cf2c7a3840d1691169c9e099c7def0dc16c46
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d89cf2c7a3840d1691169c9e099c7def0dc16c46
vim +/int_pow +94 drivers/iio/common/hid-sensors/hid-sensor-attributes.c
5d02edfc395744 Srinivas Pandruvada 2014-04-19 75
73c6768b710a16 srinivas pandruvada 2012-09-05 76 static void simple_div(int dividend, int divisor, int *whole,
73c6768b710a16 srinivas pandruvada 2012-09-05 77 int *micro_frac)
73c6768b710a16 srinivas pandruvada 2012-09-05 78 {
73c6768b710a16 srinivas pandruvada 2012-09-05 79 int rem;
73c6768b710a16 srinivas pandruvada 2012-09-05 80 int exp = 0;
73c6768b710a16 srinivas pandruvada 2012-09-05 81
73c6768b710a16 srinivas pandruvada 2012-09-05 82 *micro_frac = 0;
73c6768b710a16 srinivas pandruvada 2012-09-05 83 if (divisor == 0) {
73c6768b710a16 srinivas pandruvada 2012-09-05 84 *whole = 0;
73c6768b710a16 srinivas pandruvada 2012-09-05 85 return;
73c6768b710a16 srinivas pandruvada 2012-09-05 86 }
73c6768b710a16 srinivas pandruvada 2012-09-05 87 *whole = dividend/divisor;
73c6768b710a16 srinivas pandruvada 2012-09-05 88 rem = dividend % divisor;
73c6768b710a16 srinivas pandruvada 2012-09-05 89 if (rem) {
73c6768b710a16 srinivas pandruvada 2012-09-05 90 while (rem <= divisor) {
73c6768b710a16 srinivas pandruvada 2012-09-05 91 rem *= 10;
73c6768b710a16 srinivas pandruvada 2012-09-05 92 exp++;
73c6768b710a16 srinivas pandruvada 2012-09-05 93 }
473d12f7638c93 Andy Shevchenko 2019-06-19 @94 *micro_frac = (rem / divisor) * int_pow(10, 6 - exp);
73c6768b710a16 srinivas pandruvada 2012-09-05 95 }
73c6768b710a16 srinivas pandruvada 2012-09-05 96 }
73c6768b710a16 srinivas pandruvada 2012-09-05 97
:::::: The code at line 94 was first introduced by commit
:::::: 473d12f7638c93acbd9296a8cd455b203d5eb528 iio: hid-sensor-attributes: Convert to use int_pow()
:::::: TO: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
:::::: CC: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31905 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-09-21 15:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20190919140620.32407-1-linux@rasmusvillemoes.dk>
2019-09-19 14:06 ` [PATCH 5/5] lib/math: remove int_pow() Rasmus Villemoes
2019-09-19 14:36 ` Andy Shevchenko
2019-09-21 15:19 ` kbuild test robot
2019-09-21 15:22 ` kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox