[hch-block:blkdev.h-includes 15/16] drivers/mmc/core/sd.c:1016:21: error: variable has incomplete type 'struct scatterlist'

From: kernel test robot
Date: Sun Jul 25 2021 - 04:21:40 EST


tree: git://git.infradead.org/users/hch/block.git blkdev.h-includes
head: db08f634bead64da6de80830782f3c339fc41b11
commit: 9571c3f0ec1966546513f3be443b4abe3a7b4666 [15/16] block: move integrity handling out of blkdev.h
config: riscv-randconfig-r036-20210725 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project c63dbd850182797bc4b76124d08e1c320ab2365d)
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
git remote add hch-block git://git.infradead.org/users/hch/block.git
git fetch --no-tags hch-block blkdev.h-includes
git checkout 9571c3f0ec1966546513f3be443b4abe3a7b4666
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=riscv SHELL=/bin/bash drivers/mmc/core/

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/mmc/core/sd.c:1016:21: error: variable has incomplete type 'struct scatterlist'
struct scatterlist sg;
^
include/linux/mmc/core.h:139:9: note: forward declaration of 'struct scatterlist'
struct scatterlist *sg; /* I/O scatter list */
^
>> drivers/mmc/core/sd.c:1045:2: error: implicit declaration of function 'sg_init_one' [-Werror,-Wimplicit-function-declaration]
sg_init_one(&sg, reg_buf, 512);
^
2 errors generated.


vim +1016 drivers/mmc/core/sd.c

6a11fc47f175c8 Adrian Hunter 2017-09-25 1008
2c5d4276903804 Ulf Hansson 2021-05-04 1009 static int sd_write_ext_reg(struct mmc_card *card, u8 fno, u8 page, u16 offset,
2c5d4276903804 Ulf Hansson 2021-05-04 1010 u8 reg_data)
2c5d4276903804 Ulf Hansson 2021-05-04 1011 {
2c5d4276903804 Ulf Hansson 2021-05-04 1012 struct mmc_host *host = card->host;
2c5d4276903804 Ulf Hansson 2021-05-04 1013 struct mmc_request mrq = {};
2c5d4276903804 Ulf Hansson 2021-05-04 1014 struct mmc_command cmd = {};
2c5d4276903804 Ulf Hansson 2021-05-04 1015 struct mmc_data data = {};
2c5d4276903804 Ulf Hansson 2021-05-04 @1016 struct scatterlist sg;
2c5d4276903804 Ulf Hansson 2021-05-04 1017 u8 *reg_buf;
2c5d4276903804 Ulf Hansson 2021-05-04 1018
2c5d4276903804 Ulf Hansson 2021-05-04 1019 reg_buf = kzalloc(512, GFP_KERNEL);
2c5d4276903804 Ulf Hansson 2021-05-04 1020 if (!reg_buf)
2c5d4276903804 Ulf Hansson 2021-05-04 1021 return -ENOMEM;
2c5d4276903804 Ulf Hansson 2021-05-04 1022
2c5d4276903804 Ulf Hansson 2021-05-04 1023 mrq.cmd = &cmd;
2c5d4276903804 Ulf Hansson 2021-05-04 1024 mrq.data = &data;
2c5d4276903804 Ulf Hansson 2021-05-04 1025
2c5d4276903804 Ulf Hansson 2021-05-04 1026 /*
2c5d4276903804 Ulf Hansson 2021-05-04 1027 * Arguments of CMD49:
2c5d4276903804 Ulf Hansson 2021-05-04 1028 * [31:31] MIO (0 = memory).
2c5d4276903804 Ulf Hansson 2021-05-04 1029 * [30:27] FNO (function number).
2c5d4276903804 Ulf Hansson 2021-05-04 1030 * [26:26] MW - mask write mode (0 = disable).
2c5d4276903804 Ulf Hansson 2021-05-04 1031 * [25:18] page number.
2c5d4276903804 Ulf Hansson 2021-05-04 1032 * [17:9] offset address.
2c5d4276903804 Ulf Hansson 2021-05-04 1033 * [8:0] length (0 = 1 byte).
2c5d4276903804 Ulf Hansson 2021-05-04 1034 */
2c5d4276903804 Ulf Hansson 2021-05-04 1035 cmd.arg = fno << 27 | page << 18 | offset << 9;
2c5d4276903804 Ulf Hansson 2021-05-04 1036
2c5d4276903804 Ulf Hansson 2021-05-04 1037 /* The first byte in the buffer is the data to be written. */
2c5d4276903804 Ulf Hansson 2021-05-04 1038 reg_buf[0] = reg_data;
2c5d4276903804 Ulf Hansson 2021-05-04 1039
2c5d4276903804 Ulf Hansson 2021-05-04 1040 data.flags = MMC_DATA_WRITE;
2c5d4276903804 Ulf Hansson 2021-05-04 1041 data.blksz = 512;
2c5d4276903804 Ulf Hansson 2021-05-04 1042 data.blocks = 1;
2c5d4276903804 Ulf Hansson 2021-05-04 1043 data.sg = &sg;
2c5d4276903804 Ulf Hansson 2021-05-04 1044 data.sg_len = 1;
2c5d4276903804 Ulf Hansson 2021-05-04 @1045 sg_init_one(&sg, reg_buf, 512);
2c5d4276903804 Ulf Hansson 2021-05-04 1046
2c5d4276903804 Ulf Hansson 2021-05-04 1047 cmd.opcode = SD_WRITE_EXTR_SINGLE;
2c5d4276903804 Ulf Hansson 2021-05-04 1048 cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
2c5d4276903804 Ulf Hansson 2021-05-04 1049
2c5d4276903804 Ulf Hansson 2021-05-04 1050 mmc_set_data_timeout(&data, card);
2c5d4276903804 Ulf Hansson 2021-05-04 1051 mmc_wait_for_req(host, &mrq);
2c5d4276903804 Ulf Hansson 2021-05-04 1052
2c5d4276903804 Ulf Hansson 2021-05-04 1053 kfree(reg_buf);
2c5d4276903804 Ulf Hansson 2021-05-04 1054
2c5d4276903804 Ulf Hansson 2021-05-04 1055 /*
2c5d4276903804 Ulf Hansson 2021-05-04 1056 * Note that, the SD card is allowed to signal busy on DAT0 up to 1s
2c5d4276903804 Ulf Hansson 2021-05-04 1057 * after the CMD49. Although, let's leave this to be managed by the
2c5d4276903804 Ulf Hansson 2021-05-04 1058 * caller.
2c5d4276903804 Ulf Hansson 2021-05-04 1059 */
2c5d4276903804 Ulf Hansson 2021-05-04 1060
2c5d4276903804 Ulf Hansson 2021-05-04 1061 if (cmd.error)
2c5d4276903804 Ulf Hansson 2021-05-04 1062 return cmd.error;
2c5d4276903804 Ulf Hansson 2021-05-04 1063 if (data.error)
2c5d4276903804 Ulf Hansson 2021-05-04 1064 return data.error;
2c5d4276903804 Ulf Hansson 2021-05-04 1065
2c5d4276903804 Ulf Hansson 2021-05-04 1066 return 0;
2c5d4276903804 Ulf Hansson 2021-05-04 1067 }
2c5d4276903804 Ulf Hansson 2021-05-04 1068

:::::: The code at line 1016 was first introduced by commit
:::::: 2c5d42769038045b92160a849aad43c4b3170e2a mmc: core: Add support for Power Off Notification for SD cards

:::::: TO: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
:::::: CC: Ulf Hansson <ulf.hansson@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip