Skip to contentSkip to conversation

i2c: Provide a stub for i2c_detect_slave_mode()

PATCH In review Andy Shevchenko 2 participants 2 messages Jul 6, 2017 – Jul 8, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: Provide a stub for i2c_detect_slave_mode()

Drivers would like to call i2c_detect_slave_mode() even if !I2C_SLAVE. Give them what they want to,

Otherwise kernel will not compile:
drivers/i2c/busses/i2c-designware-platdrv.c: In function ‘dw_i2c_plat_probe’:
drivers/i2c/busses/i2c-designware-platdrv.c:331:6: error: implicit declaration of function ‘i2c_detect_slave_mode’ [-Werror=implicit-function-declaration]
if (i2c_detect_slave_mode(&pdev->dev))

      ^~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

Fixes 6e38cf3b4421 ("i2c: designware: Let slave adapter support be optional")
---
 include/linux/i2c.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/i2c.h +2 -0
index 72d0ece70ed3..00ca5b86a753 100644
@@ -295,6 +295,8 @@ static inline int i2c_slave_event(struct i2c_client *client,
 {
 	return client->slave_cb(client, event, val);
 }
+#else
+static inline bool i2c_detect_slave_mode(struct device *dev) { return false; }
 #endif
 
 /**
Signature · 1 line
2.11.0
#1 lore raw
Quoted 7 lines · Andy Shevchenko

Drivers would like to call i2c_detect_slave_mode() even if !I2C_SLAVE. Give them what they want to,

Otherwise kernel will not compile:
drivers/i2c/busses/i2c-designware-platdrv.c: In function ‘dw_i2c_plat_probe’:
drivers/i2c/busses/i2c-designware-platdrv.c:331:6: error: implicit declaration of function ‘i2c_detect_slave_mode’ [-Werror=implicit-function-declaration]
if (i2c_detect_slave_mode(&pdev->dev))

Quoted 6 lines
      ^~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

Fixes 6e38cf3b4421 ("i2c: designware: Let slave adapter support be optional")

I'll apply it and push out. Buildbot found this issue as well and should give me a success report...

Thanks!