[ammarfaizi2-block:axboe/linux-block/m1-test 343/385] drivers/platform/apple/smc_rtkit.c:73:9: error: implicit declaration of function 'FIELD_PREP'

From: kernel test robot
Date: Thu Feb 17 2022 - 03:08:16 EST


tree: https://github.com/ammarfaizi2/linux-block axboe/linux-block/m1-test
head: e226b395bc2d49a6a1411765875e0864c9a0e0da
commit: 63615eb2a0f68ad3d05cf48ccf0771dd613e1f44 [343/385] platform/apple: Add new Apple Mac SMC driver
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20220217/202202171656.Usxovuzb-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0bad7cb56526f2572c74449fcf97c1fcda42b41d)
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/ammarfaizi2/linux-block/commit/63615eb2a0f68ad3d05cf48ccf0771dd613e1f44
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block axboe/linux-block/m1-test
git checkout 63615eb2a0f68ad3d05cf48ccf0771dd613e1f44
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/platform/apple/

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

All error/warnings (new ones prefixed by >>):

>> drivers/platform/apple/smc_rtkit.c:73:9: error: implicit declaration of function 'FIELD_PREP' [-Werror,-Wimplicit-function-declaration]
msg = (FIELD_PREP(SMC_MSG, SMC_MSG_WRITE_KEY) |
^
>> drivers/platform/apple/smc_rtkit.c:93:6: error: implicit declaration of function 'FIELD_GET' [-Werror,-Wimplicit-function-declaration]
if (FIELD_GET(SMC_ID, smc->cmd_ret) != smc->msg_id) {
^
drivers/platform/apple/smc_rtkit.c:93:6: note: did you mean 'FIELD_PREP'?
drivers/platform/apple/smc_rtkit.c:73:9: note: 'FIELD_PREP' declared here
msg = (FIELD_PREP(SMC_MSG, SMC_MSG_WRITE_KEY) |
^
>> drivers/platform/apple/smc_rtkit.c:76:20: warning: shift count >= width of type [-Wshift-count-overflow]
FIELD_PREP(SMC_DATA, key));
^~~~~~~~
drivers/platform/apple/smc_rtkit.c:29:20: note: expanded from macro 'SMC_DATA'
#define SMC_DATA GENMASK(63, 32)
^~~~~~~~~~~~~~~
include/linux/bits.h:38:31: note: expanded from macro 'GENMASK'
(GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
^~~~~~~~~~~~~~~
include/linux/bits.h:35:22: note: expanded from macro '__GENMASK'
(((~UL(0)) - (UL(1) << (l)) + 1) & \
^ ~~~
>> drivers/platform/apple/smc_rtkit.c:76:20: warning: shift count is negative [-Wshift-count-negative]
FIELD_PREP(SMC_DATA, key));
^~~~~~~~
drivers/platform/apple/smc_rtkit.c:29:20: note: expanded from macro 'SMC_DATA'
#define SMC_DATA GENMASK(63, 32)
^~~~~~~~~~~~~~~
include/linux/bits.h:38:31: note: expanded from macro 'GENMASK'
(GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
^~~~~~~~~~~~~~~
include/linux/bits.h:36:11: note: expanded from macro '__GENMASK'
(~UL(0) >> (BITS_PER_LONG - 1 - (h))))
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/apple/smc_rtkit.c:119:9: error: implicit declaration of function 'FIELD_PREP' [-Werror,-Wimplicit-function-declaration]
msg = (FIELD_PREP(SMC_MSG, cmd) |
^
drivers/platform/apple/smc_rtkit.c:136:7: error: implicit declaration of function 'FIELD_GET' [-Werror,-Wimplicit-function-declaration]
if (FIELD_GET(SMC_ID, smc->cmd_ret) == smc->msg_id)
^
drivers/platform/apple/smc_rtkit.c:142:11: error: implicit declaration of function 'FIELD_GET' [-Werror,-Wimplicit-function-declaration]
result = FIELD_GET(SMC_RESULT, smc->cmd_ret);
^
drivers/platform/apple/smc_rtkit.c:123:20: warning: shift count >= width of type [-Wshift-count-overflow]
FIELD_PREP(SMC_DATA, arg));
^~~~~~~~
drivers/platform/apple/smc_rtkit.c:29:20: note: expanded from macro 'SMC_DATA'
#define SMC_DATA GENMASK(63, 32)
^~~~~~~~~~~~~~~
include/linux/bits.h:38:31: note: expanded from macro 'GENMASK'
(GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
^~~~~~~~~~~~~~~
include/linux/bits.h:35:22: note: expanded from macro '__GENMASK'
(((~UL(0)) - (UL(1) << (l)) + 1) & \
^ ~~~
drivers/platform/apple/smc_rtkit.c:123:20: warning: shift count is negative [-Wshift-count-negative]
FIELD_PREP(SMC_DATA, arg));
^~~~~~~~
drivers/platform/apple/smc_rtkit.c:29:20: note: expanded from macro 'SMC_DATA'
#define SMC_DATA GENMASK(63, 32)
^~~~~~~~~~~~~~~
include/linux/bits.h:38:31: note: expanded from macro 'GENMASK'
(GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
^~~~~~~~~~~~~~~
include/linux/bits.h:36:11: note: expanded from macro '__GENMASK'
(~UL(0) >> (BITS_PER_LONG - 1 - (h))))
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/apple/smc_rtkit.c:147:25: warning: shift count >= width of type [-Wshift-count-overflow]
*ret_data = FIELD_GET(SMC_DATA, smc->cmd_ret);
^~~~~~~~
drivers/platform/apple/smc_rtkit.c:29:20: note: expanded from macro 'SMC_DATA'
#define SMC_DATA GENMASK(63, 32)
^~~~~~~~~~~~~~~
include/linux/bits.h:38:31: note: expanded from macro 'GENMASK'
(GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
^~~~~~~~~~~~~~~
include/linux/bits.h:35:22: note: expanded from macro '__GENMASK'
(((~UL(0)) - (UL(1) << (l)) + 1) & \
^ ~~~
drivers/platform/apple/smc_rtkit.c:147:25: warning: shift count is negative [-Wshift-count-negative]
*ret_data = FIELD_GET(SMC_DATA, smc->cmd_ret);
^~~~~~~~
drivers/platform/apple/smc_rtkit.c:29:20: note: expanded from macro 'SMC_DATA'
#define SMC_DATA GENMASK(63, 32)
^~~~~~~~~~~~~~~
include/linux/bits.h:38:31: note: expanded from macro 'GENMASK'
(GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
^~~~~~~~~~~~~~~
include/linux/bits.h:36:11: note: expanded from macro '__GENMASK'
(~UL(0) >> (BITS_PER_LONG - 1 - (h))))
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/apple/smc_rtkit.c:298:13: error: implicit declaration of function 'FIELD_GET' [-Werror,-Wimplicit-function-declaration]
} else if (FIELD_GET(SMC_MSG, message) == SMC_MSG_NOTIFICATION) {
^
drivers/platform/apple/smc_rtkit.c:322:6: error: implicit declaration of function 'FIELD_GET' [-Werror,-Wimplicit-function-declaration]
if (FIELD_GET(SMC_MSG, message) != SMC_MSG_NOTIFICATION) {
^
drivers/platform/apple/smc_rtkit.c:327:48: warning: shift count >= width of type [-Wshift-count-overflow]
apple_smc_event_received(smc->core, FIELD_GET(SMC_DATA, message));
^~~~~~~~
drivers/platform/apple/smc_rtkit.c:29:20: note: expanded from macro 'SMC_DATA'
#define SMC_DATA GENMASK(63, 32)
^~~~~~~~~~~~~~~
include/linux/bits.h:38:31: note: expanded from macro 'GENMASK'
(GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
^~~~~~~~~~~~~~~
include/linux/bits.h:35:22: note: expanded from macro '__GENMASK'
(((~UL(0)) - (UL(1) << (l)) + 1) & \
^ ~~~
drivers/platform/apple/smc_rtkit.c:327:48: warning: shift count is negative [-Wshift-count-negative]
apple_smc_event_received(smc->core, FIELD_GET(SMC_DATA, message));
^~~~~~~~
drivers/platform/apple/smc_rtkit.c:29:20: note: expanded from macro 'SMC_DATA'
#define SMC_DATA GENMASK(63, 32)
^~~~~~~~~~~~~~~
include/linux/bits.h:38:31: note: expanded from macro 'GENMASK'
(GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
^~~~~~~~~~~~~~~
include/linux/bits.h:36:11: note: expanded from macro '__GENMASK'
(~UL(0) >> (BITS_PER_LONG - 1 - (h))))
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/apple/smc_rtkit.c:381:12: error: implicit declaration of function 'FIELD_PREP' [-Werror,-Wimplicit-function-declaration]
FIELD_PREP(SMC_MSG, SMC_MSG_INITIALIZE));
^
>> drivers/platform/apple/smc_rtkit.c:429:25: error: use of undeclared identifier 'apple_smc_of_match'; did you mean 'apple_smc_rtkit_of_match'?
MODULE_DEVICE_TABLE(of, apple_smc_of_match);
^~~~~~~~~~~~~~~~~~
apple_smc_rtkit_of_match
include/linux/module.h:244:15: note: expanded from macro 'MODULE_DEVICE_TABLE'
extern typeof(name) __mod_##type##__##name##_device_table \
^
drivers/platform/apple/smc_rtkit.c:425:34: note: 'apple_smc_rtkit_of_match' declared here
static const struct of_device_id apple_smc_rtkit_of_match[] = {
^
8 warnings and 9 errors generated.


vim +/FIELD_PREP +73 drivers/platform/apple/smc_rtkit.c

57
58 static int apple_smc_rtkit_write_key_atomic(void *cookie, smc_key key, void *buf, size_t size)
59 {
60 struct apple_smc_rtkit *smc = cookie;
61 int ret;
62 u64 msg;
63 u8 result;
64
65 if (size > SMC_SHMEM_SIZE || size == 0)
66 return -EINVAL;
67
68 if (!smc->alive)
69 return -EIO;
70
71 memcpy_toio(smc->shmem.iomem, buf, size);
72 smc->msg_id = (smc->msg_id + 1) & 0xf;
> 73 msg = (FIELD_PREP(SMC_MSG, SMC_MSG_WRITE_KEY) |
74 FIELD_PREP(SMC_SIZE, size) |
75 FIELD_PREP(SMC_ID, smc->msg_id) |
> 76 FIELD_PREP(SMC_DATA, key));
77 smc->atomic_pending = true;
78
79 ret = apple_rtkit_send_message_atomic(smc->rtk, SMC_ENDPOINT, msg);
80 if (ret < 0) {
81 dev_err(smc->dev, "Failed to send command\n");
82 return ret;
83 }
84
85 while (smc->atomic_pending) {
86 ret = apple_rtkit_poll(smc->rtk);
87 if (ret < 0) {
88 dev_err(smc->dev, "RTKit poll failed (%llx)", msg);
89 return ret;
90 }
91 }
92
> 93 if (FIELD_GET(SMC_ID, smc->cmd_ret) != smc->msg_id) {
94 dev_err(smc->dev, "Command sequence mismatch (expected %d, got %d)\n",
95 smc->msg_id, (unsigned int)FIELD_GET(SMC_ID, smc->cmd_ret));
96 return -EIO;
97 }
98
99 result = FIELD_GET(SMC_RESULT, smc->cmd_ret);
100 if (result != 0)
101 return -result;
102
103 return FIELD_GET(SMC_SIZE, smc->cmd_ret);
104 }
105

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