diff mbox series

[2/5] dm: ofnode: simplify ofnode_read_prop()

Message ID 1498118047-11918-2-git-send-email-yamada.masahiro@socionext.com
State Accepted
Commit cb7dbe1fb017f0a1ad050a9dc91ed2c10cb998e6
Headers show
Series [1/5] dm: ofnode: use ofnode_read_bool() to check property existence | expand

Commit Message

Masahiro Yamada June 22, 2017, 7:54 a.m. UTC
The code inside the if-block is the same as of_get_property().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/core/ofnode.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

Comments

Simon Glass July 6, 2017, 4:49 a.m. UTC | #1
On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> The code inside the if-block is the same as of_get_property().
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  drivers/core/ofnode.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass July 6, 2017, 5:36 p.m. UTC | #2
On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> The code inside the if-block is the same as of_get_property().
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  drivers/core/ofnode.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index b8b16bf5e275..08b3e03b1e8e 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -424,17 +424,11 @@  int ofnode_decode_display_timing(ofnode parent, int index,
 
 const u32 *ofnode_read_prop(ofnode node, const char *propname, int *lenp)
 {
-	if (ofnode_is_np(node)) {
-		struct property *prop;
-
-		prop = of_find_property(ofnode_to_np(node), propname, lenp);
-		if (!prop)
-			return NULL;
-		return prop->value;
-	} else {
+	if (ofnode_is_np(node))
+		return of_get_property(ofnode_to_np(node), propname, lenp);
+	else
 		return fdt_getprop(gd->fdt_blob, ofnode_to_offset(node),
 				   propname, lenp);
-	}
 }
 
 bool ofnode_is_available(ofnode node)