gpio: mcp23s08: Fix build error when CONFIG_SPI_MASTER=y && CONFIG_I2C=m
PATCH 1/1 gpio: mcp23s08: Fix build error when CONFIG_SPI_MASTER=y && CONFIG_I2C=m
This patch fixes below build error when CONFIG_SPI_MASTER=y && CONFIG_I2C=m && CONFIG_GPIO_MCP23S08=y.
LD init/built-in.odrivers/built-in.o: In function `mcp23017_write':
clkdev.c:(.text+0x1e14): undefined reference to i2c_smbus_write_word_data' drivers/built-in.o: In function mcp23017_read':
clkdev.c:(.text+0x1e24): undefined reference to i2c_smbus_read_word_data' drivers/built-in.o: In function mcp23008_write':
clkdev.c:(.text+0x1e8c): undefined reference to i2c_smbus_write_byte_data' drivers/built-in.o: In function mcp23008_read':
clkdev.c:(.text+0x1e98): undefined reference to i2c_smbus_read_byte_data' drivers/built-in.o: In function mcp23008_read_regs':
clkdev.c:(.text+0x1ed0): undefined reference to i2c_smbus_read_byte_data' drivers/built-in.o: In function mcp23s08_init':
clkdev.c:(.init.text+0x30): undefined reference to i2c_register_driver' drivers/built-in.o: In function mcp23s08_exit':
clkdev.c:(.exit.text+0x30): undefined reference to `i2c_del_driver'
make: *** [vmlinux] Error 1
When CONFIG_I2C=m, meaning we can't build the drivers in with I2C support. Thus don't allow the drivers to be compiled as built-in when CONFIG_I2C=m.
The real fix though is to break the driver apart into a SPI part, an I2C part and a common part. But that's something for 3.11 while this is something for 3.10/stable.
--- drivers/gpio/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/Kconfig +1 -1
@@ -636,7 +636,7 @@ config GPIO_MAX7301 config GPIO_MCP23S08 tristate "Microchip MCP23xxx I/O expander" - depends on SPI_MASTER || I2C + depends on (SPI_MASTER && I2C!=m) || I2C help SPI/I2C driver for Microchip MCP23S08/MCP23S17/MCP23008/MCP23017 I/O expanders.
Signature · 1 line
1.8.1.2
Quoted 9 lines · Axel Lin
This patch fixes below build error when
CONFIG_SPI_MASTER=y&&CONFIG_I2C=m&&CONFIG_GPIO_MCP23S08=y.When
CONFIG_I2C=m, meaning we can't build the drivers in with I2C support. Thus don't allow the drivers to be compiled as built-in whenCONFIG_I2C=m.
drivers/gpio/Kconfig config GPIO_MAX7301 · line 639
Quoted 5 lines
drivers/gpio/Kconfig +1
-1@@ -636,7 +636,7 @@ config GPIO_MAX7301 config GPIO_MCP23S08 tristate "Microchip MCP23xxx I/O expander" - depends on SPI_MASTER || I2C + depends on (SPI_MASTER && I2C!=m) || I2C
For me it looks like the result of the following will be the same
depends on (SPI_MASTER && !I2C) || I2C
--
With Best Regards,
Andy Shevchenko
Quoted 11 lines
drivers/gpio/Kconfig config GPIO_MAX7301 · line 639
Quoted 8 lines
drivers/gpio/Kconfig +1
-1@@ -636,7 +636,7 @@ config GPIO_MAX7301 config GPIO_MCP23S08 tristate "Microchip MCP23xxx I/O expander" - depends on SPI_MASTER || I2C + depends on (SPI_MASTER && I2C!=m) || I2CFor me it looks like the result of the following will be the same
depends on (SPI_MASTER&& !I2C) || I2C
Yes, I think the result is the same.
I just send a v2.
So you can Ack the version you prefer.
Thanks for the review.
Axel