Re: [PATCH] rtc: abx80x: Add nvmem support

From: Sean Anderson
Date: Mon Dec 05 2022 - 10:14:56 EST


On 12/3/22 03:45, kernel test robot wrote:
> Hi Sean,
>
> I love your patch! Yet something to improve:
>
> [auto build test ERROR on v6.1-rc7]
> [also build test ERROR on linus/master]
> [cannot apply to abelloni/rtc-next next-20221202]
> [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/Sean-Anderson/rtc-abx80x-Add-nvmem-support/20221202-070301
> patch link: https://lore.kernel.org/r/20221201230208.713118-1-sean.anderson%40seco.com
> patch subject: [PATCH] rtc: abx80x: Add nvmem support
> config: x86_64-randconfig-a014
> compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
> 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/6dbbdf7eef71cb4255c6751bc9762cf02a0f53b6
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Sean-Anderson/rtc-abx80x-Add-nvmem-support/20221202-070301
> git checkout 6dbbdf7eef71cb4255c6751bc9762cf02a0f53b6
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All errors (new ones prefixed by >>):
>
>>> drivers/rtc/rtc-abx80x.c:695:11: error: implicit declaration of function 'FIELD_GET' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
> lower = FIELD_GET(NVMEM_ADDR_LOWER, offset);
> ^
>>> drivers/rtc/rtc-abx80x.c:697:12: error: implicit declaration of function 'FIELD_PREP' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
> extram = FIELD_PREP(ABX8XX_EXTRAM_XADS, upper);
> ^
> drivers/rtc/rtc-abx80x.c:697:12: note: did you mean 'FIELD_GET'?
> drivers/rtc/rtc-abx80x.c:695:11: note: 'FIELD_GET' declared here
> lower = FIELD_GET(NVMEM_ADDR_LOWER, offset);
> ^
> 2 errors generated.
>
>
> vim +/FIELD_GET +695 drivers/rtc/rtc-abx80x.c
>
> 685
> 686 #ifdef CONFIG_NVMEM
> 687 static int abx80x_nvmem_xfer(struct abx80x_priv *priv, unsigned int offset,
> 688 void *val, size_t bytes, bool write)
> 689 {
> 690 int ret;
> 691
> 692 while (bytes) {
> 693 u8 extram, reg, len, lower, upper;
> 694
> > 695 lower = FIELD_GET(NVMEM_ADDR_LOWER, offset);
> 696 upper = FIELD_GET(NVMEM_ADDR_UPPER, offset);
> > 697 extram = FIELD_PREP(ABX8XX_EXTRAM_XADS, upper);
> 698 reg = ABX8XX_SRAM_BASE + lower;
> 699 len = min(lower + bytes, (size_t)ABX8XX_SRAM_WIN_SIZE) - lower;
> 700 len = min_t(u8, len, I2C_SMBUS_BLOCK_MAX);
> 701
> 702 ret = i2c_smbus_write_byte_data(priv->client, ABX8XX_REG_EXTRAM,
> 703 extram);
> 704 if (ret)
> 705 return ret;
> 706
> 707 if (write)
> 708 ret = i2c_smbus_write_i2c_block_data(priv->client, reg,
> 709 len, val);
> 710 else
> 711 ret = i2c_smbus_read_i2c_block_data(priv->client, reg,
> 712 len, val);
> 713 if (ret)
> 714 return ret;
> 715
> 716 offset += len;
> 717 val += len;
> 718 bytes -= len;
> 719 }
> 720
> 721 return 0;
> 722 }
> 723
>

Ah, the ARM64 bitfield inclusion strikes again...

--Sean