linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the dt-rh tree with Linus' tree
@ 2012-10-02  3:50 Stephen Rothwell
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Rothwell @ 2012-10-02  3:50 UTC (permalink / raw)
  To: Rob Herring; +Cc: linux-next, linux-kernel, Srinivas Kandagatla, Timur Tabi

[-- Attachment #1: Type: text/plain, Size: 3179 bytes --]

Hi Rob,

Today's linux-next merge of the dt-rh tree got a conflict in
drivers/of/base.c include/linux/of.h between commit 3296193d1421 ("dt:
introduce for_each_available_child_of_node, of_get_next_available_child")
from Linus' tree and commit 9c19761a7ecd ("dt: introduce
of_get_child_by_name to get child node by name") from the dt-rh tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc drivers/of/base.c
index 4a8d46f,e2e8136..0000000
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@@ -364,33 -364,29 +364,56 @@@ struct device_node *of_get_next_child(c
  EXPORT_SYMBOL(of_get_next_child);
  
  /**
 + *	of_get_next_available_child - Find the next available child node
 + *	@node:	parent node
 + *	@prev:	previous child of the parent node, or NULL to get first
 + *
 + *      This function is like of_get_next_child(), except that it
 + *      automatically skips any disabled nodes (i.e. status = "disabled").
 + */
 +struct device_node *of_get_next_available_child(const struct device_node *node,
 +	struct device_node *prev)
 +{
 +	struct device_node *next;
 +
 +	read_lock(&devtree_lock);
 +	next = prev ? prev->sibling : node->child;
 +	for (; next; next = next->sibling) {
 +		if (!of_device_is_available(next))
 +			continue;
 +		if (of_node_get(next))
 +			break;
 +	}
 +	of_node_put(prev);
 +	read_unlock(&devtree_lock);
 +	return next;
 +}
 +EXPORT_SYMBOL(of_get_next_available_child);
 +
 +/**
+  *	of_get_child_by_name - Find the child node by name for a given parent
+  *	@node:	parent node
+  *	@name:	child name to look for.
+  *
+  *      This function looks for child node for given matching name
+  *
+  *	Returns a node pointer if found, with refcount incremented, use
+  *	of_node_put() on it when done.
+  *	Returns NULL if node is not found.
+  */
+ struct device_node *of_get_child_by_name(const struct device_node *node,
+ 				const char *name)
+ {
+ 	struct device_node *child;
+ 
+ 	for_each_child_of_node(node, child)
+ 		if (child->name && (of_node_cmp(child->name, name) == 0))
+ 			break;
+ 	return child;
+ }
+ EXPORT_SYMBOL(of_get_child_by_name);
+ 
+ /**
   *	of_find_node_by_path - Find a node matching a full OF path
   *	@path:	The full path to match
   *
diff --cc include/linux/of.h
index 5c7a158,fabb524..0000000
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@@ -190,9 -190,8 +190,11 @@@ extern struct device_node *of_get_paren
  extern struct device_node *of_get_next_parent(struct device_node *node);
  extern struct device_node *of_get_next_child(const struct device_node *node,
  					     struct device_node *prev);
 +extern struct device_node *of_get_next_available_child(
 +	const struct device_node *node, struct device_node *prev);
 +
+ extern struct device_node *of_get_child_by_name(const struct device_node *node,
+ 					const char *name);
  #define for_each_child_of_node(parent, child) \
  	for (child = of_get_next_child(parent, NULL); child != NULL; \
  	     child = of_get_next_child(parent, child))

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* linux-next: manual merge of the dt-rh tree with Linus' tree
@ 2014-05-13  5:10 Stephen Rothwell
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Rothwell @ 2014-05-13  5:10 UTC (permalink / raw)
  To: Rob Herring, Grant Likely; +Cc: linux-next, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2288 bytes --]

Hi Rob,

Today's linux-next merge of the dt-rh tree got a conflict in
drivers/of/selftest.c between commit 82c0f5897a87 ("of: selftest: add
deferred probe interrupt test") from Linus' tree and commit
ae7c987bc3a7 ("of/selftest: add testcase for nodes with same name and
address") from the dt-rh tree.

I fixed it up (I think - see below) and can carry the fix as necessary
(no action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc drivers/of/selftest.c
index fe70b86bcffb,c93cb4ae5a21..000000000000
--- a/drivers/of/selftest.c
+++ b/drivers/of/selftest.c
@@@ -430,32 -430,23 +430,49 @@@ static void __init of_selftest_match_no
  
  static void __init of_selftest_platform_populate(void)
  {
 -	struct device_node *np, *child;
 +	int irq;
 +	struct device_node *np;
 +	struct platform_device *pdev;
++	struct device_node *child;
+ 	int rc;
+ 	struct of_device_id match[] = {
+ 		{ .compatible = "test-device", },
+ 		{}
+ 	};
  
 +	np = of_find_node_by_path("/testcase-data");
 +	of_platform_populate(np, of_default_bus_match_table, NULL, NULL);
 +
 +	/* Test that a missing irq domain returns -EPROBE_DEFER */
 +	np = of_find_node_by_path("/testcase-data/testcase-device1");
 +	pdev = of_find_device_by_node(np);
 +	if (!pdev)
 +		selftest(0, "device 1 creation failed\n");
 +	irq = platform_get_irq(pdev, 0);
 +	if (irq != -EPROBE_DEFER)
 +		selftest(0, "device deferred probe failed - %d\n", irq);
 +
 +	/* Test that a parsing failure does not return -EPROBE_DEFER */
 +	np = of_find_node_by_path("/testcase-data/testcase-device2");
 +	pdev = of_find_device_by_node(np);
 +	if (!pdev)
 +		selftest(0, "device 2 creation failed\n");
 +	irq = platform_get_irq(pdev, 0);
 +	if (irq >= 0 || irq == -EPROBE_DEFER)
 +		selftest(0, "device parsing error failed - %d\n", irq);
 +
 +	selftest(1, "passed");
++
+ 	np = of_find_node_by_path("/testcase-data/platform-tests");
+ 	if (!np) {
+ 		pr_err("No testcase data in device tree\n");
+ 		return;
+ 	}
+ 
+ 	for_each_child_of_node(np, child) {
+ 		rc = of_platform_populate(child, match, NULL, NULL);
+ 		selftest(!rc, "Could not create device for node '%s'\n", child->name);
+ 	}
  }
  
  static int __init of_selftest(void)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2014-05-13  5:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-02  3:50 linux-next: manual merge of the dt-rh tree with Linus' tree Stephen Rothwell
2014-05-13  5:10 Stephen Rothwell

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