All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/5] dm: ofnode: use ofnode_read_bool() to check property existence
@ 2017-06-22  7:54 Masahiro Yamada
  2017-06-22  7:54 ` [U-Boot] [PATCH 2/5] dm: ofnode: simplify ofnode_read_prop() Masahiro Yamada
                   ` (4 more replies)
  0 siblings, 5 replies; 21+ messages in thread
From: Masahiro Yamada @ 2017-06-22  7:54 UTC (permalink / raw)
  To: u-boot

This will clarify the code.

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

 drivers/core/ofnode.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index ac312d654654..b8b16bf5e275 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -556,22 +556,22 @@ int ofnode_read_size_cells(ofnode node)
 
 bool ofnode_pre_reloc(ofnode node)
 {
-	if (ofnode_read_prop(node, "u-boot,dm-pre-reloc", NULL))
+	if (ofnode_read_bool(node, "u-boot,dm-pre-reloc"))
 		return true;
 
 #ifdef CONFIG_TPL_BUILD
-	if (ofnode_read_prop(node, "u-boot,dm-tpl", NULL))
+	if (ofnode_read_bool(node, "u-boot,dm-tpl"))
 		return true;
 #elif defined(CONFIG_SPL_BUILD)
-	if (ofnode_read_prop(node, "u-boot,dm-spl", NULL))
+	if (ofnode_read_bool(node, "u-boot,dm-spl"))
 		return true;
 #else
 	/*
 	 * In regular builds individual spl and tpl handling both
 	 * count as handled pre-relocation for later second init.
 	 */
-	if (ofnode_read_prop(node, "u-boot,dm-spl", NULL) ||
-	    ofnode_read_prop(node, "u-boot,dm-tpl", NULL))
+	if (ofnode_read_bool(node, "u-boot,dm-spl") ||
+	    ofnode_read_bool(node, "u-boot,dm-tpl"))
 		return true;
 #endif
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 2/5] dm: ofnode: simplify ofnode_read_prop()
  2017-06-22  7:54 [U-Boot] [PATCH 1/5] dm: ofnode: use ofnode_read_bool() to check property existence Masahiro Yamada
@ 2017-06-22  7:54 ` Masahiro Yamada
  2017-07-06  4:49   ` Simon Glass
  2017-06-22  7:54 ` [U-Boot] [PATCH 3/5] dm: ofnode: rename ofnode_read_prop() to ofnode_get_property() Masahiro Yamada
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 21+ messages in thread
From: Masahiro Yamada @ 2017-06-22  7:54 UTC (permalink / raw)
  To: u-boot

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(-)

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)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 3/5] dm: ofnode: rename ofnode_read_prop() to ofnode_get_property()
  2017-06-22  7:54 [U-Boot] [PATCH 1/5] dm: ofnode: use ofnode_read_bool() to check property existence Masahiro Yamada
  2017-06-22  7:54 ` [U-Boot] [PATCH 2/5] dm: ofnode: simplify ofnode_read_prop() Masahiro Yamada
