提交 d14a3420 编写于 作者: P Pali Rohár 提交者: Stefan Roese

tools: kwboot: Change retry loop from decreasing to increasing

This patch does not change behavior of the code, just allows to implement
new changes more easily.
Signed-off-by: NPali Rohár <pali@kernel.org>
Reviewed-by: NMarek Behún <marek.behun@nic.cz>
Reviewed-by: NStefan Roese <sr@denx.de>
上级 d656f5a0
...@@ -925,7 +925,7 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm, ...@@ -925,7 +925,7 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm,
*done_print = 0; *done_print = 0;
retries = 16; retries = 0;
do { do {
rc = kwboot_tty_send(fd, block, sizeof(*block)); rc = kwboot_tty_send(fd, block, sizeof(*block));
if (rc) if (rc)
...@@ -944,7 +944,7 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm, ...@@ -944,7 +944,7 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm,
if (!allow_non_xm && c != ACK) if (!allow_non_xm && c != ACK)
kwboot_progress(-1, '+'); kwboot_progress(-1, '+');
} while (c == NAK && retries-- > 0); } while (c == NAK && retries++ < 16);
if (non_xm_print) if (non_xm_print)
kwboot_printv("\n"); kwboot_printv("\n");
...@@ -973,7 +973,7 @@ kwboot_xm_finish(int fd) ...@@ -973,7 +973,7 @@ kwboot_xm_finish(int fd)
kwboot_printv("Finishing transfer\n"); kwboot_printv("Finishing transfer\n");
retries = 16; retries = 0;
do { do {
rc = kwboot_tty_send_char(fd, EOT); rc = kwboot_tty_send_char(fd, EOT);
if (rc) if (rc)
...@@ -982,7 +982,7 @@ kwboot_xm_finish(int fd) ...@@ -982,7 +982,7 @@ kwboot_xm_finish(int fd)
rc = kwboot_xm_recv_reply(fd, &c, 0, NULL, 0, NULL); rc = kwboot_xm_recv_reply(fd, &c, 0, NULL, 0, NULL);
if (rc) if (rc)
return rc; return rc;
} while (c == NAK && retries-- > 0); } while (c == NAK && retries++ < 16);
return _xm_reply_to_error(c); return _xm_reply_to_error(c);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册