Re: [PATCH v2 2/6] iio: adc: ad4030: add driver for ad4030-24
From: kernel test robot
Date: Sat Dec 21 2024 - 02:15:23 EST
Hi Esteban,
kernel test robot noticed the following build errors:
[auto build test ERROR on 40384c840ea1944d7c5a392e8975ed088ecf0b37]
url: https://github.com/intel-lab-lkp/linux/commits/Esteban-Blanc/dt-bindings-iio-adc-add-ADI-ad4030-ad4630-and-ad4632/20241220-001408
base: 40384c840ea1944d7c5a392e8975ed088ecf0b37
patch link: https://lore.kernel.org/r/20241219-eblanc-ad4630_v1-v2-2-f36e55907bf5%40baylibre.com
patch subject: [PATCH v2 2/6] iio: adc: ad4030: add driver for ad4030-24
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20241221/202412211547.tPF7ZugU-lkp@xxxxxxxxx/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 9daf10ff8f29ba3a88a105aaa9d2379c21b77d35)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241221/202412211547.tPF7ZugU-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/202412211547.tPF7ZugU-lkp@xxxxxxxxx/
All errors (new ones prefixed by >>):
In file included from drivers/iio/adc/ad4030.c:22:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:21:
In file included from include/linux/mm.h:2223:
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> drivers/iio/adc/ad4030.c:346:9: error: call to undeclared function 'get_unaligned_be16'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
346 | gain = get_unaligned_be16(st->rx_data.raw);
| ^
drivers/iio/adc/ad4030.c:371:24: error: call to undeclared function 'get_unaligned_be16'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
371 | *val = sign_extend32(get_unaligned_be16(st->rx_data.raw), 15);
| ^
>> drivers/iio/adc/ad4030.c:375:24: error: call to undeclared function 'get_unaligned_be24'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
375 | *val = sign_extend32(get_unaligned_be24(st->rx_data.raw), 23);
| ^
>> drivers/iio/adc/ad4030.c:399:2: error: call to undeclared function 'put_unaligned_be16'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
399 | put_unaligned_be16(DIV_ROUND_CLOSEST_ULL(gain * 0x8000, MICRO),
| ^
drivers/iio/adc/ad4030.c:420:3: error: call to undeclared function 'put_unaligned_be16'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
420 | put_unaligned_be16(offset, st->tx_data);
| ^
>> drivers/iio/adc/ad4030.c:424:3: error: call to undeclared function 'put_unaligned_be24'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
424 | put_unaligned_be24(offset, st->tx_data);
| ^
1 warning and 6 errors generated.
vim +/get_unaligned_be16 +346 drivers/iio/adc/ad4030.c
331
332 static int ad4030_get_chan_calibscale(struct iio_dev *indio_dev,
333 struct iio_chan_spec const *chan,
334 int *val,
335 int *val2)
336 {
337 struct ad4030_state *st = iio_priv(indio_dev);
338 u16 gain;
339 int ret;
340
341 ret = regmap_bulk_read(st->regmap, AD4030_REG_GAIN_CHAN(chan->address),
342 st->rx_data.raw, AD4030_REG_GAIN_BYTES_NB);
343 if (ret)
344 return ret;
345
> 346 gain = get_unaligned_be16(st->rx_data.raw);
347
348 /* From datasheet: multiplied output = input × gain word/0x8000 */
349 *val = gain / 0x8000;
350 *val2 = mul_u64_u32_div(gain % 0x8000, NANO, 0x8000);
351
352 return IIO_VAL_INT_PLUS_NANO;
353 }
354
355 /* Returns the offset where 1 LSB = (VREF/2^precision_bits - 1)/gain */
356 static int ad4030_get_chan_calibbias(struct iio_dev *indio_dev,
357 struct iio_chan_spec const *chan,
358 int *val)
359 {
360 struct ad4030_state *st = iio_priv(indio_dev);
361 int ret;
362
363 ret = regmap_bulk_read(st->regmap,
364 AD4030_REG_OFFSET_CHAN(chan->address),
365 st->rx_data.raw, AD4030_REG_OFFSET_BYTES_NB);
366 if (ret)
367 return ret;
368
369 switch (st->chip->precision_bits) {
370 case 16:
371 *val = sign_extend32(get_unaligned_be16(st->rx_data.raw), 15);
372 return IIO_VAL_INT;
373
374 case 24:
> 375 *val = sign_extend32(get_unaligned_be24(st->rx_data.raw), 23);
376 return IIO_VAL_INT;
377
378 default:
379 return -EINVAL;
380 }
381 }
382
383 static int ad4030_set_chan_calibscale(struct iio_dev *indio_dev,
384 struct iio_chan_spec const *chan,
385 int gain_int,
386 int gain_frac)
387 {
388 struct ad4030_state *st = iio_priv(indio_dev);
389 u64 gain;
390
391 if (gain_int < 0 || gain_frac < 0)
392 return -EINVAL;
393
394 gain = mul_u32_u32(gain_int, MICRO) + gain_frac;
395
396 if (gain > AD4030_REG_GAIN_MAX_GAIN)
397 return -EINVAL;
398
> 399 put_unaligned_be16(DIV_ROUND_CLOSEST_ULL(gain * 0x8000, MICRO),
400 st->tx_data);
401
402 return regmap_bulk_write(st->regmap,
403 AD4030_REG_GAIN_CHAN(chan->address),
404 st->tx_data, AD4030_REG_GAIN_BYTES_NB);
405 }
406
407 static int ad4030_set_chan_calibbias(struct iio_dev *indio_dev,
408 struct iio_chan_spec const *chan,
409 int offset)
410 {
411 struct ad4030_state *st = iio_priv(indio_dev);
412
413 if (offset < st->offset_avail[0] || offset > st->offset_avail[2])
414 return -EINVAL;
415
416 st->tx_data[2] = 0;
417
418 switch (st->chip->precision_bits) {
419 case 16:
420 put_unaligned_be16(offset, st->tx_data);
421 break;
422
423 case 24:
> 424 put_unaligned_be24(offset, st->tx_data);
425 break;
426
427 default:
428 return -EINVAL;
429 }
430
431 return regmap_bulk_write(st->regmap,
432 AD4030_REG_OFFSET_CHAN(chan->address),
433 st->tx_data, AD4030_REG_OFFSET_BYTES_NB);
434 }
435
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki