Re: [PATCH v6 6/7] iio: light: ROHM BU27034 Ambient Light Sensor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Matti,

I love your patch! Perhaps something to improve:

[auto build test WARNING on eeac8ede17557680855031c6f305ece2378af326]

url:    https://github.com/intel-lab-lkp/linux/commits/Matti-Vaittinen/dt-bindings-iio-light-Support-ROHM-BU27034/20230327-193728
base:   eeac8ede17557680855031c6f305ece2378af326
patch link:    https://lore.kernel.org/r/1b7d3725bf5ae829b12eaf96362204edd29c6966.1679915278.git.mazziesaccount%40gmail.com
patch subject: [PATCH v6 6/7] iio: light: ROHM BU27034 Ambient Light Sensor
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20230328/202303281338.X45nIbaD-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/b824935db7c7734628f11c55cd64dc819be8798f
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Matti-Vaittinen/dt-bindings-iio-light-Support-ROHM-BU27034/20230327-193728
        git checkout b824935db7c7734628f11c55cd64dc819be8798f
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/iio/light/ drivers/media/i2c/ drivers/media/pci/intel/ drivers/net/usb/ net/netfilter/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202303281338.X45nIbaD-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/iio/light/rohm-bu27034.c:402:8: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask)))' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
           val = FIELD_PREP(mask, sel);
                 ^~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:114:3: note: expanded from macro 'FIELD_PREP'
                   __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: ");    \
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:71:53: note: expanded from macro '__BF_FIELD_CHECK'
                   BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) >     \
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
   include/linux/build_bug.h:39:58: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   include/linux/compiler_types.h:397:22: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:385:23: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:377:9: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                         ^~~~~~~~~
   1 warning generated.


vim +402 drivers/iio/light/rohm-bu27034.c

   388	
   389	/* Caller should hold the lock to protect lux reading */
   390	static int bu27034_write_gain_sel(struct bu27034_data *data, int chan, int sel)
   391	{
   392		static const int reg[] = {
   393			[BU27034_CHAN_DATA0] = BU27034_REG_MODE_CONTROL2,
   394			[BU27034_CHAN_DATA1] = BU27034_REG_MODE_CONTROL3,
   395		};
   396		int mask, val;
   397	
   398		if (chan != BU27034_CHAN_DATA0 && chan != BU27034_CHAN_DATA1)
   399			return -EINVAL;
   400	
   401		mask = BU27034_MASK_D01_GAIN;
 > 402		val = FIELD_PREP(mask, sel);
   403	
   404		if (chan == BU27034_CHAN_DATA0) {
   405			/*
   406			 * We keep the same gain for channel 2 as we set for channel 0
   407			 * We can't allow them to be individually controlled because
   408			 * setting one will impact also the other. Also, if we don't
   409			 * always update both gains we may result unsupported bit
   410			 * combinations.
   411			 *
   412			 * This is not nice but this is yet another place where the
   413			 * user space must be prepared to surprizes. Namely, see chan 2
   414			 * gain changed when chan 0 gain is changed.
   415			 *
   416			 * This is not fatal for most users though. I don't expect the
   417			 * channel 2 to be used in any generic cases - the intensity
   418			 * values provided by the sensor for IR area are not openly
   419			 * documented. Also, channel 2 is not used for visible light.
   420			 *
   421			 * So, if there is application which is written to utilize the
   422			 * channel 2 - then it is probably specifically targeted to this
   423			 * sensor and knows how to utilize those values. It is safe to
   424			 * hope such user can also cope with the gain changes.
   425			 */
   426			mask |=  BU27034_MASK_D2_GAIN_LO;
   427	
   428			/*
   429			 * The D2 gain bits are directly the lowest bits of selector.
   430			 * Just do add those bits to the value
   431			 */
   432			val |= sel & BU27034_MASK_D2_GAIN_LO;
   433		}
   434	
   435		return regmap_update_bits(data->regmap, reg[chan], mask, val);
   436	}
   437	

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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux