[PATCH u-boot-marvell v3 12/39] tools: kwboot: Use a function to check whether received byte is a Xmodem reply

Stefan Roese sr at denx.de
Fri Oct 1 08:17:28 CEST 2021


On 24.09.21 23:06, Marek Behún wrote:
> From: Marek Behún <marek.behun at nic.cz>
> 
> This is a non-functional change that should make the code more readable.
> 
> Signed-off-by: Marek Behún <marek.behun at nic.cz>

Reviewed-by: Stefan Roese <sr at denx.de>

Thanks,
Stefan

> ---
>   tools/kwboot.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/kwboot.c b/tools/kwboot.c
> index 7f231c0823..2e5684b91c 100644
> --- a/tools/kwboot.c
> +++ b/tools/kwboot.c
> @@ -375,6 +375,12 @@ kwboot_xm_makeblock(struct kwboot_block *block, const void *data,
>   	return n;
>   }
>   
> +static int
> +_is_xm_reply(char c)
> +{
> +	return c == ACK || c == NAK || c == CAN;
> +}
> +
>   static int
>   kwboot_xm_sendblock(int fd, struct kwboot_block *block)
>   {
> @@ -395,10 +401,10 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block)
>   				c = NAK;
>   			}
>   
> -			if (c != ACK && c != NAK && c != CAN)
> +			if (!_is_xm_reply(c))
>   				printf("%c", c);
>   
> -		} while (c != ACK && c != NAK && c != CAN);
> +		} while (!_is_xm_reply(c));
>   
>   		if (c != ACK)
>   			kwboot_progress(-1, '+');
> 


Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de


More information about the U-Boot mailing list