summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-07-31 00:52:10 +0300
committerTom Rini <trini@konsulko.com>2022-08-12 15:14:24 +0300
commitbe0789a8ee024e685f070dbd8c58736ea3891654 (patch)
tree4ba504834c7df3cf5029337703da754a9f4287d0
parent6571559449cef5fe11678c25bc4fdf57b6a4e81f (diff)
downloadu-boot-be0789a8ee024e685f070dbd8c58736ea3891654.tar.xz
dm: core: Swap parameters of ofnode_write_prop()
It is normal for the length to come after the value in libfdt. Follow this same convention with ofnode. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--drivers/core/ofnode.c6
-rw-r--r--include/dm/ofnode.h6
-rw-r--r--test/dm/ofnode.c4
3 files changed, 8 insertions, 8 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index bd41ef503c..1c9542a356 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -1105,8 +1105,8 @@ ofnode ofnode_by_prop_value(ofnode from, const char *propname,
}
}
-int ofnode_write_prop(ofnode node, const char *propname, int len,
- const void *value)
+int ofnode_write_prop(ofnode node, const char *propname, const void *value,
+ int len)
{
const struct device_node *np = ofnode_to_np(node);
struct property *pp;
@@ -1161,7 +1161,7 @@ int ofnode_write_string(ofnode node, const char *propname, const char *value)
debug("%s: %s = %s", __func__, propname, value);
- return ofnode_write_prop(node, propname, strlen(value) + 1, value);
+ return ofnode_write_prop(node, propname, value, strlen(value) + 1);
}
int ofnode_set_enabled(ofnode node, bool value)
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index d7ad5dccc1..071a9d63f6 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -1114,13 +1114,13 @@ int ofnode_device_is_compatible(ofnode node, const char *compat);
*
* @node: The node for whose property should be set
* @propname: The name of the property to set
- * @len: The length of the new value of the property
* @value: The new value of the property (must be valid prior to calling
* the function)
+ * @len: The length of the new value of the property
* Return: 0 if successful, -ve on error
*/
-int ofnode_write_prop(ofnode node, const char *propname, int len,
- const void *value);
+int ofnode_write_prop(ofnode node, const char *propname, const void *value,
+ int len);
/**
* ofnode_write_string() - Set a string property of a ofnode
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index b8d8e440db..0aeaaeb7f8 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -576,8 +576,8 @@ static int dm_test_ofnode_livetree_writing(struct unit_test_state *uts)
/* Non-existent in DTB */
ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr(dev));
/* reg = 0x42, size = 0x100 */
- ut_assertok(ofnode_write_prop(node, "reg", 8,
- "\x00\x00\x00\x42\x00\x00\x01\x00"));
+ ut_assertok(ofnode_write_prop(node, "reg",
+ "\x00\x00\x00\x42\x00\x00\x01\x00", 8));
ut_asserteq(0x42, dev_read_addr(dev));
/* Test disabling devices */