From 2fc2af97d81a40d6ab3c5b0c54c33889782c3bb1 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Wed, 21 Oct 2015 14:07:32 +0200 Subject: [PATCH] config: get the time stamp information early. There is no need to have a function to get this information as we can easily obtain it when the interface is first created. Signed-off-by: Richard Cochran --- config.c | 7 +------ config.h | 1 - ptp4l.c | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/config.c b/config.c index d462410..7bb3b05 100644 --- a/config.c +++ b/config.c @@ -534,7 +534,6 @@ int config_read(char *name, struct config *cfg) current_port = config_create_interface(port, cfg); if (!current_port) goto parse_error; - config_init_interface(current_port, cfg); } continue; } @@ -606,15 +605,11 @@ struct interface *config_create_interface(char *name, struct config *cfg) } strncpy(iface->name, name, MAX_IFNAME_SIZE); + sk_get_ts_info(iface->name, &iface->ts_info); STAILQ_INSERT_TAIL(&cfg->interfaces, iface, list); return iface; } -void config_init_interface(struct interface *iface, struct config *cfg) -{ - sk_get_ts_info(iface->name, &iface->ts_info); -} - struct config *config_create(void) { char buf[CONFIG_LABEL_SIZE + 8]; diff --git a/config.h b/config.h index 8aa7322..ad057e9 100644 --- a/config.h +++ b/config.h @@ -48,7 +48,6 @@ struct config { int config_read(char *name, struct config *cfg); struct interface *config_create_interface(char *name, struct config *cfg); -void config_init_interface(struct interface *iface, struct config *cfg); void config_destroy(struct config *cfg); /* New, hash table based methods: */ diff --git a/ptp4l.c b/ptp4l.c index 662e6e6..e250e2f 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -296,7 +296,6 @@ int main(int argc, char *argv[]) /* Init interface configs and check whether timestamping mode is * supported. */ STAILQ_FOREACH(iface, &cfg->interfaces, list) { - config_init_interface(iface, cfg); if (iface->ts_info.valid && ((iface->ts_info.so_timestamping & required_modes) != required_modes)) { fprintf(stderr, "interface '%s' does not support "