Re: [PATCH 3/3] hwmon: (pmbus/tps25990): add initial support

From: kernel test robot
Date: Tue Sep 10 2024 - 06:36:48 EST


Hi Jerome,

kernel test robot noticed the following build errors:

[auto build test ERROR on d22bd451d5606411895ef55cb105277e4f4f6e54]

url: https://github.com/intel-lab-lkp/linux/commits/Jerome-Brunet/dt-bindings-hwmon-pmbus-add-ti-tps25990-documentation/20240909-234152
base: d22bd451d5606411895ef55cb105277e4f4f6e54
patch link: https://lore.kernel.org/r/20240909-tps25990-v1-3-39b37e43e795%40baylibre.com
patch subject: [PATCH 3/3] hwmon: (pmbus/tps25990): add initial support
config: hexagon-allyesconfig (https://download.01.org/0day-ci/archive/20240910/202409101807.GjHADcvQ-lkp@xxxxxxxxx/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 05f5a91d00b02f4369f46d076411c700755ae041)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240910/202409101807.GjHADcvQ-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/202409101807.GjHADcvQ-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

In file included from drivers/hwmon/pmbus/tps25990.c:9:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:25:
In file included from include/linux/kernel_stat.h:8:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:14:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
548 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
561 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
| ^
In file included from drivers/hwmon/pmbus/tps25990.c:9:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:25:
In file included from include/linux/kernel_stat.h:8:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:14:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
574 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
In file included from drivers/hwmon/pmbus/tps25990.c:9:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:25:
In file included from include/linux/kernel_stat.h:8:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:14:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
585 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
In file included from drivers/hwmon/pmbus/tps25990.c:9:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:21:
In file included from include/linux/mm.h:2228:
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_"
| ~~~~~~~~~~~ ^ ~~~
>> drivers/hwmon/pmbus/tps25990.c:267:9: error: call to undeclared function 'FIELD_GET'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
267 | ret = FIELD_GET(PK_MIN_AVG_AVG_CNT, ret);
| ^
>> drivers/hwmon/pmbus/tps25990.c:337:11: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
337 | FIELD_PREP(PK_MIN_AVG_AVG_CNT, value));
| ^
7 warnings and 2 errors generated.


vim +/FIELD_GET +267 drivers/hwmon/pmbus/tps25990.c

254
255 static int tps25990_read_word(struct i2c_client *client,
256 int page, int phase, int reg)
257 {
258 int ret, addr;
259
260 addr = tps25990_get_addr(reg);
261 if (addr < 0)
262 return addr;
263
264 switch (reg) {
265 case PMBUS_VIRT_SAMPLES:
266 ret = pmbus_read_byte_data(client, page, addr);
> 267 ret = FIELD_GET(PK_MIN_AVG_AVG_CNT, ret);
268 break;
269
270 case PMBUS_IIN_OC_FAULT_LIMIT:
271 ret = pmbus_read_byte_data(client, page, addr);
272 break;
273
274 default:
275 ret = pmbus_read_word_data(client, page, -1, addr);
276 break;
277 }
278
279 if (ret >= 0)
280 ret = tps25990_read_adapt_value(reg, ret);
281
282 return ret;
283 }
284
285 static int tps25990_write_adapt_value(int reg, int val)
286 {
287 switch (reg) {
288 case PMBUS_VIN_UV_WARN_LIMIT:
289 case PMBUS_VIN_UV_FAULT_LIMIT:
290 case PMBUS_VIN_OV_WARN_LIMIT:
291 case PMBUS_VOUT_UV_WARN_LIMIT:
292 case PMBUS_IIN_OC_WARN_LIMIT:
293 case PMBUS_OT_WARN_LIMIT:
294 case PMBUS_OT_FAULT_LIMIT:
295 case PMBUS_PIN_OP_WARN_LIMIT:
296 case PMBUS_POWER_GOOD_OFF:
297 val >>= TPS25990_8B_SHIFT;
298 val = clamp(val, 0, 0xff);
299 break;
300
301 case PMBUS_VIN_OV_FAULT_LIMIT:
302 val -= TPS25990_VIN_OVF_OFF;
303 val = DIV_ROUND_CLOSEST(val * TPS25990_VIN_OVF_DIV, TPS25990_VIN_OVF_NUM);
304 val = clamp_val(val, 0, 0xf);
305 break;
306
307 case PMBUS_IIN_OC_FAULT_LIMIT:
308 val -= TPS25990_IIN_OCF_OFF;
309 val = DIV_ROUND_CLOSEST(val * TPS25990_IIN_OCF_DIV, TPS25990_IIN_OCF_NUM);
310 val = clamp_val(val, 0, 0x3f);
311 break;
312
313 case PMBUS_VIRT_SAMPLES:
314 val = clamp_val(val, 1, 1 << PK_MIN_AVG_AVG_CNT);
315 val = ilog2(val);
316 break;
317 }
318
319 return val;
320 }
321
322 static int tps25990_write_word(struct i2c_client *client,
323 int page, int reg, u16 value)
324 {
325 int addr, ret;
326
327 addr = tps25990_get_addr(reg);
328 if (addr < 0)
329 return addr;
330
331 value = tps25990_write_adapt_value(reg, value);
332
333 switch (reg) {
334 case PMBUS_VIRT_SAMPLES:
335 ret = pmbus_update_byte_data(client, page, addr,
336 PK_MIN_AVG_AVG_CNT,
> 337 FIELD_PREP(PK_MIN_AVG_AVG_CNT, value));
338 break;
339
340 case PMBUS_IIN_OC_FAULT_LIMIT:
341 ret = pmbus_write_byte_data(client, page, addr,
342 value);
343 break;
344
345 default:
346 ret = pmbus_write_word_data(client, page, addr, value);
347 break;
348 }
349
350 return ret;
351 }
352

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