From 9243224687bd92674c693546a46f849b1a54c75c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 6 Sep 2022 20:27:14 -0600 Subject: [PATCH] dm: core: Rename ofnode_get_property_by_prop() The current name is quite unwieldy. Change it to use an ofprop_ prefix and shorten it. Fix the return-value comment while we are here. Signed-off-by: Simon Glass --- drivers/core/ofnode.c | 4 ++-- drivers/core/read.c | 2 +- env/common.c | 2 +- include/dm/ofnode.h | 14 +++++++------- include/dm/read.h | 2 +- test/dm/ofread.c | 7 +++---- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 2feca567a8..f9c9ca14a6 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -816,8 +816,8 @@ int ofnode_next_property(struct ofprop *prop) return 0; } -const void *ofnode_get_property_by_prop(const struct ofprop *prop, - const char **propname, int *lenp) +const void *ofprop_get_property(const struct ofprop *prop, + const char **propname, int *lenp) { if (ofnode_is_np(prop->node)) return of_get_property_by_prop(ofnode_to_np(prop->node), diff --git a/drivers/core/read.c b/drivers/core/read.c index df298d50cd..3e5fea87d8 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -298,7 +298,7 @@ int dev_read_next_prop(struct ofprop *prop) const void *dev_read_prop_by_prop(struct ofprop *prop, const char **propname, int *lenp) { - return ofnode_get_property_by_prop(prop, propname, lenp); + return ofprop_get_property(prop, propname, lenp); } int dev_read_alias_seq(const struct udevice *dev, int *devnump) diff --git a/env/common.c b/env/common.c index 4e70baaee8..8beb8e6aa4 100644 --- a/env/common.c +++ b/env/common.c @@ -544,7 +544,7 @@ void env_import_fdt(void) res = ofnode_next_property(&prop)) { const char *name, *val; - val = ofnode_get_property_by_prop(&prop, &name, NULL); + val = ofprop_get_property(&prop, &name, NULL); env_set(name, val); } } diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index d477ef1762..9dcc1fed5b 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -802,7 +802,7 @@ const void *ofnode_get_property(ofnode node, const char *propname, int *lenp); * ofnode_first_property()- get the reference of the first property * * Get reference to the first property of the node, it is used to iterate - * and read all the property with ofnode_get_property_by_prop(). + * and read all the property with ofprop_get_property(). * * @node: node to read * @prop: place to put argument reference @@ -814,7 +814,7 @@ int ofnode_first_property(ofnode node, struct ofprop *prop); * ofnode_next_property() - get the reference of the next property * * Get reference to the next property of the node, it is used to iterate - * and read all the property with ofnode_get_property_by_prop(). + * and read all the property with ofprop_get_property(). * * @prop: reference of current argument and place to put reference of next one * Return: 0 if OK, -ve on error. -FDT_ERR_NOTFOUND if not found @@ -822,17 +822,17 @@ int ofnode_first_property(ofnode node, struct ofprop *prop); int ofnode_next_property(struct ofprop *prop); /** - * ofnode_get_property_by_prop() - get a pointer to the value of a property + * ofprop_get_property() - get a pointer to the value of a property * * Get value for the property identified by the provided reference. * * @prop: reference on property * @propname: If non-NULL, place to property name on success, - * @lenp: If non-NULL, place to put length on success - * Return: 0 if OK, -ve on error. -FDT_ERR_NOTFOUND if not found + * @lenp: If non-NULL, place to put length on success, or error code on failure + * Return: pointer to property, or NULL if not found */ -const void *ofnode_get_property_by_prop(const struct ofprop *prop, - const char **propname, int *lenp); +const void *ofprop_get_property(const struct ofprop *prop, + const char **propname, int *lenp); /** * ofnode_is_available() - check if a node is marked available diff --git a/include/dm/read.h b/include/dm/read.h index 519c156e1c..cc4f16196f 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -1091,7 +1091,7 @@ static inline const void *dev_read_prop_by_prop(struct ofprop *prop, const char **propname, int *lenp) { - return ofnode_get_property_by_prop(prop, propname, lenp); + return ofprop_get_property(prop, propname, lenp); } static inline int dev_read_alias_seq(const struct udevice *dev, int *devnump) diff --git a/test/dm/ofread.c b/test/dm/ofread.c index 95a24c3f42..3523860d2b 100644 --- a/test/dm/ofread.c +++ b/test/dm/ofread.c @@ -5,7 +5,7 @@ #include #include -static int dm_test_ofnode_get_property_by_prop(struct unit_test_state *uts) +static int dm_test_ofprop_get_property(struct unit_test_state *uts) { ofnode node; struct ofprop prop; @@ -17,7 +17,7 @@ static int dm_test_ofnode_get_property_by_prop(struct unit_test_state *uts) for (res = ofnode_first_property(node, &prop); !res; res = ofnode_next_property(&prop)) { - value = ofnode_get_property_by_prop(&prop, &propname, &len); + value = ofprop_get_property(&prop, &propname, &len); ut_assertnonnull(value); switch (count) { case 0: @@ -46,5 +46,4 @@ static int dm_test_ofnode_get_property_by_prop(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_ofnode_get_property_by_prop, - UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +DM_TEST(dm_test_ofprop_get_property, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); -- 2.39.5