@ 2017-06-22  7:54 ` Masahiro Yamada
  2017-07-06  4:49   ` Simon Glass
  2017-06-22  7:54 ` [U-Boot] [PATCH 4/5] dm: ofnode: rename dev_read_prop() to dev_get_property() Masahiro Yamada
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 21+ messages in thread
From: Masahiro Yamada @ 2017-06-22  7:54 UTC (permalink / raw)
  To: u-boot

This function returns the pointer to the value of a node property.
The current name ofnode_read_prop() is confusing.  Follow the naming
of_get_property() from Linux.

The return type (const u32 *) is wrong.  DT property values can be
strings as well as integers.  This is why of_get_property/fdt_getprop
returns an opaque pointer.

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

 drivers/core/lists.c             | 3 +--
 drivers/core/ofnode.c            | 4 ++--
 drivers/core/read.c              | 2 +-
 drivers/misc/cros_ec_sandbox.c   | 2 +-
 drivers/pci/pci-uclass.c         | 2 +-
 drivers/pinctrl/pinctrl-uclass.c | 2 +-
 include/dm/ofnode.h              | 4 ++--
 include/dm/read.h                | 2 +-
 8 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/core/lists.c b/drivers/core/lists.c
index b79f26dbe6c9..6067914e8117 100644
--- a/drivers/core/lists.c
+++ b/drivers/core/lists.c
@@ -141,8 +141,7 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp)
 	name = ofnode_get_name(node);
 	dm_dbg("bind node %s\n", name);
 
-	compat_list = (const char *)ofnode_read_prop(node, "compatible",
-						     &compat_length);
+	compat_list = ofnode_get_property(node, "compatible", &compat_length);
 	if (!compat_list) {
 		if (compat_length == -FDT_ERR_NOTFOUND) {
 			dm_dbg("Device '%s' has no compatible string\n", name);
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 08b3e03b1e8e..87e731dc2b77 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -422,7 +422,7 @@ int ofnode_decode_display_timing(ofnode parent, int index,
 	return ret;
 }
 
-const u32 *ofnode_read_prop(ofnode node, const char *propname, int *lenp)
+const void *ofnode_get_property(ofnode node, const char *propname, int *lenp)
 {
 	if (ofnode_is_np(node))
 		return of_get_property(ofnode_to_np(node), propname, lenp);
@@ -493,7 +493,7 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
 	 * #size-cells. They need to be 3 and 2 accordingly. However,
 	 * for simplicity we skip the check here.
 	 */
-	cell = ofnode_read_prop(node, propname, &len);
+	cell = ofnode_get_property(node, propname, &len);
 	if (!cell)
 		goto fail;
 
diff --git a/drivers/core/read.c b/drivers/core/read.c
index 3131e5379c96..c1fe949808fa 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -106,7 +106,7 @@ int dev_read_phandle(struct udevice *dev)
 
 const u32 *dev_read_prop(struct udevice *dev, const char *propname, int *lenp)
 {
-	return ofnode_read_prop(dev_ofnode(dev), propname, lenp);
+	return ofnode_get_property(dev_ofnode(dev), propname, lenp);
 }
 
 int dev_read_alias_seq(struct udevice *dev, int *devnump)
diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c
index c96e26e6b782..5924adee4085 100644
--- a/drivers/misc/cros_ec_sandbox.c
+++ b/drivers/misc/cros_ec_sandbox.c
@@ -197,7 +197,7 @@ static int keyscan_read_fdt_matrix(struct ec_state *ec, ofnode node)
 	int upto;
 	int len;
 
-	cell = ofnode_read_prop(node, "linux,keymap", &len);
+	cell = ofnode_get_property(node, "linux,keymap", &len);
 	ec->matrix_count = len / 4;
 	ec->matrix = calloc(ec->matrix_count, sizeof(*ec->matrix));
 	if (!ec->matrix) {
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index b36ef3338ceb..922401f2a015 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -763,7 +763,7 @@ static int decode_regions(struct pci_controller *hose, ofnode parent_node,
 	int len;
 	int i;
 
-	prop = ofnode_read_prop(node, "ranges", &len);
+	prop = ofnode_get_property(node, "ranges", &len);
 	if (!prop)
 		return -EINVAL;
 	pci_addr_cells = ofnode_read_addr_cells(node);
diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index 02e269020df5..114952a1da36 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -134,7 +134,7 @@ static int pinconfig_post_bind(struct udevice *dev)
 		 * If this node has "compatible" property, this is not
 		 * a pin configuration node, but a normal device. skip.
 		 */
-		ofnode_read_prop(node, "compatible", &ret);
+		ofnode_get_property(node, "compatible", &ret);
 		if (ret >= 0)
 			continue;
 
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 149622a0b2c9..1c507c9f1688 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -463,14 +463,14 @@ int ofnode_decode_display_timing(ofnode node, int index,
 				 struct display_timing *config);
 
 /**
- * ofnode_read_prop()- - read a node property
+ * ofnode_get_property()- - get a pointer to the value of a node property
  *
  * @node: node to read
  * @propname: property to read
  * @lenp: place to put length on success
  * @return pointer to property, or NULL if not found
  */
-const u32 *ofnode_read_prop(ofnode node, const char *propname, int *lenp);
+const void *ofnode_get_property(ofnode node, 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 8c9846eaf26f..562881962a64 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -389,7 +389,7 @@ static inline int dev_read_phandle(struct udevice *dev)
 static inline const u32 *dev_read_prop(struct udevice *dev,
 				       const char *propname, int *lenp)
 {
-	return ofnode_read_prop(dev_ofnode(dev), propname, lenp);
+	return ofnode_get_property(dev_ofnode(dev), propname, lenp);
 }
 
 static inline int dev_read_alias_seq(struct udevice *dev, int *devnump)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 4/5] dm: ofnode: rename dev_read_prop() to dev_get_property()
  2017-06-22  7:54 [U-Boot] [PATCH 1/5] dm: ofnode: use ofnode_read_bool() to check property existence Masahiro Yamada
  2017-06-22  7:54 ` [U-Boot] [PATCH 2/5] dm: ofnode: simplify ofnode_read_prop() Masahiro Yamada
  2017-06-22  7:54 ` [U-Boot] [PATCH 3/5] dm: ofnode: rename ofnode_read_prop() to ofnode_get_property() Masahiro Yamada
@ 2017-06-22  7:54 ` Masahiro Yamada
  2017-07-06  4:49   ` Simon Glass
  2017-06-22  7:54 ` [U-Boot] [PATCH 5/5] dm: ofnode: simplify ofnode_read_bool() Masahiro Yamada
  2017-07-06  4:49 ` [U-Boot] [PATCH 1/5] dm: ofnode: use ofnode_read_bool() to check property existence Simon Glass
  4 siblings, 1 reply; 21+ messages in thread
From: Masahiro Yamada @ 2017-06-22  7:54 UTC (permalink / raw)
  To: u-boot

The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
and fixed its return type.  Likewise, rename dev_read_prop() and fix
its return type.

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

 drivers/core/read.c        | 3 ++-
 drivers/input/key_matrix.c | 4 ++--
 include/dm/read.h          | 9 +++++----
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/core/read.c b/drivers/core/read.c
index c1fe949808fa..61fda9334a7c 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -104,7 +104,8 @@ int dev_read_phandle(struct udevice *dev)
 		return fdt_get_phandle(gd->fdt_blob, ofnode_to_offset(node));
 }
 
-const u32 *dev_read_prop(struct udevice *dev, const char *propname, int *lenp)
+const void *dev_get_property(struct udevice *dev, const char *propname,
+			     int *lenp)
 {
 	return ofnode_get_property(dev_ofnode(dev), propname, lenp);
 }
diff --git a/drivers/input/key_matrix.c b/drivers/input/key_matrix.c
index cd5bce361356..3669019cb9ff 100644
--- a/drivers/input/key_matrix.c
+++ b/drivers/input/key_matrix.c
@@ -144,7 +144,7 @@ int key_matrix_decode_fdt(struct udevice *dev, struct key_matrix *config)
 	int proplen;
 	uchar *plain_keycode;
 
-	prop = dev_read_prop(dev, "linux,keymap", &proplen);
+	prop = dev_get_property(dev, "linux,keymap", &proplen);
 	/* Basic keymap is required */
 	if (!prop) {
 		debug("%s: cannot find keycode-plain map\n", __func__);
@@ -158,7 +158,7 @@ int key_matrix_decode_fdt(struct udevice *dev, struct key_matrix *config)
 	if (!config->plain_keycode)
 		return -1;
 
-	prop = dev_read_prop(dev, "linux,fn-keymap", &proplen);
+	prop = dev_get_property(dev, "linux,fn-keymap", &proplen);
 	/* fn keymap is optional */
 	if (!prop)
 		goto done;
diff --git a/include/dm/read.h b/include/dm/read.h
index 562881962a64..74d5490ad2ce 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -227,14 +227,15 @@ int dev_read_size_cells(struct udevice *dev);
 int dev_read_phandle(struct udevice *dev);
 
 /**
- * dev_read_prop()- - read a property from a device's node
+ * dev_get_property()- - get a pointer to the value of a device's node
  *
  * @dev: device to check
  * @propname: property to read
  * @lenp: place to put length on success
  * @return pointer to property, or NULL if not found
  */
-const u32 *dev_read_prop(struct udevice *dev, const char *propname, int *lenp);
+const void *dev_get_property(struct udevice *dev, const char *propname,
+			     int *lenp);
 
 /**
  * dev_read_alias_seq() - Get the alias sequence number of a node
@@ -386,8 +387,8 @@ static inline int dev_read_phandle(struct udevice *dev)
 	return fdt_get_phandle(gd->fdt_blob, dev_of_offset(dev));
 }
 
-static inline const u32 *dev_read_prop(struct udevice *dev,
-				       const char *propname, int *lenp)
+static inline const void *dev_get_property(struct udevice *dev,
+					  const char *propname, int *lenp)
 {
 	return ofnode_get_property(dev_ofnode(dev), propname, lenp);
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 5/5] dm: ofnode: simplify ofnode_read_bool()
  2017-06-22  7:54 [U-Boot] [PATCH 1/5] dm: ofnode: use ofnode_read_bool() to check property existence Masahiro Yamada
                   ` (2 preceding siblings ...)
  2017-06-22  7:54 ` [U-Boot] [PATCH 4/5] dm: ofnode: rename dev_read_prop() to dev_get_property() Masahiro Yamada
@ 2017-06-22  7:54 ` Masahiro Yamada
  2017-07-06  4:49   ` Simon Glass
  2017-07-06  4:49 ` [U-Boot] [PATCH 1/5] dm: ofnode: use ofnode_read_bool() to check property existence Simon Glass
  4 siblings, 1 reply; 21+ messages in thread
From: Masahiro Yamada @ 2017-06-22  7:54 UTC (permalink / raw)
  To: u-boot

Reuse ofnode_get_property() to simplify the implementation.

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

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

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 87e731dc2b77..5a3e1d452fbb 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -57,20 +57,16 @@ int ofnode_read_s32_default(ofnode node, const char *propname, s32 def)
 
 bool ofnode_read_bool(ofnode node, const char *propname)
 {
-	bool val;
+	const void *prop;
 
 	assert(ofnode_valid(node));
 	debug("%s: %s: ", __func__, propname);
 
-	if (ofnode_is_np(node)) {
-		val = !!of_find_property(ofnode_to_np(node), propname, NULL);
-	} else {
-		val = !!fdt_getprop(gd->fdt_blob, ofnode_to_offset(node),
-				    propname, NULL);
-	}
-	debug("%s\n", val ? "true" : "false");
+	prop = ofnode_get_property(node, propname, NULL);
+
+	debug("%s\n", prop ? "true" : "false");
 
-	return val;
+	return prop ? true : false;
 }
 
 const char *ofnode_read_string(ofnode node, const char *propname)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 1/5] dm: ofnode: use ofnode_read_bool() to check property existence
  2017-06-22  7:54 [U-Boot] [PATCH 1/5] dm: ofnode: use ofnode_read_bool() to check property existence Masahiro Yamada
                   ` (3 preceding siblings ...)
  2017-06-22  7:54 ` [U-Boot] [PATCH 5/5] dm: ofnode: simplify ofnode_read_bool() Masahiro Yamada
