mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-24 22:36:05 +00:00
net: tftp: use IS_ENABLED(CONFIG_NET_TFTP_VARS) instead of #if
Nothing inside this block depends on NET_TFTP_VARS to be set to parse correctly. Switch to C if() in preparation for adding code before this (to avoid a declaration-after-statement warning). Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> [trini: Update to cover CONFIG_TFTP_PORT case as well] Signed-off-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
parent
06653c7010
commit
4b8c44e39c
1 changed files with 30 additions and 30 deletions
60
net/tftp.c
60
net/tftp.c
|
@ -710,43 +710,43 @@ static int tftp_init_load_addr(void)
|
||||||
|
|
||||||
void tftp_start(enum proto_t protocol)
|
void tftp_start(enum proto_t protocol)
|
||||||
{
|
{
|
||||||
#if CONFIG_NET_TFTP_VARS
|
__maybe_unused char *ep; /* Environment pointer */
|
||||||
char *ep; /* Environment pointer */
|
if (IS_ENABLED(CONFIG_NET_TFTP_VARS)) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allow the user to choose TFTP blocksize and timeout.
|
* Allow the user to choose TFTP blocksize and timeout.
|
||||||
* TFTP protocol has a minimal timeout of 1 second.
|
* TFTP protocol has a minimal timeout of 1 second.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ep = env_get("tftpblocksize");
|
ep = env_get("tftpblocksize");
|
||||||
if (ep != NULL)
|
if (ep != NULL)
|
||||||
tftp_block_size_option = simple_strtol(ep, NULL, 10);
|
tftp_block_size_option = simple_strtol(ep, NULL, 10);
|
||||||
|
|
||||||
ep = env_get("tftpwindowsize");
|
ep = env_get("tftpwindowsize");
|
||||||
if (ep != NULL)
|
if (ep != NULL)
|
||||||
tftp_window_size_option = simple_strtol(ep, NULL, 10);
|
tftp_window_size_option = simple_strtol(ep, NULL, 10);
|
||||||
|
|
||||||
ep = env_get("tftptimeout");
|
ep = env_get("tftptimeout");
|
||||||
if (ep != NULL)
|
if (ep != NULL)
|
||||||
timeout_ms = simple_strtol(ep, NULL, 10);
|
timeout_ms = simple_strtol(ep, NULL, 10);
|
||||||
|
|
||||||
if (timeout_ms < 1000) {
|
if (timeout_ms < 1000) {
|
||||||
printf("TFTP timeout (%ld ms) too low, set min = 1000 ms\n",
|
printf("TFTP timeout (%ld ms) too low, set min = 1000 ms\n",
|
||||||
timeout_ms);
|
timeout_ms);
|
||||||
timeout_ms = 1000;
|
timeout_ms = 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
ep = env_get("tftptimeoutcountmax");
|
||||||
|
if (ep != NULL)
|
||||||
|
tftp_timeout_count_max = simple_strtol(ep, NULL, 10);
|
||||||
|
|
||||||
|
if (tftp_timeout_count_max < 0) {
|
||||||
|
printf("TFTP timeout count max (%d ms) negative, set to 0\n",
|
||||||
|
tftp_timeout_count_max);
|
||||||
|
tftp_timeout_count_max = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ep = env_get("tftptimeoutcountmax");
|
|
||||||
if (ep != NULL)
|
|
||||||
tftp_timeout_count_max = simple_strtol(ep, NULL, 10);
|
|
||||||
|
|
||||||
if (tftp_timeout_count_max < 0) {
|
|
||||||
printf("TFTP timeout count max (%d ms) negative, set to 0\n",
|
|
||||||
tftp_timeout_count_max);
|
|
||||||
tftp_timeout_count_max = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
debug("TFTP blocksize = %i, TFTP windowsize = %d timeout = %ld ms\n",
|
debug("TFTP blocksize = %i, TFTP windowsize = %d timeout = %ld ms\n",
|
||||||
tftp_block_size_option, tftp_window_size_option, timeout_ms);
|
tftp_block_size_option, tftp_window_size_option, timeout_ms);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue