[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c07b7375-327e-44bd-907a-73771e9f938e@gmail.com>
Date: Thu, 28 Nov 2024 12:06:28 +0100
From: Javier Carrasco <javier.carrasco.cruz@...il.com>
To: kernel test robot <lkp@...el.com>, Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
Rishi Gupta <gupt21@...il.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] iio: light: add support for veml6031x00 ALS series
On 28/11/2024 10:55, kernel test robot wrote:
> Hi Javier,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on a61ff7eac77e86de828fe28c4e42b8ae9ec2b195]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Javier-Carrasco/dt-bindings-iio-light-veml6030-add-veml6031x00-ALS-series/20241128-104104
> base: a61ff7eac77e86de828fe28c4e42b8ae9ec2b195
> patch link: https://lore.kernel.org/r/20241126-veml6031x00-v1-2-4affa62bfefd%40gmail.com
> patch subject: [PATCH 2/2] iio: light: add support for veml6031x00 ALS series
> config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20241128/202411281741.xz7mD4E2-lkp@intel.com/config)
> compiler: loongarch64-linux-gcc (GCC) 14.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241128/202411281741.xz7mD4E2-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@...el.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202411281741.xz7mD4E2-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> drivers/iio/light/veml6031x00.c: In function 'veml6031x00_set_scale':
>>> drivers/iio/light/veml6031x00.c:422:24: warning: variable 'gain_idx' set but not used [-Wunused-but-set-variable]
> 422 | int new_scale, gain_idx;
> | ^~~~~~~~
>
>
> vim +/gain_idx +422 drivers/iio/light/veml6031x00.c
>
> 418
> 419 static int veml6031x00_set_scale(struct iio_dev *iio, int val, int val2)
> 420 {
> 421 struct veml6031x00_data *data = iio_priv(iio);
> > 422 int new_scale, gain_idx;
> 423
> 424 if (val == 0 && val2 == 125000) {
> 425 new_scale = FIELD_PREP(VEML6031X00_CONF1_GAIN, 0x03) |
> 426 VEML6031X00_CONF1_PD_D4;
> 427 gain_idx = 0;
> 428 } else if (val == 0 && val2 == 165000) {
> 429 new_scale = FIELD_PREP(VEML6031X00_CONF1_GAIN, 0x02) |
> 430 VEML6031X00_CONF1_PD_D4;
> 431 gain_idx = 1;
> 432 } else if (val == 0 && val2 == 250000) {
> 433 new_scale = FIELD_PREP(VEML6031X00_CONF1_GAIN, 0x00) |
> 434 VEML6031X00_CONF1_PD_D4;
> 435 gain_idx = 2;
> 436 } else if (val == 0 && val2 == 500000) {
> 437 new_scale = FIELD_PREP(VEML6031X00_CONF1_GAIN, 0x03);
> 438 gain_idx = 3;
> 439 } else if (val == 0 && val2 == 660000) {
> 440 new_scale = FIELD_PREP(VEML6031X00_CONF1_GAIN, 0x02);
> 441 gain_idx = 4;
> 442 } else if (val == 1 && val2 == 0) {
> 443 new_scale = FIELD_PREP(VEML6031X00_CONF1_GAIN, 0x00);
> 444 gain_idx = 5;
> 445 } else if (val == 2 && val2 == 0) {
> 446 new_scale = FIELD_PREP(VEML6031X00_CONF1_GAIN, 0x01);
> 447 gain_idx = 6;
> 448 } else {
> 449 return -EINVAL;
> 450 }
> 451
> 452 return regmap_update_bits(data->regmap, VEML6031X00_REG_CONF1,
> 453 VEML6031X00_CONF1_GAIN |
> 454 VEML6031X00_CONF1_PD_D4,
> 455 new_scale);
> 456 }
> 457
>
The gain_idx variable is a leftover of a previous approach where
processed values were also provided. But given that the conversion is
linear (raw * scale), processed values were dropped. I will also drop
this variable for v2 with the rest of the feedback I could get from this v1.
Best regards,
Javier Carrasco
Powered by blists - more mailing lists