[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202108211510.CrFu7P0M-lkp@intel.com>
Date: Sat, 21 Aug 2021 15:21:04 +0800
From: kernel test robot <lkp@...el.com>
To: Liam Beguin <liambeguin@...il.com>, peda@...ntia.se,
jic23@...nel.org, lars@...afoo.de
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
robh+dt@...nel.org
Subject: Re: [PATCH v8 09/14] iio: afe: rescale: fix accuracy for small
fractional scales
Hi Liam,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on 6cbb3aa0f9d5d23221df787cf36f74d3866fdb78]
url: https://github.com/0day-ci/linux/commits/Liam-Beguin/iio-afe-add-temperature-rescaling-support/20210821-032112
base: 6cbb3aa0f9d5d23221df787cf36f74d3866fdb78
config: i386-randconfig-r026-20210821 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/e5c2e1505fa3f8cf9fe6d3a21f3a5c585efc6dce
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Liam-Beguin/iio-afe-add-temperature-rescaling-support/20210821-032112
git checkout e5c2e1505fa3f8cf9fe6d3a21f3a5c585efc6dce
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All errors (new ones prefixed by >>):
ld: drivers/iio/afe/iio-rescale.o: in function `rescale_process_scale':
>> drivers/iio/afe/iio-rescale.c:56: undefined reference to `__divdi3'
vim +56 drivers/iio/afe/iio-rescale.c
20
21 int rescale_process_scale(struct rescale *rescale, int scale_type,
22 int *val, int *val2)
23 {
24 s64 tmp;
25 s32 rem, rem2;
26 u32 mult;
27 u32 neg;
28
29 switch (scale_type) {
30 case IIO_VAL_INT:
31 *val *= rescale->numerator;
32 if (rescale->denominator == 1)
33 return scale_type;
34 *val2 = rescale->denominator;
35 return IIO_VAL_FRACTIONAL;
36 case IIO_VAL_FRACTIONAL:
37 case IIO_VAL_FRACTIONAL_LOG2:
38 tmp = (s64)*val * 1000000000LL;
39 tmp = div_s64(tmp, rescale->denominator);
40 tmp *= rescale->numerator;
41
42 tmp = div_s64_rem(tmp, 1000000000LL, &rem);
43 *val = tmp;
44
45 /*
46 * For small values, the approximation can be costly,
47 * change scale type to maintain accuracy.
48 *
49 * 100 vs. 10000000 NANO caps the error to about 100 ppm.
50 */
51 if (scale_type == IIO_VAL_FRACTIONAL)
52 tmp = *val2;
53 else
54 tmp = 1 << *val2;
55
> 56 if (abs(rem) > 10000000 && abs(*val / tmp) < 100) {
57 *val = div_s64_rem(*val, tmp, &rem2);
58
59 *val2 = div_s64(rem, tmp);
60 if (rem2)
61 *val2 += div_s64(rem2 * 1000000000LL, tmp);
62
63 return IIO_VAL_INT_PLUS_NANO;
64 }
65
66 return scale_type;
67 case IIO_VAL_INT_PLUS_NANO:
68 case IIO_VAL_INT_PLUS_MICRO:
69 if (scale_type == IIO_VAL_INT_PLUS_NANO)
70 mult = 1000000000LL;
71 else
72 mult = 1000000LL;
73 /*
74 * For IIO_VAL_INT_PLUS_{MICRO,NANO} scale types if *val OR
75 * *val2 is negative the schan scale is negative
76 */
77 neg = *val < 0 || *val2 < 0;
78
79 tmp = (s64)abs(*val) * abs(rescale->numerator);
80 *val = div_s64_rem(tmp, abs(rescale->denominator), &rem);
81
82 tmp = (s64)rem * mult + (s64)abs(*val2) * abs(rescale->numerator);
83 tmp = div_s64(tmp, abs(rescale->denominator));
84
85 *val += div_s64_rem(tmp, mult, val2);
86
87 /*
88 * If only one of the rescaler elements or the schan scale is
89 * negative, the combined scale is negative.
90 */
91 if (neg ^ ((rescale->numerator < 0) ^ (rescale->denominator < 0))) {
92 if (*val)
93 *val = -*val;
94 else
95 *val2 = -*val2;
96 }
97
98 return scale_type;
99 default:
100 return -EOPNOTSUPP;
101 }
102 }
103
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (37862 bytes)
Powered by blists - more mailing lists