Re: [PATCH 2/2] hwmon: Add driver for TI INA233 Current and Power Monitor

From: kernel test robot
Date: Thu Jan 09 2025 - 09:59:26 EST


Hi Leo,

kernel test robot noticed the following build errors:

[auto build test ERROR on groeck-staging/hwmon-next]
[also build test ERROR on linus/master v6.13-rc6 next-20250109]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Leo-Yang/dt-bindings-Add-INA233-device/20250106-151934
base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
patch link: https://lore.kernel.org/r/20250106071337.3017926-3-Leo-Yang%40quantatw.com
patch subject: [PATCH 2/2] hwmon: Add driver for TI INA233 Current and Power Monitor
config: i386-randconfig-r072-20250109 (https://download.01.org/0day-ci/archive/20250109/202501092213.X9mbPW5Q-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250109/202501092213.X9mbPW5Q-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501092213.X9mbPW5Q-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

ld: drivers/hwmon/pmbus/ina233.o: in function `calculate_coef':
>> drivers/hwmon/pmbus/ina233.c:59: undefined reference to `__divdi3'


vim +59 drivers/hwmon/pmbus/ina233.c

23
24 static int calculate_coef(int *m, int *R, bool power)
25 {
26 s64 scaled_m;
27 int scale_factor = 0;
28 int scale_coef = 1;
29 int power_coef = 1;
30 bool is_integer = false;
31
32 if (*m == 0) {
33 *R = 0;
34 return -1;
35 }
36
37 if (power)
38 power_coef = 25;
39
40 if (1000000 % *m) {
41 /* Default value, Scaling to keep integer precision,
42 * Change it if you need
43 */
44 scale_factor = -3;
45 scale_coef = 1000;
46 } else {
47 is_integer = true;
48 }
49
50 /*
51 * Unit Conversion (Current_LSB A->uA) and use scaling(scale_factor)
52 * to keep integer precision.
53 * Formulae referenced from spec.
54 */
55 scaled_m = div_s64(1000000 * scale_coef, *m * power_coef);
56
57 /* Maximize while keeping it bounded.*/
58 while (scaled_m > MAX_M_VAL || scaled_m < MIN_M_VAL) {
> 59 scaled_m /= 10;
60 scale_factor++;
61 }
62 /* Scale up only if fractional part exists. */
63 while (scaled_m * 10 < MAX_M_VAL && scaled_m * 10 > MIN_M_VAL && !is_integer) {
64 scaled_m *= 10;
65 scale_factor--;
66 }
67
68 *m = scaled_m;
69 *R = scale_factor;
70 return 0;
71 }
72

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki