diff mbox series

[v2,1/1] riscv: use log functions in fdt_fixup

Message ID 20200630093059.19669-1-xypron.glpk@gmx.de
State New
Headers show
Series [v2,1/1] riscv: use log functions in fdt_fixup | expand

Commit Message

Heinrich Schuchardt June 30, 2020, 9:30 a.m. UTC
Replace printf() and debug() by log_err() and log_debug().

"No reserved memory region found in source FDT\n" is not an error but a
debug information.

%s/can not/cannot/ - use the more common spelling.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
v2:
	define the log category as LOGC_ARCH
	rebase the patch upon "Assorted fixes related to reserved memory"
---
 arch/riscv/lib/fdt_fixup.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

--
2.27.0

Comments

Bin Meng June 30, 2020, 9:34 a.m. UTC | #1
On Tue, Jun 30, 2020 at 5:31 PM Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> Replace printf() and debug() by log_err() and log_debug().
>
> "No reserved memory region found in source FDT\n" is not an error but a
> debug information.
>
> %s/can not/cannot/ - use the more common spelling.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
> v2:
>         define the log category as LOGC_ARCH
>         rebase the patch upon "Assorted fixes related to reserved memory"
> ---
>  arch/riscv/lib/fdt_fixup.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>

Reviewed-by: Bin Meng <bin.meng at windriver.com>
Atish Patra June 30, 2020, 9:35 p.m. UTC | #2
On Tue, Jun 30, 2020 at 2:31 AM Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> Replace printf() and debug() by log_err() and log_debug().
>
> "No reserved memory region found in source FDT\n" is not an error but a
> debug information.
>
> %s/can not/cannot/ - use the more common spelling.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
> v2:
>         define the log category as LOGC_ARCH
>         rebase the patch upon "Assorted fixes related to reserved memory"
> ---
>  arch/riscv/lib/fdt_fixup.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/arch/riscv/lib/fdt_fixup.c b/arch/riscv/lib/fdt_fixup.c
> index fab93873d5..2780475c5d 100644
> --- a/arch/riscv/lib/fdt_fixup.c
> +++ b/arch/riscv/lib/fdt_fixup.c
> @@ -4,6 +4,8 @@
>   *
>   */
>
> +#define LOG_CATEGORY LOGC_ARCH
> +
>  #include <common.h>
>  #include <fdt_support.h>
>  #include <log.h>
> @@ -37,7 +39,7 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
>
>         offset = fdt_path_offset(src, "/reserved-memory");
>         if (offset < 0) {
> -               printf("No reserved memory region found in source FDT\n");
> +               log_debug("No reserved memory region found in source FDT\n");
>                 return 0;
>         }
>
> @@ -48,7 +50,7 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
>                                                         "reg", 0, &size,
>                                                         false);
>                 if (addr == FDT_ADDR_T_NONE) {
> -                       debug("failed to read address/size for %s\n", name);
> +                       log_debug("failed to read address/size for %s\n", name);
>                         continue;
>                 }
>                 strncpy(basename, name, max_len);
> @@ -63,7 +65,7 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
>                 err = fdtdec_add_reserved_memory(dst, basename, &pmp_mem,
>                                                  &phandle);
>                 if (err < 0 && err != -FDT_ERR_EXISTS) {
> -                       printf("failed to add reserved memory: %d\n", err);
> +                       log_err("failed to add reserved memory: %d\n", err);
>                         return err;
>                 }
>                 if (!fdt_getprop(src, node, "no-map", NULL))
> @@ -109,7 +111,7 @@ int board_fix_fdt(void *fdt)
>
>         err = riscv_board_reserved_mem_fixup(fdt);
>         if (err < 0) {
> -               printf("failed to fixup DT for reserved memory: %d\n", err);
> +               log_err("failed to fixup DT for reserved memory: %d\n", err);
>                 return err;
>         }
>
> @@ -127,14 +129,14 @@ int arch_fixup_fdt(void *blob)
>         size = fdt_totalsize(blob);
>         err  = fdt_open_into(blob, blob, size + 32);
>         if (err < 0) {
> -               printf("Device Tree can't be expanded to accommodate new node");
> +               log_err("Device Tree can't be expanded to accommodate new node");
>                 return err;
>         }
>         chosen_offset = fdt_path_offset(blob, "/chosen");
>         if (chosen_offset < 0) {
>                 err = fdt_add_subnode(blob, 0, "chosen");
>                 if (err < 0) {
> -                       printf("chosen node can not be added\n");
> +                       log_err("chosen node cannot be added\n");
>                         return err;
>                 }
>         }
> --
> 2.27.0
>

Reviewed-by: Atish Patra <atish.patra at wdc.com>
diff mbox series

Patch

diff --git a/arch/riscv/lib/fdt_fixup.c b/arch/riscv/lib/fdt_fixup.c
index fab93873d5..2780475c5d 100644
--- a/arch/riscv/lib/fdt_fixup.c
+++ b/arch/riscv/lib/fdt_fixup.c
@@ -4,6 +4,8 @@ 
  *
  */

+#define LOG_CATEGORY LOGC_ARCH
+
 #include <common.h>
 #include <fdt_support.h>
 #include <log.h>
@@ -37,7 +39,7 @@  int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)

 	offset = fdt_path_offset(src, "/reserved-memory");
 	if (offset < 0) {
-		printf("No reserved memory region found in source FDT\n");
+		log_debug("No reserved memory region found in source FDT\n");
 		return 0;
 	}

@@ -48,7 +50,7 @@  int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
 							"reg", 0, &size,
 							false);
 		if (addr == FDT_ADDR_T_NONE) {
-			debug("failed to read address/size for %s\n", name);
+			log_debug("failed to read address/size for %s\n", name);
 			continue;
 		}
 		strncpy(basename, name, max_len);
@@ -63,7 +65,7 @@  int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
 		err = fdtdec_add_reserved_memory(dst, basename, &pmp_mem,
 						 &phandle);
 		if (err < 0 && err != -FDT_ERR_EXISTS) {
-			printf("failed to add reserved memory: %d\n", err);
+			log_err("failed to add reserved memory: %d\n", err);
 			return err;
 		}
 		if (!fdt_getprop(src, node, "no-map", NULL))
@@ -109,7 +111,7 @@  int board_fix_fdt(void *fdt)

 	err = riscv_board_reserved_mem_fixup(fdt);
 	if (err < 0) {
-		printf("failed to fixup DT for reserved memory: %d\n", err);
+		log_err("failed to fixup DT for reserved memory: %d\n", err);
 		return err;
 	}

@@ -127,14 +129,14 @@  int arch_fixup_fdt(void *blob)
 	size = fdt_totalsize(blob);
 	err  = fdt_open_into(blob, blob, size + 32);
 	if (err < 0) {
-		printf("Device Tree can't be expanded to accommodate new node");
+		log_err("Device Tree can't be expanded to accommodate new node");
 		return err;
 	}
 	chosen_offset = fdt_path_offset(blob, "/chosen");
 	if (chosen_offset < 0) {
 		err = fdt_add_subnode(blob, 0, "chosen");
 		if (err < 0) {
-			printf("chosen node can not be added\n");
+			log_err("chosen node cannot be added\n");
 			return err;
 		}
 	}