Skip to contentSkip to conversation

powerpc: Rework btext_find_display to use of_stdout and device_type helpers

PATCH Applied Rob Herring 2 participants 2 messages Nov 16, 2018 – Dec 7, 2018 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Rework btext_find_display to use of_stdout and device_type helpers

Remove directly accessing device_node.type pointer and use the accessors instead. This will eventually allow removing the type pointer.

In the process, the of_stdout pointer can be used instead of finding the stdout node again.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
---
 arch/powerpc/kernel/btext.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
arch/powerpc/kernel/btext.c +4 -12
index b4241ed1456e..488b0875ed66 100644
@@ -232,20 +232,12 @@ static int btext_initialize(struct device_node *np)
 
 int __init btext_find_display(int allow_nonstdout)
 {
-	const char *name;
-	struct device_node *np = NULL; 
+	struct device_node *np = of_stdout; 
 	int rc = -ENODEV;
 
-	name = of_get_property(of_chosen, "linux,stdout-path", NULL);
-	if (name != NULL) {
-		np = of_find_node_by_path(name);
-		if (np != NULL) {
-			if (strcmp(np->type, "display") != 0) {
-				printk("boot stdout isn't a display !\n");
-				of_node_put(np);
-				np = NULL;
-			}
-		}
+	if (!of_node_is_type(np, "display")) {
+		printk("boot stdout isn't a display !\n");
+		np = NULL;
 	}
 	if (np)
 		rc = btext_initialize(np);
Signature · 1 line
2.19.1
#1 lore raw
Quoted 11 lines · Rob Herring

Remove directly accessing device_node.type pointer and use the accessors instead. This will eventually allow removing the type pointer.

In the process, the of_stdout pointer can be used instead of finding the stdout node again.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/5b8d6be7b8dd286bd654e37d637ded

cheers