i2c: Only include slave support if selected
Subsystems (2)
PATCH v2 1/1 i2c: Only include slave support if selected
Make the slave support depend on CONFIG_I2C_SLAVE. Otherwise it gets included unconditionally, even when it is not needed.
---
Changes since v1:
* Let I2C_RCAR select I2C_SLAVE
Wolfram, you mentioned i2c-sh_mobile but that driver doesn't seem to implement slave support in v3.19-rc6 so I did not include it. Feel free to add more selects to drivers/i2c/busses/Kconfig to match the current state of your i2c tree.
drivers/i2c/busses/Kconfig | 1 + drivers/i2c/i2c-core.c | 2 ++ include/linux/i2c.h | 4 ++++ 3 files changed, 7 insertions(+)
drivers/i2c/i2c-core.c +2 -0
@@ -2962,6 +2962,7 @@ trace: }EXPORT_SYMBOL (i2c_smbus_xfer); +#if IS_ENABLED (CONFIG_I2C_SLAVE )int i2c_slave_register (struct i2c_client *client,i2c_slave_cb_t slave_cb) {int ret;
@@ -3009,6 +3010,7 @@ int i2c_slave_unregister(struct i2c_clie return ret; }EXPORT_SYMBOL_GPL (i2c_slave_unregister); +#endif MODULE_AUTHOR ("Simon G. Vogl <simon-nD9nYVNVf00W+b/[email protected]>" );MODULE_DESCRIPTION ("I2C-Bus main module" );
include/linux/i2c.h +4 -0
@@ -222,7 +222,9 @@ struct i2c_client {struct device dev;/* the device structure */ int irq;/* irq issued by device */ struct list_head detected; +#if IS_ENABLED (CONFIG_I2C_SLAVE )i2c_slave_cb_t slave_cb;/* callback for slave mode */ +#endif };#define to_i2c_client (d) container_of(d, struct i2c_client, dev)
@@ -247,6 +249,7 @@ static inline void i2c_set_clientdata(st/* I2C slave support */ +#if IS_ENABLED (CONFIG_I2C_SLAVE )enum i2c_slave_event {I2C_SLAVE_REQ_READ_START , I2C_SLAVE_REQ_READ_END,
@@ -263,6 +266,7 @@ static inline int i2c_slave_event(struct {return client->slave_cb (client, event, val); } +#endif /** * struct i2c_board_info - template for device creation
drivers/i2c/busses/Kconfig +1 -0
@@ -881,6 +881,7 @@ config I2C_XLR config I2C_RCAR tristate "Renesas R-Car I2C Controller" depends on ARCH_SHMOBILE || COMPILE_TEST + select I2C_SLAVE help If you say yes to this option, support will be included for the R-Car I2C controller.
Signature · 2 lines
Jean Delvare SUSE L3 Support
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 5 lines · Jean Delvare
Make the slave support depend on
CONFIG_I2C_SLAVE. Otherwise it gets included unconditionally, even when it is not needed.Signed-off-by Jean Delvare <[email protected]>Cc Wolfram Sang <wsa-z923LK4zBo2bacvFa/[email protected]>
Quoted 8 lines
---
Changes since v1:
* LetI2C_RCARselectI2C_SLAVEWolfram, you mentioned i2c-sh_mobile but that driver doesn't seem to implement slave support in v3.19-rc6 so I did not include it. Feel free to add more selects to
drivers/i2c/busses/Kconfigto match the current state of your i2c tree.
Sorry, my bad. I meant the RCAR driver which you spotted. What about the function pointers in the algo struct?
Quoted 10 lines · Wolfram Sang
Quoted 9 lines · Jean Delvare
Make the slave support depend on
CONFIG_I2C_SLAVE. Otherwise it gets included unconditionally, even when it is not needed.Signed-off-by Jean Delvare <[email protected]>Cc Wolfram Sang <wsa-z923LK4zBo2bacvFa/[email protected]>---
Changes since v1:
* LetI2C_RCARselectI2C_SLAVE
Quoted 7 lines
Quoted 4 lines
Wolfram, you mentioned i2c-sh_mobile but that driver doesn't seem to implement slave support in v3.19-rc6 so I did not include it. Feel free to add more selects to
drivers/i2c/busses/Kconfigto match the current state of your i2c tree.Sorry, my bad. I meant the RCAR driver which you spotted. What about the function pointers in the algo struct?
Doh, forgot about them once again. Stay tuned, patch v3 is coming...
Signature · 2 lines
Jean Delvare SUSE L3 Support