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: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
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");
/* 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;