Re: drivers/mfd/intel-m10-bmc-spi.c:28:10: error: 'const struct regmap_config' has no member named 'reg_bits'

From: Javier Carrasco
Date: Tue Oct 01 2024 - 19:22:40 EST


On 01/10/2024 23:57, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: e32cde8d2bd7d251a8f9b434143977ddf13dcec6
> commit: 9842c62162858c7b0625dd3e00085b68167257d3 mfd: intel-m10-bmc: Constify struct regmap_config
> date: 5 weeks ago
> config: x86_64-randconfig-001-20231120 (https://download.01.org/0day-ci/archive/20241002/202410020505.B2WRKx9B-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/202410020505.B2WRKx9B-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/202410020505.B2WRKx9B-lkp@xxxxxxxxx/
>
> All errors (new ones prefixed by >>):
>
> In file included from include/linux/sched.h:38,
> from include/linux/ratelimit.h:6,
> from include/linux/dev_printk.h:16,
> from drivers/mfd/intel-m10-bmc-spi.c:8:
> 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:2888:5: note: in expansion of macro 'USE_SPLIT_PTE_PTLOCKS'
> 2888 | #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:3010:5: note: in expansion of macro 'USE_SPLIT_PMD_PTLOCKS'
> 3010 | #if USE_SPLIT_PMD_PTLOCKS
> | ^~~~~~~~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:16:34: error: array type has incomplete element type 'struct regmap_range'
> 16 | static const struct regmap_range m10bmc_regmap_range[] = {
> | ^~~~~~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:17:9: error: implicit declaration of function 'regmap_reg_range'; did you mean 'remap_pfn_range'? [-Werror=implicit-function-declaration]
> 17 | regmap_reg_range(M10BMC_N3000_LEGACY_BUILD_VER, M10BMC_N3000_LEGACY_BUILD_VER),
> | ^~~~~~~~~~~~~~~~
> | remap_pfn_range
> drivers/mfd/intel-m10-bmc-spi.c:22:21: error: variable 'm10bmc_access_table' has initializer but incomplete type
> 22 | static const struct regmap_access_table m10bmc_access_table = {
> | ^~~~~~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:23:10: error: 'const struct regmap_access_table' has no member named 'yes_ranges'
> 23 | .yes_ranges = m10bmc_regmap_range,
> | ^~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:23:27: warning: excess elements in struct initializer
> 23 | .yes_ranges = m10bmc_regmap_range,
> | ^~~~~~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:23:27: note: (near initialization for 'm10bmc_access_table')
> drivers/mfd/intel-m10-bmc-spi.c:24:10: error: 'const struct regmap_access_table' has no member named 'n_yes_ranges'
> 24 | .n_yes_ranges = ARRAY_SIZE(m10bmc_regmap_range),
> | ^~~~~~~~~~~~
> In file included from include/linux/bitfield.h:10,
> from drivers/mfd/intel-m10-bmc-spi.c:7:
> include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant
> 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
> | ^
> include/linux/compiler.h:243:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
> 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
> | ^~~~~~~~~~~~~~~~~
> include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
> 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
> | ^~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:24:27: note: in expansion of macro 'ARRAY_SIZE'
> 24 | .n_yes_ranges = ARRAY_SIZE(m10bmc_regmap_range),
> | ^~~~~~~~~~
> In file included from include/linux/kernel.h:16,
> from include/linux/cpumask.h:11,
> from arch/x86/include/asm/tlbbatch.h:5,
> from include/linux/mm_types_task.h:16:
> include/linux/array_size.h:11:25: warning: excess elements in struct initializer
> 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
> | ^
> drivers/mfd/intel-m10-bmc-spi.c:24:27: note: in expansion of macro 'ARRAY_SIZE'
> 24 | .n_yes_ranges = ARRAY_SIZE(m10bmc_regmap_range),
> | ^~~~~~~~~~
> include/linux/array_size.h:11:25: note: (near initialization for 'm10bmc_access_table')
> 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
> | ^
> drivers/mfd/intel-m10-bmc-spi.c:24:27: note: in expansion of macro 'ARRAY_SIZE'
> 24 | .n_yes_ranges = ARRAY_SIZE(m10bmc_regmap_range),
> | ^~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:27:21: error: variable 'intel_m10bmc_regmap_config' has initializer but incomplete type
> 27 | static const struct regmap_config intel_m10bmc_regmap_config = {
> | ^~~~~~~~~~~~~
>>> drivers/mfd/intel-m10-bmc-spi.c:28:10: error: 'const struct regmap_config' has no member named 'reg_bits'
> 28 | .reg_bits = 32,
> | ^~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:28:21: warning: excess elements in struct initializer
> 28 | .reg_bits = 32,
> | ^~
> drivers/mfd/intel-m10-bmc-spi.c:28:21: note: (near initialization for 'intel_m10bmc_regmap_config')
>>> drivers/mfd/intel-m10-bmc-spi.c:29:10: error: 'const struct regmap_config' has no member named 'val_bits'
> 29 | .val_bits = 32,
> | ^~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:29:21: warning: excess elements in struct initializer
> 29 | .val_bits = 32,
> | ^~
> drivers/mfd/intel-m10-bmc-spi.c:29:21: note: (near initialization for 'intel_m10bmc_regmap_config')
>>> drivers/mfd/intel-m10-bmc-spi.c:30:10: error: 'const struct regmap_config' has no member named 'reg_stride'
> 30 | .reg_stride = 4,
> | ^~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:30:23: warning: excess elements in struct initializer
> 30 | .reg_stride = 4,
> | ^
> drivers/mfd/intel-m10-bmc-spi.c:30:23: note: (near initialization for 'intel_m10bmc_regmap_config')
>>> drivers/mfd/intel-m10-bmc-spi.c:31:10: error: 'const struct regmap_config' has no member named 'wr_table'
> 31 | .wr_table = &m10bmc_access_table,
> | ^~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:31:21: warning: excess elements in struct initializer
> 31 | .wr_table = &m10bmc_access_table,
> | ^
> drivers/mfd/intel-m10-bmc-spi.c:31:21: note: (near initialization for 'intel_m10bmc_regmap_config')
>>> drivers/mfd/intel-m10-bmc-spi.c:32:10: error: 'const struct regmap_config' has no member named 'rd_table'
> 32 | .rd_table = &m10bmc_access_table,
> | ^~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:32:21: warning: excess elements in struct initializer
> 32 | .rd_table = &m10bmc_access_table,
> | ^
> drivers/mfd/intel-m10-bmc-spi.c:32:21: note: (near initialization for 'intel_m10bmc_regmap_config')
>>> drivers/mfd/intel-m10-bmc-spi.c:33:10: error: 'const struct regmap_config' has no member named 'max_register'
> 33 | .max_register = M10BMC_N3000_MEM_END,
> | ^~~~~~~~~~~~
> In file included from drivers/mfd/intel-m10-bmc-spi.c:11:
> include/linux/mfd/intel-m10-bmc.h:20:41: warning: excess elements in struct initializer
> 20 | #define M10BMC_N3000_FLASH_END 0x1fffffff
> | ^~~~~~~~~~
> include/linux/mfd/intel-m10-bmc.h:21:41: note: in expansion of macro 'M10BMC_N3000_FLASH_END'
> 21 | #define M10BMC_N3000_MEM_END M10BMC_N3000_FLASH_END
> | ^~~~~~~~~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:33:25: note: in expansion of macro 'M10BMC_N3000_MEM_END'
> 33 | .max_register = M10BMC_N3000_MEM_END,
> | ^~~~~~~~~~~~~~~~~~~~
> include/linux/mfd/intel-m10-bmc.h:20:41: note: (near initialization for 'intel_m10bmc_regmap_config')
> 20 | #define M10BMC_N3000_FLASH_END 0x1fffffff
> | ^~~~~~~~~~
> include/linux/mfd/intel-m10-bmc.h:21:41: note: in expansion of macro 'M10BMC_N3000_FLASH_END'
> 21 | #define M10BMC_N3000_MEM_END M10BMC_N3000_FLASH_END
> | ^~~~~~~~~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:33:25: note: in expansion of macro 'M10BMC_N3000_MEM_END'
> 33 | .max_register = M10BMC_N3000_MEM_END,
> | ^~~~~~~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c: In function 'intel_m10_bmc_spi_probe':
> drivers/mfd/intel-m10-bmc-spi.c:76:25: error: implicit declaration of function 'devm_regmap_init_spi_avmm' [-Werror=implicit-function-declaration]
> 76 | ddata->regmap = devm_regmap_init_spi_avmm(spi, &intel_m10bmc_regmap_config);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:76:23: warning: assignment to 'struct regmap *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
> 76 | ddata->regmap = devm_regmap_init_spi_avmm(spi, &intel_m10bmc_regmap_config);
> | ^
> drivers/mfd/intel-m10-bmc-spi.c: At top level:
> drivers/mfd/intel-m10-bmc-spi.c:120:34: error: array type has incomplete element type 'struct regmap_range'
> 120 | static const struct regmap_range m10bmc_d5005_fw_handshake_regs[] = {
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:130:34: error: array type has incomplete element type 'struct regmap_range'
> 130 | static const struct regmap_range m10bmc_n3000_fw_handshake_regs[] = {
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant
> 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
> | ^
> include/linux/compiler.h:243:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
> 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
> | ^~~~~~~~~~~~~~~~~
> include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
> 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
> | ^~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:142:38: note: in expansion of macro 'ARRAY_SIZE'
> 142 | .handshake_sys_reg_nranges = ARRAY_SIZE(m10bmc_n3000_fw_handshake_regs),
> | ^~~~~~~~~~
> include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant
> 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
> | ^
> include/linux/compiler.h:243:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
> 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
> | ^~~~~~~~~~~~~~~~~
> include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
> 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
> | ^~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:150:38: note: in expansion of macro 'ARRAY_SIZE'
> 150 | .handshake_sys_reg_nranges = ARRAY_SIZE(m10bmc_d5005_fw_handshake_regs),
> | ^~~~~~~~~~
> include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant
> 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
> | ^
> include/linux/compiler.h:243:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
> 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
> | ^~~~~~~~~~~~~~~~~
> include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
> 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
> | ^~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:158:38: note: in expansion of macro 'ARRAY_SIZE'
> 158 | .handshake_sys_reg_nranges = ARRAY_SIZE(m10bmc_n3000_fw_handshake_regs),
> | ^~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:22:41: error: storage size of 'm10bmc_access_table' isn't known
> 22 | static const struct regmap_access_table m10bmc_access_table = {
> | ^~~~~~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:27:35: error: storage size of 'intel_m10bmc_regmap_config' isn't known
> 27 | static const struct regmap_config intel_m10bmc_regmap_config = {
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:130:34: warning: 'm10bmc_n3000_fw_handshake_regs' defined but not used [-Wunused-variable]
> 130 | static const struct regmap_range m10bmc_n3000_fw_handshake_regs[] = {
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:120:34: warning: 'm10bmc_d5005_fw_handshake_regs' defined but not used [-Wunused-variable]
> 120 | static const struct regmap_range m10bmc_d5005_fw_handshake_regs[] = {
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/mfd/intel-m10-bmc-spi.c:16:34: warning: 'm10bmc_regmap_range' defined but not used [-Wunused-variable]
> 16 | static const struct regmap_range m10bmc_regmap_range[] = {
> | ^~~~~~~~~~~~~~~~~~~
> cc1: some warnings being treated as errors
>
>
> vim +28 drivers/mfd/intel-m10-bmc-spi.c
>
> 8169f74ca6f318 drivers/mfd/intel-m10-bmc.c Matthew Gerlach 2021-03-10 26
> 9842c62162858c drivers/mfd/intel-m10-bmc-spi.c Javier Carrasco 2024-07-04 27 static const struct regmap_config intel_m10bmc_regmap_config = {
> 876611c493b10c drivers/mfd/intel-m10-bmc.c Xu Yilun 2020-09-15 @28 .reg_bits = 32,
> 876611c493b10c drivers/mfd/intel-m10-bmc.c Xu Yilun 2020-09-15 @29 .val_bits = 32,
> 876611c493b10c drivers/mfd/intel-m10-bmc.c Xu Yilun 2020-09-15 @30 .reg_stride = 4,
> 8169f74ca6f318 drivers/mfd/intel-m10-bmc.c Matthew Gerlach 2021-03-10 @31 .wr_table = &m10bmc_access_table,
> 8169f74ca6f318 drivers/mfd/intel-m10-bmc.c Matthew Gerlach 2021-03-10 @32 .rd_table = &m10bmc_access_table,
> bcababfc60ccc6 drivers/mfd/intel-m10-bmc-spi.c Ilpo Järvinen 2023-01-16 @33 .max_register = M10BMC_N3000_MEM_END,
> 876611c493b10c drivers/mfd/intel-m10-bmc.c Xu Yilun 2020-09-15 34 };
> 876611c493b10c drivers/mfd/intel-m10-bmc.c Xu Yilun 2020-09-15 35
>
> :::::: The code at line 28 was first introduced by commit
> :::::: 876611c493b10cbb59e0e2143d3e744d0442de63 mfd: intel-m10-bmc: Add Intel MAX 10 BMC chip support for Intel FPGA PAC
>
> :::::: TO: Xu Yilun <yilun.xu@xxxxxxxxx>
> :::::: CC: Lee Jones <lee.jones@xxxxxxxxxx>
>


I followed the "how to reproduce" guide step by step, but it compiled
just fine (gcc-12.3.0 instead of 12.2.0, though).

On the other hand there has been a similar bug in hwmon[1] and it had
nothing to do with making the struct const, wich actually uncovered a
missing select (in that case REGMAP_I2C).

I would say we are facing the same thing here, and 'select
REGMAP_SPI_AVMM' is probably not enough. Is adding a 'select REGMAP_SPI'
for MFD_INTEL_M10_BMC_SPI the right approach? I could not test it myself
because as I said, it compiled without those errors.


Link:
https://lore.kernel.org/oe-kbuild-all/202410020246.2cTDDx0X-lkp@xxxxxxxxx/
[1]

Best regards,
Javier Carrasco