All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: cem@kernel.org
Cc: oe-kbuild-all@lists.linux.dev
Subject: Re: [RFC PATCH] math.h: Account for 64-bit division on i386
Date: Sun, 20 Apr 2025 02:28:10 +0800	[thread overview]
Message-ID: <202504200218.98vwdj3m-lkp@intel.com> (raw)
In-Reply-To: <20250419115157.567249-1-cem@kernel.org>

Hi,

[This is a private test report for your RFC patch.]
kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on hch-configfs/for-next v6.15-rc2 next-20250417]
[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/cem-kernel-org/math-h-Account-for-64-bit-division-on-i386/20250419-195242
base:   linus/master
patch link:    https://lore.kernel.org/r/20250419115157.567249-1-cem%40kernel.org
patch subject: [RFC PATCH] math.h: Account for 64-bit division on i386
config: csky-randconfig-002-20250420 (https://download.01.org/0day-ci/archive/20250420/202504200218.98vwdj3m-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250420/202504200218.98vwdj3m-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504200218.98vwdj3m-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   In file included from ./arch/csky/include/generated/asm/div64.h:1,
                    from include/linux/math.h:6,
                    from include/linux/math64.h:6,
                    from include/linux/time.h:6,
                    from include/linux/stat.h:19,
                    from include/linux/module.h:13,
                    from drivers/power/supply/ltc4162-l-charger.c:12:
   drivers/power/supply/ltc4162-l-charger.c: In function 'ltc4162l_get_ibat':
   include/asm-generic/div64.h:183:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
     183 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:360:23: note: in expansion of macro 'mult_frac'
     360 |         val->intval = mult_frac(ret, chip_info->ibat_resolution_pv, info->rsnsb);
         |                       ^~~~~~~~~
   In file included from include/linux/build_bug.h:5,
                    from include/linux/bitfield.h:10,
                    from drivers/power/supply/ltc4162-l-charger.c:11:
>> include/asm-generic/div64.h:195:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     195 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:76:45: note: in definition of macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:360:23: note: in expansion of macro 'mult_frac'
     360 |         val->intval = mult_frac(ret, chip_info->ibat_resolution_pv, info->rsnsb);
         |                       ^~~~~~~~~
>> include/asm-generic/div64.h:199:36: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Wincompatible-pointer-types]
     199 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
         |                                    |
         |                                    int *
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:360:23: note: in expansion of macro 'mult_frac'
     360 |         val->intval = mult_frac(ret, chip_info->ibat_resolution_pv, info->rsnsb);
         |                       ^~~~~~~~~
   include/asm-generic/div64.h:174:38: note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'int *'
     174 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
         |                            ~~~~~~~~~~^~~~~~~~
   include/asm-generic/div64.h:183:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
     183 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:360:23: note: in expansion of macro 'mult_frac'
     360 |         val->intval = mult_frac(ret, chip_info->ibat_resolution_pv, info->rsnsb);
         |                       ^~~~~~~~~
>> include/asm-generic/div64.h:195:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     195 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:76:45: note: in definition of macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:360:23: note: in expansion of macro 'mult_frac'
     360 |         val->intval = mult_frac(ret, chip_info->ibat_resolution_pv, info->rsnsb);
         |                       ^~~~~~~~~
>> include/asm-generic/div64.h:199:36: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Wincompatible-pointer-types]
     199 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
         |                                    |
         |                                    int *
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:360:23: note: in expansion of macro 'mult_frac'
     360 |         val->intval = mult_frac(ret, chip_info->ibat_resolution_pv, info->rsnsb);
         |                       ^~~~~~~~~
   include/asm-generic/div64.h:174:38: note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'int *'
     174 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
         |                            ~~~~~~~~~~^~~~~~~~
   drivers/power/supply/ltc4162-l-charger.c: In function 'ltc4162l_get_icharge':
   include/asm-generic/div64.h:183:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
     183 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:417:32: note: in expansion of macro 'mult_frac'
     417 |         val->intval = 10000u * mult_frac(regval, 100000u, info->rsnsb);
         |                                ^~~~~~~~~
>> include/asm-generic/div64.h:195:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     195 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:76:45: note: in definition of macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:417:32: note: in expansion of macro 'mult_frac'
     417 |         val->intval = 10000u * mult_frac(regval, 100000u, info->rsnsb);
         |                                ^~~~~~~~~
>> include/asm-generic/div64.h:199:36: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Wincompatible-pointer-types]
     199 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
         |                                    |
         |                                    unsigned int *
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:417:32: note: in expansion of macro 'mult_frac'
     417 |         val->intval = 10000u * mult_frac(regval, 100000u, info->rsnsb);
         |                                ^~~~~~~~~
   include/asm-generic/div64.h:174:38: note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'unsigned int *'
     174 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
         |                            ~~~~~~~~~~^~~~~~~~
   include/asm-generic/div64.h:183:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
     183 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:417:32: note: in expansion of macro 'mult_frac'
     417 |         val->intval = 10000u * mult_frac(regval, 100000u, info->rsnsb);
         |                                ^~~~~~~~~
>> include/asm-generic/div64.h:195:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     195 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:76:45: note: in definition of macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:417:32: note: in expansion of macro 'mult_frac'
     417 |         val->intval = 10000u * mult_frac(regval, 100000u, info->rsnsb);
         |                                ^~~~~~~~~
>> include/asm-generic/div64.h:199:36: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Wincompatible-pointer-types]
     199 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
         |                                    |
         |                                    unsigned int *
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:417:32: note: in expansion of macro 'mult_frac'
     417 |         val->intval = 10000u * mult_frac(regval, 100000u, info->rsnsb);
         |                                ^~~~~~~~~
   include/asm-generic/div64.h:174:38: note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'unsigned int *'
     174 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
         |                            ~~~~~~~~~~^~~~~~~~
   drivers/power/supply/ltc4162-l-charger.c: In function 'ltc4162l_set_icharge':
   include/asm-generic/div64.h:183:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
     183 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:426:17: note: in expansion of macro 'mult_frac'
     426 |         value = mult_frac(value, info->rsnsb, 100000u);
         |                 ^~~~~~~~~
>> include/asm-generic/div64.h:195:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     195 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:76:45: note: in definition of macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:426:17: note: in expansion of macro 'mult_frac'
     426 |         value = mult_frac(value, info->rsnsb, 100000u);
         |                 ^~~~~~~~~
>> include/asm-generic/div64.h:199:36: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Wincompatible-pointer-types]
     199 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
         |                                    |
         |                                    unsigned int *
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:426:17: note: in expansion of macro 'mult_frac'
     426 |         value = mult_frac(value, info->rsnsb, 100000u);
         |                 ^~~~~~~~~
   include/asm-generic/div64.h:174:38: note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'unsigned int *'
     174 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
         |                            ~~~~~~~~~~^~~~~~~~
   include/asm-generic/div64.h:183:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
     183 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:426:17: note: in expansion of macro 'mult_frac'
     426 |         value = mult_frac(value, info->rsnsb, 100000u);
         |                 ^~~~~~~~~
>> include/asm-generic/div64.h:195:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     195 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:76:45: note: in definition of macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:426:17: note: in expansion of macro 'mult_frac'
     426 |         value = mult_frac(value, info->rsnsb, 100000u);
         |                 ^~~~~~~~~
>> include/asm-generic/div64.h:199:36: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Wincompatible-pointer-types]
     199 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
         |                                    |
         |                                    unsigned int *
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:426:17: note: in expansion of macro 'mult_frac'
     426 |         value = mult_frac(value, info->rsnsb, 100000u);
         |                 ^~~~~~~~~
   include/asm-generic/div64.h:174:38: note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'unsigned int *'
     174 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
         |                            ~~~~~~~~~~^~~~~~~~
   drivers/power/supply/ltc4162-l-charger.c: In function 'ltc4015_get_vcharge':
   include/asm-generic/div64.h:183:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
     183 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:528:37: note: in expansion of macro 'mult_frac'
     528 |                 voltage = 2000000 + mult_frac(regval, 1000000, 105);
         |                                     ^~~~~~~~~
>> include/asm-generic/div64.h:195:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     195 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:76:45: note: in definition of macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:528:37: note: in expansion of macro 'mult_frac'
     528 |                 voltage = 2000000 + mult_frac(regval, 1000000, 105);
         |                                     ^~~~~~~~~
>> include/asm-generic/div64.h:199:36: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Wincompatible-pointer-types]
     199 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
         |                                    |
         |                                    unsigned int *
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:528:37: note: in expansion of macro 'mult_frac'
     528 |                 voltage = 2000000 + mult_frac(regval, 1000000, 105);
         |                                     ^~~~~~~~~
   include/asm-generic/div64.h:174:38: note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'unsigned int *'
     174 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
         |                            ~~~~~~~~~~^~~~~~~~
   include/asm-generic/div64.h:183:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
     183 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:528:37: note: in expansion of macro 'mult_frac'
     528 |                 voltage = 2000000 + mult_frac(regval, 1000000, 105);
         |                                     ^~~~~~~~~
