[mingo-tip:sched/headers 2357/2380] drivers/sbus/char/envctrl.c:1001:57: error: invalid use of undefined type 'struct task_struct'

From: kernel test robot
Date: Mon Jan 10 2022 - 11:18:08 EST


tree: git://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git sched/headers
head: 351bfbf7f1e8dce84b605c8007c98dd603c4ca4d
commit: 61ea5a6fab5c8fae043a02a100970041dc6a877e [2357/2380] headers/deps: delay: Optimize <linux/delay.h> dependencies, remove <linux/sched.h> inclusion
config: sparc64-buildonly-randconfig-r003-20220109 (https://download.01.org/0day-ci/archive/20220111/202201110001.jDRoBKcb-lkp@xxxxxxxxx/config)
compiler: sparc64-linux-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://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git/commit/?id=61ea5a6fab5c8fae043a02a100970041dc6a877e
git remote add mingo-tip git://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git
git fetch --no-tags mingo-tip sched/headers
git checkout 61ea5a6fab5c8fae043a02a100970041dc6a877e
# 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=sparc64 SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

In file included from include/asm-generic/bug.h:22,
from arch/sparc/include/asm/bug.h:25,
from include/linux/bug.h:5,
from include/linux/kernfs.h:9,
from include/linux/kobject_api.h:20,
from include/linux/of_api.h:26,
from drivers/sbus/char/envctrl.c:22:
drivers/sbus/char/envctrl.c: In function 'kenvctrld':
>> drivers/sbus/char/envctrl.c:1001:57: error: invalid use of undefined type 'struct task_struct'
1001 | printk(KERN_INFO PFX "%s starting...\n", current->comm);
| ^~
include/linux/printk.h:419:33: note: in definition of macro 'printk_index_wrap'
419 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~~~~~~~~
drivers/sbus/char/envctrl.c:1001:9: note: in expansion of macro 'printk'
1001 | printk(KERN_INFO PFX "%s starting...\n", current->comm);
| ^~~~~~
drivers/sbus/char/envctrl.c:1016:56: error: invalid use of undefined type 'struct task_struct'
1016 | current->comm, whichcpu,
| ^~
include/linux/printk.h:419:33: note: in definition of macro 'printk_index_wrap'
419 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~~~~~~~~
drivers/sbus/char/envctrl.c:1013:41: note: in expansion of macro 'printk'
1013 | printk(KERN_CRIT
| ^~~~~~
drivers/sbus/char/envctrl.c:1023:56: error: invalid use of undefined type 'struct task_struct'
1023 | printk(KERN_INFO PFX "%s exiting...\n", current->comm);
| ^~
include/linux/printk.h:419:33: note: in definition of macro 'printk_index_wrap'
419 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~~~~~~~~
drivers/sbus/char/envctrl.c:1023:9: note: in expansion of macro 'printk'
1023 | printk(KERN_INFO PFX "%s exiting...\n", current->comm);
| ^~~~~~
In file included from drivers/sbus/char/envctrl.c:26:
drivers/sbus/char/envctrl.c: In function 'envctrl_probe':
>> include/linux/kthread.h:58:17: error: implicit declaration of function 'wake_up_process' [-Werror=implicit-function-declaration]
58 | wake_up_process(__k); \
| ^~~~~~~~~~~~~~~
drivers/sbus/char/envctrl.c:1085:26: note: in expansion of macro 'kthread_run'
1085 | kenvctrld_task = kthread_run(kenvctrld, NULL, "kenvctrld");
| ^~~~~~~~~~~
cc1: some warnings being treated as errors
--
drivers/sbus/char/bbc_envctrl.c:569:5: warning: no previous prototype for 'bbc_envctrl_init' [-Wmissing-prototypes]
569 | int bbc_envctrl_init(struct bbc_i2c_bus *bp)
| ^~~~~~~~~~~~~~~~
In file included from drivers/sbus/char/bbc_envctrl.c:10:
drivers/sbus/char/bbc_envctrl.c: In function 'bbc_envctrl_init':
>> include/linux/kthread.h:58:17: error: implicit declaration of function 'wake_up_process' [-Werror=implicit-function-declaration]
58 | wake_up_process(__k); \
| ^~~~~~~~~~~~~~~
drivers/sbus/char/bbc_envctrl.c:583:34: note: in expansion of macro 'kthread_run'
583 | kenvctrld_task = kthread_run(kenvctrld, NULL, "kenvctrld");
| ^~~~~~~~~~~
drivers/sbus/char/bbc_envctrl.c: At top level:
drivers/sbus/char/bbc_envctrl.c:597:6: warning: no previous prototype for 'bbc_envctrl_cleanup' [-Wmissing-prototypes]
597 | void bbc_envctrl_cleanup(struct bbc_i2c_bus *bp)
| ^~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +1001 drivers/sbus/char/envctrl.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 985
^1da177e4c3f41 Linus Torvalds 2005-04-16 986 static int kenvctrld(void *__unused)
^1da177e4c3f41 Linus Torvalds 2005-04-16 987 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 988 int poll_interval;
^1da177e4c3f41 Linus Torvalds 2005-04-16 989 int whichcpu;
^1da177e4c3f41 Linus Torvalds 2005-04-16 990 char tempbuf[10];
^1da177e4c3f41 Linus Torvalds 2005-04-16 991 struct i2c_child_t *cputemp;
^1da177e4c3f41 Linus Torvalds 2005-04-16 992
^1da177e4c3f41 Linus Torvalds 2005-04-16 993 if (NULL == (cputemp = envctrl_get_i2c_child(ENVCTRL_CPUTEMP_MON))) {
6b8c90f24e2450 David S. Miller 2008-08-29 994 printk(KERN_ERR PFX
6b8c90f24e2450 David S. Miller 2008-08-29 995 "kenvctrld unable to monitor CPU temp-- exiting\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 996 return -ENODEV;
^1da177e4c3f41 Linus Torvalds 2005-04-16 997 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 998
cb39d263e751f9 Nishanth Aravamudan 2005-07-24 999 poll_interval = 5000; /* TODO env_mon_interval */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1000
6b8c90f24e2450 David S. Miller 2008-08-29 @1001 printk(KERN_INFO PFX "%s starting...\n", current->comm);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1002 for (;;) {
218b29e0c3995e Christoph Hellwig 2005-08-09 1003 msleep_interruptible(poll_interval);
218b29e0c3995e Christoph Hellwig 2005-08-09 1004
218b29e0c3995e Christoph Hellwig 2005-08-09 1005 if (kthread_should_stop())
^1da177e4c3f41 Linus Torvalds 2005-04-16 1006 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1007
^1da177e4c3f41 Linus Torvalds 2005-04-16 1008 for (whichcpu = 0; whichcpu < ENVCTRL_MAX_CPU; ++whichcpu) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1009 if (0 < envctrl_read_cpu_info(whichcpu, cputemp,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1010 ENVCTRL_CPUTEMP_MON,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1011 tempbuf)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1012 if (tempbuf[0] >= shutdown_temperature) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1013 printk(KERN_CRIT
^1da177e4c3f41 Linus Torvalds 2005-04-16 1014 "%s: WARNING: CPU%i temperature %i C meets or exceeds "\
^1da177e4c3f41 Linus Torvalds 2005-04-16 1015 "shutdown threshold %i C\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 1016 current->comm, whichcpu,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1017 tempbuf[0], shutdown_temperature);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1018 envctrl_do_shutdown();
^1da177e4c3f41 Linus Torvalds 2005-04-16 1019 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1020 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1021 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1022 }
6b8c90f24e2450 David S. Miller 2008-08-29 1023 printk(KERN_INFO PFX "%s exiting...\n", current->comm);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1024 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1025 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1026

:::::: The code at line 1001 was first introduced by commit
:::::: 6b8c90f24e24505f97efaef1a46572d6b45929b9 envctrl: Convert to pure OF driver.

:::::: TO: David S. Miller <davem@xxxxxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

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