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 <jerome.forissier@linaro.org> Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
This commit is contained in:
@@ -372,13 +372,14 @@ static int set_cacert(char * const saddr, char * const ssz)
|
|||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_WGET_CACERT || CONFIG_WGET_BUILTIN_CACERT */
|
#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)
|
#if CONFIG_IS_ENABLED(WGET_HTTPS)
|
||||||
altcp_allocator_t tls_allocator;
|
altcp_allocator_t tls_allocator;
|
||||||
#endif
|
#endif
|
||||||
httpc_connection_t conn;
|
httpc_connection_t conn;
|
||||||
httpc_state_t *state;
|
httpc_state_t *state;
|
||||||
|
struct udevice *udev;
|
||||||
struct netif *netif;
|
struct netif *netif;
|
||||||
struct wget_ctx ctx;
|
struct wget_ctx ctx;
|
||||||
char *path;
|
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))
|
if (parse_url(uri, ctx.server_name, &ctx.port, &path, &is_https))
|
||||||
return CMD_RET_USAGE;
|
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);
|
netif = net_lwip_new_netif(udev);
|
||||||
if (!netif)
|
if (!netif)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -469,20 +478,6 @@ static int wget_loop(struct udevice *udev, ulong dst_addr, char *uri)
|
|||||||
return -1;
|
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[])
|
int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
|
||||||
{
|
{
|
||||||
char *end;
|
char *end;
|
||||||
|
Reference in New Issue
Block a user