Skip to content

Commit 5d38814

Browse files
arndbwsakernel
authored andcommitted
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: 4a55ed6 ("i2c: Add GXP SoC I2C Controller") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Nick Hawkins <nick.hawkins@hpe.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent fa39065 commit 5d38814

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

drivers/i2c/busses/i2c-gxp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ static void gxp_i2c_chk_data_ack(struct gxp_i2c_drvdata *drvdata)
353353
writew(value, drvdata->base + GXP_I2CMCMD);
354354
}
355355

356-
#if IS_ENABLED(CONFIG_I2C_SLAVE)
357356
static bool gxp_i2c_slave_irq_handler(struct gxp_i2c_drvdata *drvdata)
358357
{
359358
u8 value;
@@ -437,7 +436,6 @@ static bool gxp_i2c_slave_irq_handler(struct gxp_i2c_drvdata *drvdata)
437436

438437
return true;
439438
}
440-
#endif
441439

442440
static irqreturn_t gxp_i2c_irq_handler(int irq, void *_drvdata)
443441
{

include/linux/i2c.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ static inline void i2c_set_clientdata(struct i2c_client *client, void *data)
385385

386386
/* I2C slave support */
387387

388-
#if IS_ENABLED(CONFIG_I2C_SLAVE)
389388
enum i2c_slave_event {
390389
I2C_SLAVE_READ_REQUESTED,
391390
I2C_SLAVE_WRITE_REQUESTED,
@@ -396,9 +395,10 @@ enum i2c_slave_event {
396395

397396
int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb);
398397
int i2c_slave_unregister(struct i2c_client *client);
399-
bool i2c_detect_slave_mode(struct device *dev);
400398
int i2c_slave_event(struct i2c_client *client,
401399
enum i2c_slave_event event, u8 *val);
400+
#if IS_ENABLED(CONFIG_I2C_SLAVE)
401+
bool i2c_detect_slave_mode(struct device *dev);
402402
#else
403403
static inline bool i2c_detect_slave_mode(struct device *dev) { return false; }
404404
#endif

0 commit comments

Comments
 (0)