mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
i2c: move OF helpers into the core
I2C of helpers used to live in of_i2c.c but experience (from SPI) shows that it is much cleaner to have this in the core. This also removes a circular dependency between the helpers and the core, and so we can finally register child nodes in the core instead of doing this manually in each driver. So, fix the drivers and documentation, too. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
parent
c1d15b68aa
commit
687b81d083
47 changed files with 138 additions and 262 deletions
|
@ -544,6 +544,26 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
|
|||
|
||||
#endif /* I2C */
|
||||
|
||||
#if IS_ENABLED(CONFIG_OF)
|
||||
/* must call put_device() when done with returned i2c_client device */
|
||||
extern struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
|
||||
|
||||
/* must call put_device() when done with returned i2c_adapter device */
|
||||
extern struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node);
|
||||
|
||||
#else
|
||||
|
||||
static inline struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif /* CONFIG_OF */
|
||||
|
||||
#if IS_ENABLED(CONFIG_ACPI_I2C)
|
||||
extern void acpi_i2c_register_devices(struct i2c_adapter *adap);
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue