drivers/i2c/busses/i2c-mlxbf.c:1927:3: error: implicit declaration of function 'i2c_slave_event'

From: kernel test robot
Date: Thu Nov 05 2020 - 09:36:20 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4ef8451b332662d004df269d4cdeb7d9f31419b5
commit: b5b5b32081cd206baa6e58cca7f112d9723785d6 i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC
date: 6 weeks ago
config: arm64-randconfig-r011-20201105 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 09ec07827b1128504457a93dee80b2ceee1af600)
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 arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b5b5b32081cd206baa6e58cca7f112d9723785d6
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout b5b5b32081cd206baa6e58cca7f112d9723785d6
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64

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/i2c/busses/i2c-mlxbf.c:1927:3: error: implicit declaration of function 'i2c_slave_event' [-Werror,-Wimplicit-function-declaration]
i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value);
^
>> drivers/i2c/busses/i2c-mlxbf.c:1927:26: error: use of undeclared identifier 'I2C_SLAVE_WRITE_REQUESTED'
i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value);
^
>> drivers/i2c/busses/i2c-mlxbf.c:1929:32: error: use of undeclared identifier 'I2C_SLAVE_WRITE_RECEIVED'
ret = i2c_slave_event(slave, I2C_SLAVE_WRITE_RECEIVED,
^
>> drivers/i2c/busses/i2c-mlxbf.c:1931:26: error: use of undeclared identifier 'I2C_SLAVE_STOP'
i2c_slave_event(slave, I2C_SLAVE_STOP, &value);
^
drivers/i2c/busses/i2c-mlxbf.c:1943:2: error: implicit declaration of function 'i2c_slave_event' [-Werror,-Wimplicit-function-declaration]
i2c_slave_event(slave, I2C_SLAVE_READ_REQUESTED, &value);
^
>> drivers/i2c/busses/i2c-mlxbf.c:1943:25: error: use of undeclared identifier 'I2C_SLAVE_READ_REQUESTED'
i2c_slave_event(slave, I2C_SLAVE_READ_REQUESTED, &value);
^
>> drivers/i2c/busses/i2c-mlxbf.c:1947:26: error: use of undeclared identifier 'I2C_SLAVE_READ_PROCESSED'
i2c_slave_event(slave, I2C_SLAVE_READ_PROCESSED, &value);
^
drivers/i2c/busses/i2c-mlxbf.c:1951:25: error: use of undeclared identifier 'I2C_SLAVE_STOP'
i2c_slave_event(slave, I2C_SLAVE_STOP, &value);
^
drivers/i2c/busses/i2c-mlxbf.c:2011:2: error: implicit declaration of function 'i2c_slave_event' [-Werror,-Wimplicit-function-declaration]
i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value);
^
drivers/i2c/busses/i2c-mlxbf.c:2011:25: error: use of undeclared identifier 'I2C_SLAVE_WRITE_REQUESTED'
i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value);
^
drivers/i2c/busses/i2c-mlxbf.c:2016:32: error: use of undeclared identifier 'I2C_SLAVE_WRITE_RECEIVED'
ret = i2c_slave_event(slave, I2C_SLAVE_WRITE_RECEIVED,
^
drivers/i2c/busses/i2c-mlxbf.c:2023:25: error: use of undeclared identifier 'I2C_SLAVE_STOP'
i2c_slave_event(slave, I2C_SLAVE_STOP, &value);
^
>> drivers/i2c/busses/i2c-mlxbf.c:2244:3: error: field designator 'reg_slave' does not refer to any field in type 'const struct i2c_algorithm'
.reg_slave = mlxbf_i2c_reg_slave,
^
>> drivers/i2c/busses/i2c-mlxbf.c:2245:3: error: field designator 'unreg_slave' does not refer to any field in type 'const struct i2c_algorithm'
.unreg_slave = mlxbf_i2c_unreg_slave,
^
drivers/i2c/busses/i2c-mlxbf.c:2296:8: error: implicit declaration of function 'acpi_device_uid' [-Werror,-Wimplicit-function-declaration]
uid = acpi_device_uid(adev);
^
drivers/i2c/busses/i2c-mlxbf.c:2296:8: note: did you mean 'cpu_device_up'?
include/linux/cpu.h:93:5: note: 'cpu_device_up' declared here
int cpu_device_up(struct device *dev);
^
drivers/i2c/busses/i2c-mlxbf.c:2296:6: warning: incompatible integer to pointer conversion assigning to 'const char *' from 'int' [-Wint-conversion]
uid = acpi_device_uid(adev);
^ ~~~~~~~~~~~~~~~~~~~~~
1 warning and 15 errors generated.

vim +/i2c_slave_event +1927 drivers/i2c/busses/i2c-mlxbf.c

1879
1880 /* Send byte to 'external' smbus master. */
1881 static int mlxbf_smbus_irq_send(struct mlxbf_i2c_priv *priv, u8 recv_bytes)
1882 {
1883 u8 data_desc[MLXBF_I2C_SLAVE_DATA_DESC_SIZE] = { 0 };
1884 u8 write_size, pec_en, addr, byte, value, byte_cnt, desc_size;
1885 struct i2c_client *slave = priv->slave;
1886 u32 control32, data32;
1887 int ret;
1888
1889 if (!slave)
1890 return -EINVAL;
1891
1892 addr = 0;
1893 byte = 0;
1894 desc_size = MLXBF_I2C_SLAVE_DATA_DESC_SIZE;
1895
1896 /*
1897 * Read bytes received from the external master. These bytes should
1898 * be located in the first data descriptor register of the slave GW.
1899 * These bytes are the slave address byte and the internal register
1900 * address, if supplied.
1901 */
1902 if (recv_bytes > 0) {
1903 data32 = mlxbf_i2c_read_data(priv->smbus->io,
1904 MLXBF_I2C_SLAVE_DATA_DESC_ADDR);
1905
1906 /* Parse the received bytes. */
1907 switch (recv_bytes) {
1908 case 2:
1909 byte = (data32 >> 8) & GENMASK(7, 0);
1910 fallthrough;
1911 case 1:
1912 addr = (data32 & GENMASK(7, 0)) >> 1;
1913 }
1914
1915 /* Check whether it's our slave address. */
1916 if (slave->addr != addr)
1917 return -EINVAL;
1918 }
1919
1920 /*
1921 * I2C read transactions may start by a WRITE followed by a READ.
1922 * Indeed, most slave devices would expect the internal address
1923 * following the slave address byte. So, write that byte first,
1924 * and then, send the requested data bytes to the master.
1925 */
1926 if (recv_bytes > 1) {
> 1927 i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value);
1928 value = byte;
> 1929 ret = i2c_slave_event(slave, I2C_SLAVE_WRITE_RECEIVED,
1930 &value);
> 1931 i2c_slave_event(slave, I2C_SLAVE_STOP, &value);
1932
1933 if (ret < 0)
1934 return ret;
1935 }
1936
1937 /*
1938 * Now, send data to the master; currently, the driver supports
1939 * READ_BYTE, READ_WORD and BLOCK READ protocols. Note that the
1940 * hardware can send up to 128 bytes per transfer. That is the
1941 * size of its data registers.
1942 */
> 1943 i2c_slave_event(slave, I2C_SLAVE_READ_REQUESTED, &value);
1944
1945 for (byte_cnt = 0; byte_cnt < desc_size; byte_cnt++) {
1946 data_desc[byte_cnt] = value;
> 1947 i2c_slave_event(slave, I2C_SLAVE_READ_PROCESSED, &value);
1948 }
1949
1950 /* Send a stop condition to the backend. */
1951 i2c_slave_event(slave, I2C_SLAVE_STOP, &value);
1952
1953 /* Handle the actual transfer. */
1954
1955 /* Set the number of bytes to write to master. */
1956 write_size = (byte_cnt - 1) & 0x7f;
1957
1958 /* Write data to Slave GW data descriptor. */
1959 mlxbf_i2c_smbus_write_data(priv, data_desc, byte_cnt,
1960 MLXBF_I2C_SLAVE_DATA_DESC_ADDR);
1961
1962 pec_en = 0; /* Disable PEC since it is not supported. */
1963
1964 /* Prepare control word. */
1965 control32 = MLXBF_I2C_SLAVE_ENABLE;
1966 control32 |= rol32(write_size, MLXBF_I2C_SLAVE_WRITE_BYTES_SHIFT);
1967 control32 |= rol32(pec_en, MLXBF_I2C_SLAVE_SEND_PEC_SHIFT);
1968
1969 mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_GW, control32);
1970
1971 /*
1972 * Wait until the transfer is completed; the driver will wait
1973 * until the GW is idle, a cause will rise on fall of GW busy.
1974 */
1975 mlxbf_smbus_slave_wait_for_idle(priv, MLXBF_I2C_SMBUS_TIMEOUT);
1976
1977 /* Release the Slave GW. */
1978 mlxbf_i2c_write(priv->smbus->io,
1979 MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES, 0x0);
1980 mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_PEC, 0x0);
1981 mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_READY, 0x1);
1982
1983 return 0;
1984 }
1985

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

Attachment: .config.gz
Description: application/gzip