Re: drivers/cpuidle/cpuidle-riscv-sbi.c:79:16: error: variable has incomplete type 'struct sbiret'

From: Randy Dunlap
Date: Tue Apr 05 2022 - 20:44:42 EST


Hi,

On 4/4/22 23:11, kernel test robot wrote:
> Hi Anup,
>
> First bad commit (maybe != root cause):
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 3123109284176b1532874591f7c81f3837bbdc17
> commit: c5179ef1ca0c39dab6955be6b0e3c034cc4164c8 RISC-V: Enable RISC-V SBI CPU Idle driver for QEMU virt machine
> date: 4 weeks ago
> config: riscv-randconfig-r022-20220405 (https://download.01.org/0day-ci/archive/20220405/202204051441.dQ4w35Ga-lkp@xxxxxxxxx/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project c4a1b07d0979e7ff20d7d541af666d822d66b566)
> 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
> # install riscv cross compiling tool for clang build
> # apt-get install binutils-riscv64-linux-gnu
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c5179ef1ca0c39dab6955be6b0e3c034cc4164c8
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout c5179ef1ca0c39dab6955be6b0e3c034cc4164c8
> # 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=riscv 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 >>):
>

[delete many build warnings and errors]

> 3 warnings and 17 errors generated.
>
> Kconfig warnings: (for reference only)
> WARNING: unmet direct dependencies detected for RISCV_SBI_CPUIDLE
> Depends on CPU_IDLE && RISCV && RISCV_SBI
> Selected by
> - SOC_VIRT && CPU_IDLE

This Kconfig warning is the root of the problem. All of the build errors
and warnings can be fixed by something like so. Is it OK?

---
arch/riscv/Kconfig.socs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20220404.orig/arch/riscv/Kconfig.socs
+++ linux-next-20220404/arch/riscv/Kconfig.socs
@@ -38,7 +38,7 @@ config SOC_VIRT
select SIFIVE_PLIC
select PM_GENERIC_DOMAINS if PM
select PM_GENERIC_DOMAINS_OF if PM && OF
- select RISCV_SBI_CPUIDLE if CPU_IDLE
+ select RISCV_SBI_CPUIDLE if CPU_IDLE && RISCV_SBI
help
This enables support for QEMU Virt Machine.

[snip]

Also, to the @bot:

Why does the reported Kconfig warning look like it was generated
by some older kconfig software? Current Kconfig reports more info:

WARNING: unmet direct dependencies detected for RISCV_SBI_CPUIDLE
Depends on [n]: CPU_IDLE [=y] && RISCV [=y] && RISCV_SBI [=n]
Selected by [y]:
- SOC_VIRT [=y] && CPU_IDLE [=y]

Thanks.
>
> :::::: The code at line 79 was first introduced by commit
> :::::: 6abf32f1d9c5009dcccded2c1e7ca899a4ab587b cpuidle: Add RISC-V SBI CPU idle driver
>
> :::::: TO: Anup Patel <anup.patel@xxxxxxx>
> :::::: CC: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
>

--
~Randy