summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2016-10-17 13:18:02 (GMT)
committerMasahiro Yamada <yamada.masahiro@socionext.com>2016-10-29 08:01:40 (GMT)
commit40749d5a8365c182300bc7ab259500b3abf06838 (patch)
tree7b16284e3fdd6663a699579ebb5f9b235a886a5f
parent1df182ddf700de49fb4400ba67c3029278ea88e7 (diff)
downloadu-boot-fsl-qoriq-40749d5a8365c182300bc7ab259500b3abf06838.tar.xz
ARM: uniphier: adjust fdt_file environment handling to latest Linux
The environment fdt_file is useful to remember the appropriate DTB file name. Adjust it to the recent renaming in the upstream kernel. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-rw-r--r--arch/arm/mach-uniphier/board_late_init.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/arch/arm/mach-uniphier/board_late_init.c b/arch/arm/mach-uniphier/board_late_init.c
index f23295f..ece761f 100644
--- a/arch/arm/mach-uniphier/board_late_init.c
+++ b/arch/arm/mach-uniphier/board_late_init.c
@@ -1,5 +1,7 @@
/*
- * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
+ * Copyright (C) 2014 Panasonic Corporation
+ * Copyright (C) 2015-2016 Socionext Inc.
+ * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -28,15 +30,12 @@ static void nand_denali_wp_disable(void)
#endif
}
-#define VENDOR_PREFIX "socionext,"
-#define DTB_FILE_PREFIX "uniphier-"
-
static int uniphier_set_fdt_file(void)
{
DECLARE_GLOBAL_DATA_PTR;
const char *compat;
char dtb_name[256];
- int buf_len = 256;
+ int buf_len = sizeof(dtb_name);
if (getenv("fdt_file"))
return 0; /* do nothing if it is already set */
@@ -45,15 +44,13 @@ static int uniphier_set_fdt_file(void)
if (!compat)
return -EINVAL;
- if (strncmp(compat, VENDOR_PREFIX, strlen(VENDOR_PREFIX)))
+ /* rip off the vendor prefix "socionext," */
+ compat = strchr(compat, ',');
+ if (!compat)
return -EINVAL;
+ compat++;
- compat += strlen(VENDOR_PREFIX);
-
- strncat(dtb_name, DTB_FILE_PREFIX, buf_len);
- buf_len -= strlen(DTB_FILE_PREFIX);
-
- strncat(dtb_name, compat, buf_len);
+ strncpy(dtb_name, compat, buf_len);
buf_len -= strlen(compat);
strncat(dtb_name, ".dtb", buf_len);