Skip to contentSkip to conversation

mfd: Use of_property_read_reg() to parse "reg"

PATCH Applied Rob Herring 2 participants 2 messages Jun 9, 2023 – Jun 15, 2023 Multifunction devices (MFD)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: Use of_property_read_reg() to parse "reg"

Use the recently added of_property_read_reg() helper to get the untranslated "reg" address value.

---
 drivers/mfd/mfd-core.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/mfd/mfd-core.c +1 -5
index 695d50b3bac6..0ed7c0d7784e 100644
@@ -102,7 +102,6 @@ static int mfd_match_of_node_to_dev(struct platform_device *pdev,
 {
 #if IS_ENABLED(CONFIG_OF)
 	struct mfd_of_node_entry *of_entry;
-	const __be32 *reg;
 	u64 of_node_addr;
 
 	/* Skip if OF node has previously been allocated to a device */
@@ -115,13 +114,10 @@ static int mfd_match_of_node_to_dev(struct platform_device *pdev,
 		goto allocate_of_node;
 
 	/* We only care about each node's first defined address */
-	reg = of_get_address(np, 0, NULL, NULL);
-	if (!reg)
+	if (of_property_read_reg(np, 0, &of_node_addr, NULL))
 		/* OF node does not contatin a 'reg' property to match to */
 		return -EAGAIN;
 
-	of_node_addr = of_read_number(reg, of_n_addr_cells(np));
-
 	if (cell->of_reg != of_node_addr)
 		/* No match */
 		return -EAGAIN;
Signature · 1 line
2.39.2
maintainer Applied
#1 lore raw
Quoted 7 lines · Rob Herring

Use the recently added of_property_read_reg() helper to get the untranslated "reg" address value.

---
 drivers/mfd/mfd-core.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Applied, thanks

Signature · 1 line
Lee Jones [李琼斯]