From b8345bb5d492a911c2143528ca443a5c4f04a9a3 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 6 May 2023 22:50:48 +0200 Subject: [PATCH] oxnas: 5.15: fix mangle bootargs patch compilation warning Fix mangle bootargs patch compilation warning due to defined but not used functions. Fix compilation warning: arch/arm/boot/compressed/atags_to_fdt.c:63:17: error: 'get_cell_size' defined but not used [-Werror=unused-function] 63 | static uint32_t get_cell_size(const void *fdt) | ^~~~~~~~~~~~~ arch/arm/boot/compressed/atags_to_fdt.c:43:12: error: 'setprop_cell' defined but not used [-Werror=unused-function] 43 | static int setprop_cell(void *fdt, const char *node_path, | ^~~~~~~~~~~~ arch/arm/boot/compressed/atags_to_fdt.c:25:12: error: 'setprop' defined but not used [-Werror=unused-function] 25 | static int setprop(void *fdt, const char *node_path, const char *property, | ^~~~~~~ arch/arm/boot/compressed/atags_to_fdt.c: In function 'atags_to_fdt': arch/arm/boot/compressed/atags_to_fdt.c:207:18: error: unused variable 'memsize' [-Werror=unused-variable] 207 | int ret, memsize; | ^~~~~~~ arch/arm/boot/compressed/atags_to_fdt.c:206:13: error: unused variable 'memcount' [-Werror=unused-variable] 206 | int memcount = 0; | ^~~~~~~~ arch/arm/boot/compressed/atags_to_fdt.c:205:16: error: unused variable 'mem_reg_property' [-Werror=unused-variable] 205 | __be32 mem_reg_property[2 * 2 * NR_BANKS]; | ^~~~~~~~~~~~~~~~ arch/arm/boot/compressed/atags_to_fdt.c: At top level: arch/arm/boot/compressed/atags_to_fdt.c:174:13: error: 'hex_str' defined but not used [-Werror=unused-function] 174 | static void hex_str(char *out, uint32_t value) | ^~~~~~~ cc1: all warnings being treated as errors Also make some variable const to fix compilation warning: arch/arm/boot/compressed/atags_to_fdt.c: In function 'append_rootblock': arch/arm/boot/compressed/atags_to_fdt.c:91:13: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] 91 | ptr = str - 1; | ^ Signed-off-by: Christian Marangi --- ...Mangle-bootloader-s-kernel-arguments.patch | 83 +++++++++++++++++-- 1 file changed, 77 insertions(+), 6 deletions(-) diff --git a/target/linux/oxnas/patches-5.15/996-generic-Mangle-bootloader-s-kernel-arguments.patch b/target/linux/oxnas/patches-5.15/996-generic-Mangle-bootloader-s-kernel-arguments.patch index 8cf935ad12..c64c193e7e 100644 --- a/target/linux/oxnas/patches-5.15/996-generic-Mangle-bootloader-s-kernel-arguments.patch +++ b/target/linux/oxnas/patches-5.15/996-generic-Mangle-bootloader-s-kernel-arguments.patch @@ -51,16 +51,58 @@ Signed-off-by: Adrian Panella #else #define do_extend_cmdline 0 #endif -@@ -69,6 +71,59 @@ static uint32_t get_cell_size(const void +@@ -20,6 +22,7 @@ static int node_offset(void *fdt, const + return offset; + } + ++#ifndef CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE + static int setprop(void *fdt, const char *node_path, const char *property, + void *val_array, int size) + { +@@ -28,6 +31,7 @@ static int setprop(void *fdt, const char + return offset; + return fdt_setprop(fdt, offset, property, val_array, size); + } ++#endif + + static int setprop_string(void *fdt, const char *node_path, + const char *property, const char *string) +@@ -38,6 +42,7 @@ static int setprop_string(void *fdt, con + return fdt_setprop_string(fdt, offset, property, string); + } + ++#ifndef CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE + static int setprop_cell(void *fdt, const char *node_path, + const char *property, uint32_t val) + { +@@ -46,6 +51,7 @@ static int setprop_cell(void *fdt, const + return offset; + return fdt_setprop_cell(fdt, offset, property, val); + } ++#endif + + static const void *getprop(const void *fdt, const char *node_path, + const char *property, int *len) +@@ -58,6 +64,7 @@ static const void *getprop(const void *f + return fdt_getprop(fdt, offset, property, len); + } + ++#ifndef CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE + static uint32_t get_cell_size(const void *fdt) + { + int len; +@@ -69,6 +76,61 @@ static uint32_t get_cell_size(const void return cell_size; } ++#endif ++ +#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE) + +static char *append_rootblock(char *dest, const char *str, int len, void *fdt) +{ -+ char *ptr, *end; -+ char *root="root="; ++ const char *ptr, *end; ++ const char *root="root="; + int i, l; + const char *rootblock; + @@ -111,7 +153,7 @@ Signed-off-by: Adrian Panella static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline) { char cmdline[COMMAND_LINE_SIZE]; -@@ -88,12 +143,21 @@ static void merge_fdt_bootargs(void *fdt +@@ -88,18 +150,28 @@ static void merge_fdt_bootargs(void *fdt /* and append the ATAG_CMDLINE */ if (fdt_cmdline) { @@ -133,7 +175,36 @@ Signed-off-by: Adrian Panella } *ptr = '\0'; -@@ -168,7 +232,9 @@ int atags_to_fdt(void *atag_list, void * + setprop_string(fdt, "/chosen", "bootargs", cmdline); + } + ++#ifndef CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE + static void hex_str(char *out, uint32_t value) + { + uint32_t digit; +@@ -117,6 +189,7 @@ static void hex_str(char *out, uint32_t + } + *out = '\0'; + } ++#endif + + /* + * Convert and fold provided ATAGs into the provided FDT. +@@ -131,9 +204,11 @@ int atags_to_fdt(void *atag_list, void * + struct tag *atag = atag_list; + /* In the case of 64 bits memory size, need to reserve 2 cells for + * address and size for each bank */ ++#ifndef CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE + __be32 mem_reg_property[2 * 2 * NR_BANKS]; +- int memcount = 0; +- int ret, memsize; ++ int memsize, memcount = 0; ++#endif ++ int ret; + + /* make sure we've got an aligned pointer */ + if ((u32)atag_list & 0x3) +@@ -168,7 +243,9 @@ int atags_to_fdt(void *atag_list, void * else setprop_string(fdt, "/chosen", "bootargs", atag->u.cmdline.cmdline); @@ -144,7 +215,7 @@ Signed-off-by: Adrian Panella if (memcount >= sizeof(mem_reg_property)/4) continue; if (!atag->u.mem.size) -@@ -212,6 +278,10 @@ int atags_to_fdt(void *atag_list, void * +@@ -212,6 +289,10 @@ int atags_to_fdt(void *atag_list, void * setprop(fdt, "/memory", "reg", mem_reg_property, 4 * memcount * memsize); } -- 2.30.2