diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-06-19 10:58:20 -0400 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-06-19 10:58:20 -0400 |
commit | 23af8400571ac4431fac0caefeac18f8aef490df (patch) | |
tree | 815be4893ec9a0875813151de3fe85dcae781434 /include/linux/i2c.h | |
parent | f18c41daea14baee11252da268cdf5dcd57c7c10 (diff) |
i2c: Don't advertise i2c functions when not available
Surround i2c function declarations with ifdefs, so that they aren't
advertised when i2c-core isn't actually built. That way, drivers using
these functions unconditionally will result in an immediate build
failure, rather than a late linking failure which is harder to figure
out.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include/linux/i2c.h')
-rw-r--r-- | include/linux/i2c.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 844d2662a875..bc17f7fa7d39 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -47,6 +47,7 @@ struct i2c_driver; | |||
47 | union i2c_smbus_data; | 47 | union i2c_smbus_data; |
48 | struct i2c_board_info; | 48 | struct i2c_board_info; |
49 | 49 | ||
50 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | ||
50 | /* | 51 | /* |
51 | * The master routines are the ones normally used to transmit data to devices | 52 | * The master routines are the ones normally used to transmit data to devices |
52 | * on a bus (or read from them). Apart from two basic transfer functions to | 53 | * on a bus (or read from them). Apart from two basic transfer functions to |
@@ -93,6 +94,7 @@ extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, | |||
93 | extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, | 94 | extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, |
94 | u8 command, u8 length, | 95 | u8 command, u8 length, |
95 | const u8 *values); | 96 | const u8 *values); |
97 | #endif /* I2C */ | ||
96 | 98 | ||
97 | /** | 99 | /** |
98 | * struct i2c_driver - represent an I2C device driver | 100 | * struct i2c_driver - represent an I2C device driver |
@@ -260,6 +262,7 @@ struct i2c_board_info { | |||
260 | .type = dev_type, .addr = (dev_addr) | 262 | .type = dev_type, .addr = (dev_addr) |
261 | 263 | ||
262 | 264 | ||
265 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | ||
263 | /* Add-on boards should register/unregister their devices; e.g. a board | 266 | /* Add-on boards should register/unregister their devices; e.g. a board |
264 | * with integrated I2C, a config eeprom, sensors, and a codec that's | 267 | * with integrated I2C, a config eeprom, sensors, and a codec that's |
265 | * used in conjunction with the primary hardware. | 268 | * used in conjunction with the primary hardware. |
@@ -283,6 +286,7 @@ extern struct i2c_client * | |||
283 | i2c_new_dummy(struct i2c_adapter *adap, u16 address); | 286 | i2c_new_dummy(struct i2c_adapter *adap, u16 address); |
284 | 287 | ||
285 | extern void i2c_unregister_device(struct i2c_client *); | 288 | extern void i2c_unregister_device(struct i2c_client *); |
289 | #endif /* I2C */ | ||
286 | 290 | ||
287 | /* Mainboard arch_initcall() code should register all its I2C devices. | 291 | /* Mainboard arch_initcall() code should register all its I2C devices. |
288 | * This is done at arch_initcall time, before declaring any i2c adapters. | 292 | * This is done at arch_initcall time, before declaring any i2c adapters. |
@@ -299,7 +303,7 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info, | |||
299 | { | 303 | { |
300 | return 0; | 304 | return 0; |
301 | } | 305 | } |
302 | #endif | 306 | #endif /* I2C_BOARDINFO */ |
303 | 307 | ||
304 | /* | 308 | /* |
305 | * The following structs are for those who like to implement new bus drivers: | 309 | * The following structs are for those who like to implement new bus drivers: |
@@ -394,6 +398,7 @@ struct i2c_client_address_data { | |||
394 | 398 | ||
395 | /* administration... | 399 | /* administration... |
396 | */ | 400 | */ |
401 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | ||
397 | extern int i2c_add_adapter(struct i2c_adapter *); | 402 | extern int i2c_add_adapter(struct i2c_adapter *); |
398 | extern int i2c_del_adapter(struct i2c_adapter *); | 403 | extern int i2c_del_adapter(struct i2c_adapter *); |
399 | extern int i2c_add_numbered_adapter(struct i2c_adapter *); | 404 | extern int i2c_add_numbered_adapter(struct i2c_adapter *); |
@@ -435,6 +440,7 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap) | |||
435 | { | 440 | { |
436 | return adap->nr; | 441 | return adap->nr; |
437 | } | 442 | } |
443 | #endif /* I2C */ | ||
438 | #endif /* __KERNEL__ */ | 444 | #endif /* __KERNEL__ */ |
439 | 445 | ||
440 | /** | 446 | /** |