[PATCH -next] extcon: fix fsa9480 Kconfig warning and build errors

From: Randy Dunlap
Date: Tue Jun 25 2019 - 21:10:57 EST


From: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>

Fix Kconfig dependency warning and subsequent build errors caused by
the Kconfig entry for EXTCON-FSA9480. It should not select
REGMAP_I2C unless I2C is already set/enabled.

WARNING: unmet direct dependencies detected for REGMAP_I2C
Depends on [n]: I2C [=n]
Selected by [y]:
- EXTCON_FSA9480 [=y] && EXTCON [=y] && INPUT [=y]

../drivers/base/regmap/regmap-i2c.c: In function âregmap_smbus_byte_reg_readâ:
../drivers/base/regmap/regmap-i2c.c:25:2: error: implicit declaration of function âi2c_smbus_read_byte_dataâ [-Werror=implicit-function-declaration]
ret = i2c_smbus_read_byte_data(i2c, reg);
^
../drivers/base/regmap/regmap-i2c.c: In function âregmap_smbus_byte_reg_writeâ:
../drivers/base/regmap/regmap-i2c.c:43:2: error: implicit declaration of function âi2c_smbus_write_byte_dataâ [-Werror=implicit-function-declaration]
return i2c_smbus_write_byte_data(i2c, reg, val);
../drivers/base/regmap/regmap-i2c.c: In function âregmap_smbus_word_reg_readâ:
../drivers/base/regmap/regmap-i2c.c:61:2: error: implicit declaration of function âi2c_smbus_read_word_dataâ [-Werror=implicit-function-declaration]
ret = i2c_smbus_read_word_data(i2c, reg);
../drivers/base/regmap/regmap-i2c.c: In function âregmap_smbus_word_reg_writeâ:
../drivers/base/regmap/regmap-i2c.c:79:2: error: implicit declaration of function âi2c_smbus_write_word_dataâ [-Werror=implicit-function-declaration]
return i2c_smbus_write_word_data(i2c, reg, val);
../drivers/base/regmap/regmap-i2c.c: In function âregmap_smbus_word_read_swappedâ:
../drivers/base/regmap/regmap-i2c.c:97:2: error: implicit declaration of function âi2c_smbus_read_word_swappedâ [-Werror=implicit-function-declaration]
ret = i2c_smbus_read_word_swapped(i2c, reg);
../drivers/base/regmap/regmap-i2c.c: In function âregmap_smbus_word_write_swappedâ:
../drivers/base/regmap/regmap-i2c.c:115:2: error: implicit declaration of function âi2c_smbus_write_word_swappedâ [-Werror=implicit-function-declaration]
return i2c_smbus_write_word_swapped(i2c, reg, val);
../drivers/base/regmap/regmap-i2c.c: In function âregmap_i2c_writeâ:
../drivers/base/regmap/regmap-i2c.c:129:2: error: implicit declaration of function âi2c_master_sendâ [-Werror=implicit-function-declaration]
ret = i2c_master_send(i2c, data, count);
../drivers/base/regmap/regmap-i2c.c: In function âregmap_i2c_gather_writeâ:
../drivers/base/regmap/regmap-i2c.c:150:2: error: implicit declaration of function âi2c_check_functionalityâ [-Werror=implicit-function-declaration]
if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_NOSTART))
../drivers/base/regmap/regmap-i2c.c:163:2: error: implicit declaration of function âi2c_transferâ [-Werror=implicit-function-declaration]
ret = i2c_transfer(i2c->adapter, xfer, 2);
../drivers/base/regmap/regmap-i2c.c: In function âregmap_i2c_smbus_i2c_writeâ:
../drivers/base/regmap/regmap-i2c.c:218:2: error: implicit declaration of function âi2c_smbus_write_i2c_block_dataâ [-Werror=implicit-function-declaration]
return i2c_smbus_write_i2c_block_data(i2c, ((u8 *)data)[0], count,
../drivers/base/regmap/regmap-i2c.c: In function âregmap_i2c_smbus_i2c_readâ:
../drivers/base/regmap/regmap-i2c.c:233:2: error: implicit declaration of function âi2c_smbus_read_i2c_block_dataâ [-Werror=implicit-function-declaration]
ret = i2c_smbus_read_i2c_block_data(i2c, ((u8 *)reg)[0], val_size, val);

../drivers/extcon/extcon-fsa9480.c: In function âfsa9480_module_initâ:
../drivers/extcon/extcon-fsa9480.c:383:2: error: implicit declaration of function âi2c_add_driverâ [-Werror=implicit-function-declaration]
return i2c_add_driver(&fsa9480_i2c_driver);
../drivers/extcon/extcon-fsa9480.c: In function âfsa9480_module_exitâ:
../drivers/extcon/extcon-fsa9480.c:389:2: error: implicit declaration of function âi2c_del_driverâ [-Werror=implicit-function-declaration]
i2c_del_driver(&fsa9480_i2c_driver);

Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Cc: Tomasz Figa <tomasz.figa@xxxxxxxxx>
Cc: MyungJoo Ham <myungjoo.ham@xxxxxxxxxxx>
Cc: Chanwoo Choi <cw00.choi@xxxxxxxxxxx>
---
Found in mmotm; applies to linux-next.

To extcon maintainers: there are a few more extcon driver Kconfig
entries that seem to have this same problem of selecting REGMAP_I2C
without checking that I2C is set/enabled.

drivers/extcon/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- mmotm-2019-0625-1620.orig/drivers/extcon/Kconfig
+++ mmotm-2019-0625-1620/drivers/extcon/Kconfig
@@ -39,7 +39,7 @@ config EXTCON_AXP288

config EXTCON_FSA9480
tristate "FSA9480 EXTCON Support"
- depends on INPUT
+ depends on INPUT && I2C
select IRQ_DOMAIN
select REGMAP_I2C
help