Re: [PATCH 1/1] iio:proximity:sx9360: Fix hardware gain read/write

From: kernel test robot
Date: Wed Jun 08 2022 - 20:15:19 EST


Hi Xiaohui,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on v5.19-rc1 next-20220608]
[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/intel-lab-lkp/linux/commits/Xiaohui-Zhang/iio-proximity-sx9360-Fix-hardware-gain-read-write/20220608-125912
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: openrisc-randconfig-r033-20220608 (https://download.01.org/0day-ci/archive/20220609/202206090828.1Q7GljFY-lkp@xxxxxxxxx/config)
compiler: or1k-linux-gcc (GCC) 11.3.0
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
# https://github.com/intel-lab-lkp/linux/commit/bdc0a6947530604152de0d152635e144a486ee32
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Xiaohui-Zhang/iio-proximity-sx9360-Fix-hardware-gain-read-write/20220608-125912
git checkout bdc0a6947530604152de0d152635e144a486ee32
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=openrisc SHELL=/bin/bash drivers/iio/proximity/

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

All errors (new ones prefixed by >>):

drivers/iio/proximity/sx9360.c: In function 'sx9360_read_gain':
>> drivers/iio/proximity/sx9360.c:297:28: error: 'SX9360_REG_PROX_CTRL0_GAIN_RSVD' undeclared (first use in this function); did you mean 'SX9324_REG_PROX_CTRL0_GAIN_RSVD'?
297 | else if (regval == SX9360_REG_PROX_CTRL0_GAIN_RSVD ||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| SX9324_REG_PROX_CTRL0_GAIN_RSVD
drivers/iio/proximity/sx9360.c:297:28: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/iio/proximity/sx9360.c:298:27: error: 'SX9360_REG_PROX_CTRL0_GAIN_8' undeclared (first use in this function); did you mean 'SX9324_REG_PROX_CTRL0_GAIN_8'?
298 | regval > SX9360_REG_PROX_CTRL0_GAIN_8)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| SX9324_REG_PROX_CTRL0_GAIN_8
drivers/iio/proximity/sx9360.c: In function 'sx9360_write_gain':
drivers/iio/proximity/sx9360.c:646:32: error: 'SX9360_REG_PROX_CTRL0_GAIN_8' undeclared (first use in this function); did you mean 'SX9324_REG_PROX_CTRL0_GAIN_8'?
646 | if (val <= 0 || gain > SX9360_REG_PROX_CTRL0_GAIN_8)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| SX9324_REG_PROX_CTRL0_GAIN_8
drivers/iio/proximity/sx9360.c: At top level:
>> drivers/iio/proximity/sx9360.c:699:17: error: 'SX9360_REG_PROX_CTRL0_GAIN_1' undeclared here (not in a function); did you mean 'SX9324_REG_PROX_CTRL0_GAIN_1'?
699 | SX9360_REG_PROX_CTRL0_GAIN_1 << SX9360_REG_PROX_CTRL0_GAIN_SHIFT |
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| SX9324_REG_PROX_CTRL0_GAIN_1
>> drivers/iio/proximity/sx9360.c:699:49: error: 'SX9360_REG_PROX_CTRL0_GAIN_SHIFT' undeclared here (not in a function); did you mean 'SX9324_REG_PROX_CTRL0_GAIN_SHIFT'?
699 | SX9360_REG_PROX_CTRL0_GAIN_1 << SX9360_REG_PROX_CTRL0_GAIN_SHIFT |
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| SX9324_REG_PROX_CTRL0_GAIN_SHIFT


vim +297 drivers/iio/proximity/sx9360.c

282
283 static int sx9360_read_gain(struct sx_common_data *data,
284 const struct iio_chan_spec *chan, int *val)
285 {
286 unsigned int reg, regval;
287 int ret;
288
289 reg = SX9360_REG_PROX_CTRL0_PHR + chan->channel;
290 ret = regmap_read(data->regmap, reg, &regval);
291 if (ret)
292 return ret;
293
294 regval = FIELD_GET(SX9360_REG_PROX_CTRL0_GAIN_MASK, regval);
295 if (regval)
296 regval--;
> 297 else if (regval == SX9360_REG_PROX_CTRL0_GAIN_RSVD ||
> 298 regval > SX9360_REG_PROX_CTRL0_GAIN_8)
299 return -EINVAL;
300
301 *val = 1 << regval;
302
303 return IIO_VAL_INT;
304 }
305

--
0-DAY CI Kernel Test Service
https://01.org/lkp