linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] of: unittest: minor cleanups
@ 2019-01-24 23:22 frowand.list
  2019-01-24 23:22 ` [PATCH 1/2] of: unittest: remove report of expected error frowand.list
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: frowand.list @ 2019-01-24 23:22 UTC (permalink / raw)
  To: Rob Herring; +Cc: devicetree, linux-kernel

From: Frank Rowand <frank.rowand@sony.com>

1) Suppress expected error message when adding unittest data to livetree.

2) While writing patch 1, noted a misleading function name.  Add comment
   to the function header warning about possible unexpected results.


Frank Rowand (2):
  of: unittest: remove report of expected error
  of: unittest: add caution to function header comment

 drivers/of/unittest.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

-- 
Frank Rowand <frank.rowand@sony.com>


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

* [PATCH 1/2] of: unittest: remove report of expected error
  2019-01-24 23:22 [PATCH 0/2] of: unittest: minor cleanups frowand.list
@ 2019-01-24 23:22 ` frowand.list
  2019-01-24 23:22 ` [PATCH 2/2] of: unittest: add caution to function header comment frowand.list
  2019-02-13 19:09 ` [PATCH 0/2] of: unittest: minor cleanups Rob Herring
  2 siblings, 0 replies; 4+ messages in thread
From: frowand.list @ 2019-01-24 23:22 UTC (permalink / raw)
  To: Rob Herring; +Cc: devicetree, linux-kernel

From: Frank Rowand <frank.rowand@sony.com>

update_node_properties() reports an error when the test data contains
a node (such as "/aliases") that already exists in the base devicetree.
The error is caused by of_fdt_unflatten_tree() autogenerating the
"name" property, thus both the existing node and the new node will
have a property with the same name.  Suppress reporting the known
error.

Signed-off-by: Frank Rowand <frank.rowand@sony.com>
---
 drivers/of/unittest.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 84427384654d..3249fe259d30 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1116,9 +1116,12 @@ static void update_node_properties(struct device_node *np,
 	for (prop = np->properties; prop != NULL; prop = save_next) {
 		save_next = prop->next;
 		ret = of_add_property(dup, prop);
-		if (ret)
+		if (ret) {
+			if (ret == -EEXIST && !strcmp(prop->name, "name"))
+				continue;
 			pr_err("unittest internal error: unable to add testdata property %pOF/%s",
 			       np, prop->name);
+		}
 	}
 }
 
-- 
Frank Rowand <frank.rowand@sony.com>


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

* [PATCH 2/2] of: unittest: add caution to function header comment
  2019-01-24 23:22 [PATCH 0/2] of: unittest: minor cleanups frowand.list
  2019-01-24 23:22 ` [PATCH 1/2] of: unittest: remove report of expected error frowand.list
@ 2019-01-24 23:22 ` frowand.list
  2019-02-13 19:09 ` [PATCH 0/2] of: unittest: minor cleanups Rob Herring
  2 siblings, 0 replies; 4+ messages in thread
From: frowand.list @ 2019-01-24 23:22 UTC (permalink / raw)
  To: Rob Herring; +Cc: devicetree, linux-kernel

From: Frank Rowand <frank.rowand@sony.com>

Name of function attach_node_and_children() is misleading because
if the node already exists in the livetree then only the node's
properties are attached.  This works for the existing test data,
but add comment warning of this misleading name.

Signed-off-by: Frank Rowand <frank.rowand@sony.com>
---
 drivers/of/unittest.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 3249fe259d30..872956500c27 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1127,7 +1127,11 @@ static void update_node_properties(struct device_node *np,
 
 /**
  *	attach_node_and_children - attaches nodes
- *	and its children to live tree
+ *	and its children to live tree.
+ *	CAUTION: misleading function name - if node @np already exists in
+ *	the live tree then children of @np are *not* attached to the live
+ *	tree.  This works for the current test devicetree nodes because such
+ *	nodes do not have child nodes.
  *
  *	@np:	Node to attach to live tree
  */
-- 
Frank Rowand <frank.rowand@sony.com>


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

* Re: [PATCH 0/2] of: unittest: minor cleanups
  2019-01-24 23:22 [PATCH 0/2] of: unittest: minor cleanups frowand.list
  2019-01-24 23:22 ` [PATCH 1/2] of: unittest: remove report of expected error frowand.list
  2019-01-24 23:22 ` [PATCH 2/2] of: unittest: add caution to function header comment frowand.list
@ 2019-02-13 19:09 ` Rob Herring
  2 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2019-02-13 19:09 UTC (permalink / raw)
  To: frowand.list; +Cc: devicetree, linux-kernel

On Thu, Jan 24, 2019 at 03:22:12PM -0800, frowand.list@gmail.com wrote:
> From: Frank Rowand <frank.rowand@sony.com>
> 
> 1) Suppress expected error message when adding unittest data to livetree.
> 
> 2) While writing patch 1, noted a misleading function name.  Add comment
>    to the function header warning about possible unexpected results.
> 
> 
> Frank Rowand (2):
>   of: unittest: remove report of expected error
>   of: unittest: add caution to function header comment

Applied.

Rob

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

end of thread, other threads:[~2019-02-13 19:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-24 23:22 [PATCH 0/2] of: unittest: minor cleanups frowand.list
2019-01-24 23:22 ` [PATCH 1/2] of: unittest: remove report of expected error frowand.list
2019-01-24 23:22 ` [PATCH 2/2] of: unittest: add caution to function header comment frowand.list
2019-02-13 19:09 ` [PATCH 0/2] of: unittest: minor cleanups Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).