Re: [PATCH v4 2/2] iio: humidity: Add support for ENS210

From: kernel test robot
Date: Sat Jul 20 2024 - 05:20:21 EST


Hi Joshua,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 1ebab783647a9e3bf357002d5c4ff060c8474a0a]

url: https://github.com/intel-lab-lkp/linux/commits/Joshua-Felmeden/dt-bindings-iio-humidity-add-ENS210-sensor-family/20240719-210648
base: 1ebab783647a9e3bf357002d5c4ff060c8474a0a
patch link: https://lore.kernel.org/r/20240719-ens21x-v4-2-6044e48a376a%40thegoodpenguin.co.uk
patch subject: [PATCH v4 2/2] iio: humidity: Add support for ENS210
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20240720/202407201602.KrJ889wu-lkp@xxxxxxxxx/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project ad154281230d83ee551e12d5be48bb956ef47ed3)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240720/202407201602.KrJ889wu-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407201602.KrJ889wu-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from drivers/iio/humidity/ens210.c:19:
In file included from include/linux/i2c.h:13:
In file included from include/linux/acpi.h:14:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:19:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:173:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:2258:
include/linux/vmstat.h:500:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
500 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
501 | item];
| ~~~~
include/linux/vmstat.h:507:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
507 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
508 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
514 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:519:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
519 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
520 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:528:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
528 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
529 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/iio/humidity/ens210.c:252:4: warning: format specifies type 'unsigned long' but the argument has underlying type 'unsigned int' [-Wformat]
251 | "Part ID does not match (0x%04x != 0x%04lx)\n", part_id,
| ~~~~~
| %04x
252 | data->chip_info->part_id);
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:160:67: note: expanded from macro 'dev_info'
160 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ~~~ ^~~~~~~~~~~
drivers/iio/humidity/ens210.c:200:30: warning: unused variable 'id' [-Wunused-variable]
200 | const struct i2c_device_id *id = i2c_client_get_device_id(client);
| ^~
7 warnings generated.


vim +252 drivers/iio/humidity/ens210.c

197
198 static int ens210_probe(struct i2c_client *client)
199 {
200 const struct i2c_device_id *id = i2c_client_get_device_id(client);
201 struct ens210_data *data;
202 struct iio_dev *indio_dev;
203 uint16_t part_id;
204 int ret;
205
206 if (!i2c_check_functionality(client->adapter,
207 I2C_FUNC_SMBUS_WRITE_BYTE_DATA |
208 I2C_FUNC_SMBUS_WRITE_BYTE |
209 I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
210 dev_err_probe(&client->dev, -EOPNOTSUPP,
211 "adapter does not support some i2c transactions\n");
212 return -EOPNOTSUPP;
213 }
214
215 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
216 if (!indio_dev)
217 return -ENOMEM;
218
219 data = iio_priv(indio_dev);
220 i2c_set_clientdata(client, indio_dev);
221 data->client = client;
222 mutex_init(&data->lock);
223 data->chip_info = i2c_get_match_data(client);
224
225 ret = devm_regulator_get_enable(&client->dev, "vdd");
226 if (ret)
227 return ret;
228
229 /* reset device */
230 ret = i2c_smbus_write_byte_data(client, ENS210_REG_SYS_CTRL,
231 ENS210_SYS_CTRL_SYS_RESET);
232 if (ret)
233 return ret;
234
235 /* wait for device to become active */
236 usleep_range(4000, 5000);
237
238 /* disable low power mode */
239 ret = i2c_smbus_write_byte_data(client, ENS210_REG_SYS_CTRL, 0x00);
240 if (ret)
241 return ret;
242
243 /* wait for device to finish */
244 usleep_range(4000, 5000);
245
246 /* get part_id */
247 part_id = i2c_smbus_read_word_data(client, ENS210_REG_PART_ID);
248
249 if (part_id != data->chip_info->part_id) {
250 dev_info(&client->dev,
251 "Part ID does not match (0x%04x != 0x%04lx)\n", part_id,
> 252 data->chip_info->part_id);
253 }
254
255 /* reenable low power */
256 ret = i2c_smbus_write_byte_data(client, ENS210_REG_SYS_CTRL,
257 ENS210_SYS_CTRL_LOW_POWER_ENABLE);
258 if (ret)
259 return ret;
260
261 indio_dev->name = data->chip_info->name;
262 indio_dev->modes = INDIO_DIRECT_MODE;
263 indio_dev->channels = ens210_channels;
264 indio_dev->num_channels = ARRAY_SIZE(ens210_channels);
265 indio_dev->info = &ens210_info;
266
267 return devm_iio_device_register(&client->dev, indio_dev);
268 }
269

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