Re: [PATCH v2 2/4] docs: hwmon: (ltc2945): change type of val to ULL in ltc2945_val_to_reg()

kernel test robot
2020-11-13T07:27:02Z

[-- Attachment #1: Type: text/plain, Size: 5196 bytes --]

Hi Alexandru,

I love your patch! Yet something to improve:

[auto build test ERROR on hwmon/hwmon-next]
[also build test ERROR on v5.10-rc3 next-20201112]
[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]

url: https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/hwmon-ltc2945-add-support-for-sense-resistor/20201111-171129
base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
config: powerpc64-randconfig-r005-20201111 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 874b0a0b9db93f5d3350ffe6b5efda2d908415d0)
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
# install powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
# https://github.com/0day-ci/linux/commit/4e0e9315df2733ae5efe6095c5ab9b7675d07fb0
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alexandru-Ardelean/hwmon-ltc2945-add-support-for-sense-resistor/20201111-171129
git checkout 4e0e9315df2733ae5efe6095c5ab9b7675d07fb0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64

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/hwmon/ltc2945.c:256:26: error: incompatible pointer types passing 'unsigned long long *' to parameter of type 'unsigned long *' [-Werror,-Wincompatible-pointer-types]
ret = kstrtoul(buf, 10, &val);
^~~~
include/linux/kernel.h:351:90: note: passing argument to parameter 'res' here
static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
^
1 error generated.

vim +256 drivers/hwmon/ltc2945.c

6700ce035f8301 Guenter Roeck 2014-01-11 241
5614e26d84a99a Guenter Roeck 2018-12-06 242 static ssize_t ltc2945_value_store(struct device *dev,
6700ce035f8301 Guenter Roeck 2014-01-11 243 struct device_attribute *da,
6700ce035f8301 Guenter Roeck 2014-01-11 244 const char *buf, size_t count)
6700ce035f8301 Guenter Roeck 2014-01-11 245 {
6700ce035f8301 Guenter Roeck 2014-01-11 246 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
c159257a60302f Alexandru Ardelean 2020-11-11 247 struct ltc2945_state *st = dev_get_drvdata(dev);
c159257a60302f Alexandru Ardelean 2020-11-11 248 struct regmap *regmap = st->regmap;
6700ce035f8301 Guenter Roeck 2014-01-11 249 u8 reg = attr->index;
4e0e9315df2733 Alexandru Ardelean 2020-11-11 250 unsigned long long val;
6700ce035f8301 Guenter Roeck 2014-01-11 251 u8 regbuf[3];
6700ce035f8301 Guenter Roeck 2014-01-11 252 int num_regs;
6700ce035f8301 Guenter Roeck 2014-01-11 253 int regval;
6700ce035f8301 Guenter Roeck 2014-01-11 254 int ret;
6700ce035f8301 Guenter Roeck 2014-01-11 255
6700ce035f8301 Guenter Roeck 2014-01-11 @256 ret = kstrtoul(buf, 10, &val);
6700ce035f8301 Guenter Roeck 2014-01-11 257 if (ret)
6700ce035f8301 Guenter Roeck 2014-01-11 258 return ret;
6700ce035f8301 Guenter Roeck 2014-01-11 259
6700ce035f8301 Guenter Roeck 2014-01-11 260 /* convert to register value, then clamp and write result */
6700ce035f8301 Guenter Roeck 2014-01-11 261 regval = ltc2945_val_to_reg(dev, reg, val);
6700ce035f8301 Guenter Roeck 2014-01-11 262 if (is_power_reg(reg)) {
6700ce035f8301 Guenter Roeck 2014-01-11 263 regval = clamp_val(regval, 0, 0xffffff);
6700ce035f8301 Guenter Roeck 2014-01-11 264 regbuf[0] = regval >> 16;
6700ce035f8301 Guenter Roeck 2014-01-11 265 regbuf[1] = (regval >> 8) & 0xff;
6700ce035f8301 Guenter Roeck 2014-01-11 266 regbuf[2] = regval;
6700ce035f8301 Guenter Roeck 2014-01-11 267 num_regs = 3;
6700ce035f8301 Guenter Roeck 2014-01-11 268 } else {
6700ce035f8301 Guenter Roeck 2014-01-11 269 regval = clamp_val(regval, 0, 0xfff) << 4;
6700ce035f8301 Guenter Roeck 2014-01-11 270 regbuf[0] = regval >> 8;
6700ce035f8301 Guenter Roeck 2014-01-11 271 regbuf[1] = regval & 0xff;
6700ce035f8301 Guenter Roeck 2014-01-11 272 num_regs = 2;
6700ce035f8301 Guenter Roeck 2014-01-11 273 }
6700ce035f8301 Guenter Roeck 2014-01-11 274 ret = regmap_bulk_write(regmap, reg, regbuf, num_regs);
6700ce035f8301 Guenter Roeck 2014-01-11 275 return ret < 0 ? ret : count;
6700ce035f8301 Guenter Roeck 2014-01-11 276 }
6700ce035f8301 Guenter Roeck 2014-01-11 277

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27065 bytes --]