Re: [Uboot-stm32] [PATCH 32/33] board: st: common: migrate trace to dev and log macro

2020-10-21 Thread Patrice CHOTARD
Hi Patrick

On 10/14/20 11:16 AM, Patrick Delaunay wrote:
> Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.
>
> Signed-off-by: Patrick Delaunay 
> ---
>
>  board/st/common/stm32mp_dfu.c  | 3 ++-
>  board/st/common/stm32mp_mtdparts.c | 5 +++--
>  board/st/common/stpmic1.c  | 5 -
>  board/st/common/stusb160x.c| 2 ++
>  4 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/board/st/common/stm32mp_dfu.c b/board/st/common/stm32mp_dfu.c
> index aab7d741ac..515fc952fd 100644
> --- a/board/st/common/stm32mp_dfu.c
> +++ b/board/st/common/stm32mp_dfu.c
> @@ -8,6 +8,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -199,7 +200,7 @@ static int dfu_pmic_read(u64 offset, u8 *buffer, long 
> *size)
>   ret = 0;
>   }
>  #else
> - pr_err("PMIC update not supported");
> + log_err("PMIC update not supported");
>   ret = -EOPNOTSUPP;
>  #endif
>  
> diff --git a/board/st/common/stm32mp_mtdparts.c 
> b/board/st/common/stm32mp_mtdparts.c
> index 9f5897f8c8..71a0b449ad 100644
> --- a/board/st/common/stm32mp_mtdparts.c
> +++ b/board/st/common/stm32mp_mtdparts.c
> @@ -8,6 +8,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -117,7 +118,7 @@ void board_mtdparts_default(const char **mtdids, const 
> char **mtdparts)
>   for (uclass_first_device(UCLASS_MTD, );
>dev;
>uclass_next_device()) {
> - pr_debug("mtd device = %s\n", dev->name);
> + log_debug("mtd device = %s\n", dev->name);
>   }
>  
>   if (nor || nand) {
> @@ -163,5 +164,5 @@ void board_mtdparts_default(const char **mtdids, const 
> char **mtdparts)
>   mtd_initialized = true;
>   *mtdids = ids;
>   *mtdparts = parts;
> - debug("%s:mtdids=%s & mtdparts=%s\n", __func__, ids, parts);
> + log_debug("mtdids=%s & mtdparts=%s\n", ids, parts);
>  }
> diff --git a/board/st/common/stpmic1.c b/board/st/common/stpmic1.c
> index 3aa379e8a5..272dc4edac 100644
> --- a/board/st/common/stpmic1.c
> +++ b/board/st/common/stpmic1.c
> @@ -3,8 +3,11 @@
>   * Copyright (C) 2020, STMicroelectronics - All Rights Reserved
>   */
>  
> +#define LOG_CATEGORY LOGC_BOARD
> +
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -202,7 +205,7 @@ void stpmic1_init(u32 voltage_mv)
>  
>   /* Check if debug is enabled to program PMIC according to the bit */
>   if (readl(TAMP_BOOT_CONTEXT) & TAMP_BOOT_DEBUG_ON) {
> - printf("Keep debug unit ON\n");
> + log_info("Keep debug unit ON\n");
>  
>   pmic_clrsetbits(dev, STPMIC1_BUCKS_MRST_CR,
>   STPMIC1_MRST_BUCK_DEBUG,
> diff --git a/board/st/common/stusb160x.c b/board/st/common/stusb160x.c
> index f1197f9faa..0ee4212131 100644
> --- a/board/st/common/stusb160x.c
> +++ b/board/st/common/stusb160x.c
> @@ -6,6 +6,8 @@
>   * Copyright (C) 2020, STMicroelectronics - All Rights Reserved
>   */
>  
> +#define LOG_CATEGORY UCLASS_I2C_GENERIC
> +
>  #include 
>  #include 
>  #include 

Reviewed-by: Patrice Chotard 

Thanks


[PATCH 32/33] board: st: common: migrate trace to dev and log macro

2020-10-14 Thread Patrick Delaunay
Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay 
---

 board/st/common/stm32mp_dfu.c  | 3 ++-
 board/st/common/stm32mp_mtdparts.c | 5 +++--
 board/st/common/stpmic1.c  | 5 -
 board/st/common/stusb160x.c| 2 ++
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/board/st/common/stm32mp_dfu.c b/board/st/common/stm32mp_dfu.c
index aab7d741ac..515fc952fd 100644
--- a/board/st/common/stm32mp_dfu.c
+++ b/board/st/common/stm32mp_dfu.c
@@ -8,6 +8,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -199,7 +200,7 @@ static int dfu_pmic_read(u64 offset, u8 *buffer, long *size)
ret = 0;
}
 #else
-   pr_err("PMIC update not supported");
+   log_err("PMIC update not supported");
ret = -EOPNOTSUPP;
 #endif
 
diff --git a/board/st/common/stm32mp_mtdparts.c 
b/board/st/common/stm32mp_mtdparts.c
index 9f5897f8c8..71a0b449ad 100644
--- a/board/st/common/stm32mp_mtdparts.c
+++ b/board/st/common/stm32mp_mtdparts.c
@@ -8,6 +8,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -117,7 +118,7 @@ void board_mtdparts_default(const char **mtdids, const char 
**mtdparts)
for (uclass_first_device(UCLASS_MTD, );
 dev;
 uclass_next_device()) {
-   pr_debug("mtd device = %s\n", dev->name);
+   log_debug("mtd device = %s\n", dev->name);
}
 
if (nor || nand) {
@@ -163,5 +164,5 @@ void board_mtdparts_default(const char **mtdids, const char 
**mtdparts)
mtd_initialized = true;
*mtdids = ids;
*mtdparts = parts;
-   debug("%s:mtdids=%s & mtdparts=%s\n", __func__, ids, parts);
+   log_debug("mtdids=%s & mtdparts=%s\n", ids, parts);
 }
diff --git a/board/st/common/stpmic1.c b/board/st/common/stpmic1.c
index 3aa379e8a5..272dc4edac 100644
--- a/board/st/common/stpmic1.c
+++ b/board/st/common/stpmic1.c
@@ -3,8 +3,11 @@
  * Copyright (C) 2020, STMicroelectronics - All Rights Reserved
  */
 
+#define LOG_CATEGORY LOGC_BOARD
+
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -202,7 +205,7 @@ void stpmic1_init(u32 voltage_mv)
 
/* Check if debug is enabled to program PMIC according to the bit */
if (readl(TAMP_BOOT_CONTEXT) & TAMP_BOOT_DEBUG_ON) {
-   printf("Keep debug unit ON\n");
+   log_info("Keep debug unit ON\n");
 
pmic_clrsetbits(dev, STPMIC1_BUCKS_MRST_CR,
STPMIC1_MRST_BUCK_DEBUG,
diff --git a/board/st/common/stusb160x.c b/board/st/common/stusb160x.c
index f1197f9faa..0ee4212131 100644
--- a/board/st/common/stusb160x.c
+++ b/board/st/common/stusb160x.c
@@ -6,6 +6,8 @@
  * Copyright (C) 2020, STMicroelectronics - All Rights Reserved
  */
 
+#define LOG_CATEGORY UCLASS_I2C_GENERIC
+
 #include 
 #include 
 #include 
-- 
2.17.1