Skip to contentSkip to conversation

drivers/hwmon/tmp513.c:163:10: error: 'const struct regmap_config' has no member named 'reg_bits'

DISCUSSION kernel test robot 3 participants 3 messages Oct 1, 2024

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e32cde8d2bd7d251a8f9b434143977ddf13dcec6
commit: 4bc82dd20be09fa133bf3116be6afc933497f860 hwmon: (tmp513) Constify struct regmap_config
date:   3 months ago
config: x86_64-randconfig-r133-20240215 (https://download.01.org/0day-ci/archive/20241002/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

drivers/hwmon/tmp513.c:162:21: error: variable 'tmp51x_regmap_config' has initializer but incomplete type

     162 | static const struct regmap_config tmp51x_regmap_config = {
         |                     ^~~~~~~~~~~~~
>> drivers/hwmon/tmp513.c:163:10: error: 'const struct regmap_config' has no member named 'reg_bits'
     163 |         .reg_bits = 8,
         |          ^~~~~~~~
   drivers/hwmon/tmp513.c:163:21: warning: excess elements in struct initializer
     163 |         .reg_bits = 8,
         |                     ^
   drivers/hwmon/tmp513.c:163:21: note: (near initialization for 'tmp51x_regmap_config')
>> drivers/hwmon/tmp513.c:164:10: error: 'const struct regmap_config' has no member named 'val_bits'
     164 |         .val_bits = 16,
         |          ^~~~~~~~
   drivers/hwmon/tmp513.c:164:21: warning: excess elements in struct initializer
     164 |         .val_bits = 16,
         |                     ^~
   drivers/hwmon/tmp513.c:164:21: note: (near initialization for 'tmp51x_regmap_config')
>> drivers/hwmon/tmp513.c:165:10: error: 'const struct regmap_config' has no member named 'max_register'
     165 |         .max_register = TMP51X_MAX_REGISTER_ADDR,
         |          ^~~~~~~~~~~~
   drivers/hwmon/tmp513.c:79:41: warning: excess elements in struct initializer
      79 | #define TMP51X_MAX_REGISTER_ADDR        0xFF
         |                                         ^~~~
   drivers/hwmon/tmp513.c:165:25: note: in expansion of macro 'TMP51X_MAX_REGISTER_ADDR'
     165 |         .max_register = TMP51X_MAX_REGISTER_ADDR,
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hwmon/tmp513.c:79:41: note: (near initialization for 'tmp51x_regmap_config')
      79 | #define TMP51X_MAX_REGISTER_ADDR        0xFF
         |                                         ^~~~
   drivers/hwmon/tmp513.c:165:25: note: in expansion of macro 'TMP51X_MAX_REGISTER_ADDR'
     165 |         .max_register = TMP51X_MAX_REGISTER_ADDR,
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hwmon/tmp513.c: In function 'tmp51x_probe':
   drivers/hwmon/tmp513.c:726:24: error: implicit declaration of function 'devm_regmap_init_i2c' [-Werror=implicit-function-declaration]
     726 |         data->regmap = devm_regmap_init_i2c(client, &tmp51x_regmap_config);
         |                        ^~~~~~~~~~~~~~~~~~~~
   drivers/hwmon/tmp513.c:726:22: warning: assignment to 'struct regmap *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     726 |         data->regmap = devm_regmap_init_i2c(client, &tmp51x_regmap_config);
         |                      ^
   drivers/hwmon/tmp513.c: At top level:
   drivers/hwmon/tmp513.c:756:1: warning: data definition has no type or storage class
     756 | module_i2c_driver(tmp51x_driver);
         | ^~~~~~~~~~~~~~~~~
   drivers/hwmon/tmp513.c:756:1: error: type defaults to 'int' in declaration of 'module_i2c_driver' [-Werror=implicit-int]
   drivers/hwmon/tmp513.c:756:1: warning: parameter names (without types) in function declaration
   drivers/hwmon/tmp513.c:162:35: error: storage size of 'tmp51x_regmap_config' isn't known
     162 | static const struct regmap_config tmp51x_regmap_config = {
         |                                   ^~~~~~~~~~~~~~~~~~~~
   drivers/hwmon/tmp513.c:747:26: warning: 'tmp51x_driver' defined but not used [-Wunused-variable]
     747 | static struct i2c_driver tmp51x_driver = {
         |                          ^~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +163 drivers/hwmon/tmp513.c

59dfa75e5d82a1 Eric Tremblay 2019-11-12 161

4bc82dd20be09f Javier Carrasco 2024-07-02  162  static const struct regmap_config tmp51x_regmap_config = {
59dfa75e5d82a1 Eric Tremblay   2019-11-12 @163  	.reg_bits = 8,
59dfa75e5d82a1 Eric Tremblay   2019-11-12 @164  	.val_bits = 16,
59dfa75e5d82a1 Eric Tremblay   2019-11-12 @165  	.max_register = TMP51X_MAX_REGISTER_ADDR,
59dfa75e5d82a1 Eric Tremblay   2019-11-12  166  };

59dfa75e5d82a1 Eric Tremblay 2019-11-12 167

:::::: The code at line 163 was first introduced by commit
:::::: 59dfa75e5d82a1e1b3d090a1d51fc14f66844576 hwmon: Add driver for Texas Instruments TMP512/513 sensor chips.

:::::: TO: Eric Tremblay <[email protected]> :::::: CC: Guenter Roeck <[email protected]>

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 77 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e32cde8d2bd7d251a8f9b434143977ddf13dcec6
commit: 4bc82dd20be09fa133bf3116be6afc933497f860 hwmon: (tmp513) Constify struct regmap_config
date:   3 months ago
config: x86_64-randconfig-r133-20240215 (https://download.01.org/0day-ci/archive/20241002/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

   drivers/hwmon/tmp513.c:162:21: error: variable 'tmp51x_regmap_config' has initializer but incomplete type
     162 | static const struct regmap_config tmp51x_regmap_config = {
         |                     ^~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

drivers/hwmon/tmp513.c:163:10: error: 'const struct regmap_config' has no member named 'reg_bits'

     163 |         .reg_bits = 8,
         |          ^~~~~~~~
   drivers/hwmon/tmp513.c:163:21: warning: excess elements in struct initializer
     163 |         .reg_bits = 8,
         |                     ^

drivers/hwmon/tmp513.c:163:21: note: (near initialization for 'tmp51x_regmap_config')

Quoted 1 line
Quoted 1 line

drivers/hwmon/tmp513.c:164:10: error: 'const struct regmap_config' has no member named 'val_bits'

     164 |         .val_bits = 16,
         |          ^~~~~~~~
   drivers/hwmon/tmp513.c:164:21: warning: excess elements in struct initializer
     164 |         .val_bits = 16,
         |                     ^~

drivers/hwmon/tmp513.c:164:21: note: (near initialization for 'tmp51x_regmap_config')

Quoted 1 line
Quoted 1 line

drivers/hwmon/tmp513.c:165:10: error: 'const struct regmap_config' has no member named 'max_register'

165 | .max_register = TMP51X_MAX_REGISTER_ADDR,
| ^~~~~~~~~~~~
drivers/hwmon/tmp513.c:79:41: warning: excess elements in struct initializer

      79 | #define TMP51X_MAX_REGISTER_ADDR        0xFF
         |                                         ^~~~
   drivers/hwmon/tmp513.c:165:25: note: in expansion of macro 'TMP51X_MAX_REGISTER_ADDR'
     165 |         .max_register = TMP51X_MAX_REGISTER_ADDR,
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hwmon/tmp513.c:79:41: note: (near initialization for 'tmp51x_regmap_config')
      79 | #define TMP51X_MAX_REGISTER_ADDR        0xFF
         |                                         ^~~~
   drivers/hwmon/tmp513.c:165:25: note: in expansion of macro 'TMP51X_MAX_REGISTER_ADDR'
     165 |         .max_register = TMP51X_MAX_REGISTER_ADDR,
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hwmon/tmp513.c: In function 'tmp51x_probe':
   drivers/hwmon/tmp513.c:726:24: error: implicit declaration of function 'devm_regmap_init_i2c' [-Werror=implicit-function-declaration]
     726 |         data->regmap = devm_regmap_init_i2c(client, &tmp51x_regmap_config);
         |                        ^~~~~~~~~~~~~~~~~~~~
   drivers/hwmon/tmp513.c:726:22: warning: assignment to 'struct regmap *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     726 |         data->regmap = devm_regmap_init_i2c(client, &tmp51x_regmap_config);
         |                      ^
   drivers/hwmon/tmp513.c: At top level:
   drivers/hwmon/tmp513.c:756:1: warning: data definition has no type or storage class
     756 | module_i2c_driver(tmp51x_driver);
         | ^~~~~~~~~~~~~~~~~
   drivers/hwmon/tmp513.c:756:1: error: type defaults to 'int' in declaration of 'module_i2c_driver' [-Werror=implicit-int]
   drivers/hwmon/tmp513.c:756:1: warning: parameter names (without types) in function declaration
   drivers/hwmon/tmp513.c:162:35: error: storage size of 'tmp51x_regmap_config' isn't known
     162 | static const struct regmap_config tmp51x_regmap_config = {
         |                                   ^~~~~~~~~~~~~~~~~~~~
   drivers/hwmon/tmp513.c:747:26: warning: 'tmp51x_driver' defined but not used [-Wunused-variable]
     747 | static struct i2c_driver tmp51x_driver = {
         |                          ^~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +163 drivers/hwmon/tmp513.c

59dfa75e5d82a1 Eric Tremblay 2019-11-12 161

4bc82dd20be09f Javier Carrasco 2024-07-02  162  static const struct regmap_config tmp51x_regmap_config = {
59dfa75e5d82a1 Eric Tremblay   2019-11-12 @163  	.reg_bits = 8,
59dfa75e5d82a1 Eric Tremblay   2019-11-12 @164  	.val_bits = 16,
59dfa75e5d82a1 Eric Tremblay   2019-11-12 @165  	.max_register = TMP51X_MAX_REGISTER_ADDR,
59dfa75e5d82a1 Eric Tremblay   2019-11-12  166  };
Quoted 8 lines

59dfa75e5d82a1 Eric Tremblay 2019-11-12 167

:::::: The code at line 163 was first introduced by commit
:::::: 59dfa75e5d82a1e1b3d090a1d51fc14f66844576 hwmon: Add driver for Texas Instruments TMP512/513 sensor chips.

:::::: TO: Eric Tremblay <[email protected]> :::::: CC: Guenter Roeck <[email protected]>

The bug is not in that commit, the Kconfig entry for this driver is missing a 'select REGMAP_I2C'. I just tested it and then it builds without any issues.

I can send a patch to fix that, but I would like to know what commit it really fixes: the one that introduced the driver as it already used regmap and did not include the required select? Or the one from this report because it triggered, even though it is not the real source of the issue?

Thanks and best regards,
Javier Carrasco

#2 lore raw

On 10/1/24 11:53, Javier Carrasco wrote:
[ ... ]

Quoted 11 lines

The bug is not in that commit, the Kconfig entry for this driver is missing a 'select REGMAP_I2C'. I just tested it and then it builds without any issues.

I can send a patch to fix that, but I would like to know what commit it really fixes: the one that introduced the driver as it already used regmap and did not include the required select? Or the one from this report because it triggered, even though it is not the real source of the issue?

I have no idea why this is reported now, but the problem was introduced with the driver, and as you have noticed I already submitted a fix.

Thanks a lot for reviewing it!

Guenter