Re: [PATCH v1 2/2] iio: adc: adding support for pac193x

From: kernel test robot
Date: Mon Feb 20 2023 - 16:36:38 EST


Hi,

I love your patch! Perhaps something to improve:

[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on linus/master v6.2 next-20230220]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/marius-cristea-microchip-com/dt-bindings-iio-adc-adding-dt-bindings-for-PAC193X/20230220-203540
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link: https://lore.kernel.org/r/20230220123232.413029-3-marius.cristea%40microchip.com
patch subject: [PATCH v1 2/2] iio: adc: adding support for pac193x
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20230221/202302210551.5yGSdcbc-lkp@xxxxxxxxx/config)
compiler: powerpc-linux-gcc (GCC) 12.1.0
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/fd3be916ffe18735a98bdc55ccc0cb5f3097582c
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review marius-cristea-microchip-com/dt-bindings-iio-adc-adding-dt-bindings-for-PAC193X/20230220-203540
git checkout fd3be916ffe18735a98bdc55ccc0cb5f3097582c
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash

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/202302210551.5yGSdcbc-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/iio/adc/pac193x.c: In function 'pac193x_acpi_get_acpi_match_entry':
drivers/iio/adc/pac193x.c:1402:21: warning: variable 'status' set but not used [-Wunused-but-set-variable]
1402 | acpi_status status;
| ^~~~~~
drivers/iio/adc/pac193x.c: In function 'pac193x_match_acpi_device':
>> drivers/iio/adc/pac193x.c:1469:57: warning: '<<' in boolean context, did you mean '<'? [-Wint-in-bool-context]
1469 | chip_info->bi_dir[0] = (bi_dir_mask & (1 << 1)) << 1;
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/iio/adc/pac193x.c:1470:57: warning: '<<' in boolean context, did you mean '<'? [-Wint-in-bool-context]
1470 | chip_info->bi_dir[0] = (bi_dir_mask & (1 << 2)) << 2;
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/iio/adc/pac193x.c:1471:57: warning: '<<' in boolean context, did you mean '<'? [-Wint-in-bool-context]
1471 | chip_info->bi_dir[0] = (bi_dir_mask & (1 << 3)) << 3;
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~


vim +1469 drivers/iio/adc/pac193x.c

1411
1412 static const char *pac193x_match_acpi_device(struct i2c_client *client,
1413 struct pac193x_chip_info *chip_info)
1414 {
1415 char *name;
1416 acpi_handle handle;
1417 union acpi_object *rez;
1418 unsigned short bi_dir_mask;
1419 int idx, i;
1420
1421 handle = ACPI_HANDLE(&client->dev);
1422 name = pac193x_acpi_get_acpi_match_entry(handle);
1423 if (!name)
1424 return NULL;
1425
1426 rez = pac193x_acpi_eval_function(handle, 0, PAC193X_ACPI_GET_NAMES_AND_MOHMS_VALS);
1427
1428 if (!rez)
1429 return NULL;
1430
1431 for (i = 0; i < rez->package.count; i += 2) {
1432 idx = i / 2;
1433 chip_info->channel_names[idx] =
1434 devm_kmemdup(&client->dev, rez->package.elements[i].string.pointer,
1435 (size_t)rez->package.elements[i].string.length + 1,
1436 GFP_KERNEL);
1437 chip_info->channel_names[idx][rez->package.elements[i].string.length] = '\0';
1438 chip_info->shunts[idx] =
1439 rez->package.elements[i + 1].integer.value * 1000;
1440 chip_info->active_channels[idx] = (chip_info->shunts[idx] != 0);
1441 }
1442
1443 kfree(rez);
1444
1445 rez = pac193x_acpi_eval_function(handle, 1, PAC193X_ACPI_GET_UOHMS_VALS);
1446 if (!rez) {
1447 /*
1448 * initialising with default values
1449 * we assume all channels are unidectional(the mask is zero)
1450 * and assign the default sampling rate
1451 */
1452 chip_info->sample_rate_value = PAC193X_DEFAULT_CHIP_SAMP_SPEED;
1453 return name;
1454 }
1455
1456 for (i = 0; i < rez->package.count; i++) {
1457 idx = i;
1458 chip_info->shunts[idx] = rez->package.elements[i].integer.value;
1459 chip_info->active_channels[idx] = (chip_info->shunts[idx] != 0);
1460 }
1461
1462 kfree(rez);
1463
1464 rez = pac193x_acpi_eval_function(handle, 1, PAC193X_ACPI_GET_BIPOLAR_SETTINGS);
1465 if (!rez)
1466 return NULL;
1467 bi_dir_mask = rez->package.elements[0].integer.value;
1468 chip_info->bi_dir[0] = (bi_dir_mask & (1 << 0)) << 0;
> 1469 chip_info->bi_dir[0] = (bi_dir_mask & (1 << 1)) << 1;
1470 chip_info->bi_dir[0] = (bi_dir_mask & (1 << 2)) << 2;
1471 chip_info->bi_dir[0] = (bi_dir_mask & (1 << 3)) << 3;
1472 kfree(rez);
1473
1474 rez = pac193x_acpi_eval_function(handle, 1, PAC193X_ACPI_GET_SAMP);
1475 if (!rez)
1476 return NULL;
1477
1478 chip_info->sample_rate_value = rez->package.elements[0].integer.value;
1479 kfree(rez);
1480
1481 return name;
1482 }
1483

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