All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] common: update: fix an "unused" warning against update_flash()
@ 2020-11-19  0:37 AKASHI Takahiro
  2020-12-03 16:59 ` Tom Rini
  0 siblings, 1 reply; 3+ messages in thread
From: AKASHI Takahiro @ 2020-11-19  0:37 UTC (permalink / raw)
  To: u-boot

Since update_flash() is used only in update_tftp(), it should be
guarded with appropriate config options.

After the commit 3149e524fc1e, common/update.c will be built under
either CONFIG_UDATE_TFTP, CONFIG_DFU_TFTP or CONFIG_UPDATE_FIT.
Since CONFIG_UPDATE_FIT, hence fit_update(), doesn't rely on
update_flash(), the compiler may cause an "unused" warning if
CONFIG_UPDATE_FIT=y and CONFIG_UPDATE_TFTP=n and CONFIG_DFU_TFTP=n.

This is, for example, the case for sandbox defconfig where
EFI_CAPSULE_FIRMWARE_FIT is enabled for test purpose.

Fixes: 3149e524fc1e ("common: update: add a generic interface for FIT
       image")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
Change in v2
* modify the commit message
---
 common/update.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/update.c b/common/update.c
index 808be0880dfd..a5879cb52c41 100644
--- a/common/update.c
+++ b/common/update.c
@@ -29,7 +29,7 @@
 #include <errno.h>
 #include <mtd/cfi_flash.h>
 
-#ifdef CONFIG_DFU_TFTP
+#if defined(CONFIG_DFU_TFTP) || defined(CONFIG_UPDATE_TFTP)
 /* env variable holding the location of the update file */
 #define UPDATE_FILE_ENV		"updatefile"
 
@@ -99,7 +99,6 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 
 	return rv;
 }
-#endif /* CONFIG_DFU_TFTP */
 
 #ifdef CONFIG_MTD_NOR_FLASH
 static int update_flash_protect(int prot, ulong addr_first, ulong addr_last)
@@ -216,6 +215,7 @@ static int update_flash(ulong addr_source, ulong addr_first, ulong size)
 #endif
 	return 0;
 }
+#endif /* CONFIG_DFU_TFTP || CONFIG_UPDATE_TFTP */
 
 static int update_fit_getparams(const void *fit, int noffset, ulong *addr,
 						ulong *fladdr, ulong *size)
@@ -233,7 +233,7 @@ static int update_fit_getparams(const void *fit, int noffset, ulong *addr,
 	return 0;
 }
 
-#ifdef CONFIG_DFU_TFTP
+#if defined(CONFIG_DFU_TFTP) || defined(CONFIG_UPDATE_TFTP)
 int update_tftp(ulong addr, char *interface, char *devstring)
 {
 	char *filename, *env_addr, *fit_image_name;
@@ -340,7 +340,7 @@ next_node:
 
 	return ret;
 }
-#endif /* CONFIG_DFU_UPDATE */
+#endif /* CONFIG_DFU_UPDATE || CONFIG_UPDATE_TFTP */
 
 #ifdef CONFIG_UPDATE_FIT
 /**
-- 
2.28.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2] common: update: fix an "unused" warning against update_flash()
  2020-11-19  0:37 [PATCH v2] common: update: fix an "unused" warning against update_flash() AKASHI Takahiro
@ 2020-12-03 16:59 ` Tom Rini
  2020-12-03 19:53   ` Heinrich Schuchardt
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Rini @ 2020-12-03 16:59 UTC (permalink / raw)
  To: u-boot

On Thu, Nov 19, 2020 at 09:37:19AM +0900, AKASHI Takahiro wrote:

> Since update_flash() is used only in update_tftp(), it should be
> guarded with appropriate config options.
> 
> After the commit 3149e524fc1e, common/update.c will be built under
> either CONFIG_UDATE_TFTP, CONFIG_DFU_TFTP or CONFIG_UPDATE_FIT.
> Since CONFIG_UPDATE_FIT, hence fit_update(), doesn't rely on
> update_flash(), the compiler may cause an "unused" warning if
> CONFIG_UPDATE_FIT=y and CONFIG_UPDATE_TFTP=n and CONFIG_DFU_TFTP=n.
> 
> This is, for example, the case for sandbox defconfig where
> EFI_CAPSULE_FIRMWARE_FIT is enabled for test purpose.
> 
> Fixes: 3149e524fc1e ("common: update: add a generic interface for FIT
>        image")
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201203/8a90c42e/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] common: update: fix an "unused" warning against update_flash()
  2020-12-03 16:59 ` Tom Rini
@ 2020-12-03 19:53   ` Heinrich Schuchardt
  0 siblings, 0 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2020-12-03 19:53 UTC (permalink / raw)
  To: u-boot

On 12/3/20 5:59 PM, Tom Rini wrote:
> On Thu, Nov 19, 2020 at 09:37:19AM +0900, AKASHI Takahiro wrote:
>
>> Since update_flash() is used only in update_tftp(), it should be
>> guarded with appropriate config options.
>>
>> After the commit 3149e524fc1e, common/update.c will be built under
>> either CONFIG_UDATE_TFTP, CONFIG_DFU_TFTP or CONFIG_UPDATE_FIT.
>> Since CONFIG_UPDATE_FIT, hence fit_update(), doesn't rely on
>> update_flash(), the compiler may cause an "unused" warning if
>> CONFIG_UPDATE_FIT=y and CONFIG_UPDATE_TFTP=n and CONFIG_DFU_TFTP=n.
>>
>> This is, for example, the case for sandbox defconfig where
>> EFI_CAPSULE_FIRMWARE_FIT is enabled for test purpose.
>>
>> Fixes: 3149e524fc1e ("common: update: add a generic interface for FIT
>>         image")
>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>
> Applied to u-boot/master, thanks!
>

Hello Takahiro,

sorry I missed this patch when trying to get your v10 version for
capsule updates compiled. I will retest.

Best regards

Heinrich

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-03 19:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19  0:37 [PATCH v2] common: update: fix an "unused" warning against update_flash() AKASHI Takahiro
2020-12-03 16:59 ` Tom Rini
2020-12-03 19:53   ` Heinrich Schuchardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.