Commit 5d388143 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Wolfram Sang

i2c: gxp: fix build failure without CONFIG_I2C_SLAVE

The gxp_i2c_slave_irq_handler() is hidden in an #ifdef, but the
caller uses an IS_ENABLED() check:

drivers/i2c/busses/i2c-gxp.c: In function 'gxp_i2c_irq_handler':
drivers/i2c/busses/i2c-gxp.c:467:29: error: implicit declaration of function 'gxp_i2c_slave_irq_handler'; did you mean 'gxp_i2c_irq_handler'? [-Werror=implicit-function-declaration]

It has to consistently use one method or the other to avoid warnings,
so move to IS_ENABLED() here for readability and build coverage, and
move the #ifdef in linux/i2c.h to allow building it as dead code.

Fixes: 4a55ed6f ("i2c: Add GXP SoC I2C Controller")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarNick Hawkins <nick.hawkins@hpe.com>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent fa390658
...@@ -353,7 +353,6 @@ static void gxp_i2c_chk_data_ack(struct gxp_i2c_drvdata *drvdata) ...@@ -353,7 +353,6 @@ static void gxp_i2c_chk_data_ack(struct gxp_i2c_drvdata *drvdata)
writew(value, drvdata->base + GXP_I2CMCMD); writew(value, drvdata->base + GXP_I2CMCMD);
} }
#if IS_ENABLED(CONFIG_I2C_SLAVE)
static bool gxp_i2c_slave_irq_handler(struct gxp_i2c_drvdata *drvdata) static bool gxp_i2c_slave_irq_handler(struct gxp_i2c_drvdata *drvdata)
{ {
u8 value; u8 value;
...@@ -437,7 +436,6 @@ static bool gxp_i2c_slave_irq_handler(struct gxp_i2c_drvdata *drvdata) ...@@ -437,7 +436,6 @@ static bool gxp_i2c_slave_irq_handler(struct gxp_i2c_drvdata *drvdata)
return true; return true;
} }
#endif
static irqreturn_t gxp_i2c_irq_handler(int irq, void *_drvdata) static irqreturn_t gxp_i2c_irq_handler(int irq, void *_drvdata)
{ {
......
...@@ -385,7 +385,6 @@ static inline void i2c_set_clientdata(struct i2c_client *client, void *data) ...@@ -385,7 +385,6 @@ static inline void i2c_set_clientdata(struct i2c_client *client, void *data)
/* I2C slave support */ /* I2C slave support */
#if IS_ENABLED(CONFIG_I2C_SLAVE)
enum i2c_slave_event { enum i2c_slave_event {
I2C_SLAVE_READ_REQUESTED, I2C_SLAVE_READ_REQUESTED,
I2C_SLAVE_WRITE_REQUESTED, I2C_SLAVE_WRITE_REQUESTED,
...@@ -396,9 +395,10 @@ enum i2c_slave_event { ...@@ -396,9 +395,10 @@ enum i2c_slave_event {
int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb); int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb);
int i2c_slave_unregister(struct i2c_client *client); int i2c_slave_unregister(struct i2c_client *client);
bool i2c_detect_slave_mode(struct device *dev);
int i2c_slave_event(struct i2c_client *client, int i2c_slave_event(struct i2c_client *client,
enum i2c_slave_event event, u8 *val); enum i2c_slave_event event, u8 *val);
#if IS_ENABLED(CONFIG_I2C_SLAVE)
bool i2c_detect_slave_mode(struct device *dev);
#else #else
static inline bool i2c_detect_slave_mode(struct device *dev) { return false; } static inline bool i2c_detect_slave_mode(struct device *dev) { return false; }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment