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

From: kernel test robot
Date: Tue Sep 10 2024 - 04:13:05 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: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20240910/202409101522.ZoP360wM-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240910/202409101522.ZoP360wM-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/202409101522.ZoP360wM-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

drivers/hwmon/pmbus/tps25990.c: In function 'tps25990_read_word':
>> drivers/hwmon/pmbus/tps25990.c:267:23: error: implicit declaration of function 'FIELD_GET' [-Wimplicit-function-declaration]
267 | ret = FIELD_GET(PK_MIN_AVG_AVG_CNT, ret);
| ^~~~~~~~~
drivers/hwmon/pmbus/tps25990.c: In function 'tps25990_write_word':
>> drivers/hwmon/pmbus/tps25990.c:337:46: error: implicit declaration of function 'FIELD_PREP' [-Wimplicit-function-declaration]
337 | FIELD_PREP(PK_MIN_AVG_AVG_CNT, value));
| ^~~~~~~~~~


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