Commit 778ec49c authored by Rob Herring's avatar Rob Herring Committed by Greg Kroah-Hartman

tty: Use of_node_name_{eq,prefix} for node name comparisons

Convert string compares of DT node names to use of_node_name_eq helper
instead. This removes direct access to the node name pointer.

For hvc, the code can also be simplified by using of_stdout pointer
instead of searching again for the stdout node.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-serial@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Acked-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d7240214
...@@ -353,7 +353,7 @@ void __init hvc_opal_init_early(void) ...@@ -353,7 +353,7 @@ void __init hvc_opal_init_early(void)
if (!opal) if (!opal)
return; return;
for_each_child_of_node(opal, np) { for_each_child_of_node(opal, np) {
if (!strcmp(np->name, "serial")) { if (of_node_name_eq(np, "serial")) {
stdout_node = np; stdout_node = np;
break; break;
} }
......
...@@ -371,20 +371,11 @@ device_initcall(hvc_vio_init); /* after drivers/tty/hvc/hvc_console.c */ ...@@ -371,20 +371,11 @@ device_initcall(hvc_vio_init); /* after drivers/tty/hvc/hvc_console.c */
void __init hvc_vio_init_early(void) void __init hvc_vio_init_early(void)
{ {
const __be32 *termno; const __be32 *termno;
const char *name;
const struct hv_ops *ops; const struct hv_ops *ops;
/* find the boot console from /chosen/stdout */ /* find the boot console from /chosen/stdout */
if (!of_stdout)
return;
name = of_get_property(of_stdout, "name", NULL);
if (!name) {
printk(KERN_WARNING "stdout node missing 'name' property!\n");
return;
}
/* Check if it's a virtual terminal */ /* Check if it's a virtual terminal */
if (strncmp(name, "vty", 3) != 0) if (!of_node_name_prefix(of_stdout, "vty"))
return; return;
termno = of_get_property(of_stdout, "reg", NULL); termno = of_get_property(of_stdout, "reg", NULL);
if (termno == NULL) if (termno == NULL)
......
...@@ -1648,9 +1648,9 @@ static int __init pmz_probe(void) ...@@ -1648,9 +1648,9 @@ static int __init pmz_probe(void)
*/ */
node_a = node_b = NULL; node_a = node_b = NULL;
for (np = NULL; (np = of_get_next_child(node_p, np)) != NULL;) { for (np = NULL; (np = of_get_next_child(node_p, np)) != NULL;) {
if (strncmp(np->name, "ch-a", 4) == 0) if (of_node_name_prefix(np, "ch-a"))
node_a = of_node_get(np); node_a = of_node_get(np);
else if (strncmp(np->name, "ch-b", 4) == 0) else if (of_node_name_prefix(np, "ch-b"))
node_b = of_node_get(np); node_b = of_node_get(np);
} }
if (!node_a && !node_b) { if (!node_a && !node_b) {
......
...@@ -89,14 +89,14 @@ void sunserial_console_termios(struct console *con, struct device_node *uart_dp) ...@@ -89,14 +89,14 @@ void sunserial_console_termios(struct console *con, struct device_node *uart_dp)
int baud, bits, stop, cflag; int baud, bits, stop, cflag;
char parity; char parity;
if (!strcmp(uart_dp->name, "rsc") || if (of_node_name_eq(uart_dp, "rsc") ||
!strcmp(uart_dp->name, "rsc-console") || of_node_name_eq(uart_dp, "rsc-console") ||
!strcmp(uart_dp->name, "rsc-control")) { of_node_name_eq(uart_dp, "rsc-control")) {
mode = of_get_property(uart_dp, mode = of_get_property(uart_dp,
"ssp-console-modes", NULL); "ssp-console-modes", NULL);
if (!mode) if (!mode)
mode = "115200,8,n,1,-"; mode = "115200,8,n,1,-";
} else if (!strcmp(uart_dp->name, "lom-console")) { } else if (of_node_name_eq(uart_dp, "lom-console")) {
mode = "9600,8,n,1,-"; mode = "9600,8,n,1,-";
} else { } else {
struct device_node *dp; struct device_node *dp;
......
...@@ -1482,8 +1482,8 @@ static int su_probe(struct platform_device *op) ...@@ -1482,8 +1482,8 @@ static int su_probe(struct platform_device *op)
up->port.ops = &sunsu_pops; up->port.ops = &sunsu_pops;
ignore_line = false; ignore_line = false;
if (!strcmp(dp->name, "rsc-console") || if (of_node_name_eq(dp, "rsc-console") ||
!strcmp(dp->name, "lom-console")) of_node_name_eq(dp, "lom-console"))
ignore_line = true; ignore_line = true;
sunserial_console_match(SUNSU_CONSOLE(), dp, sunserial_console_match(SUNSU_CONSOLE(), dp,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment