[asahilinux:bits/070-audio 13/15] drivers/clk/clk-apple-nco.c:139:16: error: implicit declaration of function 'FIELD_PREP'

From: kernel test robot
Date: Wed Mar 09 2022 - 06:15:14 EST


tree: https://github.com/AsahiLinux/linux bits/070-audio
head: 1d99a1536d2dd3a0727f8cb942549073f0b3f055
commit: 1bf217d927e0f44f6f66173636f037e43acd065a [13/15] fixup! clk: clk-apple-nco: Add driver for Apple NCO
config: arc-buildonly-randconfig-r005-20220307 (https://download.01.org/0day-ci/archive/20220309/202203091915.aH27LZEz-lkp@xxxxxxxxx/config)
compiler: arceb-elf-gcc (GCC) 11.2.0
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/AsahiLinux/linux/commit/1bf217d927e0f44f6f66173636f037e43acd065a
git remote add asahilinux https://github.com/AsahiLinux/linux
git fetch --no-tags asahilinux bits/070-audio
git checkout 1bf217d927e0f44f6f66173636f037e43acd065a
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash drivers/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

drivers/clk/clk-apple-nco.c: In function 'applnco_div_translate':
>> drivers/clk/clk-apple-nco.c:139:16: error: implicit declaration of function 'FIELD_PREP' [-Werror=implicit-function-declaration]
139 | return FIELD_PREP(DIV_COARSE, tbl->fwd[coarse - COARSE_DIV_OFFSET]) |
| ^~~~~~~~~~
drivers/clk/clk-apple-nco.c: In function 'applnco_div_translate_inv':
>> drivers/clk/clk-apple-nco.c:147:27: error: implicit declaration of function 'FIELD_GET' [-Werror=implicit-function-declaration]
147 | coarse = tbl->inv[FIELD_GET(DIV_COARSE, regval)] + COARSE_DIV_OFFSET;
| ^~~~~~~~~
drivers/clk/clk-apple-nco.c: At top level:
drivers/clk/clk-apple-nco.c:322:1: error: expected ',' or ';' before 'static'
322 | static struct platform_driver applnco_driver = {
| ^~~~~~
In file included from drivers/clk/clk-apple-nco.c:16:
drivers/clk/clk-apple-nco.c: In function 'applnco_driver_init':
drivers/clk/clk-apple-nco.c:329:24: error: 'applnco_driver' undeclared (first use in this function); did you mean 'applnco_probe'?
329 | module_platform_driver(applnco_driver);
| ^~~~~~~~~~~~~~
include/linux/platform_device.h:222:36: note: in definition of macro 'platform_driver_register'
222 | __platform_driver_register(drv, THIS_MODULE)
| ^~~
include/linux/platform_device.h:252:9: note: in expansion of macro 'module_driver'
252 | module_driver(__platform_driver, platform_driver_register, \
| ^~~~~~~~~~~~~
drivers/clk/clk-apple-nco.c:329:1: note: in expansion of macro 'module_platform_driver'
329 | module_platform_driver(applnco_driver);
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/clk/clk-apple-nco.c:329:24: note: each undeclared identifier is reported only once for each function it appears in
329 | module_platform_driver(applnco_driver);
| ^~~~~~~~~~~~~~
include/linux/platform_device.h:222:36: note: in definition of macro 'platform_driver_register'
222 | __platform_driver_register(drv, THIS_MODULE)
| ^~~
include/linux/platform_device.h:252:9: note: in expansion of macro 'module_driver'
252 | module_driver(__platform_driver, platform_driver_register, \
| ^~~~~~~~~~~~~
drivers/clk/clk-apple-nco.c:329:1: note: in expansion of macro 'module_platform_driver'
329 | module_platform_driver(applnco_driver);
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/device.h:32,
from include/linux/platform_device.h:13,
from drivers/clk/clk-apple-nco.c:16:
drivers/clk/clk-apple-nco.c: In function 'applnco_driver_exit':
drivers/clk/clk-apple-nco.c:329:24: error: 'applnco_driver' undeclared (first use in this function); did you mean 'applnco_probe'?
329 | module_platform_driver(applnco_driver);
| ^~~~~~~~~~~~~~
include/linux/device/driver.h:267:24: note: in definition of macro 'module_driver'
267 | __unregister(&(__driver) , ##__VA_ARGS__); \
| ^~~~~~~~
drivers/clk/clk-apple-nco.c:329:1: note: in expansion of macro 'module_platform_driver'
329 | module_platform_driver(applnco_driver);
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/clk/clk-apple-nco.c: In function 'applnco_driver_init':
include/linux/device/driver.h:263:1: error: control reaches end of non-void function [-Werror=return-type]
263 | } \
| ^
include/linux/platform_device.h:252:9: note: in expansion of macro 'module_driver'
252 | module_driver(__platform_driver, platform_driver_register, \
| ^~~~~~~~~~~~~
drivers/clk/clk-apple-nco.c:329:1: note: in expansion of macro 'module_platform_driver'
329 | module_platform_driver(applnco_driver);
| ^~~~~~~~~~~~~~~~~~~~~~
At top level:
drivers/clk/clk-apple-nco.c:254:12: warning: 'applnco_probe' defined but not used [-Wunused-function]
254 | static int applnco_probe(struct platform_device *pdev)
| ^~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +/FIELD_PREP +139 drivers/clk/clk-apple-nco.c

4affca42511f75 Martin Povišer 2022-02-08 131
4affca42511f75 Martin Povišer 2022-02-08 132 static u32 applnco_div_translate(struct applnco_tables *tbl, unsigned int div)
4affca42511f75 Martin Povišer 2022-02-08 133 {
4affca42511f75 Martin Povišer 2022-02-08 134 unsigned int coarse = div / 4;
4affca42511f75 Martin Povišer 2022-02-08 135
4affca42511f75 Martin Povišer 2022-02-08 136 if (WARN_ON(applnco_div_out_of_range(div)))
4affca42511f75 Martin Povišer 2022-02-08 137 return 0;
4affca42511f75 Martin Povišer 2022-02-08 138
4affca42511f75 Martin Povišer 2022-02-08 @139 return FIELD_PREP(DIV_COARSE, tbl->fwd[coarse - COARSE_DIV_OFFSET]) |
4affca42511f75 Martin Povišer 2022-02-08 140 FIELD_PREP(DIV_FINE, div % 4);
4affca42511f75 Martin Povišer 2022-02-08 141 }
4affca42511f75 Martin Povišer 2022-02-08 142
4affca42511f75 Martin Povišer 2022-02-08 143 static unsigned int applnco_div_translate_inv(struct applnco_tables *tbl, u32 regval)
4affca42511f75 Martin Povišer 2022-02-08 144 {
4affca42511f75 Martin Povišer 2022-02-08 145 unsigned int coarse, fine;
4affca42511f75 Martin Povišer 2022-02-08 146
4affca42511f75 Martin Povišer 2022-02-08 @147 coarse = tbl->inv[FIELD_GET(DIV_COARSE, regval)] + COARSE_DIV_OFFSET;
4affca42511f75 Martin Povišer 2022-02-08 148 fine = FIELD_GET(DIV_FINE, regval);
4affca42511f75 Martin Povišer 2022-02-08 149
4affca42511f75 Martin Povišer 2022-02-08 150 return coarse * 4 + fine;
4affca42511f75 Martin Povišer 2022-02-08 151 }
4affca42511f75 Martin Povišer 2022-02-08 152

:::::: The code at line 139 was first introduced by commit
:::::: 4affca42511f7532ad7ce1a4b880e54d612f2d94 clk: clk-apple-nco: Add driver for Apple NCO

:::::: TO: Martin Povišer <povik+lin@xxxxxxxxxxx>
:::::: CC: Hector Martin <marcan@xxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx