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

kernel test robot lkp at intel.com
Fri Aug 30 17:45:16 PDT 2024


Hi Thomas,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 5be63fc19fcaa4c236b307420483578a56986a37]

url:    https://github.com/intel-lab-lkp/linux/commits/Thomas-Bonnefille/dt-bindings-iio-adc-sophgo-cv1800b-saradc-Add-Sophgo-CV1800B-SARADC/20240829-203431
base:   5be63fc19fcaa4c236b307420483578a56986a37
patch link:    https://lore.kernel.org/r/20240829-sg2002-adc-v5-2-aacb381e869b%40bootlin.com
patch subject: [PATCH v5 2/3] iio: adc: sophgo-saradc: Add driver for Sophgo CV1800B SARADC
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240831/202408310817.GT3TMpnv-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/20240831/202408310817.GT3TMpnv-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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408310817.GT3TMpnv-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/iio/adc/sophgo-cv1800b-adc.c:120:3: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
     120 |                 u32 status_reg = readl(saradc->regs + CV1800B_ADC_CYC_SET_REG);
         |                 ^
   1 warning generated.


vim +120 drivers/iio/adc/sophgo-cv1800b-adc.c

    88	
    89	static int cv1800b_adc_read_raw(struct iio_dev *indio_dev,
    90					struct iio_chan_spec const *chan,
    91					int *val, int *val2, long mask)
    92	{
    93		struct cv1800b_adc *saradc = iio_priv(indio_dev);
    94	
    95		switch (mask) {
    96		case IIO_CHAN_INFO_RAW:{
    97			u32 sample;
    98	
    99			scoped_guard(mutex, &saradc->lock) {
   100				int ret;
   101	
   102				cv1800b_adc_start_measurement(saradc, chan->scan_index);
   103				ret = cv1800b_adc_wait(saradc);
   104				if (ret < 0)
   105					return ret;
   106	
   107				sample = readl(saradc->regs + CV1800B_ADC_CH_RESULT_REG(chan->scan_index));
   108			}
   109			if (!(sample & CV1800B_ADC_CH_VALID))
   110				return -ENODATA;
   111	
   112			*val = sample & CV1800B_ADC_CH_RESULT;
   113			return IIO_VAL_INT;
   114			}
   115		case IIO_CHAN_INFO_SCALE:
   116			*val = 3300;
   117			*val2 = 12;
   118			return IIO_VAL_FRACTIONAL_LOG2;
   119		case IIO_CHAN_INFO_SAMP_FREQ:
 > 120			u32 status_reg = readl(saradc->regs + CV1800B_ADC_CYC_SET_REG);
   121			int clk_div = (1 + FIELD_GET(CV1800B_MASK_CLKDIV, status_reg));
   122			int freq = clk_get_rate(saradc->clk) / clk_div;
   123			int nb_startup_cycle = 1 + FIELD_GET(CV1800B_MASK_STARTUP_CYCLE, status_reg);
   124			int nb_sample_cycle = 1 + FIELD_GET(CV1800B_MASK_SAMPLE_WINDOW, status_reg);
   125			int nb_compare_cycle = 1 + FIELD_GET(CV1800B_MASK_COMPARE_CYCLE, status_reg);
   126	
   127			*val = freq / (nb_startup_cycle + nb_sample_cycle + nb_compare_cycle);
   128			return IIO_VAL_INT;
   129		default:
   130			return -EINVAL;
   131		}
   132	}
   133	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



More information about the linux-riscv mailing list