[Skiboot] [PATCH 2/4] hdata/i2c: Replace i2c_ prefix with dev_

Oliver O'Halloran oohall at gmail.com
Tue Apr 24 13:25:00 AEST 2018


The current naming scheme makes it easy to conflate "i2cm_port" and
"i2c_port." The latter is used to describe multi-port I2C devices such
as GPIO expanders and multi-channel PCIe hotplug controllers. Rename
i2c_port to dev_port to make the two a bit more distinct.

Also rename i2c_addr to dev_addr for consistency.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 hdata/i2c.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/hdata/i2c.c b/hdata/i2c.c
index 6ea34507345c..c08b53d5c8fb 100644
--- a/hdata/i2c.c
+++ b/hdata/i2c.c
@@ -31,8 +31,8 @@ struct i2c_dev {
 
 	/* i2c slave info */
 	uint8_t type;
-	uint8_t i2c_addr;
-	uint8_t i2c_port;
+	uint8_t dev_addr;
+	uint8_t dev_port;
 	uint8_t __reserved;
 
 	__be32 purpose;
@@ -207,7 +207,7 @@ int parse_i2c_devs(const struct HDIF_common_hdr *hdr, int idata_index,
 	const struct i2c_dev *dev;
 	const char *label, *name, *compat;
 	const struct host_i2c_hdr *ahdr;
-	uint32_t i2c_addr;
+	uint32_t dev_addr;
 	uint32_t version;
 	uint32_t size;
 	uint32_t purpose;
@@ -280,7 +280,7 @@ int parse_i2c_devs(const struct HDIF_common_hdr *hdr, int idata_index,
 		 * justified quantity (i.e it includes the R/W bit). So we need
 		 * to strip it off to get an address linux can use.
 		 */
-		i2c_addr = dev->i2c_addr >> 1;
+		dev_addr = dev->dev_addr >> 1;
 
 		purpose = be32_to_cpu(dev->purpose);
 		type = map_type(dev->type);
@@ -315,18 +315,18 @@ int parse_i2c_devs(const struct HDIF_common_hdr *hdr, int idata_index,
 		 */
 		if (!type || dev->type == 0xFF)
 			prlog(PR_WARNING, "HDAT I2C: found e%dp%d - %s@%x (%#x:%s)\n",
-			      dev->i2cm_engine, dev->i2cm_port, name, i2c_addr,
+			      dev->i2cm_engine, dev->i2cm_port, name, dev_addr,
 			      purpose, label);
 		else
 			prlog(PR_TRACE, "HDAT I2C: found e%dp%d - %s@%x (%#x:%s)\n",
-			      dev->i2cm_engine, dev->i2cm_port, name, i2c_addr,
+			      dev->i2cm_engine, dev->i2cm_port, name, dev_addr,
 			      purpose, label);
 
-		node = dt_new_addr(bus, name, i2c_addr);
+		node = dt_new_addr(bus, name, dev_addr);
 		if (!node)
 			continue;
 
-		dt_add_property_cells(node, "reg", i2c_addr);
+		dt_add_property_cells(node, "reg", dev_addr);
 		dt_add_property_cells(node, "link-id",
 			be32_to_cpu(dev->i2c_link));
 		if (compat)
-- 
2.9.5



More information about the Skiboot mailing list