Re: [PATCH v3 7/7] iio: accel: kx022a: align with subsystem way

kernel test robot
2024-11-28T17:53:04Z

Hi Matti,

kernel test robot noticed the following build errors:

[auto build test ERROR on a61ff7eac77e86de828fe28c4e42b8ae9ec2b195]

url: https://github.com/intel-lab-lkp/linux/commits/Matti-Vaittinen/iio-accel-kx022a-Use-cleanup-h-helpers/20241128-170626
base: a61ff7eac77e86de828fe28c4e42b8ae9ec2b195
patch link: https://lore.kernel.org/r/9b63813ecf10b1cd0126cb950bc09514c4287b9a.1732783834.git.mazziesaccount%40gmail.com
patch subject: [PATCH v3 7/7] iio: accel: kx022a: align with subsystem way
config: x86_64-buildonly-randconfig-004-20241128 (https://download.01.org/0day-ci/archive/20241129/202411290148.Jdoj8IqZ-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241129/202411290148.Jdoj8IqZ-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/202411290148.Jdoj8IqZ-lkp@intel.com/

All errors (new ones prefixed by >>):

drivers/iio/accel/kionix-kx022a.c: In function 'kx022a_write_raw':
>> drivers/iio/accel/kionix-kx022a.c:507:9: error: implicit declaration of function 'if_not_cond_guard' [-Werror=implicit-function-declaration]
507 | if_not_cond_guard(iio_claim_direct_try, idev)
| ^~~~~~~~~~~~~~~~~
>> drivers/iio/accel/kionix-kx022a.c:507:27: error: 'iio_claim_direct_try' undeclared (first use in this function); did you mean 'class_iio_claim_direct_try_t'?
507 | if_not_cond_guard(iio_claim_direct_try, idev)
| ^~~~~~~~~~~~~~~~~~~~
| class_iio_claim_direct_try_t
drivers/iio/accel/kionix-kx022a.c:507:27: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/iio/accel/kionix-kx022a.c:507:54: error: expected ';' before 'return'
507 | if_not_cond_guard(iio_claim_direct_try, idev)
| ^
| ;
508 | return -EBUSY;
| ~~~~~~
In file included from drivers/iio/accel/kionix-kx022a.c:8:
include/linux/cleanup.h:308:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
308 | for (CLASS(_name, scope)(args), \
| ^~~
drivers/iio/accel/kionix-kx022a.c:521:17: note: in expansion of macro 'scoped_guard'
521 | scoped_guard(mutex, &data->mutex) {
| ^~~~~~~~~~~~
drivers/iio/accel/kionix-kx022a.c:532:9: note: here
532 | case IIO_CHAN_INFO_SCALE:
| ^~~~
cc1: some warnings being treated as errors

vim +/if_not_cond_guard +507 drivers/iio/accel/kionix-kx022a.c

490
491 static int kx022a_write_raw(struct iio_dev *idev,
492 struct iio_chan_spec const *chan,
493 int val, int val2, long mask)
494 {
495 struct kx022a_data *data = iio_priv(idev);
496 int ret, n;
497
498 /*
499 * We should not allow changing scale or frequency when FIFO is running
500 * as it will mess the timestamp/scale for samples existing in the
501 * buffer. If this turns out to be an issue we can later change logic
502 * to internally flush the fifo before reconfiguring so the samples in
503 * fifo keep matching the freq/scale settings. (Such setup could cause
504 * issues if users trust the watermark to be reached within known
505 * time-limit).
506 */
> 507 if_not_cond_guard(iio_claim_direct_try, idev)
508 return -EBUSY;
509
510 switch (mask) {
511 case IIO_CHAN_INFO_SAMP_FREQ:
512 n = ARRAY_SIZE(kx022a_accel_samp_freq_table);
513
514 while (n--)
515 if (val == kx022a_accel_samp_freq_table[n][0] &&
516 val2 == kx022a_accel_samp_freq_table[n][1])
517 break;
518 if (n < 0)
519 return -EINVAL;
520
521 scoped_guard(mutex, &data->mutex) {
522 ret = kx022a_turn_on_off(data, false);
523 if (ret)
524 return ret;
525
526 ret = regmap_update_bits(data->regmap,
527 data->chip_info->odcntl,
528 KX022A_MASK_ODR, n);
529 data->odr_ns = kx022a_odrs[n];
530 return kx022a_turn_on_off(data, true);
531 }
532 case IIO_CHAN_INFO_SCALE:
533 n = data->chip_info->scale_table_size / 2;
534
535 while (n-- > 0)
536 if (val == data->chip_info->scale_table[n][0] &&
537 val2 == data->chip_info->scale_table[n][1])
538 break;
539 if (n < 0)
540 return -EINVAL;
541
542 scoped_guard(mutex, &data->mutex) {
543 ret = kx022a_turn_on_off(data, false);
544 if (ret)
545 return ret;
546
547 ret = regmap_update_bits(data->regmap,
548 data->chip_info->cntl,
549 KX022A_MASK_GSEL,
550 n << KX022A_GSEL_SHIFT);
551 kx022a_turn_on_off(data, true);
552
553 return ret;
554 }
555 default:
556 break;
557 }
558
559 return -EINVAL;
560 }
561

--
0-DAY CI Kernel Test Service