>> include/asm-generic/div64.h:195:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     195 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:76:45: note: in definition of macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:528:37: note: in expansion of macro 'mult_frac'
     528 |                 voltage = 2000000 + mult_frac(regval, 1000000, 105);
         |                                     ^~~~~~~~~
>> include/asm-generic/div64.h:199:36: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Wincompatible-pointer-types]
     199 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
         |                                    |
         |                                    unsigned int *
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:528:37: note: in expansion of macro 'mult_frac'
     528 |                 voltage = 2000000 + mult_frac(regval, 1000000, 105);
         |                                     ^~~~~~~~~
   include/asm-generic/div64.h:174:38: note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'unsigned int *'
     174 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
         |                            ~~~~~~~~~~^~~~~~~~
   drivers/power/supply/ltc4162-l-charger.c: In function 'ltc4162l_set_iin_limit':
   include/asm-generic/div64.h:183:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
     183 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:655:18: note: in expansion of macro 'mult_frac'
     655 |         regval = mult_frac(value, info->rsnsi, 50000u);
         |                  ^~~~~~~~~
>> include/asm-generic/div64.h:195:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     195 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:76:45: note: in definition of macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:655:18: note: in expansion of macro 'mult_frac'
     655 |         regval = mult_frac(value, info->rsnsi, 50000u);
         |                  ^~~~~~~~~
>> include/asm-generic/div64.h:199:36: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Wincompatible-pointer-types]
     199 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
         |                                    |
         |                                    unsigned int *
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:655:18: note: in expansion of macro 'mult_frac'
     655 |         regval = mult_frac(value, info->rsnsi, 50000u);
         |                  ^~~~~~~~~
   include/asm-generic/div64.h:174:38: note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'unsigned int *'
     174 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
         |                            ~~~~~~~~~~^~~~~~~~
   include/asm-generic/div64.h:183:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
     183 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:655:18: note: in expansion of macro 'mult_frac'
     655 |         regval = mult_frac(value, info->rsnsi, 50000u);
         |                  ^~~~~~~~~
>> include/asm-generic/div64.h:195:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     195 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:76:45: note: in definition of macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:655:18: note: in expansion of macro 'mult_frac'
     655 |         regval = mult_frac(value, info->rsnsi, 50000u);
         |                  ^~~~~~~~~
>> include/asm-generic/div64.h:199:36: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Wincompatible-pointer-types]
     199 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
         |                                    |
         |                                    unsigned int *
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:655:18: note: in expansion of macro 'mult_frac'
     655 |         regval = mult_frac(value, info->rsnsi, 50000u);
         |                  ^~~~~~~~~
   include/asm-generic/div64.h:174:38: note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'unsigned int *'
     174 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
         |                            ~~~~~~~~~~^~~~~~~~
   drivers/power/supply/ltc4162-l-charger.c: In function 'ltc4162l_set_term_current':
   include/asm-generic/div64.h:183:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
     183 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:746:18: note: in expansion of macro 'mult_frac'
     746 |         regval = mult_frac(value, info->rsnsb, 14660u);
         |                  ^~~~~~~~~
   include/asm-generic/div64.h:195:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     195 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:76:45: note: in definition of macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:746:18: note: in expansion of macro 'mult_frac'
     746 |         regval = mult_frac(value, info->rsnsb, 14660u);
         |                  ^~~~~~~~~
   include/asm-generic/div64.h:199:36: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Wincompatible-pointer-types]
     199 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
         |                                    |
         |                                    unsigned int *
   include/linux/math.h:142:24: note: in expansion of macro 'do_div'
     142 |         typeof(x_) r = do_div(x_, d_);  \
         |                        ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:746:18: note: in expansion of macro 'mult_frac'
     746 |         regval = mult_frac(value, info->rsnsb, 14660u);
         |                  ^~~~~~~~~
   include/asm-generic/div64.h:174:38: note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'unsigned int *'
     174 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
         |                            ~~~~~~~~~~^~~~~~~~
   include/asm-generic/div64.h:183:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
     183 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:746:18: note: in expansion of macro 'mult_frac'
     746 |         regval = mult_frac(value, info->rsnsb, 14660u);
         |                  ^~~~~~~~~
   include/asm-generic/div64.h:195:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     195 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:76:45: note: in definition of macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:746:18: note: in expansion of macro 'mult_frac'
     746 |         regval = mult_frac(value, info->rsnsb, 14660u);
         |                  ^~~~~~~~~
   include/asm-generic/div64.h:199:36: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Wincompatible-pointer-types]
     199 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
         |                                    |
         |                                    unsigned int *
   include/linux/math.h:144:9: note: in expansion of macro 'do_div'
     144 |         do_div(r, d_);                  \
         |         ^~~~~~
   drivers/power/supply/ltc4162-l-charger.c:746:18: note: in expansion of macro 'mult_frac'
     746 |         regval = mult_frac(value, info->rsnsb, 14660u);
         |                  ^~~~~~~~~
   include/asm-generic/div64.h:174:38: note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'unsigned int *'
     174 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
         |                            ~~~~~~~~~~^~~~~~~~


vim +/__div64_32 +199 include/asm-generic/div64.h

^1da177e4c3f41 Linus Torvalds     2005-04-16  176  
^1da177e4c3f41 Linus Torvalds     2005-04-16  177  /* The unnecessary pointer compare is there
^1da177e4c3f41 Linus Torvalds     2005-04-16  178   * to check for type safety (n must be 64bit)
^1da177e4c3f41 Linus Torvalds     2005-04-16  179   */
^1da177e4c3f41 Linus Torvalds     2005-04-16  180  # define do_div(n,base) ({				\
^1da177e4c3f41 Linus Torvalds     2005-04-16  181  	uint32_t __base = (base);			\
^1da177e4c3f41 Linus Torvalds     2005-04-16  182  	uint32_t __rem;					\
^1da177e4c3f41 Linus Torvalds     2005-04-16  183  	(void)(((typeof((n)) *)0) == ((uint64_t *)0));	\
911918aa7ef6f8 Nicolas Pitre      2015-11-02  184  	if (__builtin_constant_p(__base) &&		\
911918aa7ef6f8 Nicolas Pitre      2015-11-02  185  	    is_power_of_2(__base)) {			\
911918aa7ef6f8 Nicolas Pitre      2015-11-02  186  		__rem = (n) & (__base - 1);		\
911918aa7ef6f8 Nicolas Pitre      2015-11-02  187  		(n) >>= ilog2(__base);			\
c747ce4706190e Geert Uytterhoeven 2021-08-11  188  	} else if (__builtin_constant_p(__base) &&	\
461a5e51060c93 Nicolas Pitre      2015-10-30  189  		   __base != 0) {			\
461a5e51060c93 Nicolas Pitre      2015-10-30  190  		uint32_t __res_lo, __n_lo = (n);	\
461a5e51060c93 Nicolas Pitre      2015-10-30  191  		(n) = __div64_const32(n, __base);	\
461a5e51060c93 Nicolas Pitre      2015-10-30  192  		/* the remainder can be computed with 32-bit regs */ \
461a5e51060c93 Nicolas Pitre      2015-10-30  193  		__res_lo = (n);				\
461a5e51060c93 Nicolas Pitre      2015-10-30  194  		__rem = __n_lo - __res_lo * __base;	\
911918aa7ef6f8 Nicolas Pitre      2015-11-02 @195  	} else if (likely(((n) >> 32) == 0)) {		\
^1da177e4c3f41 Linus Torvalds     2005-04-16  196  		__rem = (uint32_t)(n) % __base;		\
^1da177e4c3f41 Linus Torvalds     2005-04-16  197  		(n) = (uint32_t)(n) / __base;		\
c747ce4706190e Geert Uytterhoeven 2021-08-11  198  	} else {					\
^1da177e4c3f41 Linus Torvalds     2005-04-16 @199  		__rem = __div64_32(&(n), __base);	\
c747ce4706190e Geert Uytterhoeven 2021-08-11  200  	}						\
^1da177e4c3f41 Linus Torvalds     2005-04-16  201  	__rem;						\
^1da177e4c3f41 Linus Torvalds     2005-04-16  202   })
^1da177e4c3f41 Linus Torvalds     2005-04-16  203  

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

  reply	other threads:[~2025-04-19 18:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-19 11:51 [RFC PATCH] math.h: Account for 64-bit division on i386 cem
2025-04-19 18:28 ` kernel test robot [this message]
2025-04-19 18:59 ` kernel test robot
2025-04-20 15:40 ` Guenter Roeck
2025-04-20 17:42   ` Guenter Roeck
2025-04-20 18:05     ` Carlos Maiolino
2025-04-23  7:02     ` Geert Uytterhoeven
2025-04-20 18:01   ` Carlos Maiolino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202504200218.98vwdj3m-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=cem@kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.