All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: u-boot@lists.denx.de
Subject: [PATCH] stm32mp1: remove the board_check_usb_power function when ADC is not activated
Date: Fri, 9 Apr 2021 07:10:21 +0900	[thread overview]
Message-ID: <fcab9ea0-d84e-1527-9b21-e93ee147b384@samsung.com> (raw)
In-Reply-To: <20210406095752.1.I339c57936517e4941007cc421c1e2cad5a08a0d3@changeid>

On 4/6/21 4:57 PM, Patrick Delaunay wrote:
> Simplify the code of the function board_check_usb_power
> based in CONFIG_ADC and adc_measurement; the function is removed by the
> linker when the CONFIG_ADC is not activated.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
> 
>  board/st/stm32mp1/stm32mp1.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
> index 759181fb5d..261ec15e1b 100644
> --- a/board/st/stm32mp1/stm32mp1.c
> +++ b/board/st/stm32mp1/stm32mp1.c
> @@ -347,6 +347,9 @@ static int board_check_usb_power(void)
>  	u32 nb_blink;
>  	u8 i;
>  
> +	if (!IS_ENABLED(CONFIG_ADC))
> +		return -ENODEV;
> +
>  	node = ofnode_path("/config");
>  	if (!ofnode_valid(node)) {
>  		log_debug("no /config node?\n");
> @@ -370,11 +373,7 @@ static int board_check_usb_power(void)
>  
>  	/* perform maximum of 2 ADC measurements to detect power supply current */
>  	for (i = 0; i < 2; i++) {
> -		if (IS_ENABLED(CONFIG_ADC))
> -			ret = adc_measurement(node, adc_count, &min_uV, &max_uV);
> -		else
> -			ret = -ENODEV;
> -
> +		ret = adc_measurement(node, adc_count, &min_uV, &max_uV);
>  		if (ret)
>  			return ret;
>  
> 

      parent reply	other threads:[~2021-04-08 22:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210406075821epcas1p3d7a41df177d536e6ee14be60f4556999@epcas1p3.samsung.com>
2021-04-06  7:57 ` [PATCH] stm32mp1: remove the board_check_usb_power function when ADC is not activated Patrick Delaunay
2021-04-08 13:58   ` Patrice CHOTARD
2021-04-08 22:10   ` Jaehoon Chung [this message]

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=fcab9ea0-d84e-1527-9b21-e93ee147b384@samsung.com \
    --to=jh80.chung@samsung.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.