public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu@linaro.org>
To: Tom Rini <trini@konsulko.com>, Lukasz Majewski <lukma@denx.de>
Cc: u-boot@lists.denx.de, ilias.apalodimas@linaro.org,
	sughosh.ganu@linaro.org, jaswinder.singh@linaro.org
Subject: [PATCH v2 5/5] cmd/dfu: Enable 'dfu list' command without DFU_OVER_USB
Date: Mon, 31 Jan 2022 11:52:54 +0900	[thread overview]
Message-ID: <164359757437.280839.2615214689304951773.stgit@localhost> (raw)
In-Reply-To: <164359753172.280839.8310577813724924540.stgit@localhost>

Since dfu is not only used for USB, and some platform only
supports DFU_OVER_TFTP or EFI capsule update, dfu_alt_info
is defined on such platforms too.

For such platform, 'dfu list' command is useful to check
how the current dfu_alt_info setting is parsed.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
---
 Changes in v2:
   Fix a compile error if CONFIG_DFU_OVER_USB=n && CONFIG_DFU_OVER_TFTP=n.
---
 cmd/dfu.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/cmd/dfu.c b/cmd/dfu.c
index 4a288f74c2..d7bfb535dc 100644
--- a/cmd/dfu.c
+++ b/cmd/dfu.c
@@ -28,7 +28,6 @@ static int do_dfu(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 #ifdef CONFIG_DFU_OVER_USB
 	char *usb_controller = argv[1];
 #endif
-#if defined(CONFIG_DFU_OVER_USB) || defined(CONFIG_DFU_OVER_TFTP)
 	char *interface = NULL;
 	char *devstring = NULL;
 #if defined(CONFIG_DFU_TIMEOUT) || defined(CONFIG_DFU_OVER_TFTP)
@@ -42,7 +41,6 @@ static int do_dfu(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 #if defined(CONFIG_DFU_TIMEOUT) || defined(CONFIG_DFU_OVER_TFTP)
 	if (argc == 5 || argc == 3)
 		value = simple_strtoul(argv[argc - 1], NULL, 0);
-#endif
 #endif
 
 	int ret = 0;
@@ -50,7 +48,6 @@ static int do_dfu(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	if (!strcmp(argv[1], "tftp"))
 		return update_tftp(value, interface, devstring);
 #endif
-#ifdef CONFIG_DFU_OVER_USB
 	ret = dfu_init_env_entities(interface, devstring);
 	if (ret)
 		goto done;
@@ -65,6 +62,7 @@ static int do_dfu(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 		goto done;
 	}
 
+#ifdef CONFIG_DFU_OVER_USB
 	int controller_index = simple_strtoul(usb_controller, NULL, 0);
 	bool retry = false;
 	do {
@@ -79,9 +77,9 @@ static int do_dfu(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 		}
 	} while (retry);
 
+#endif
 done:
 	dfu_free_entities();
-#endif
 	return ret;
 }
 
@@ -100,8 +98,8 @@ U_BOOT_CMD(dfu, CONFIG_SYS_MAXARGS, 1, do_dfu,
 #ifdef CONFIG_DFU_TIMEOUT
 	"    [<timeout>] - specify inactivity timeout in seconds\n"
 #endif
-	"    [list] - list available alt settings\n"
 #endif
+	"    [list] - list available alt settings\n"
 #ifdef CONFIG_DFU_OVER_TFTP
 #ifdef CONFIG_DFU_OVER_USB
 	"dfu "


  parent reply	other threads:[~2022-01-31  2:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-31  2:52 [PATCH v2 0/5] DFU: Update dfu_alt_info parser etc Masami Hiramatsu
2022-01-31  2:52 ` [PATCH v2 1/5] DFU: Do not copy the entity name over the buffer size Masami Hiramatsu
2022-02-11 17:06   ` Tom Rini
2022-01-31  2:52 ` [PATCH v2 2/5] DFU: Accept redundant spaces and tabs in dfu_alt_info Masami Hiramatsu
2022-02-11 17:06   ` Tom Rini
2022-01-31  2:52 ` [PATCH v2 3/5] DFU: Check the number of arguments and argument string strictly Masami Hiramatsu
2022-02-11 17:06   ` Tom Rini
2022-08-09 14:11   ` Michal Simek
2022-08-10  0:19     ` AKASHI Takahiro
2022-01-31  2:52 ` [PATCH v2 4/5] doc: usage: DFU: Fix dfu_alt_info document Masami Hiramatsu
2022-02-11 17:06   ` Tom Rini
2022-01-31  2:52 ` Masami Hiramatsu [this message]
2022-02-11 17:06   ` [PATCH v2 5/5] cmd/dfu: Enable 'dfu list' command without DFU_OVER_USB Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=164359757437.280839.2615214689304951773.stgit@localhost \
    --to=masami.hiramatsu@linaro.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jaswinder.singh@linaro.org \
    --cc=lukma@denx.de \
    --cc=sughosh.ganu@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox