All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@st.com>
To: u-boot@lists.denx.de
Subject: [PATCH 22/33] i2c: stm32f7_i2c: migrate trace to dev and log macro
Date: Wed, 21 Oct 2020 12:33:21 +0000	[thread overview]
Message-ID: <aa6bceaf-447a-9330-a078-33c7854f44f8@st.com> (raw)
In-Reply-To: <20201014091646.4233-23-patrick.delaunay@st.com>

Hi Patrick

On 10/14/20 11:16 AM, Patrick Delaunay wrote:
> Change debug to 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/i2c/stm32f7_i2c.c | 74 +++++++++++++++++++--------------------
>  1 file changed, 37 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c
> index 2f60911549..a407cc02ab 100644
> --- a/drivers/i2c/stm32f7_i2c.c
> +++ b/drivers/i2c/stm32f7_i2c.c
> @@ -3,6 +3,8 @@
>   * (C) Copyright 2017 STMicroelectronics
>   */
>  
> +#define LOG_CATEGORY UCLASS_I2C
> +
>  #include <common.h>
>  #include <clk.h>
>  #include <dm.h>
> @@ -11,10 +13,10 @@
>  #include <regmap.h>
>  #include <reset.h>
>  #include <syscon.h>
> +#include <dm/device.h>
> +#include <dm/device_compat.h>
>  #include <linux/bitops.h>
>  #include <linux/delay.h>
> -
> -#include <dm/device.h>
>  #include <linux/err.h>
>  #include <linux/io.h>
>  
> @@ -346,7 +348,7 @@ static int stm32_i2c_wait_flags(struct stm32_i2c_priv *i2c_priv,
>  	*status = readl(&regs->isr);
>  	while (!(*status & flags)) {
>  		if (get_timer(time_start) > CONFIG_SYS_HZ) {
> -			debug("%s: i2c timeout\n", __func__);
> +			log_debug("i2c timeout\n");
>  			return -ETIMEDOUT;
>  		}
>  
> @@ -369,7 +371,7 @@ static int stm32_i2c_check_end_of_message(struct stm32_i2c_priv *i2c_priv)
>  		return ret;
>  
>  	if (status & STM32_I2C_ISR_BERR) {
> -		debug("%s: Bus error\n", __func__);
> +		log_debug("Bus error\n");
>  
>  		/* Clear BERR flag */
>  		setbits_le32(&regs->icr, STM32_I2C_ICR_BERRCF);
> @@ -378,7 +380,7 @@ static int stm32_i2c_check_end_of_message(struct stm32_i2c_priv *i2c_priv)
>  	}
>  
>  	if (status & STM32_I2C_ISR_ARLO) {
> -		debug("%s: Arbitration lost\n", __func__);
> +		log_debug("Arbitration lost\n");
>  
>  		/* Clear ARLO flag */
>  		setbits_le32(&regs->icr, STM32_I2C_ICR_ARLOCF);
> @@ -387,7 +389,7 @@ static int stm32_i2c_check_end_of_message(struct stm32_i2c_priv *i2c_priv)
>  	}
>  
>  	if (status & STM32_I2C_ISR_NACKF) {
> -		debug("%s: Receive NACK\n", __func__);
> +		log_debug("Receive NACK\n");
>  
>  		/* Clear NACK flag */
>  		setbits_le32(&regs->icr, STM32_I2C_ICR_NACKCF);
> @@ -535,8 +537,8 @@ static int stm32_i2c_compute_solutions(struct stm32_i2c_setup *setup,
>  	if (sdadel_max < 0)
>  		sdadel_max = 0;
>  
> -	debug("%s: SDADEL(min/max): %i/%i, SCLDEL(Min): %i\n", __func__,
> -	      sdadel_min, sdadel_max, scldel_min);
> +	log_debug("SDADEL(min/max): %i/%i, SCLDEL(Min): %i\n",
> +		  sdadel_min, sdadel_max, scldel_min);
>  
>  	/* Compute possible values for PRESC, SCLDEL and SDADEL */
>  	for (p = 0; p < STM32_PRESC_MAX; p++) {
> @@ -572,7 +574,7 @@ static int stm32_i2c_compute_solutions(struct stm32_i2c_setup *setup,
>  	}
>  
>  	if (list_empty(solutions)) {
> -		pr_err("%s: no Prescaler solution\n", __func__);
> +		log_err("no Prescaler solution\n");
>  		ret = -EPERM;
>  	}
>  
> @@ -656,7 +658,7 @@ static int stm32_i2c_choose_solution(struct stm32_i2c_setup *setup,
>  	}
>  
>  	if (!sol_found) {
> -		pr_err("%s: no solution at all\n", __func__);
> +		log_err("no solution at all\n");
>  		ret = -EPERM;
>  	}
>  
> @@ -686,23 +688,22 @@ static int stm32_i2c_compute_timing(struct stm32_i2c_priv *i2c_priv,
>  
>  	specs = get_specs(setup->speed_freq);
>  	if (specs == ERR_PTR(-EINVAL)) {
> -		pr_err("%s: speed out of bound {%d}\n", __func__,
> -		       setup->speed_freq);
> +		log_err("speed out of bound {%d}\n",
> +			setup->speed_freq);
>  		return -EINVAL;
>  	}
>  
>  	if (setup->rise_time > specs->rise_max ||
>  	    setup->fall_time > specs->fall_max) {
> -		pr_err("%s :timings out of bound Rise{%d>%d}/Fall{%d>%d}\n",
> -		       __func__,
> -		       setup->rise_time, specs->rise_max,
> -		       setup->fall_time, specs->fall_max);
> +		log_err("timings out of bound Rise{%d>%d}/Fall{%d>%d}\n",
> +			setup->rise_time, specs->rise_max,
> +			setup->fall_time, specs->fall_max);
>  		return -EINVAL;
>  	}
>  
>  	if (setup->dnf > STM32_I2C_DNF_MAX) {
> -		pr_err("%s: DNF out of bound %d/%d\n", __func__,
> -		       setup->dnf, STM32_I2C_DNF_MAX);
> +		log_err("DNF out of bound %d/%d\n",
> +			setup->dnf, STM32_I2C_DNF_MAX);
>  		return -EINVAL;
>  	}
>  
> @@ -715,10 +716,10 @@ static int stm32_i2c_compute_timing(struct stm32_i2c_priv *i2c_priv,
>  	if (ret)
>  		goto exit;
>  
> -	debug("%s: Presc: %i, scldel: %i, sdadel: %i, scll: %i, sclh: %i\n",
> -	      __func__, output->presc,
> -	      output->scldel, output->sdadel,
> -	      output->scll, output->sclh);
> +	log_debug("Presc: %i, scldel: %i, sdadel: %i, scll: %i, sclh: %i\n",
> +		  output->presc,
> +		  output->scldel, output->sdadel,
> +		  output->scll, output->sclh);
>  
>  exit:
>  	/* Release list and memory */
> @@ -751,20 +752,19 @@ static int stm32_i2c_setup_timing(struct stm32_i2c_priv *i2c_priv,
>  	setup->clock_src = clk_get_rate(&i2c_priv->clk);
>  
>  	if (!setup->clock_src) {
> -		pr_err("%s: clock rate is 0\n", __func__);
> +		log_err("clock rate is 0\n");
>  		return -EINVAL;
>  	}
>  
>  	do {
>  		ret = stm32_i2c_compute_timing(i2c_priv, setup, timing);
>  		if (ret) {
> -			debug("%s: failed to compute I2C timings.\n",
> -			      __func__);
> +			log_debug("failed to compute I2C timings.\n");
>  			if (setup->speed_freq > I2C_SPEED_STANDARD_RATE) {
>  				setup->speed_freq =
>  					get_lower_rate(setup->speed_freq);
> -				debug("%s: downgrade I2C Speed Freq to (%i)\n",
> -				      __func__, setup->speed_freq);
> +				log_debug("downgrade I2C Speed Freq to (%i)\n",
> +					  setup->speed_freq);
>  			} else {
>  				break;
>  			}
> @@ -772,16 +772,16 @@ static int stm32_i2c_setup_timing(struct stm32_i2c_priv *i2c_priv,
>  	} while (ret);
>  
>  	if (ret) {
> -		pr_err("%s: impossible to compute I2C timings.\n", __func__);
> +		log_err("impossible to compute I2C timings.\n");
>  		return ret;
>  	}
>  
> -	debug("%s: I2C Freq(%i), Clk Source(%i)\n", __func__,
> -	      setup->speed_freq, setup->clock_src);
> -	debug("%s: I2C Rise(%i) and Fall(%i) Time\n", __func__,
> -	      setup->rise_time, setup->fall_time);
> -	debug("%s: I2C Analog Filter(%s), DNF(%i)\n", __func__,
> -	      setup->analog_filter ? "On" : "Off", setup->dnf);
> +	log_debug("I2C Freq(%i), Clk Source(%i)\n",
> +		  setup->speed_freq, setup->clock_src);
> +	log_debug("I2C Rise(%i) and Fall(%i) Time\n",
> +		  setup->rise_time, setup->fall_time);
> +	log_debug("I2C Analog Filter(%s), DNF(%i)\n",
> +		  setup->analog_filter ? "On" : "Off", setup->dnf);
>  
>  	i2c_priv->speed = setup->speed_freq;
>  
> @@ -848,12 +848,12 @@ static int stm32_i2c_hw_config(struct stm32_i2c_priv *i2c_priv)
>  	return 0;
>  }
>  
> -static int stm32_i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
> +static int stm32_i2c_set_bus_speed(struct udevice *dev, unsigned int speed)
>  {
> -	struct stm32_i2c_priv *i2c_priv = dev_get_priv(bus);
> +	struct stm32_i2c_priv *i2c_priv = dev_get_priv(dev);
>  
>  	if (speed > I2C_SPEED_FAST_PLUS_RATE) {
> -		debug("%s: Speed %d not supported\n", __func__, speed);
> +		dev_dbg(dev, "Speed %d not supported\n", speed);
>  		return -EINVAL;
>  	}
>  

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

Thanks

  reply	other threads:[~2020-10-21 12:33 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14  9:16 [PATCH 00/33] stm32: enable logging features Patrick Delaunay
2020-10-14  9:16 ` [PATCH 01/33] arm: stm32mp: migrate trace to log macro Patrick Delaunay
2020-10-21 12:01   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 02/33] arm: stm32mp: migrate cmd_stm32prog " Patrick Delaunay
2020-10-21 12:01   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 03/33] arm: stm32mp: bsec: migrate trace " Patrick Delaunay
2020-10-21 12:01   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 04/33] pinctrl: stm32: " Patrick Delaunay
2020-10-21 12:38   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 05/33] gpio: stm32-gpio: migrate trace to dev and " Patrick Delaunay
2020-10-21 12:24   ` Patrice CHOTARD
2020-10-21 12:29   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 06/33] remoproc: stm32: migrate trace to " Patrick Delaunay
2020-10-21 12:25   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 07/33] ram: " Patrick Delaunay
2020-10-21 12:25   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 08/33] ram: stm32mp1: migrate trace to dev or " Patrick Delaunay
2020-10-21 12:25   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 09/33] mmc: stm32_sdmmc2: migrate trace to dev and " Patrick Delaunay
2020-10-15 10:25   ` Peng Fan
2020-10-21 12:26   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 10/33] timer: stm32: migrate trace to " Patrick Delaunay
2020-10-21 12:26   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 11/33] hwspinlock: " Patrick Delaunay
2020-10-21 12:26   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 12/33] rtc: " Patrick Delaunay
2020-10-21 12:26   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 13/33] watchdog: stm32mp: migrate trace to dev macro Patrick Delaunay
2020-10-21 12:27   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 14/33] power: regulator: stm32-verfbuf: define LOG_CATEGORY Patrick Delaunay
2020-10-21 12:27   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 15/33] misc: rcc: migrate trace to dev macro Patrick Delaunay
2020-10-21 12:27   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 16/33] misc: rcc: keep the rcc device name for subnode Patrick Delaunay
2020-10-21 12:28   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 17/33] clk: stm32mp1: migrate trace to dev and log macro Patrick Delaunay
2020-10-21 12:28   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 18/33] clk: clk_stm32f: " Patrick Delaunay
2020-10-21 12:32   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 19/33] clk: clk_stm32h7: " Patrick Delaunay
2020-10-21 12:32   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 20/33] reset: stm32-reset: " Patrick Delaunay
2020-10-21 12:32   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 21/33] mailbox: stm32-ipcc: " Patrick Delaunay
2020-10-21 12:33   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 22/33] i2c: stm32f7_i2c: " Patrick Delaunay
2020-10-21 12:33   ` Patrice CHOTARD [this message]
2020-10-14  9:16 ` [PATCH 23/33] phy: stm32-usbphyc: " Patrick Delaunay
2020-10-21 12:33   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 24/33] spi: stm32_spi: " Patrick Delaunay
2020-10-21 12:34   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 25/33] spi: stm32_qspi: " Patrick Delaunay
2020-10-21 12:34   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 26/33] mtd: stm32_fmc2: " Patrick Delaunay
2020-10-21 12:34   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 27/33] memory: stm32-fmc2: " Patrick Delaunay
2020-10-21 12:34   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 28/33] serial: stm32: define LOG_CATEGORY Patrick Delaunay
2020-10-21 12:34   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 29/33] video: stm32_ltdc: migrate trace to dev and log macro Patrick Delaunay
2020-10-21 12:35   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 30/33] video: stm32_dsi: " Patrick Delaunay
2020-10-15  8:50   ` Philippe CORNU
2020-10-14  9:16 ` [PATCH 31/33] board: st: stm32mp1: " Patrick Delaunay
2020-10-21 12:35   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 32/33] board: st: common: " Patrick Delaunay
2020-10-21 12:36   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 33/33] configs: stm32mp15: enable LOG features Patrick Delaunay
2020-10-21 12:37   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-15 15:05 ` [PATCH 00/33] stm32: enable logging features Simon Glass
2020-10-15 15:59   ` Patrick DELAUNAY
2020-10-26 19:22     ` Simon Glass
2020-10-28 11:52       ` Patrick DELAUNAY
2020-10-30 18:15         ` Simon Glass
2020-11-06 17:45           ` Patrick DELAUNAY
2020-11-06 18:50             ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aa6bceaf-447a-9330-a078-33c7854f44f8@st.com \
    --to=patrice.chotard@st.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.