@@ -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,13 @@ 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;
+ net_lwip_set_current();
+
+ if (!wget_info)
+ wget_info = &default_wget_info;
+
+ udev = eth_get_dev();
+
netif = net_lwip_new_netif(udev);
if (!netif)
return -1;
@@ -469,16 +477,6 @@ static int wget_loop(struct udevice *udev, ulong dst_addr, char *uri)
return -1;
}
-int wget_do_request(ulong dst_addr, char *uri)
-{
- net_lwip_set_current();
-
- 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;
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 <jerome.forissier@linaro.org> --- Changes in v4: - New patch net/lwip/wget.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)