media: cec: i2c: ch7322: also select REGMAP

Message ID 20230608025435.29249-1-rdunlap@infradead.org
State New
Headers
Series media: cec: i2c: ch7322: also select REGMAP |

Commit Message

Randy Dunlap June 8, 2023, 2:54 a.m. UTC
  Selecting only REGMAP_I2C can leave REGMAP unset, causing build errors,
so also select REGMAP to prevent the build errors.

../drivers/media/cec/i2c/ch7322.c:158:21: error: variable 'ch7322_regmap' has initializer but incomplete type
  158 | static const struct regmap_config ch7322_regmap = {
../drivers/media/cec/i2c/ch7322.c:159:10: error: 'const struct regmap_config' has no member named 'reg_bits'
  159 |         .reg_bits = 8,
../drivers/media/cec/i2c/ch7322.c:159:21: warning: excess elements in struct initializer
  159 |         .reg_bits = 8,
../drivers/media/cec/i2c/ch7322.c:160:10: error: 'const struct regmap_config' has no member named 'val_bits'
  160 |         .val_bits = 8,
../drivers/media/cec/i2c/ch7322.c:160:21: warning: excess elements in struct initializer
  160 |         .val_bits = 8,
../drivers/media/cec/i2c/ch7322.c:161:10: error: 'const struct regmap_config' has no member named 'max_register'
  161 |         .max_register = 0x7f,
../drivers/media/cec/i2c/ch7322.c:161:25: warning: excess elements in struct initializer
  161 |         .max_register = 0x7f,
../drivers/media/cec/i2c/ch7322.c:162:10: error: 'const struct regmap_config' has no member named 'disable_locking'
  162 |         .disable_locking = true,
../drivers/media/cec/i2c/ch7322.c:162:28: warning: excess elements in struct initializer
  162 |         .disable_locking = true,
../drivers/media/cec/i2c/ch7322.c: In function 'ch7322_probe':
../drivers/media/cec/i2c/ch7322.c:468:26: error: implicit declaration of function 'devm_regmap_init_i2c' [-Werror=implicit-function-declaration]
  468 |         ch7322->regmap = devm_regmap_init_i2c(client, &ch7322_regmap);
../drivers/media/cec/i2c/ch7322.c:468:24: warning: assignment to 'struct regmap *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  468 |         ch7322->regmap = devm_regmap_init_i2c(client, &ch7322_regmap);
../drivers/media/cec/i2c/ch7322.c: At top level:
../drivers/media/cec/i2c/ch7322.c:158:35: error: storage size of 'ch7322_regmap' isn't known
  158 | static const struct regmap_config ch7322_regmap = {

Fixes: 21b9a47e0ec7 ("media: cec: i2c: ch7322: Add ch7322 CEC controller driver")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Jeff Chase <jnchase@google.com>
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Joe Tessler <jrt@google.com>
Cc: linux-media@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mark Brown <broonie@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
---
 drivers/media/cec/i2c/Kconfig |    1 +
 1 file changed, 1 insertion(+)
  

Comments

Joe Tessler June 8, 2023, 6:28 p.m. UTC | #1
On Wed, Jun 7, 2023 at 10:54 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> Selecting only REGMAP_I2C can leave REGMAP unset, causing build errors,
> so also select REGMAP to prevent the build errors.

Hi Randy,

I'm curious how you got into this state given that REGMAP is "default
y" when REGMAP_I2C is set.

$ grep -w REGMAP -A4 linux-6.3.6/drivers/base/regmap/Kconfig
config REGMAP
  default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1
|| REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SOUNDWIRE ||
REGMAP_SOUNDWIRE_MBQ || REGMAP_SCCB || REGMAP_I3C || REGMAP_SPI_AVMM
|| REGMAP_MDIO || REGMAP_FSI)
  select IRQ_DOMAIN if REGMAP_IRQ
  select MDIO_BUS if REGMAP_MDIO
  bool

FWIW, I only see four cases where both REGMAP and REGMAP_I2C are
selected in the linux-6.3.6 tree (out of 400+ REGMAP_I2C instances).

Joe

>
> ../drivers/media/cec/i2c/ch7322.c:158:21: error: variable 'ch7322_regmap' has initializer but incomplete type
>   158 | static const struct regmap_config ch7322_regmap = {
> ../drivers/media/cec/i2c/ch7322.c:159:10: error: 'const struct regmap_config' has no member named 'reg_bits'
>   159 |         .reg_bits = 8,
> ../drivers/media/cec/i2c/ch7322.c:159:21: warning: excess elements in struct initializer
>   159 |         .reg_bits = 8,
> ../drivers/media/cec/i2c/ch7322.c:160:10: error: 'const struct regmap_config' has no member named 'val_bits'
>   160 |         .val_bits = 8,
> ../drivers/media/cec/i2c/ch7322.c:160:21: warning: excess elements in struct initializer
>   160 |         .val_bits = 8,
> ../drivers/media/cec/i2c/ch7322.c:161:10: error: 'const struct regmap_config' has no member named 'max_register'
>   161 |         .max_register = 0x7f,
> ../drivers/media/cec/i2c/ch7322.c:161:25: warning: excess elements in struct initializer
>   161 |         .max_register = 0x7f,
> ../drivers/media/cec/i2c/ch7322.c:162:10: error: 'const struct regmap_config' has no member named 'disable_locking'
>   162 |         .disable_locking = true,
> ../drivers/media/cec/i2c/ch7322.c:162:28: warning: excess elements in struct initializer
>   162 |         .disable_locking = true,
> ../drivers/media/cec/i2c/ch7322.c: In function 'ch7322_probe':
> ../drivers/media/cec/i2c/ch7322.c:468:26: error: implicit declaration of function 'devm_regmap_init_i2c' [-Werror=implicit-function-declaration]
>   468 |         ch7322->regmap = devm_regmap_init_i2c(client, &ch7322_regmap);
> ../drivers/media/cec/i2c/ch7322.c:468:24: warning: assignment to 'struct regmap *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>   468 |         ch7322->regmap = devm_regmap_init_i2c(client, &ch7322_regmap);
> ../drivers/media/cec/i2c/ch7322.c: At top level:
> ../drivers/media/cec/i2c/ch7322.c:158:35: error: storage size of 'ch7322_regmap' isn't known
>   158 | static const struct regmap_config ch7322_regmap = {
>
> Fixes: 21b9a47e0ec7 ("media: cec: i2c: ch7322: Add ch7322 CEC controller driver")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Jeff Chase <jnchase@google.com>
> Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> Cc: Joe Tessler <jrt@google.com>
> Cc: linux-media@vger.kernel.org
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Masahiro Yamada <masahiroy@kernel.org>
> ---
>  drivers/media/cec/i2c/Kconfig |    1 +
>  1 file changed, 1 insertion(+)
>
> diff -- a/drivers/media/cec/i2c/Kconfig b/drivers/media/cec/i2c/Kconfig
> --- a/drivers/media/cec/i2c/Kconfig
> +++ b/drivers/media/cec/i2c/Kconfig
> @@ -5,6 +5,7 @@
>  config CEC_CH7322
>         tristate "Chrontel CH7322 CEC controller"
>         depends on I2C
> +       select REGMAP
>         select REGMAP_I2C
>         select CEC_CORE
>         help
  

Patch

diff -- a/drivers/media/cec/i2c/Kconfig b/drivers/media/cec/i2c/Kconfig
--- a/drivers/media/cec/i2c/Kconfig
+++ b/drivers/media/cec/i2c/Kconfig
@@ -5,6 +5,7 @@ 
 config CEC_CH7322
 	tristate "Chrontel CH7322 CEC controller"
 	depends on I2C
+	select REGMAP
 	select REGMAP_I2C
 	select CEC_CORE
 	help