lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed,  7 Apr 2021 11:50:39 -0700
From:   Manish Varma <varmam@...gle.com>
To:     Wolfram Sang <wsa@...nel.org>, Rob Herring <robh+dt@...nel.org>
Cc:     linux-i2c@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-team@...roid.com,
        Manish Varma <varmam@...gle.com>
Subject: [PATCH v1 2/2] i2c: use "dev-name" device tree property to override
 device name

Since the dev_name field of i2c_board_info is not set while instantiating
an I2C device, they are named like <adapter_id>-<device_addr>, unless
they are instantiated through ACPI.

These coded names are less desirable in some situations as they will vary
across systems with different hardware configurations, and even also on
the same system as the adapter_id may change with change in the order
of i2c bus enumeration (i.e. due to device tree modifications).

These device names are further used by other modules like "system wakeup
events framework" to assign the name of wakeup_source. So overall this
causes somewhat difficult to interpret device and wakeup source names,
and hence presents difficulties debuging issues at multiple levels.

This change addresses above mentioned problem by setting dev_name field
based on value assigned to an optional "dev-name" property of device
tree (if present). And as a result of this, i2c_dev_set_name() should now
use the actual device name instead of made up one.

Signed-off-by: Manish Varma <varmam@...gle.com>
---
 drivers/i2c/i2c-core-of.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c
index 3ed74aa4b44b..d7a85a9cc499 100644
--- a/drivers/i2c/i2c-core-of.c
+++ b/drivers/i2c/i2c-core-of.c
@@ -58,6 +58,8 @@ int of_i2c_get_board_info(struct device *dev, struct device_node *node,
 	if (of_get_property(node, "wakeup-source", NULL))
 		info->flags |= I2C_CLIENT_WAKE;
 
+	of_property_read_string(node, "dev-name", &(info->dev_name));
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(of_i2c_get_board_info);
-- 
2.31.1.295.g9ea45b61b8-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