Skip to content

Commit

Permalink
i2c: Make i2c_register_board_info() a NOP when CONFIG_I2C_BOARDINFO=n
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Brownell authored and Jean Delvare committed Feb 24, 2008
1 parent 104cb57 commit 2638676
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion include/linux/i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,16 @@ extern void i2c_unregister_device(struct i2c_client *);
* This is done at arch_initcall time, before declaring any i2c adapters.
* Modules for add-on boards must use other calls.
*/
#ifdef CONFIG_I2C_BOARDINFO
extern int
i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n);

#else
static inline int
i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n)
{
return 0;
}
#endif

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

0 comments on commit 2638676

Please sign in to comment.