diff mbox series

[23/33] phy: stm32-usbphyc: migrate trace to dev and log macro

Message ID 20201014091646.4233-24-patrick.delaunay@st.com
State Superseded
Delegated to: Patrice Chotard
Headers show
Series stm32: enable logging features | expand

Commit Message

Patrick DELAUNAY Oct. 14, 2020, 9:16 a.m. UTC
Change pr_debug to log_debug or dev_dbg macro and define LOG_CATEGORY.

Remove the "%s:" __func__  header as it is managed by dev macro
(dev->name is displayed) or log macro (CONFIG_LOGF_FUNC).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 drivers/phy/phy-stm32-usbphyc.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

Comments

Patrice CHOTARD Oct. 21, 2020, 12:33 p.m. UTC | #1
Hi Patrick

On 10/14/20 11:16 AM, Patrick Delaunay wrote:
> Change pr_debug to log_debug or dev_dbg macro and define LOG_CATEGORY.
>
> Remove the "%s:" __func__  header as it is managed by dev macro
> (dev->name is displayed) or log macro (CONFIG_LOGF_FUNC).
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
>  drivers/phy/phy-stm32-usbphyc.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c
> index 9d4296d649..2b69514b3a 100644
> --- a/drivers/phy/phy-stm32-usbphyc.c
> +++ b/drivers/phy/phy-stm32-usbphyc.c
> @@ -3,6 +3,8 @@
>   * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
>   */
>  
> +#define LOG_CATEGORY UCLASS_PHY
> +
>  #include <common.h>
>  #include <clk.h>
>  #include <div64.h>
> @@ -97,8 +99,8 @@ static int stm32_usbphyc_pll_init(struct stm32_usbphyc *usbphyc)
>  	u32 usbphyc_pll;
>  
>  	if ((clk_rate < PLL_INFF_MIN_RATE) || (clk_rate > PLL_INFF_MAX_RATE)) {
> -		pr_debug("%s: input clk freq (%dHz) out of range\n",
> -			 __func__, clk_rate);
> +		log_debug("input clk freq (%dHz) out of range\n",
> +			  clk_rate);
>  		return -EINVAL;
>  	}
>  
> @@ -115,8 +117,8 @@ static int stm32_usbphyc_pll_init(struct stm32_usbphyc *usbphyc)
>  
>  	writel(usbphyc_pll, usbphyc->base + STM32_USBPHYC_PLL);
>  
> -	pr_debug("%s: input clk freq=%dHz, ndiv=%d, frac=%d\n", __func__,
> -		 clk_rate, pll_params.ndiv, pll_params.frac);
> +	log_debug("input clk freq=%dHz, ndiv=%d, frac=%d\n",
> +		  clk_rate, pll_params.ndiv, pll_params.frac);
>  
>  	return 0;
>  }
> @@ -153,7 +155,7 @@ static int stm32_usbphyc_phy_init(struct phy *phy)
>  		     true : false;
>  	int ret;
>  
> -	pr_debug("%s phy ID = %lu\n", __func__, phy->id);
> +	dev_dbg(phy->dev, "phy ID = %lu\n", phy->id);
>  	/* Check if one phy port has already configured the pll */
>  	if (pllen && stm32_usbphyc_is_init(usbphyc))
>  		goto initialized;
> @@ -199,7 +201,7 @@ static int stm32_usbphyc_phy_exit(struct phy *phy)
>  	struct stm32_usbphyc_phy *usbphyc_phy = usbphyc->phys + phy->id;
>  	int ret;
>  
> -	pr_debug("%s phy ID = %lu\n", __func__, phy->id);
> +	dev_dbg(phy->dev, "phy ID = %lu\n", phy->id);
>  	usbphyc_phy->init = false;
>  
>  	/* Check if other phy port requires pllen */
> @@ -238,7 +240,7 @@ static int stm32_usbphyc_phy_power_on(struct phy *phy)
>  	struct stm32_usbphyc_phy *usbphyc_phy = usbphyc->phys + phy->id;
>  	int ret;
>  
> -	pr_debug("%s phy ID = %lu\n", __func__, phy->id);
> +	dev_dbg(phy->dev, "phy ID = %lu\n", phy->id);
>  	if (usbphyc_phy->vdd) {
>  		ret = regulator_set_enable(usbphyc_phy->vdd, true);
>  		if (ret)
> @@ -256,7 +258,7 @@ static int stm32_usbphyc_phy_power_off(struct phy *phy)
>  	struct stm32_usbphyc_phy *usbphyc_phy = usbphyc->phys + phy->id;
>  	int ret;
>  
> -	pr_debug("%s phy ID = %lu\n", __func__, phy->id);
> +	dev_dbg(phy->dev, "phy ID = %lu\n", phy->id);
>  	usbphyc_phy->powered = false;
>  
>  	if (stm32_usbphyc_is_powered(usbphyc))

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>

Thanks
diff mbox series

Patch

diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c
index 9d4296d649..2b69514b3a 100644
--- a/drivers/phy/phy-stm32-usbphyc.c
+++ b/drivers/phy/phy-stm32-usbphyc.c
@@ -3,6 +3,8 @@ 
  * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
  */
 
+#define LOG_CATEGORY UCLASS_PHY
+
 #include <common.h>
 #include <clk.h>
 #include <div64.h>
@@ -97,8 +99,8 @@  static int stm32_usbphyc_pll_init(struct stm32_usbphyc *usbphyc)
 	u32 usbphyc_pll;
 
 	if ((clk_rate < PLL_INFF_MIN_RATE) || (clk_rate > PLL_INFF_MAX_RATE)) {
-		pr_debug("%s: input clk freq (%dHz) out of range\n",
-			 __func__, clk_rate);
+		log_debug("input clk freq (%dHz) out of range\n",
+			  clk_rate);
 		return -EINVAL;
 	}
 
@@ -115,8 +117,8 @@  static int stm32_usbphyc_pll_init(struct stm32_usbphyc *usbphyc)
 
 	writel(usbphyc_pll, usbphyc->base + STM32_USBPHYC_PLL);
 
-	pr_debug("%s: input clk freq=%dHz, ndiv=%d, frac=%d\n", __func__,
-		 clk_rate, pll_params.ndiv, pll_params.frac);
+	log_debug("input clk freq=%dHz, ndiv=%d, frac=%d\n",
+		  clk_rate, pll_params.ndiv, pll_params.frac);
 
 	return 0;
 }
