mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 01:49:36 +00:00
tty: serial: cpm_uart: make use of for_each_node_by_type()
Instead of open-coding loop with of_find_node_by_type(), let's use canned macro. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
aea9a80ba9
commit
0832a46202
1 changed files with 10 additions and 8 deletions
|
@ -1302,7 +1302,7 @@ static int __init cpm_uart_console_setup(struct console *co, char *options)
|
||||||
struct uart_cpm_port *pinfo;
|
struct uart_cpm_port *pinfo;
|
||||||
struct uart_port *port;
|
struct uart_port *port;
|
||||||
|
|
||||||
struct device_node *np = NULL;
|
struct device_node *np;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if (co->index >= UART_NR) {
|
if (co->index >= UART_NR) {
|
||||||
|
@ -1311,17 +1311,19 @@ static int __init cpm_uart_console_setup(struct console *co, char *options)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
for_each_node_by_type(np, "serial") {
|
||||||
np = of_find_node_by_type(np, "serial");
|
|
||||||
if (!np)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
if (!of_device_is_compatible(np, "fsl,cpm1-smc-uart") &&
|
if (!of_device_is_compatible(np, "fsl,cpm1-smc-uart") &&
|
||||||
!of_device_is_compatible(np, "fsl,cpm1-scc-uart") &&
|
!of_device_is_compatible(np, "fsl,cpm1-scc-uart") &&
|
||||||
!of_device_is_compatible(np, "fsl,cpm2-smc-uart") &&
|
!of_device_is_compatible(np, "fsl,cpm2-smc-uart") &&
|
||||||
!of_device_is_compatible(np, "fsl,cpm2-scc-uart"))
|
!of_device_is_compatible(np, "fsl,cpm2-scc-uart"))
|
||||||
i--;
|
continue;
|
||||||
} while (i++ != co->index);
|
|
||||||
|
if (i++ == co->index)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!np)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
pinfo = &cpm_uart_ports[co->index];
|
pinfo = &cpm_uart_ports[co->index];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue