summaryrefslogtreecommitdiff
path: root/cmd/net.c
diff options
context:
space:
mode:
authorPhilippe Reynes <philippe.reynes@softathome.com>2020-09-18 15:13:02 +0300
committerTom Rini <trini@konsulko.com>2020-09-30 23:55:03 +0300
commit912ece4c3dd486bcd62f0d0dfee760b9f01caac6 (patch)
tree4bc13b0c8d593e9012b58ce22c65d52e916e14bf /cmd/net.c
parent6b981a224e86b77a983438fd90cc90dd511fbb1a (diff)
downloadu-boot-912ece4c3dd486bcd62f0d0dfee760b9f01caac6.tar.xz
sntp: use udp framework
This commits update the support of sntp to use the framework udp. This change allows to remove all the reference to sntp in the main network file net/net.c. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd/net.c')
-rw-r--r--cmd/net.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/cmd/net.c b/cmd/net.c
index 9bbcdbcfe0..beb2877dfd 100644
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -13,6 +13,8 @@
#include <env.h>
#include <image.h>
#include <net.h>
+#include <net/udp.h>
+#include <net/sntp.h>
static int netboot_common(enum proto_t, struct cmd_tbl *, int, char * const []);
@@ -356,6 +358,12 @@ U_BOOT_CMD(
#endif
#if defined(CONFIG_CMD_SNTP)
+static struct udp_ops sntp_ops = {
+ .prereq = sntp_prereq,
+ .start = sntp_start,
+ .data = NULL,
+};
+
int do_sntp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
char *toff;
@@ -380,7 +388,7 @@ int do_sntp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
else
net_ntp_time_offset = simple_strtol(toff, NULL, 10);
- if (net_loop(SNTP) < 0) {
+ if (udp_loop(&sntp_ops) < 0) {
printf("SNTP failed: host %pI4 not responding\n",
&net_ntp_server);
return CMD_RET_FAILURE;