summary refs log tree commit diff
path: root/drivers/of/fdt.c
diff options
context:
space:
mode:
authorStefan Agner <stefan@agner.ch>2015-10-10 01:29:30 -0700
committerRob Herring <robh@kernel.org>2015-10-13 13:31:26 -0500
commit6296ad9e3375c6c1ddbb371f589ba6a145bb31df (patch)
treec6c7de57b7b0b6f1756d6386b23f17879e998424 /drivers/of/fdt.c
parent191b77c3615b77cf77bdbca95fd98f71c0f191ff (diff)
downloadlinux-6296ad9e3375c6c1ddbb371f589ba6a145bb31df.tar.gz
of/fdt: fix aliases with baudrate in earlycon
Many boards use an alias in the stdout-path specification along
with console options after a colon (e.g. serial0:115200n8). When
using earlycon, this specification currently does not work. While
fdt_path_offset supports alias resolution, it does not remove the
console options by itself. Use the fdt_path_offset_namelen variant
and provide the length of the alias to enable aliases with console
options in the stdout-path.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/of/fdt.c')
-rw-r--r--drivers/of/fdt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 6e82bc42373b..9fc356830226 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -813,8 +813,11 @@ static int __init early_init_dt_scan_chosen_serial(void)
 	if (!p || !l)
 		return -ENOENT;
 
+	/* Remove console options if present */
+	l = strchrnul(p, ':') - p;
+
 	/* Get the node specified by stdout-path */
-	offset = fdt_path_offset(fdt, p);
+	offset = fdt_path_offset_namelen(fdt, p, l);
 	if (offset < 0)
 		return -ENODEV;