diff mbox series

[03/11] board: stm32mp1: use IS_ENABLED to prevent ifdef in board_check_usb_power

Message ID 20200731143152.8812-3-patrick.delaunay@st.com
State Accepted
Commit feb6179ffefa455e8c88a9612528419b49c408a0
Delegated to: Patrice Chotard
Headers show
Series [01/11] board: stm32mp1: use IS_ENABLED to prevent ifdef in board_key_check | expand

Commit Message

Patrick DELAUNAY July 31, 2020, 2:31 p.m. UTC
Use IS_ENABLED to prevent ifdef in board_check_usb_power.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 board/st/stm32mp1/stm32mp1.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Patrice CHOTARD Aug. 13, 2020, 7:22 a.m. UTC | #1
Hi Patrick

On 7/31/20 4:31 PM, Patrick Delaunay wrote:
> Use IS_ENABLED to prevent ifdef in board_check_usb_power.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
>  board/st/stm32mp1/stm32mp1.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
> index 5c84b09c3e..3182f44598 100644
> --- a/board/st/stm32mp1/stm32mp1.c
> +++ b/board/st/stm32mp1/stm32mp1.c
> @@ -288,7 +288,6 @@ static void __maybe_unused led_error_blink(u32 nb_blink)
>  		hang();
>  }
>  
> -#ifdef CONFIG_ADC
>  static int board_check_usb_power(void)
>  {
>  	struct ofnode_phandle_args adc_args;
> @@ -300,6 +299,10 @@ static int board_check_usb_power(void)
>  	int ret, uV, adc_count;
>  	u32 nb_blink;
>  	u8 i;
> +
> +	if (!IS_ENABLED(CONFIG_ADC))
> +		return -ENODEV;
> +
>  	node = ofnode_path("/config");
>  	if (!ofnode_valid(node)) {
>  		debug("%s: no /config node?\n", __func__);
> @@ -422,7 +425,6 @@ static int board_check_usb_power(void)
>  
>  	return 0;
>  }
> -#endif /* CONFIG_ADC */
>  
>  static void sysconf_init(void)
>  {
> @@ -699,10 +701,8 @@ int board_late_init(void)
>  	}
>  #endif
>  
> -#ifdef CONFIG_ADC
>  	/* for DK1/DK2 boards */
>  	board_check_usb_power();
> -#endif /* CONFIG_ADC */
>  
>  	return 0;
>  }

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>

Thanks

Patrice
Patrice CHOTARD Aug. 13, 2020, 7:22 a.m. UTC | #2
Hi Patrick

On 7/31/20 4:31 PM, Patrick Delaunay wrote:
> Use IS_ENABLED to prevent ifdef in board_check_usb_power.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
>  board/st/stm32mp1/stm32mp1.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
> index 5c84b09c3e..3182f44598 100644
> --- a/board/st/stm32mp1/stm32mp1.c
> +++ b/board/st/stm32mp1/stm32mp1.c
> @@ -288,7 +288,6 @@ static void __maybe_unused led_error_blink(u32 nb_blink)
>  		hang();
>  }
>  
> -#ifdef CONFIG_ADC
>  static int board_check_usb_power(void)
>  {
>  	struct ofnode_phandle_args adc_args;
> @@ -300,6 +299,10 @@ static int board_check_usb_power(void)
>  	int ret, uV, adc_count;
>  	u32 nb_blink;
>  	u8 i;
> +
> +	if (!IS_ENABLED(CONFIG_ADC))
> +		return -ENODEV;
> +
>  	node = ofnode_path("/config");
>  	if (!ofnode_valid(node)) {
>  		debug("%s: no /config node?\n", __func__);
> @@ -422,7 +425,6 @@ static int board_check_usb_power(void)
>  
>  	return 0;
>  }
> -#endif /* CONFIG_ADC */
>  
>  static void sysconf_init(void)
>  {
> @@ -699,10 +701,8 @@ int board_late_init(void)
>  	}
>  #endif
>  
> -#ifdef CONFIG_ADC
>  	/* for DK1/DK2 boards */
>  	board_check_usb_power();
> -#endif /* CONFIG_ADC */
>  
>  	return 0;
>  }

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>

Thanks

Patrice
Patrice CHOTARD Aug. 13, 2020, 9:49 a.m. UTC | #3
On 8/13/20 9:22 AM, Patrice CHOTARD wrote:
> Hi Patrick
>
> On 7/31/20 4:31 PM, Patrick Delaunay wrote:
>> Use IS_ENABLED to prevent ifdef in board_check_usb_power.
>>
>> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
>> ---
>>
>>  board/st/stm32mp1/stm32mp1.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)

Applied on u-boot-stm/master

Thanks

>>
>> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
>> index 5c84b09c3e..3182f44598 100644
>> --- a/board/st/stm32mp1/stm32mp1.c
>> +++ b/board/st/stm32mp1/stm32mp1.c
>> @@ -288,7 +288,6 @@ static void __maybe_unused led_error_blink(u32 nb_blink)
>>  		hang();
>>  }
>>  
>> -#ifdef CONFIG_ADC
>>  static int board_check_usb_power(void)
>>  {
>>  	struct ofnode_phandle_args adc_args;
>> @@ -300,6 +299,10 @@ static int board_check_usb_power(void)
>>  	int ret, uV, adc_count;
>>  	u32 nb_blink;
>>  	u8 i;
>> +
>> +	if (!IS_ENABLED(CONFIG_ADC))
>> +		return -ENODEV;
>> +
>>  	node = ofnode_path("/config");
>>  	if (!ofnode_valid(node)) {
>>  		debug("%s: no /config node?\n", __func__);
>> @@ -422,7 +425,6 @@ static int board_check_usb_power(void)
>>  
>>  	return 0;
>>  }
>> -#endif /* CONFIG_ADC */
>>  
>>  static void sysconf_init(void)
>>  {
>> @@ -699,10 +701,8 @@ int board_late_init(void)
>>  	}
>>  #endif
>>  
>> -#ifdef CONFIG_ADC
>>  	/* for DK1/DK2 boards */
>>  	board_check_usb_power();
>> -#endif /* CONFIG_ADC */
>>  
>>  	return 0;
>>  }
> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
>
> Thanks
>
> Patrice
> _______________________________________________
> Uboot-stm32 mailing list
> Uboot-stm32@st-md-mailman.stormreply.com
> https://st-md-mailman.stormreply.com/mailman/listinfo/uboot-stm32
diff mbox series

Patch

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 5c84b09c3e..3182f44598 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -288,7 +288,6 @@  static void __maybe_unused led_error_blink(u32 nb_blink)
 		hang();
 }
 
-#ifdef CONFIG_ADC
 static int board_check_usb_power(void)
 {
 	struct ofnode_phandle_args adc_args;
@@ -300,6 +299,10 @@  static int board_check_usb_power(void)
 	int ret, uV, adc_count;
 	u32 nb_blink;
 	u8 i;
+
+	if (!IS_ENABLED(CONFIG_ADC))
+		return -ENODEV;
+
 	node = ofnode_path("/config");
 	if (!ofnode_valid(node)) {
 		debug("%s: no /config node?\n", __func__);
@@ -422,7 +425,6 @@  static int board_check_usb_power(void)
 
 	return 0;
 }
-#endif /* CONFIG_ADC */
 
 static void sysconf_init(void)
 {
@@ -699,10 +701,8 @@  int board_late_init(void)
 	}
 #endif
 
-#ifdef CONFIG_ADC
 	/* for DK1/DK2 boards */
 	board_check_usb_power();
-#endif /* CONFIG_ADC */
 
 	return 0;
 }