Re: drivers/input/touchscreen/cyttsp_i2c.c:47:18: error: implicit declaration of function 'i2c_transfer'

From: Dmitry Torokhov
Date: Wed Oct 02 2024 - 05:31:56 EST


On Wed, Oct 02, 2024 at 08:03:35AM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: e32cde8d2bd7d251a8f9b434143977ddf13dcec6
> commit: 25162a4f64f8ba0065f300977589fe1f6af332f0 Input: cyttsp4 - remove driver
> date: 8 weeks ago
> config: x86_64-randconfig-001-20231120 (https://download.01.org/0day-ci/archive/20241002/202410020735.aBI61ZYn-lkp@xxxxxxxxx/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241002/202410020735.aBI61ZYn-lkp@xxxxxxxxx/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202410020735.aBI61ZYn-lkp@xxxxxxxxx/
>
> All errors (new ones prefixed by >>):
>
> In file included from include/linux/sched.h:38,
> from include/linux/percpu.h:13,
> from arch/x86/include/asm/msr.h:15,
> from arch/x86/include/asm/tsc.h:10,
> from arch/x86/include/asm/timex.h:6,
> from include/linux/timex.h:67,
> from include/linux/time32.h:13,
> from include/linux/time.h:60,
> from include/linux/stat.h:19,
> from include/linux/module.h:13,
> from drivers/input/touchscreen/cyttsp_core.h:22,
> from drivers/input/touchscreen/cyttsp_i2c.c:16:
> include/linux/mm_types_task.h:19:45: warning: "CONFIG_SPLIT_PTLOCK_CPUS" is not defined, evaluates to 0 [-Wundef]
> 19 | #define USE_SPLIT_PTE_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS)
> | ^~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/mm.h:2928:5: note: in expansion of macro 'USE_SPLIT_PTE_PTLOCKS'
> 2928 | #if USE_SPLIT_PTE_PTLOCKS
> | ^~~~~~~~~~~~~~~~~~~~~
> include/linux/mm_types_task.h:19:45: warning: "CONFIG_SPLIT_PTLOCK_CPUS" is not defined, evaluates to 0 [-Wundef]
> 19 | #define USE_SPLIT_PTE_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS)
> | ^~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/mm_types_task.h:20:34: note: in expansion of macro 'USE_SPLIT_PTE_PTLOCKS'
> 20 | #define USE_SPLIT_PMD_PTLOCKS (USE_SPLIT_PTE_PTLOCKS && \
> | ^~~~~~~~~~~~~~~~~~~~~
> include/linux/mm.h:3050:5: note: in expansion of macro 'USE_SPLIT_PMD_PTLOCKS'
> 3050 | #if USE_SPLIT_PMD_PTLOCKS
> | ^~~~~~~~~~~~~~~~~~~~~
> drivers/input/touchscreen/cyttsp_i2c.c: In function 'cyttsp_i2c_read_block_data':
> >> drivers/input/touchscreen/cyttsp_i2c.c:47:18: error: implicit declaration of function 'i2c_transfer' [-Werror=implicit-function-declaration]
> 47 | retval = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
> | ^~~~~~~~~~~~
> drivers/input/touchscreen/cyttsp_i2c.c: In function 'cyttsp_i2c_probe':
> drivers/input/touchscreen/cyttsp_i2c.c:90:14: error: implicit declaration of function 'i2c_check_functionality' [-Werror=implicit-function-declaration]
> 90 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
> | ^~~~~~~~~~~~~~~~~~~~~~~
> drivers/input/touchscreen/cyttsp_i2c.c: At top level:
> drivers/input/touchscreen/cyttsp_i2c.c:128:1: warning: data definition has no type or storage class
> 128 | module_i2c_driver(cyttsp_i2c_driver);
> | ^~~~~~~~~~~~~~~~~
> drivers/input/touchscreen/cyttsp_i2c.c:128:1: error: type defaults to 'int' in declaration of 'module_i2c_driver' [-Werror=implicit-int]
> drivers/input/touchscreen/cyttsp_i2c.c:128:1: warning: parameter names (without types) in function declaration
> drivers/input/touchscreen/cyttsp_i2c.c:118:26: warning: 'cyttsp_i2c_driver' defined but not used [-Wunused-variable]
> 118 | static struct i2c_driver cyttsp_i2c_driver = {
> | ^~~~~~~~~~~~~~~~~
> cc1: some warnings being treated as errors
>

This is really weird: cyttsp_i2c.h includes linux/i2c.h, it has
dependency in Kconfig on I2C and CONFIG_I2C is present in the .config
referenced above, so all the declarations should be there.

I tried reproducing with the exact commit and config as in this report
and I did not get such errors. This is with gcc version 13.2.0 (Debian
13.2.0-13).

Thanks.

--
Dmitry