@ 2017-07-06  4:49 ` Simon Glass
  2017-07-06 17:36   ` sjg at google.com
  4 siblings, 1 reply; 21+ messages in thread
From: Simon Glass @ 2017-07-06  4:49 UTC (permalink / raw)
  To: u-boot

On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> This will clarify the code.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  drivers/core/ofnode.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 2/5] dm: ofnode: simplify ofnode_read_prop()
  2017-06-22  7:54 ` [U-Boot] [PATCH 2/5] dm: ofnode: simplify ofnode_read_prop() Masahiro Yamada
@ 2017-07-06  4:49   ` Simon Glass
  2017-07-06 17:36     ` sjg at google.com
  0 siblings, 1 reply; 21+ messages in thread
From: Simon Glass @ 2017-07-06  4:49 UTC (permalink / raw)
  To: u-boot

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>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 3/5] dm: ofnode: rename ofnode_read_prop() to ofnode_get_property()
  2017-06-22  7:54 ` [U-Boot] [PATCH 3/5] dm: ofnode: rename ofnode_read_prop() to ofnode_get_property() Masahiro Yamada
@ 2017-07-06  4:49   ` Simon Glass
  2017-07-06 17:36     ` sjg at google.com
  0 siblings, 1 reply; 21+ messages in thread
From: Simon Glass @ 2017-07-06  4:49 UTC (permalink / raw)
  To: u-boot

On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> This function returns the pointer to the value of a node property.
> The current name ofnode_read_prop() is confusing.  Follow the naming
> of_get_property() from Linux.
>
> The return type (const u32 *) is wrong.  DT property values can be
> strings as well as integers.  This is why of_get_property/fdt_getprop
> returns an opaque pointer.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  drivers/core/lists.c             | 3 +--
>  drivers/core/ofnode.c            | 4 ++--
>  drivers/core/read.c              | 2 +-
>  drivers/misc/cros_ec_sandbox.c   | 2 +-
>  drivers/pci/pci-uclass.c         | 2 +-
>  drivers/pinctrl/pinctrl-uclass.c | 2 +-
>  include/dm/ofnode.h              | 4 ++--
>  include/dm/read.h                | 2 +-
>  8 files changed, 10 insertions(+), 11 deletions(-)

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 4/5] dm: ofnode: rename dev_read_prop() to dev_get_property()
  2017-06-22  7:54 ` [U-Boot] [PATCH 4/5] dm: ofnode: rename dev_read_prop() to dev_get_property() Masahiro Yamada
@ 2017-07-06  4:49   ` Simon Glass
  2017-07-07  3:57     ` Simon Glass
  0 siblings, 1 reply; 21+ messages in thread
From: Simon Glass @ 2017-07-06  4:49 UTC (permalink / raw)
  To: u-boot

On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
> and fixed its return type.  Likewise, rename dev_read_prop() and fix
> its return type.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  drivers/core/read.c        | 3 ++-
>  drivers/input/key_matrix.c | 4 ++--
>  include/dm/read.h          | 9 +++++----
>  3 files changed, 9 insertions(+), 7 deletions(-)

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 5/5] dm: ofnode: simplify ofnode_read_bool()
  2017-06-22  7:54 ` [U-Boot] [PATCH 5/5] dm: ofnode: simplify ofnode_read_bool() Masahiro Yamada
