diff mbox series

[thermal:,thermal/next] iio: adc: qcom-vadc-common: use fixp_linear_interpolate

Message ID 161368078501.20312.9950089385562714464.tip-bot2@tip-bot2 (mailing list archive)
State Not Applicable, archived
Headers show
Series [thermal:,thermal/next] iio: adc: qcom-vadc-common: use fixp_linear_interpolate | expand

Commit Message

tip-bot2 for Nam Cao Feb. 18, 2021, 8:39 p.m. UTC
The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     e2621acd6d9af5b3d5584ddf0fd7994472d6199e
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//e2621acd6d9af5b3d5584ddf0fd7994472d6199e
Author:        Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
AuthorDate:    Fri, 04 Dec 2020 05:54:58 +03:00
Committer:     Jonathan Cameron <Jonathan.Cameron@huawei.com>
CommitterDate: Sat, 16 Jan 2021 18:19:00 

iio: adc: qcom-vadc-common: use fixp_linear_interpolate

Use new function fixp_linear_interpolate() instead of hand-coding the
linear interpolation.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20201204025509.1075506-5-dmitry.baryshkov@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/adc/qcom-vadc-common.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

kernel test robot Feb. 18, 2021, 10:03 p.m. UTC | #1
Hi thermal-bot,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on thermal/next]

url:    https://github.com/0day-ci/linux/commits/thermal-bot-for-Dmitry-Baryshkov/iio-adc-qcom-vadc-common-use-fixp_linear_interpolate/20210219-045140
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/2ba8f2d19b304bc7ba06b875527258b02bed2053
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review thermal-bot-for-Dmitry-Baryshkov/iio-adc-qcom-vadc-common-use-fixp_linear_interpolate/20210219-045140
        git checkout 2ba8f2d19b304bc7ba06b875527258b02bed2053
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=xtensa 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/iio/adc/qcom-vadc-common.c: In function 'qcom_vadc_map_voltage_temp':
>> drivers/iio/adc/qcom-vadc-common.c:158:13: error: implicit declaration of function 'fixp_linear_interpolate' [-Werror=implicit-function-declaration]
     158 |   *output = fixp_linear_interpolate(pts[i - 1].x, pts[i - 1].y,
         |             ^~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/fixp_linear_interpolate +158 drivers/iio/adc/qcom-vadc-common.c

   121	
   122	static int qcom_vadc_map_voltage_temp(const struct vadc_map_pt *pts,
   123					      u32 tablesize, s32 input, int *output)
   124	{
   125		bool descending = 1;
   126		u32 i = 0;
   127	
   128		if (!pts)
   129			return -EINVAL;
   130	
   131		/* Check if table is descending or ascending */
   132		if (tablesize > 1) {
   133			if (pts[0].x < pts[1].x)
   134				descending = 0;
   135		}
   136	
   137		while (i < tablesize) {
   138			if ((descending) && (pts[i].x < input)) {
   139				/* table entry is less than measured*/
   140				 /* value and table is descending, stop */
   141				break;
   142			} else if ((!descending) &&
   143					(pts[i].x > input)) {
   144				/* table entry is greater than measured*/
   145				/*value and table is ascending, stop */
   146				break;
   147			}
   148			i++;
   149		}
   150	
   151		if (i == 0) {
   152			*output = pts[0].y;
   153		} else if (i == tablesize) {
   154			*output = pts[tablesize - 1].y;
   155		} else {
   156			/* result is between search_index and search_index-1 */
   157			/* interpolate linearly */
 > 158			*output = fixp_linear_interpolate(pts[i - 1].x, pts[i - 1].y,
   159							  pts[i].x, pts[i].y,
   160							  input);
   161		}
   162	
   163		return 0;
   164	}
   165	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/iio/adc/qcom-vadc-common.c b/drivers/iio/adc/qcom-vadc-common.c
index d11f334..40d77b3 100644
--- a/drivers/iio/adc/qcom-vadc-common.c
+++ b/drivers/iio/adc/qcom-vadc-common.c
@@ -2,6 +2,7 @@ 
 #include <linux/bug.h>
 #include <linux/kernel.h>
 #include <linux/bitops.h>
+#include <linux/fixp-arith.h>
 #include <linux/math64.h>
 #include <linux/log2.h>
 #include <linux/err.h>
@@ -368,10 +369,9 @@  static int qcom_vadc_map_voltage_temp(const struct vadc_map_pt *pts,
 	} else {
 		/* result is between search_index and search_index-1 */
 		/* interpolate linearly */
-		*output = (((s32)((pts[i].y - pts[i - 1].y) *
-			(input - pts[i - 1].x)) /
-			(pts[i].x - pts[i - 1].x)) +
-			pts[i - 1].y);
+		*output = fixp_linear_interpolate(pts[i - 1].x, pts[i - 1].y,
+						  pts[i].x, pts[i].y,
+						  input);
 	}
 
 	return 0;