diff mbox series

[06/11] board: stm32mp1: use IS_ENABLED to prevent ifdef in dk2_i2c1_fix

Message ID 20200731143152.8812-6-patrick.delaunay@st.com
State Accepted
Commit e817c8eca5a25762f44adf3871bae13af39215d4
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 dk2_i2c1_fix.

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

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

Comments

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

On 7/31/20 4:31 PM, Patrick Delaunay wrote:
> Use IS_ENABLED to prevent ifdef in dk2_i2c1_fix.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
>  board/st/stm32mp1/stm32mp1.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
> index a0a2f9978f..985233f2b3 100644
> --- a/board/st/stm32mp1/stm32mp1.c
> +++ b/board/st/stm32mp1/stm32mp1.c
> @@ -521,7 +521,6 @@ static void sysconf_init(void)
>  	clrbits_le32(syscfg + SYSCFG_CMPCR, SYSCFG_CMPCR_SW_CTRL);
>  }
>  
> -#ifdef CONFIG_DM_REGULATOR
>  /* Fix to make I2C1 usable on DK2 for touchscreen usage in kernel */
>  static int dk2_i2c1_fix(void)
>  {
> @@ -529,6 +528,9 @@ static int dk2_i2c1_fix(void)
>  	struct gpio_desc hdmi, audio;
>  	int ret = 0;
>  
> +	if (!IS_ENABLED(CONFIG_DM_REGULATOR))
> +		return -ENODEV;
> +
>  	node = ofnode_path("/soc/i2c@40012000/hdmi-transmitter@39");
>  	if (!ofnode_valid(node)) {
>  		pr_debug("%s: no hdmi-transmitter@39 ?\n", __func__);
> @@ -586,7 +588,6 @@ static bool board_is_dk2(void)
>  
>  	return false;
>  }
> -#endif
>  
>  static bool board_is_ev1(void)
>  {
> @@ -634,12 +635,11 @@ int board_init(void)
>  	if (board_is_ev1())
>  		board_ev1_init();
>  
> -#ifdef CONFIG_DM_REGULATOR
>  	if (board_is_dk2())
>  		dk2_i2c1_fix();
>  
> -	regulators_enable_boot_on(_DEBUG);
> -#endif
> +	if (IS_ENABLED(CONFIG_DM_REGULATOR))
> +		regulators_enable_boot_on(_DEBUG);
>  
>  	if (!IS_ENABLED(CONFIG_TFABOOT))
>  		sysconf_init();

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

Thanks

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

Applied on u-boot-stm/master

Thanks

>>
>> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
>> index a0a2f9978f..985233f2b3 100644
>> --- a/board/st/stm32mp1/stm32mp1.c
>> +++ b/board/st/stm32mp1/stm32mp1.c
>> @@ -521,7 +521,6 @@ static void sysconf_init(void)
>>  	clrbits_le32(syscfg + SYSCFG_CMPCR, SYSCFG_CMPCR_SW_CTRL);
>>  }
>>  
>> -#ifdef CONFIG_DM_REGULATOR
>>  /* Fix to make I2C1 usable on DK2 for touchscreen usage in kernel */
>>  static int dk2_i2c1_fix(void)
>>  {
>> @@ -529,6 +528,9 @@ static int dk2_i2c1_fix(void)
>>  	struct gpio_desc hdmi, audio;
>>  	int ret = 0;
>>  
>> +	if (!IS_ENABLED(CONFIG_DM_REGULATOR))
>> +		return -ENODEV;
>> +
>>  	node = ofnode_path("/soc/i2c@40012000/hdmi-transmitter@39");
>>  	if (!ofnode_valid(node)) {
>>  		pr_debug("%s: no hdmi-transmitter@39 ?\n", __func__);
>> @@ -586,7 +588,6 @@ static bool board_is_dk2(void)
>>  
>>  	return false;
>>  }
>> -#endif
>>  
>>  static bool board_is_ev1(void)
>>  {
>> @@ -634,12 +635,11 @@ int board_init(void)
>>  	if (board_is_ev1())
>>  		board_ev1_init();
>>  
>> -#ifdef CONFIG_DM_REGULATOR
>>  	if (board_is_dk2())
>>  		dk2_i2c1_fix();
>>  
>> -	regulators_enable_boot_on(_DEBUG);
>> -#endif
>> +	if (IS_ENABLED(CONFIG_DM_REGULATOR))
>> +		regulators_enable_boot_on(_DEBUG);
>>  
>>  	if (!IS_ENABLED(CONFIG_TFABOOT))
>>  		sysconf_init();
> 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 a0a2f9978f..985233f2b3 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -521,7 +521,6 @@  static void sysconf_init(void)
 	clrbits_le32(syscfg + SYSCFG_CMPCR, SYSCFG_CMPCR_SW_CTRL);
 }
 
-#ifdef CONFIG_DM_REGULATOR
 /* Fix to make I2C1 usable on DK2 for touchscreen usage in kernel */
 static int dk2_i2c1_fix(void)
 {
@@ -529,6 +528,9 @@  static int dk2_i2c1_fix(void)
 	struct gpio_desc hdmi, audio;
 	int ret = 0;
 
+	if (!IS_ENABLED(CONFIG_DM_REGULATOR))
+		return -ENODEV;
+
 	node = ofnode_path("/soc/i2c@40012000/hdmi-transmitter@39");
 	if (!ofnode_valid(node)) {
 		pr_debug("%s: no hdmi-transmitter@39 ?\n", __func__);
@@ -586,7 +588,6 @@  static bool board_is_dk2(void)
 
 	return false;
 }
-#endif
 
 static bool board_is_ev1(void)
 {
@@ -634,12 +635,11 @@  int board_init(void)
 	if (board_is_ev1())
 		board_ev1_init();
 
-#ifdef CONFIG_DM_REGULATOR
 	if (board_is_dk2())
 		dk2_i2c1_fix();
 
-	regulators_enable_boot_on(_DEBUG);
-#endif
+	if (IS_ENABLED(CONFIG_DM_REGULATOR))
+		regulators_enable_boot_on(_DEBUG);
 
 	if (!IS_ENABLED(CONFIG_TFABOOT))
 		sysconf_init();