From: Jerome Forissier Date: Thu, 17 Apr 2025 13:26:57 +0000 (+0200) Subject: net-lwip: change static function wget_loop() to be wget_do_request() X-Git-Tag: v2025.07-rc3~10^2~4 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cabe3952c2e684f0e4013ca9ed337f785ec3ec66;p=pandora-u-boot.git net-lwip: change static function wget_loop() to be wget_do_request() wget_do_request() currently does so little before calling the static function wget_loop() that we may as well rename wget_loop() to wget_do_request() and put everything in one function. Signed-off-by: Jerome Forissier Acked-by: Sughosh Ganu --- diff --git a/net/lwip/wget.c b/net/lwip/wget.c index a3b82908877..77f55fddfac 100644 --- a/net/lwip/wget.c +++ b/net/lwip/wget.c @@ -372,13 +372,14 @@ static int set_cacert(char * const saddr, char * const ssz) #endif #endif /* CONFIG_WGET_CACERT || CONFIG_WGET_BUILTIN_CACERT */ -static int wget_loop(struct udevice *udev, ulong dst_addr, char *uri) +int wget_do_request(ulong dst_addr, char *uri) { #if CONFIG_IS_ENABLED(WGET_HTTPS) altcp_allocator_t tls_allocator; #endif httpc_connection_t conn; httpc_state_t *state; + struct udevice *udev; struct netif *netif; struct wget_ctx ctx; char *path; @@ -394,6 +395,14 @@ static int wget_loop(struct udevice *udev, ulong dst_addr, char *uri) if (parse_url(uri, ctx.server_name, &ctx.port, &path, &is_https)) return CMD_RET_USAGE; + if (net_lwip_eth_start() < 0) + return CMD_RET_FAILURE; + + if (!wget_info) + wget_info = &default_wget_info; + + udev = eth_get_dev(); + netif = net_lwip_new_netif(udev); if (!netif) return -1; @@ -469,20 +478,6 @@ static int wget_loop(struct udevice *udev, ulong dst_addr, char *uri) return -1; } -int wget_do_request(ulong dst_addr, char *uri) -{ - int ret; - - ret = net_lwip_eth_start(); - if (ret < 0) - return ret; - - if (!wget_info) - wget_info = &default_wget_info; - - return wget_loop(eth_get_dev(), dst_addr, uri); -} - int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) { char *end;