* [PATCH] stm32mp1: remove the board_check_usb_power function when ADC is not activated
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
1 sibling, 0 replies; 3+ messages in thread
From: Patrice CHOTARD @ 2021-04-08 13:58 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] stm32mp1: remove the board_check_usb_power function when ADC is not activated
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
1 sibling, 0 replies; 3+ messages in thread
From: Jaehoon Chung @ 2021-04-08 22:10 UTC (permalink / raw)
To: u-boot
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;
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread