[PATCH 12/12] i2c: Remove support for dangling device properties

From: Heikki Krogerus
Date: Mon Mar 29 2021 - 06:52:17 EST


>From now on only accepting complete software nodes.

Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
---
drivers/i2c/i2c-boardinfo.c | 11 -----------
drivers/i2c/i2c-core-base.c | 15 +--------------
include/linux/i2c.h | 2 --
3 files changed, 1 insertion(+), 27 deletions(-)

diff --git a/drivers/i2c/i2c-boardinfo.c b/drivers/i2c/i2c-boardinfo.c
index 8bc51d4e69df3..4df8ad092df38 100644
--- a/drivers/i2c/i2c-boardinfo.c
+++ b/drivers/i2c/i2c-boardinfo.c
@@ -47,7 +47,6 @@ 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.
- * Device properties are deep-copied though.
*/
int i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned len)
{
@@ -72,16 +71,6 @@ int i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsig
devinfo->busnum = busnum;
devinfo->board_info = *info;

- if (info->properties) {
- devinfo->board_info.properties =
- property_entries_dup(info->properties);
- if (IS_ERR(devinfo->board_info.properties)) {
- status = PTR_ERR(devinfo->board_info.properties);
- kfree(devinfo);
- break;
- }
- }
-
if (info->resources) {
devinfo->board_info.resources =
kmemdup(info->resources,
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index a6a68081f54e1..916899ee1115f 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -910,23 +910,13 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf

i2c_dev_set_name(adap, client, info);

- if (info->properties) {
- status = device_add_properties(&client->dev, info->properties);
- if (status) {
- dev_err(&adap->dev,
- "Failed to add properties to client %s: %d\n",
- client->name, status);
- goto out_err_put_of_node;
- }
- }
-
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;
+ goto out_err_put_of_node;
}
}

@@ -941,9 +931,6 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf

out_remove_swnode:
device_remove_software_node(&client->dev);
-out_free_props:
- if (info->properties)
- device_remove_properties(&client->dev);
out_err_put_of_node:
of_node_put(info->of_node);
out_err:
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index cb1f882a3e88e..54b3ccc71e372 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -391,7 +391,6 @@ 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: 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
@@ -416,7 +415,6 @@ struct i2c_board_info {
void *platform_data;
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;
--
2.30.2