diff mbox series

[U-Boot,1/6] mtd: cfi_flash: Use CONFIG_SYS_MONITOR_BASE only when defined

Message ID 20190910051050.17482-2-vigneshr@ti.com
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series J721e: Add HyperBus support | expand

Commit Message

Raghavendra, Vignesh Sept. 10, 2019, 5:10 a.m. UTC
Make use of CONFIG_SYS_MONITOR_BASE only when available to avoid build
error when CONFIG_SYS_MONITOR_BASE is not defined.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
 drivers/mtd/cfi_flash.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Stefan Roese Oct. 9, 2019, 7:16 a.m. UTC | #1
Hi Vignesh,

sorry for the late review.

On 10.09.19 07:10, Vignesh Raghavendra wrote:
> Make use of CONFIG_SYS_MONITOR_BASE only when available to avoid build
> error when CONFIG_SYS_MONITOR_BASE is not defined.
> 
> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
> ---
>   drivers/mtd/cfi_flash.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
> index c59254c76e3e..fea15fb523d8 100644
> --- a/drivers/mtd/cfi_flash.c
> +++ b/drivers/mtd/cfi_flash.c
> @@ -178,7 +178,8 @@ __maybe_weak u64 flash_read64(void *addr)
>   /*-----------------------------------------------------------------------
>    */
>   #if defined(CONFIG_ENV_IS_IN_FLASH) || defined(CONFIG_ENV_ADDR_REDUND) || \
> -	(CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE)
> +	(defined(CONFIG_SYS_MONITOR_BASE) && \
> +	(CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE))

Here you extend the exisiting #ifdef ...

>   static flash_info_t *flash_get_info(ulong base)
>   {
>   	int i;
> @@ -2329,12 +2330,14 @@ static void flash_protect_default(void)
>   #endif
>   
>   	/* Monitor protection ON by default */
> +#ifdef CONFIG_SYS_MONITOR_BASE
>   #if (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) && \
>   	(!defined(CONFIG_MONITOR_IS_IN_RAM))
>   	flash_protect(FLAG_PROTECT_SET,
>   		      CONFIG_SYS_MONITOR_BASE,
>   		      CONFIG_SYS_MONITOR_BASE + monitor_flash_len  - 1,
>   		      flash_get_info(CONFIG_SYS_MONITOR_BASE));
> +#endif
>   #endif

... and here you add a 2nd #ifdef. Why don't you extend the existing
one here as well?

Thanks,
Stefan
Raghavendra, Vignesh Oct. 9, 2019, 9:41 a.m. UTC | #2
Hi Stefan,

On 09/10/19 12:46 PM, Stefan Roese wrote:
> Hi Vignesh,
> 
> sorry for the late review.
> 
> On 10.09.19 07:10, Vignesh Raghavendra wrote:
>> Make use of CONFIG_SYS_MONITOR_BASE only when available to avoid build
>> error when CONFIG_SYS_MONITOR_BASE is not defined.
>>
>> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
>> ---
>>   drivers/mtd/cfi_flash.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
>> index c59254c76e3e..fea15fb523d8 100644
>> --- a/drivers/mtd/cfi_flash.c
>> +++ b/drivers/mtd/cfi_flash.c
>> @@ -178,7 +178,8 @@ __maybe_weak u64 flash_read64(void *addr)
>>  
>> /*-----------------------------------------------------------------------
>>    */
>>   #if defined(CONFIG_ENV_IS_IN_FLASH) ||
>> defined(CONFIG_ENV_ADDR_REDUND) || \
>> -    (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE)
>> +    (defined(CONFIG_SYS_MONITOR_BASE) && \
>> +    (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE))
> 
> Here you extend the exisiting #ifdef ...
> 
>>   static flash_info_t *flash_get_info(ulong base)
>>   {
>>       int i;
>> @@ -2329,12 +2330,14 @@ static void flash_protect_default(void)
>>   #endif
>>         /* Monitor protection ON by default */
>> +#ifdef CONFIG_SYS_MONITOR_BASE
>>   #if (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) && \
>>       (!defined(CONFIG_MONITOR_IS_IN_RAM))
>>       flash_protect(FLAG_PROTECT_SET,
>>                 CONFIG_SYS_MONITOR_BASE,
>>                 CONFIG_SYS_MONITOR_BASE + monitor_flash_len  - 1,
>>                 flash_get_info(CONFIG_SYS_MONITOR_BASE));
>> +#endif
>>   #endif
> 
> ... and here you add a 2nd #ifdef. Why don't you extend the existing
> one here as well?
> 

Ah, yes, Will fix it in next version. Thanks!

> Thanks,
> Stefan
diff mbox series

Patch

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index c59254c76e3e..fea15fb523d8 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -178,7 +178,8 @@  __maybe_weak u64 flash_read64(void *addr)
 /*-----------------------------------------------------------------------
  */
 #if defined(CONFIG_ENV_IS_IN_FLASH) || defined(CONFIG_ENV_ADDR_REDUND) || \
-	(CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE)
+	(defined(CONFIG_SYS_MONITOR_BASE) && \
+	(CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE))
 static flash_info_t *flash_get_info(ulong base)
 {
 	int i;
@@ -2329,12 +2330,14 @@  static void flash_protect_default(void)
 #endif
 
 	/* Monitor protection ON by default */
+#ifdef CONFIG_SYS_MONITOR_BASE
 #if (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) && \
 	(!defined(CONFIG_MONITOR_IS_IN_RAM))
 	flash_protect(FLAG_PROTECT_SET,
 		      CONFIG_SYS_MONITOR_BASE,
 		      CONFIG_SYS_MONITOR_BASE + monitor_flash_len  - 1,
 		      flash_get_info(CONFIG_SYS_MONITOR_BASE));
+#endif
 #endif
 
 	/* Environment protection ON by default */