Skip to content

Commit 2638676

Browse files
David BrownellJean Delvare
authored andcommitted
i2c: Make i2c_register_board_info() a NOP when CONFIG_I2C_BOARDINFO=n
Don't require platform code to be #ifdeffed according to whether I2C is enabled or not ... if it's not enabled, let GCC compile out all I2C device declarations. (Issue noted on an NSLU2 build that didn't configure I2C.) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
1 parent 104cb57 commit 2638676

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎include/linux/i2c.h‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,16 @@ extern void i2c_unregister_device(struct i2c_client *);
271271
* This is done at arch_initcall time, before declaring any i2c adapters.
272272
* Modules for add-on boards must use other calls.
273273
*/
274+
#ifdef CONFIG_I2C_BOARDINFO
274275
extern int
275276
i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n);
276-
277+
#else
278+
static inline int
279+
i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n)
280+
{
281+
return 0;
282+
}
283+
#endif
277284

278285
/*
279286
* The following structs are for those who like to implement new bus drivers:

0 commit comments

Comments
 (0)