Re: [PATCH v1 2/2] ACPI: PMIC: Replace open coded be16_to_cpu()

kernel test robot
2022-08-30T16:22:58Z

Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on linus/master v6.0-rc3 next-20220830]
[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/Andy-Shevchenko/ACPI-PMIC-Use-sizeof-instead-of-hard-coded-value/20220830-215815
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220831/202208310028.KhBuk6ZD-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/2ca842435092e0995ac8c691cfdc7971ab091d78
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/ACPI-PMIC-Use-sizeof-instead-of-hard-coded-value/20220830-215815
git checkout 2ca842435092e0995ac8c691cfdc7971ab091d78
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/acpi/

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

All warnings (new ones prefixed by >>):

drivers/acpi/pmic/intel_pmic_chtdc_ti.c: In function 'chtdc_ti_pmic_get_raw_temp':
>> drivers/acpi/pmic/intel_pmic_chtdc_ti.c:96:43: warning: passing argument 3 of 'regmap_bulk_read' makes pointer from integer without a cast [-Wint-conversion]
96 | if (regmap_bulk_read(regmap, reg, buf, sizeof(buf)))
| ^~~
| |
| __be16 {aka short unsigned int}
In file included from include/linux/mfd/intel_soc_pmic.h:14,
from drivers/acpi/pmic/intel_pmic_chtdc_ti.c:13:
include/linux/regmap.h:1167:66: note: expected 'void *' but argument is of type '__be16' {aka 'short unsigned int'}
1167 | int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
| ~~~~~~^~~
drivers/acpi/pmic/intel_pmic_chtdc_ti.c:99:35: error: macro "GENMASK" requires 2 arguments, but only 1 given
99 | return be16_to_cpu(buf) & PMIC_REG_MASK;
| ^~~~~~~~~~~~~
In file included from include/linux/ioport.h:13,
from include/linux/acpi.h:12,
from drivers/acpi/pmic/intel_pmic_chtdc_ti.c:10:
include/linux/bits.h:37: note: macro "GENMASK" defined here
37 | #define GENMASK(h, l) \
|
drivers/acpi/pmic/intel_pmic_chtdc_ti.c:21:33: error: 'GENMASK' undeclared (first use in this function)
21 | #define PMIC_REG_MASK GENMASK(9. 0)
| ^~~~~~~
drivers/acpi/pmic/intel_pmic_chtdc_ti.c:99:35: note: in expansion of macro 'PMIC_REG_MASK'
99 | return be16_to_cpu(buf) & PMIC_REG_MASK;
| ^~~~~~~~~~~~~
drivers/acpi/pmic/intel_pmic_chtdc_ti.c:21:33: note: each undeclared identifier is reported only once for each function it appears in
21 | #define PMIC_REG_MASK GENMASK(9. 0)
| ^~~~~~~
drivers/acpi/pmic/intel_pmic_chtdc_ti.c:99:35: note: in expansion of macro 'PMIC_REG_MASK'
99 | return be16_to_cpu(buf) & PMIC_REG_MASK;
| ^~~~~~~~~~~~~
drivers/acpi/pmic/intel_pmic_chtdc_ti.c:100:1: error: control reaches end of non-void function [-Werror=return-type]
100 | }
| ^
cc1: some warnings being treated as errors

vim +/regmap_bulk_read +96 drivers/acpi/pmic/intel_pmic_chtdc_ti.c

31374972321d16 Takashi Iwai 2017-09-04 91
31374972321d16 Takashi Iwai 2017-09-04 92 static int chtdc_ti_pmic_get_raw_temp(struct regmap *regmap, int reg)
31374972321d16 Takashi Iwai 2017-09-04 93 {
2ca842435092e0 Andy Shevchenko 2022-08-30 94 __be16 buf;
31374972321d16 Takashi Iwai 2017-09-04 95
20ea3e58eac77b Andy Shevchenko 2022-08-30 @96 if (regmap_bulk_read(regmap, reg, buf, sizeof(buf)))
31374972321d16 Takashi Iwai 2017-09-04 97 return -EIO;
31374972321d16 Takashi Iwai 2017-09-04 98
2ca842435092e0 Andy Shevchenko 2022-08-30 99 return be16_to_cpu(buf) & PMIC_REG_MASK;
31374972321d16 Takashi Iwai 2017-09-04 100 }
31374972321d16 Takashi Iwai 2017-09-04 101

--
0-DAY CI Kernel Test Service