[PATCH] serial: 8250_dw: get index of serial line from DT aliases

From: Julien CHAUVEAU
Date: Thu Oct 30 2014 - 11:05:11 EST


Get index of serial line from device tree using function of_alias_get_id().
If no alias is found, the 8250 core takes care of incrementing the line number.

Signed-off-by: Julien CHAUVEAU <julien.chauveau@xxxxxxxxxxxxxxxxxxx>
---
drivers/tty/serial/8250/8250_dw.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index beea6ca..5416355 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -293,6 +293,11 @@ static int dw8250_probe_of(struct uart_port *p,
if (!of_property_read_u32(np, "reg-shift", &val))
p->regshift = val;

+ /* get index of serial line, if found in DT aliases */
+ val = of_alias_get_id(np, "serial");
+ if (val >= 0)
+ p->line = val;
+
/* clock got configured through clk api, all done */
if (p->uartclk)
return 0;
--
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/