stm32mp1: remove the board_check_usb_power function when ADC is not activated
PATCH 1/1 stm32mp1: remove the board_check_usb_power function when ADC is not activated
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.
---
board/st/stm32mp1/stm32mp1.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
board/st/stm32mp1/stm32mp1.c +4 -5
@@ -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;
Signature · 1 line
2.17.1
PATCH 1/1 stm32mp1: remove the board_check_usb_power function when ADC is not activated
Hi Patrick
Quoted 28 lines · Patrick Delaunay
Simplify the code of the function
board_check_usb_powerbased inCONFIG_ADCandadc_measurement; the function is removed by the linker when theCONFIG_ADCis not activated.Signed-off-by Patrick Delaunay <[email protected]>---
board/st/stm32mp1/stm32mp1.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)board/st/stm32mp1/stm32mp1.c +3
-0@@ -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 */
board/st/stm32mp1/stm32mp1.c static int board_check_usb_power(void) · line 379
Quoted 10 lines
board/st/stm32mp1/stm32mp1.c +1
-5for (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;
Thanks
Patrice
PATCH 1/1 stm32mp1: remove the board_check_usb_power function when ADC is not activated
In reply to Patrick DelaunayQuoted 5 lines · Patrick Delaunay
Simplify the code of the function
board_check_usb_powerbased inCONFIG_ADCandadc_measurement; the function is removed by the linker when theCONFIG_ADCis not activated.Signed-off-by Patrick Delaunay <[email protected]>
Best Regards,
Jaehoon Chung
Quoted 33 lines
---
board/st/stm32mp1/stm32mp1.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)board/st/stm32mp1/stm32mp1.c +4
-5@@ -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;