Subject: Re: [PATCH v2 6/7] hwmon: Add Nuvoton NCT6694 HWMON support

From: kernel test robot <[email-masked]>
Date: Fri, 22 Nov 2024 19:51:44 +0800

Hi Ming,

kernel test robot noticed the following build errors:

[auto build test ERROR on andi-shyti/i2c/i2c-host]
[also build test ERROR on mkl-can-next/testing groeck-staging/hwmon-next abelloni/rtc-next linus/master lee-mfd/for-mfd-fixes v6.12 next-20241121]
[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/Ming-Yu/mfd-Add-core-driver-for-Nuvoton-NCT6694/20241121-155723
base:   https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git i2c/i2c-host
patch link:    https://lore.kernel.org/r/20241121064046.3724726-7-tmyu0%40nuvoton.com
patch subject: [PATCH v2 6/7] hwmon: Add Nuvoton NCT6694 HWMON support
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20241122/[email-masked]/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241122/[email-masked]/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 <[email-masked]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email-masked]/

All errors (new ones prefixed by >>):

>> drivers/hwmon/nct6694-hwmon.c:263:15: error: call to undeclared function 'FIELD_GET'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     263 |                 frac_part = FIELD_GET(NCT6694_LSB_REG_MASK, data->xmit_buf[1]);
         |                             ^
>> drivers/hwmon/nct6694-hwmon.c:508:10: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     508 |                        FIELD_PREP(NCT6694_TIN_HYST_MASK, temp_hyst);
         |                        ^
   2 errors generated.

vim +/FIELD_GET +263 drivers/hwmon/nct6694-hwmon.c

   238	
   239	static int nct6694_temp_read(struct device *dev, u32 attr, int channel,
   240				     long *val)
   241	{
   242		struct nct6694_hwmon_data *data = dev_get_drvdata(dev);
   243		unsigned char temp_en, temp_hyst;
   244		int ret, int_part, frac_part;
   245		signed char temp_max;
   246	
   247		guard(mutex)(&data->lock);
   248	
   249		switch (attr) {
   250		case hwmon_temp_enable:
   251			temp_en = data->hwmon_en[NCT6694_TIN_EN(channel / 8)];
   252			*val = temp_en & BIT(channel % 8) ? 1 : 0;
   253	
   254			return 0;
   255		case hwmon_temp_input:
   256			ret = nct6694_read_msg(data->nct6694, NCT6694_RPT_MOD,
   257					       NCT6694_TIN_IDX(channel), 2,
   258					       data->xmit_buf);
   259			if (ret)
   260				return ret;
   261	
   262			int_part = sign_extend32(data->xmit_buf[0], 7);
 > 263			frac_part = FIELD_GET(NCT6694_LSB_REG_MASK, data->xmit_buf[1]);
   264			if (int_part < 0)
   265				*val = (int_part + 1) * 1000 - (8 - frac_part) * 125;
   266			else
   267				*val = int_part * 1000 + frac_part * 125;
   268	
   269			return 0;
   270		case hwmon_temp_max:
   271			ret = nct6694_read_msg(data->nct6694, NCT6694_HWMON_MOD,
   272					       NCT6694_HWMON_CMD2_OFFSET,
   273					       NCT6694_HWMON_CMD2_LEN,
   274					       data->xmit_buf);
   275			if (ret)
   276				return ret;
   277	
   278			*val = temp_from_reg(data->xmit_buf[NCT6694_TIN_HL(channel)]);
   279	
   280			return 0;
   281		case hwmon_temp_max_hyst:
   282			ret = nct6694_read_msg(data->nct6694, NCT6694_HWMON_MOD,
   283					       NCT6694_HWMON_CMD2_OFFSET,
   284					       NCT6694_HWMON_CMD2_LEN,
   285					       data->xmit_buf);
   286			if (ret)
   287				return ret;
   288	
   289			temp_max = (signed char)data->xmit_buf[NCT6694_TIN_HL(channel)];
   290			temp_hyst = FIELD_GET(NCT6694_TIN_HYST_MASK,
   291					      data->xmit_buf[NCT6694_TIN_HYST(channel)]);
   292			if (temp_max < 0)
   293				*val = temp_from_reg(temp_max + temp_hyst);
   294			else
   295				*val = temp_from_reg(temp_max - temp_hyst);
   296	
   297			return 0;
   298		case hwmon_temp_max_alarm:
   299			ret = nct6694_read_msg(data->nct6694, NCT6694_RPT_MOD,
   300					       NCT6694_TIN_STS(channel / 8), 1,
   301						   data->xmit_buf);
   302			if (ret)
   303				return ret;
   304	
   305			*val = !!(data->xmit_buf[0] & BIT(channel % 8));
   306	
   307			return 0;
   308		default:
   309			return -EOPNOTSUPP;
   310		}
   311	}
   312	

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