@@ -153,7 +155,7 @@  static int stm32_usbphyc_phy_init(struct phy *phy)
 		     true : false;
 	int ret;
 
-	pr_debug("%s phy ID = %lu\n", __func__, phy->id);
+	dev_dbg(phy->dev, "phy ID = %lu\n", phy->id);
 	/* Check if one phy port has already configured the pll */
 	if (pllen && stm32_usbphyc_is_init(usbphyc))
 		goto initialized;
@@ -199,7 +201,7 @@  static int stm32_usbphyc_phy_exit(struct phy *phy)
 	struct stm32_usbphyc_phy *usbphyc_phy = usbphyc->phys + phy->id;
 	int ret;
 
-	pr_debug("%s phy ID = %lu\n", __func__, phy->id);
+	dev_dbg(phy->dev, "phy ID = %lu\n", phy->id);
 	usbphyc_phy->init = false;
 
 	/* Check if other phy port requires pllen */
@@ -238,7 +240,7 @@  static int stm32_usbphyc_phy_power_on(struct phy *phy)
 	struct stm32_usbphyc_phy *usbphyc_phy = usbphyc->phys + phy->id;
 	int ret;
 
-	pr_debug("%s phy ID = %lu\n", __func__, phy->id);
+	dev_dbg(phy->dev, "phy ID = %lu\n", phy->id);
 	if (usbphyc_phy->vdd) {
 		ret = regulator_set_enable(usbphyc_phy->vdd, true);
 		if (ret)
@@ -256,7 +258,7 @@  static int stm32_usbphyc_phy_power_off(struct phy *phy)
 	struct stm32_usbphyc_phy *usbphyc_phy = usbphyc->phys + phy->id;
 	int ret;
 
-	pr_debug("%s phy ID = %lu\n", __func__, phy->id);
+	dev_dbg(phy->dev, "phy ID = %lu\n", phy->id);
 	usbphyc_phy->powered = false;
 
 	if (stm32_usbphyc_is_powered(usbphyc))