From bbe55fbea4936fa3e3fa6398dac72016dd18a4eb Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sun, 18 Oct 2015 22:10:05 +0200 Subject: [PATCH] clock: remove redundant parameter from the create method. There is no need for the 'ifaces' parameter since the list of network interfaces is already present in the configuration. Signed-off-by: Richard Cochran --- clock.c | 7 +++---- clock.h | 4 +--- ptp4l.c | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/clock.c b/clock.c index 5198f72..8154087 100644 --- a/clock.c +++ b/clock.c @@ -798,8 +798,7 @@ static void clock_remove_port(struct clock *c, struct port *p) port_close(p); } -struct clock *clock_create(struct config *config, int phc_index, - struct interfaces_head *ifaces) +struct clock *clock_create(struct config *config, int phc_index) { enum timestamp_type timestamping = config_get_int(config, NULL, "time_stamping"); @@ -810,7 +809,7 @@ struct clock *clock_create(struct config *config, int phc_index, unsigned char oui[OUI_LEN]; char phc[32], *tmp; struct interface *udsif = &c->uds_interface; - struct interface *iface = STAILQ_FIRST(ifaces); + struct interface *iface = STAILQ_FIRST(&config->interfaces); struct timespec ts; int sfl; @@ -1017,7 +1016,7 @@ struct clock *clock_create(struct config *config, int phc_index, clock_fda_changed(c); /* Create the ports. */ - STAILQ_FOREACH(iface, ifaces, list) { + STAILQ_FOREACH(iface, &config->interfaces, list) { if (clock_add_port(c, phc_index, timestamping, iface)) { pr_err("failed to open port %s", iface->name); return NULL; diff --git a/clock.h b/clock.h index 58ce129..e096dfa 100644 --- a/clock.h +++ b/clock.h @@ -71,11 +71,9 @@ struct config *clock_config(struct clock *c); * @param config Pointer to the configuration database. * @param phc_index PTP hardware clock device to use. * Pass -1 to select CLOCK_REALTIME. - * @param ifaces A queue of network interfaces. * @return A pointer to the single global clock instance. */ -struct clock *clock_create(struct config *config, int phc_index, - struct interfaces_head *ifaces); +struct clock *clock_create(struct config *config, int phc_index); /** * Obtains a clock's default data set. diff --git a/ptp4l.c b/ptp4l.c index 0ccb4ba..0eb2490 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -254,7 +254,7 @@ int main(int argc, char *argv[]) pr_info("selected /dev/ptp%d as PTP clock", phc_index); } - clock = clock_create(cfg, phc_index, &cfg->interfaces); + clock = clock_create(cfg, phc_index); if (!clock) { fprintf(stderr, "failed to create a clock\n"); goto out;