mt76: update to the latest version
[openwrt/openwrt.git] / target / linux / ramips / patches-4.4 / 0104-fix_bootargs_handling.patch
1 --- a/arch/mips/ralink/of.c
2 +++ b/arch/mips/ralink/of.c
3 @@ -3,7 +3,7 @@
4 * under the terms of the GNU General Public License version 2 as published
5 * by the Free Software Foundation.
6 *
7 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
8 + * Copyright (C) 2008-2014 Imre Kaloz <kaloz@openwrt.org>
9 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
10 * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
11 */
12 @@ -66,6 +66,17 @@ static int __init early_init_dt_find_mem
13 return 0;
14 }
15
16 +static int chosen_dtb;
17 +
18 +static int __init early_init_dt_find_chosen(unsigned long node, const char *uname,
19 + int depth, void *data)
20 +{
21 + if (depth == 1 && !strcmp(uname, "chosen"))
22 + chosen_dtb = 1;
23 +
24 + return 0;
25 +}
26 +
27 extern struct boot_param_header __image_dtb;
28
29 void __init plat_mem_setup(void)
30 @@ -78,7 +89,9 @@ void __init plat_mem_setup(void)
31 */
32 __dt_setup_arch(&__image_dtb);
33
34 - strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
35 + of_scan_flat_dt(early_init_dt_find_chosen, NULL);
36 + if (chosen_dtb)
37 + strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
38
39 of_scan_flat_dt(early_init_dt_find_memory, NULL);
40 if (memory_dtb)