@ 2017-07-06  4:49   ` Simon Glass
  2017-07-06 17:36     ` sjg at google.com
  0 siblings, 1 reply; 21+ messages in thread
From: Simon Glass @ 2017-07-06  4:49 UTC (permalink / raw)
  To: u-boot

On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> Reuse ofnode_get_property() to simplify the implementation.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  drivers/core/ofnode.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 5/5] dm: ofnode: simplify ofnode_read_bool()
  2017-07-06  4:49   ` Simon Glass
@ 2017-07-06 17:36     ` sjg at google.com
  0 siblings, 0 replies; 21+ messages in thread
From: sjg at google.com @ 2017-07-06 17:36 UTC (permalink / raw)
  To: u-boot

On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> Reuse ofnode_get_property() to simplify the implementation.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  drivers/core/ofnode.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)

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

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 3/5] dm: ofnode: rename ofnode_read_prop() to ofnode_get_property()
  2017-07-06  4:49   ` Simon Glass
@ 2017-07-06 17:36     ` sjg at google.com
  0 siblings, 0 replies; 21+ messages in thread
From: sjg at google.com @ 2017-07-06 17:36 UTC (permalink / raw)
  To: u-boot

On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> This function returns the pointer to the value of a node property.
> The current name ofnode_read_prop() is confusing.  Follow the naming
> of_get_property() from Linux.
>
> The return type (const u32 *) is wrong.  DT property values can be
> strings as well as integers.  This is why of_get_property/fdt_getprop
> returns an opaque pointer.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  drivers/core/lists.c             | 3 +--
>  drivers/core/ofnode.c            | 4 ++--
>  drivers/core/read.c              | 2 +-
>  drivers/misc/cros_ec_sandbox.c   | 2 +-
>  drivers/pci/pci-uclass.c         | 2 +-
>  drivers/pinctrl/pinctrl-uclass.c | 2 +-
>  include/dm/ofnode.h              | 4 ++--
>  include/dm/read.h                | 2 +-
>  8 files changed, 10 insertions(+), 11 deletions(-)

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

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 2/5] dm: ofnode: simplify ofnode_read_prop()
  2017-07-06  4:49   ` Simon Glass
@ 2017-07-06 17:36     ` sjg at google.com
  0 siblings, 0 replies; 21+ messages in thread
From: sjg at google.com @ 2017-07-06 17:36 UTC (permalink / raw)
  To: u-boot

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!

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 1/5] dm: ofnode: use ofnode_read_bool() to check property existence
  2017-07-06  4:49 ` [U-Boot] [PATCH 1/5] dm: ofnode: use ofnode_read_bool() to check property existence Simon Glass
@ 2017-07-06 17:36   ` sjg at google.com
  0 siblings, 0 replies; 21+ messages in thread
From: sjg at google.com @ 2017-07-06 17:36 UTC (permalink / raw)
  To: u-boot

On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> This will clarify the code.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  drivers/core/ofnode.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

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

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 4/5] dm: ofnode: rename dev_read_prop() to dev_get_property()
  2017-07-06  4:49   ` Simon Glass
@ 2017-07-07  3:57     ` Simon Glass
  2017-07-14  2:38       ` Masahiro Yamada
  0 siblings, 1 reply; 21+ messages in thread
From: Simon Glass @ 2017-07-07  3:57 UTC (permalink / raw)
  To: u-boot

Hi Masahiro,

On 5 July 2017 at 22:49, Simon Glass <sjg@chromium.org> wrote:
> On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
>> and fixed its return type.  Likewise, rename dev_read_prop() and fix
>> its return type.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> ---
>>
>>  drivers/core/read.c        | 3 ++-
>>  drivers/input/key_matrix.c | 4 ++--
>>  include/dm/read.h          | 9 +++++----
>>  3 files changed, 9 insertions(+), 7 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Actually I take that back. I'd like all functions in read.h to start
with dev_read...().

Regards,
Simon

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 4/5] dm: ofnode: rename dev_read_prop() to dev_get_property()
  2017-07-07  3:57     ` Simon Glass
@ 2017-07-14  2:38       ` Masahiro Yamada
  2017-07-14 14:20         ` Simon Glass
  0 siblings, 1 reply; 21+ messages in thread
From: Masahiro Yamada @ 2017-07-14  2:38 UTC (permalink / raw)
  To: u-boot

Hi Simon,


2017-07-07 12:57 GMT+09:00 Simon Glass <sjg@chromium.org>:
> Hi Masahiro,
>
> On 5 July 2017 at 22:49, Simon Glass <sjg@chromium.org> wrote:
>> On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
>>> and fixed its return type.  Likewise, rename dev_read_prop() and fix
>>> its return type.
>>>
>>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>>> ---
>>>
>>>  drivers/core/read.c        | 3 ++-
>>>  drivers/input/key_matrix.c | 4 ++--
>>>  include/dm/read.h          | 9 +++++----
>>>  3 files changed, 9 insertions(+), 7 deletions(-)
>>
>> Acked-by: Simon Glass <sjg@chromium.org>
>
> Actually I take that back. I'd like all functions in read.h to start
> with dev_read...().
>

Do you want me to fix the return type?



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 4/5] dm: ofnode: rename dev_read_prop() to dev_get_property()
  2017-07-14  2:38       ` Masahiro Yamada
@ 2017-07-14 14:20         ` Simon Glass
  2017-07-17  3:29           ` Masahiro Yamada
  0 siblings, 1 reply; 21+ messages in thread
From: Simon Glass @ 2017-07-14 14:20 UTC (permalink / raw)
  To: u-boot

Hi Masahiro,

On 13 July 2017 at 20:38, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> Hi Simon,
>
>
> 2017-07-07 12:57 GMT+09:00 Simon Glass <sjg@chromium.org>:
>> Hi Masahiro,
>>
>> On 5 July 2017 at 22:49, Simon Glass <sjg@chromium.org> wrote:
>>> On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>>> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
>>>> and fixed its return type.  Likewise, rename dev_read_prop() and fix
>>>> its return type.
>>>>
>>>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>>>> ---
>>>>
>>>>  drivers/core/read.c        | 3 ++-
>>>>  drivers/input/key_matrix.c | 4 ++--
>>>>  include/dm/read.h          | 9 +++++----
>>>>  3 files changed, 9 insertions(+), 7 deletions(-)
>>>
>>> Acked-by: Simon Glass <sjg@chromium.org>
>>
>> Actually I take that back. I'd like all functions in read.h to start
>> with dev_read...().
>>
>
> Do you want me to fix the return type?

Yes void * would be better I suppose. Also what happened with that
patch with the DEBUG problem?

Regards,
Simon

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 4/5] dm: ofnode: rename dev_read_prop() to dev_get_property()
  2017-07-14 14:20         ` Simon Glass
@ 2017-07-17  3:29           ` Masahiro Yamada
  2017-07-28  4:19             ` Simon Glass
  0 siblings, 1 reply; 21+ messages in thread
From: Masahiro Yamada @ 2017-07-17  3:29 UTC (permalink / raw)
  To: u-boot

Hi Simon,

2017-07-14 23:20 GMT+09:00 Simon Glass <sjg@chromium.org>:
> Hi Masahiro,
>
> On 13 July 2017 at 20:38, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>> Hi Simon,
>>
>>
>> 2017-07-07 12:57 GMT+09:00 Simon Glass <sjg@chromium.org>:
>>> Hi Masahiro,
>>>
>>> On 5 July 2017 at 22:49, Simon Glass <sjg@chromium.org> wrote:
>>>> On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>>>> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
>>>>> and fixed its return type.  Likewise, rename dev_read_prop() and fix
>>>>> its return type.
>>>>>
>>>>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>>>>> ---
>>>>>
>>>>>  drivers/core/read.c        | 3 ++-
>>>>>  drivers/input/key_matrix.c | 4 ++--
>>>>>  include/dm/read.h          | 9 +++++----
>>>>>  3 files changed, 9 insertions(+), 7 deletions(-)
>>>>
>>>> Acked-by: Simon Glass <sjg@chromium.org>
>>>
>>> Actually I take that back. I'd like all functions in read.h to start
>>> with dev_read...().
>>>
>>
>> Do you want me to fix the return type?
>
> Yes void * would be better I suppose. Also what happened with that
> patch with the DEBUG problem?
>

Why do you need dm_dbg()
instead of generic debug() or pr_debug()?



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 4/5] dm: ofnode: rename dev_read_prop() to dev_get_property()
  2017-07-17  3:29           ` Masahiro Yamada
@ 2017-07-28  4:19             ` Simon Glass
  2017-07-28 12:57               ` Masahiro Yamada
  0 siblings, 1 reply; 21+ messages in thread
From: Simon Glass @ 2017-07-28  4:19 UTC (permalink / raw)
  To: u-boot

Hi Masahiro,

On 16 July 2017 at 21:29, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> Hi Simon,
>
> 2017-07-14 23:20 GMT+09:00 Simon Glass <sjg@chromium.org>:
>> Hi Masahiro,
>>
>> On 13 July 2017 at 20:38, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>> Hi Simon,
>>>
>>>
>>> 2017-07-07 12:57 GMT+09:00 Simon Glass <sjg@chromium.org>:
>>>> Hi Masahiro,
>>>>
>>>> On 5 July 2017 at 22:49, Simon Glass <sjg@chromium.org> wrote:
>>>>> On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>>>>> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
>>>>>> and fixed its return type.  Likewise, rename dev_read_prop() and fix
>>>>>> its return type.
>>>>>>
>>>>>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>>>>>> ---
>>>>>>
>>>>>>  drivers/core/read.c        | 3 ++-
>>>>>>  drivers/input/key_matrix.c | 4 ++--
>>>>>>  include/dm/read.h          | 9 +++++----
>>>>>>  3 files changed, 9 insertions(+), 7 deletions(-)
>>>>>
>>>>> Acked-by: Simon Glass <sjg@chromium.org>
>>>>
>>>> Actually I take that back. I'd like all functions in read.h to start
>>>> with dev_read...().
>>>>
>>>
>>> Do you want me to fix the return type?
>>
>> Yes void * would be better I suppose. Also what happened with that
>> patch with the DEBUG problem?
>>
>
> Why do you need dm_dbg()
> instead of generic debug() or pr_debug()?

I don't really understand the question, but debug() / pr_debug() are find.

Regards,
Simon

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 4/5] dm: ofnode: rename dev_read_prop() to dev_get_property()
  2017-07-28  4:19             ` Simon Glass
@ 2017-07-28 12:57               ` Masahiro Yamada
  2017-08-06  5:16                 ` Simon Glass
  0 siblings, 1 reply; 21+ messages in thread
From: Masahiro Yamada @ 2017-07-28 12:57 UTC (permalink / raw)
  To: u-boot

Hi Simon,


2017-07-28 13:19 GMT+09:00 Simon Glass <sjg@chromium.org>:
> Hi Masahiro,
>
> On 16 July 2017 at 21:29, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>> Hi Simon,
>>
>> 2017-07-14 23:20 GMT+09:00 Simon Glass <sjg@chromium.org>:
>>> Hi Masahiro,
>>>
>>> On 13 July 2017 at 20:38, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>>> Hi Simon,
>>>>
>>>>
>>>> 2017-07-07 12:57 GMT+09:00 Simon Glass <sjg@chromium.org>:
>>>>> Hi Masahiro,
>>>>>
>>>>> On 5 July 2017 at 22:49, Simon Glass <sjg@chromium.org> wrote:
>>>>>> On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>>>>>> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
>>>>>>> and fixed its return type.  Likewise, rename dev_read_prop() and fix
>>>>>>> its return type.
>>>>>>>
>>>>>>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>>>>>>> ---
>>>>>>>
>>>>>>>  drivers/core/read.c        | 3 ++-
>>>>>>>  drivers/input/key_matrix.c | 4 ++--
>>>>>>>  include/dm/read.h          | 9 +++++----
>>>>>>>  3 files changed, 9 insertions(+), 7 deletions(-)
>>>>>>
>>>>>> Acked-by: Simon Glass <sjg@chromium.org>
>>>>>
>>>>> Actually I take that back. I'd like all functions in read.h to start
>>>>> with dev_read...().
>>>>>
>>>>
>>>> Do you want me to fix the return type?
>>>
>>> Yes void * would be better I suppose. Also what happened with that
>>> patch with the DEBUG problem?
>>>
>>
>> Why do you need dm_dbg()
>> instead of generic debug() or pr_debug()?
>
> I don't really understand the question, but debug() / pr_debug() are find.
>


In U-Boot, debug() is often used for debugging.

