From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Wolfram Sang <wsa@kernel.org>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 01/12] i2c: Add support for software nodes
Date: Mon, 29 Mar 2021 13:50:36 +0300 [thread overview]
Message-ID: <20210329105047.51033-2-heikki.krogerus@linux.intel.com> (raw)
In-Reply-To: <20210329105047.51033-1-heikki.krogerus@linux.intel.com>
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>
---
drivers/i2c/i2c-core-base.c | 15 ++++++++++++++-
include/linux/i2c.h | 4 +++-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index f21362355973e..a6a68081f54e1 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -920,15 +920,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);
@@ -961,6 +973,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);
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 56622658b2158..cb1f882a3e88e 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -391,7 +391,8 @@ static inline bool i2c_detect_slave_mode(struct device *dev) { return false; }
* @platform_data: stored in i2c_client.dev.platform_data
* @of_node: pointer to OpenFirmware device node
* @fwnode: device node supplied by the platform firmware
- * @properties: additional device properties for the device
+ * @properties: Deprecated - use swnode instead
+ * @swnode: software node for the device
* @resources: resources associated with the device
* @num_resources: number of resources in the @resources array
* @irq: stored in i2c_client.irq
@@ -416,6 +417,7 @@ struct i2c_board_info {
struct device_node *of_node;
struct fwnode_handle *fwnode;
const struct property_entry *properties;
+ const struct software_node *swnode;
const struct resource *resources;
unsigned int num_resources;
int irq;
--
2.30.2
next prev parent reply other threads:[~2021-03-29 10:51 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-29 10:50 [PATCH 00/12] i2c: Adding support for software nodes Heikki Krogerus
2021-03-29 10:50 ` Heikki Krogerus [this message]
2021-03-29 10:50 ` [PATCH 02/12] ARM: davinci: Constify the " Heikki Krogerus
2021-04-06 19:38 ` Wolfram Sang
2021-04-07 7:41 ` Bartosz Golaszewski
2021-03-29 10:50 ` [PATCH 03/12] ARM: omap1: osk: Constify the software node Heikki Krogerus
2021-03-31 6:15 ` Tony Lindgren
2021-03-29 10:50 ` [PATCH 04/12] ARM: pxa: stargate2: " Heikki Krogerus
2021-04-06 19:39 ` Wolfram Sang
2021-04-10 8:16 ` Robert Jarzmik
2021-03-29 10:50 ` [PATCH 05/12] ARM: s3c: mini2440: " Heikki Krogerus
2021-03-29 10:58 ` Krzysztof Kozlowski
2021-03-29 12:32 ` Heikki Krogerus
2021-04-01 17:44 ` Krzysztof Kozlowski
2021-04-06 19:40 ` Wolfram Sang
2021-04-06 20:28 ` Krzysztof Kozlowski
2021-03-29 10:50 ` [PATCH 06/12] platform/x86: intel_cht_int33fe_microb: " Heikki Krogerus
2021-03-29 15:27 ` Hans de Goede
2021-04-06 19:40 ` Wolfram Sang
2021-04-06 19:49 ` Hans de Goede
2021-03-29 10:50 ` [PATCH 07/12] i2c: cht-wc: " Heikki Krogerus
2021-03-29 15:28 ` Hans de Goede
2021-03-29 10:50 ` [PATCH 08/12] i2c: nvidia-gpu: " Heikki Krogerus
2021-03-29 10:50 ` [PATCH 09/12] i2c: icy: " Heikki Krogerus
2021-03-30 13:58 ` Max Staudt
2021-04-08 21:22 ` Wolfram Sang
2021-04-08 22:13 ` Max Staudt
2021-03-29 10:50 ` [PATCH 10/12] platform/chrome: chromeos_laptop - Prepare complete software nodes Heikki Krogerus
2021-03-30 16:33 ` Enric Balletbo i Serra
2021-03-29 10:50 ` [PATCH 11/12] Input: elantech - Prepare a complete software node for the device Heikki Krogerus
2021-03-29 19:05 ` Dmitry Torokhov
2021-03-29 10:50 ` [PATCH 12/12] i2c: Remove support for dangling device properties Heikki Krogerus
2021-03-31 9:22 ` [PATCH 00/12] i2c: Adding support for software nodes Wolfram Sang
2021-03-31 10:17 ` Heikki Krogerus
2021-04-06 19:37 ` Wolfram Sang
2021-04-08 21:53 ` Wolfram Sang
2021-04-09 9:39 ` Heikki Krogerus
2021-04-10 19:48 ` Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210329105047.51033-2-heikki.krogerus@linux.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).