Re: [PATCH v2 2/3] iio: adc: sophgo-saradc: Add driver for Sophgo SARADC

Jonathan Cameron
2024-07-06T10:58:30Z

On Sat, 6 Jul 2024 13:16:36 +0800
kernel test robot <lkp@intel.com> wrote:

> Hi Thomas,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on d20f6b3d747c36889b7ce75ee369182af3decb6b]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Thomas-Bonnefille/dt-bindings-iio-adc-sophgo-cv18xx-saradc-yaml-Add-Sophgo-SARADC-binding-documentation/20240706-040736
> base: d20f6b3d747c36889b7ce75ee369182af3decb6b
> patch link: https://lore.kernel.org/r/20240705-sg2002-adc-v2-2-83428c20a9b2%40bootlin.com
> patch subject: [PATCH v2 2/3] iio: adc: sophgo-saradc: Add driver for Sophgo SARADC
> config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240706/202407061311.ZEmwMY8m-lkp@intel.com/config)
> compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240706/202407061311.ZEmwMY8m-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/202407061311.ZEmwMY8m-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> drivers/iio/adc/sophgo-cv18xx-adc.c:85:3: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
> 85 | struct cv18xx_adc *saradc = iio_priv(indio_dev);
> | ^
> 1 warning generated.
>
>
> vim +85 drivers/iio/adc/sophgo-cv18xx-adc.c
>
> 78
> 79 static int cv18xx_adc_read_raw(struct iio_dev *indio_dev,
> 80 struct iio_chan_spec const *chan,
> 81 int *val, int *val2, long mask)
> 82 {
> 83 switch (mask) {
> 84 case IIO_CHAN_INFO_RAW:

I guess you figured this out but if not.. Key is you need to define a scope so
{
> > 85 struct cv18xx_adc *saradc = iio_priv(indio_dev);
> 86 u32 sample;
> 87 int ret;
> 88
> 89 scoped_guard(mutex, &saradc->lock) {
> 90 cv18xx_adc_start_measurement(saradc, chan->scan_index);
> 91 ret = cv18xx_adc_wait(saradc);
> 92 if (ret < 0)
> 93 return ret;
> 94
> 95 sample = readl(saradc->regs + CV18XX_ADC_CH_RESULT_REG(chan->scan_index));
> 96 }
> 97 if (!(sample & CV18XX_ADC_CH_VALID))
> 98 return -ENODATA;
> 99
> 100 *val = sample & CV18XX_ADC_CH_RESULT;
> 101 return IIO_VAL_INT;

}

> 102 case IIO_CHAN_INFO_SCALE:
> 103 *val = 3300;
> 104 *val2 = 12;
> 105 return IIO_VAL_FRACTIONAL_LOG2;
> 106 default:
> 107 return -EINVAL;
> 108 }
> 109 }
> 110
>