My question was, why don't you use it in DM core too?
(Then dm_dbg() will be unnecessary, I think.)



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH 4/5] dm: ofnode: rename dev_read_prop() to dev_get_property()
  2017-07-28 12:57               ` Masahiro Yamada
@ 2017-08-06  5:16                 ` Simon Glass
  0 siblings, 0 replies; 21+ messages in thread
From: Simon Glass @ 2017-08-06  5:16 UTC (permalink / raw)
  To: u-boot

Hi Masahiro,

On 28 July 2017 at 06:57, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> Hi Simon,
>
>
> 2017-07-28 13:19 GMT+09:00 Simon Glass <sjg@chromium.org>:
>> Hi Masahiro,
>>
>> On 16 July 2017 at 21:29, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>> Hi Simon,
>>>
>>> 2017-07-14 23:20 GMT+09:00 Simon Glass <sjg@chromium.org>:
>>>> Hi Masahiro,
>>>>
>>>> On 13 July 2017 at 20:38, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>>>> Hi Simon,
>>>>>
>>>>>
>>>>> 2017-07-07 12:57 GMT+09:00 Simon Glass <sjg@chromium.org>:
>>>>>> Hi Masahiro,
>>>>>>
>>>>>> On 5 July 2017 at 22:49, Simon Glass <sjg@chromium.org> wrote:
>>>>>>> On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>>>>>>> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
>>>>>>>> and fixed its return type.  Likewise, rename dev_read_prop() and fix
>>>>>>>> its return type.
>>>>>>>>
>>>>>>>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>>>>>>>> ---
>>>>>>>>
>>>>>>>>  drivers/core/read.c        | 3 ++-
>>>>>>>>  drivers/input/key_matrix.c | 4 ++--
>>>>>>>>  include/dm/read.h          | 9 +++++----
>>>>>>>>  3 files changed, 9 insertions(+), 7 deletions(-)
>>>>>>>
>>>>>>> Acked-by: Simon Glass <sjg@chromium.org>
>>>>>>
>>>>>> Actually I take that back. I'd like all functions in read.h to start
>>>>>> with dev_read...().
>>>>>>
>>>>>
>>>>> Do you want me to fix the return type?
>>>>
>>>> Yes void * would be better I suppose. Also what happened with that
>>>> patch with the DEBUG problem?
>>>>
>>>
>>> Why do you need dm_dbg()
>>> instead of generic debug() or pr_debug()?
>>
>> I don't really understand the question, but debug() / pr_debug() are find.
>>
>
>
> In U-Boot, debug() is often used for debugging.
>
> My question was, why don't you use it in DM core too?
> (Then dm_dbg() will be unnecessary, I think.)

I am not quite sure - perhaps Marek will remember.

Regards,
Simon

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2017-08-06  5:16 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-22  7:54 [U-Boot] [PATCH 1/5] dm: ofnode: use ofnode_read_bool() to check property existence Masahiro Yamada
2017-06-22  7:54 ` [U-Boot] [PATCH 2/5] dm: ofnode: simplify ofnode_read_prop() Masahiro Yamada
2017-07-06  4:49   ` Simon Glass
2017-07-06 17:36     ` sjg at google.com
2017-06-22  7:54 ` [U-Boot] [PATCH 3/5] dm: ofnode: rename ofnode_read_prop() to ofnode_get_property() Masahiro Yamada
2017-07-06  4:49   ` Simon Glass
2017-07-06 17:36     ` sjg at google.com
2017-06-22  7:54 ` [U-Boot] [PATCH 4/5] dm: ofnode: rename dev_read_prop() to dev_get_property() Masahiro Yamada
2017-07-06  4:49   ` Simon Glass
2017-07-07  3:57     ` Simon Glass
2017-07-14  2:38       ` Masahiro Yamada
2017-07-14 14:20         ` Simon Glass
2017-07-17  3:29           ` Masahiro Yamada
2017-07-28  4:19             ` Simon Glass
2017-07-28 12:57               ` Masahiro Yamada
2017-08-06  5:16                 ` Simon Glass
2017-06-22  7:54 ` [U-Boot] [PATCH 5/5] dm: ofnode: simplify ofnode_read_bool() Masahiro Yamada
2017-07-06  4:49   ` Simon Glass
2017-07-06 17:36     ` sjg at google.com
2017-07-06  4:49 ` [U-Boot] [PATCH 1/5] dm: ofnode: use ofnode_read_bool() to check property existence Simon Glass
2017-07-06 17:36   ` sjg at google.com

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.