From: Patrice CHOTARD <patrice.chotard@foss.st.com>
To: u-boot@lists.denx.de
Subject: [PATCH] stm32mp1: remove the board_check_usb_power function when ADC is not activated
Date: Thu, 8 Apr 2021 15:58:09 +0200 [thread overview]
Message-ID: <f8ad7670-8ba8-5f85-b88b-5a96d9958810@foss.st.com> (raw)
In-Reply-To: <20210406095752.1.I339c57936517e4941007cc421c1e2cad5a08a0d3@changeid>
Hi Patrick
On 4/6/21 9:57 AM, 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>
> ---
>
> 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;
>
>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Thanks
Patrice
next prev parent reply other threads:[~2021-04-08 13:58 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 [this message]
2021-04-08 22:10 ` Jaehoon Chung
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=f8ad7670-8ba8-5f85-b88b-5a96d9958810@foss.st.com \
--to=patrice.chotard@foss.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.