llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [robh:dt/header-cleanups 55/57] drivers/hwmon/pmbus/lm25066.c:485:13: warning: cast to smaller integer type 'enum chips' from 'const void *'
@ 2023-04-27 20:17 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-04-27 20:17 UTC (permalink / raw)
  To: Rob Herring; +Cc: llvm, oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git dt/header-cleanups
head:   d03f4bcb40575c1caf4deb8072eb2f9486e51b25
commit: a581a78403b6af4ee0aa9c6ee6701e92dc2555f6 [55/57] Use of_device_get_match_data
config: x86_64-randconfig-a012 (https://download.01.org/0day-ci/archive/20230428/202304280427.UgLOpheh-lkp@intel.com/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://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git/commit/?id=a581a78403b6af4ee0aa9c6ee6701e92dc2555f6
        git remote add robh https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
        git fetch --no-tags robh dt/header-cleanups
        git checkout a581a78403b6af4ee0aa9c6ee6701e92dc2555f6
        # 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=x86_64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/hwmon/pmbus/ drivers/of/ lib/ net/core/

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

All warnings (new ones prefixed by >>):

>> drivers/hwmon/pmbus/lm25066.c:485:13: warning: cast to smaller integer type 'enum chips' from 'const void *' [-Wvoid-pointer-to-enum-cast]
           data->id = (enum chips)of_device_get_match_data(&client->dev);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +485 drivers/hwmon/pmbus/lm25066.c

   463	
   464	static int lm25066_probe(struct i2c_client *client)
   465	{
   466		int config;
   467		u32 shunt;
   468		struct lm25066_data *data;
   469		struct pmbus_driver_info *info;
   470		const struct __coeff *coeff;
   471	
   472		if (!i2c_check_functionality(client->adapter,
   473					     I2C_FUNC_SMBUS_READ_BYTE_DATA))
   474			return -ENODEV;
   475	
   476		data = devm_kzalloc(&client->dev, sizeof(struct lm25066_data),
   477				    GFP_KERNEL);
   478		if (!data)
   479			return -ENOMEM;
   480	
   481		config = i2c_smbus_read_byte_data(client, LM25066_DEVICE_SETUP);
   482		if (config < 0)
   483			return config;
   484	
 > 485		data->id = (enum chips)of_device_get_match_data(&client->dev);
   486		if (!data->id)
   487			data->id = i2c_match_id(lm25066_id, client)->driver_data;
   488		if (!data->id)
   489			return -ENODEV;
   490	
   491		info = &data->info;
   492	
   493		info->pages = 1;
   494		info->format[PSC_VOLTAGE_IN] = direct;
   495		info->format[PSC_VOLTAGE_OUT] = direct;
   496		info->format[PSC_CURRENT_IN] = direct;
   497		info->format[PSC_TEMPERATURE] = direct;
   498		info->format[PSC_POWER] = direct;
   499	
   500		info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VMON
   501		  | PMBUS_HAVE_PIN | PMBUS_HAVE_IIN | PMBUS_HAVE_STATUS_INPUT
   502		  | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP | PMBUS_HAVE_SAMPLES;
   503	
   504		if (data->id == lm25056) {
   505			info->func[0] |= PMBUS_HAVE_STATUS_VMON;
   506			info->read_word_data = lm25056_read_word_data;
   507			info->read_byte_data = lm25056_read_byte_data;
   508			data->rlimit = 0x0fff;
   509		} else {
   510			info->func[0] |= PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
   511			info->read_word_data = lm25066_read_word_data;
   512			data->rlimit = 0x0fff;
   513		}
   514		info->write_word_data = lm25066_write_word_data;
   515	
   516		coeff = &lm25066_coeff[data->id][0];
   517		info->m[PSC_TEMPERATURE] = coeff[PSC_TEMPERATURE].m;
   518		info->b[PSC_TEMPERATURE] = coeff[PSC_TEMPERATURE].b;
   519		info->R[PSC_TEMPERATURE] = coeff[PSC_TEMPERATURE].R;
   520		info->m[PSC_VOLTAGE_IN] = coeff[PSC_VOLTAGE_IN].m;
   521		info->b[PSC_VOLTAGE_IN] = coeff[PSC_VOLTAGE_IN].b;
   522		info->R[PSC_VOLTAGE_IN] = coeff[PSC_VOLTAGE_IN].R;
   523		info->m[PSC_VOLTAGE_OUT] = coeff[PSC_VOLTAGE_OUT].m;
   524		info->b[PSC_VOLTAGE_OUT] = coeff[PSC_VOLTAGE_OUT].b;
   525		info->R[PSC_VOLTAGE_OUT] = coeff[PSC_VOLTAGE_OUT].R;
   526		info->R[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN].R;
   527		info->R[PSC_POWER] = coeff[PSC_POWER].R;
   528		if (config & LM25066_DEV_SETUP_CL) {
   529			info->m[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN_L].m;
   530			info->b[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN_L].b;
   531			info->m[PSC_POWER] = coeff[PSC_POWER_L].m;
   532			info->b[PSC_POWER] = coeff[PSC_POWER_L].b;
   533		} else {
   534			info->m[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN].m;
   535			info->b[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN].b;
   536			info->m[PSC_POWER] = coeff[PSC_POWER].m;
   537			info->b[PSC_POWER] = coeff[PSC_POWER].b;
   538		}
   539	
   540		/*
   541		 * Values in the TI datasheets are normalized for a 1mOhm sense
   542		 * resistor; assume that unless DT specifies a value explicitly.
   543		 */
   544		if (of_property_read_u32(client->dev.of_node, "shunt-resistor-micro-ohms", &shunt))
   545			shunt = 1000;
   546	
   547		info->m[PSC_CURRENT_IN] = info->m[PSC_CURRENT_IN] * shunt / 1000;
   548		info->m[PSC_POWER] = info->m[PSC_POWER] * shunt / 1000;
   549	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-27 20:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-27 20:17 [robh:dt/header-cleanups 55/57] drivers/hwmon/pmbus/lm25066.c:485:13: warning: cast to smaller integer type 'enum chips' from 'const void *' kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).