i2c: boardinfo: Annotate code used in init phase only
Annotate two places in boardinfo code: - __i2c_first_dynamic_bus_num is set in init phase. Annotate it as __ro_after_init to prevent later changes. - i2c_register_board_info() is used in init phase only, so annotate it as __init, allowing to free the memory after init phase. This is safe, see comment: "done in board-specific init code near arch_initcall() time" Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>pull/1354/merge
parent
54d6a978bb
commit
1a2b423be6
|
|
@ -22,7 +22,7 @@ EXPORT_SYMBOL_GPL(__i2c_board_lock);
|
|||
LIST_HEAD(__i2c_board_list);
|
||||
EXPORT_SYMBOL_GPL(__i2c_board_list);
|
||||
|
||||
int __i2c_first_dynamic_bus_num;
|
||||
int __i2c_first_dynamic_bus_num __ro_after_init;
|
||||
EXPORT_SYMBOL_GPL(__i2c_first_dynamic_bus_num);
|
||||
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ EXPORT_SYMBOL_GPL(__i2c_first_dynamic_bus_num);
|
|||
* The board info passed can safely be __initdata, but be careful of embedded
|
||||
* pointers (for platform_data, functions, etc) since that won't be copied.
|
||||
*/
|
||||
int i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned len)
|
||||
int __init i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned len)
|
||||
{
|
||||
int status;
|
||||
|
||||
|
|
|
|||
|
|
@ -499,7 +499,7 @@ static inline struct i2c_client *i2c_verify_client(struct device *dev)
|
|||
* Modules for add-on boards must use other calls.
|
||||
*/
|
||||
#ifdef CONFIG_I2C_BOARDINFO
|
||||
int
|
||||
int __init
|
||||
i2c_register_board_info(int busnum, struct i2c_board_info const *info,
|
||||
unsigned n);
|
||||
#else
|
||||
|
|
|
|||
Loading…
Reference in New Issue