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 <richardcochran@gmail.com>
master
Richard Cochran 2015-10-18 22:10:05 +02:00
parent 9b27664cfc
commit bbe55fbea4
3 changed files with 5 additions and 8 deletions

View File

@ -798,8 +798,7 @@ static void clock_remove_port(struct clock *c, struct port *p)
port_close(p); port_close(p);
} }
struct clock *clock_create(struct config *config, int phc_index, struct clock *clock_create(struct config *config, int phc_index)
struct interfaces_head *ifaces)
{ {
enum timestamp_type timestamping = enum timestamp_type timestamping =
config_get_int(config, NULL, "time_stamping"); 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]; unsigned char oui[OUI_LEN];
char phc[32], *tmp; char phc[32], *tmp;
struct interface *udsif = &c->uds_interface; struct interface *udsif = &c->uds_interface;
struct interface *iface = STAILQ_FIRST(ifaces); struct interface *iface = STAILQ_FIRST(&config->interfaces);
struct timespec ts; struct timespec ts;
int sfl; int sfl;
@ -1017,7 +1016,7 @@ struct clock *clock_create(struct config *config, int phc_index,
clock_fda_changed(c); clock_fda_changed(c);
/* Create the ports. */ /* Create the ports. */
STAILQ_FOREACH(iface, ifaces, list) { STAILQ_FOREACH(iface, &config->interfaces, list) {
if (clock_add_port(c, phc_index, timestamping, iface)) { if (clock_add_port(c, phc_index, timestamping, iface)) {
pr_err("failed to open port %s", iface->name); pr_err("failed to open port %s", iface->name);
return NULL; return NULL;

View File

@ -71,11 +71,9 @@ struct config *clock_config(struct clock *c);
* @param config Pointer to the configuration database. * @param config Pointer to the configuration database.
* @param phc_index PTP hardware clock device to use. * @param phc_index PTP hardware clock device to use.
* Pass -1 to select CLOCK_REALTIME. * Pass -1 to select CLOCK_REALTIME.
* @param ifaces A queue of network interfaces.
* @return A pointer to the single global clock instance. * @return A pointer to the single global clock instance.
*/ */
struct clock *clock_create(struct config *config, int phc_index, struct clock *clock_create(struct config *config, int phc_index);
struct interfaces_head *ifaces);
/** /**
* Obtains a clock's default data set. * Obtains a clock's default data set.

View File

@ -254,7 +254,7 @@ int main(int argc, char *argv[])
pr_info("selected /dev/ptp%d as PTP clock", phc_index); 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) { if (!clock) {
fprintf(stderr, "failed to create a clock\n"); fprintf(stderr, "failed to create a clock\n");
goto out; goto out;