diff options
author | Heikki Krogerus <heikki.krogerus@linux.intel.com> | 2021-03-29 13:50:36 +0300 |
---|---|---|
committer | Wolfram Sang <wsa@kernel.org> | 2021-04-08 23:45:55 +0200 |
commit | 714638e02d94fa28c9e030d13d03e663fe24925e (patch) | |
tree | dabcaac2adecf7d3964d1139340e8fd5452e0474 /drivers/i2c/i2c-core-base.c | |
parent | e49d033bddf5b565044e2abe4241353959bc9120 (diff) | |
download | linux-714638e02d94fa28c9e030d13d03e663fe24925e.tar.gz linux-714638e02d94fa28c9e030d13d03e663fe24925e.tar.bz2 linux-714638e02d94fa28c9e030d13d03e663fe24925e.zip |
i2c: Add support for software nodes
This makes it possible for the drivers to assign complete
software fwnodes to the devices instead of only the device
properties in those nodes.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Diffstat (limited to 'drivers/i2c/i2c-core-base.c')
-rw-r--r-- | drivers/i2c/i2c-core-base.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 63ebf722a424..266b2013b1f1 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -919,15 +919,27 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf } } + if (info->swnode) { + status = device_add_software_node(&client->dev, info->swnode); + if (status) { + dev_err(&adap->dev, + "Failed to add software node to client %s: %d\n", + client->name, status); + goto out_free_props; + } + } + status = device_register(&client->dev); if (status) - goto out_free_props; + goto out_remove_swnode; dev_dbg(&adap->dev, "client [%s] registered with bus id %s\n", client->name, dev_name(&client->dev)); return client; +out_remove_swnode: + device_remove_software_node(&client->dev); out_free_props: if (info->properties) device_remove_properties(&client->dev); @@ -960,6 +972,7 @@ void i2c_unregister_device(struct i2c_client *client) if (ACPI_COMPANION(&client->dev)) acpi_device_clear_enumerated(ACPI_COMPANION(&client->dev)); + device_remove_software_node(&client->dev); device_unregister(&client->dev); } EXPORT_SYMBOL_GPL(i2c_unregister_device); |