From d951ba421f5b5bba676bc3bfdadebb62f4df9d11 Mon Sep 17 00:00:00 2001 From: Jacob Keller Date: Fri, 28 Sep 2012 11:45:49 -0700 Subject: [PATCH] ptp4l: modify clock_create to take servo as argument this patch modifies the clock_create to take the servo type as an argument Signed-off-by: Jacob Keller --- clock.c | 5 +++-- clock.h | 4 +++- ptp4l.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/clock.c b/clock.c index 9b2c374..beda1da 100644 --- a/clock.c +++ b/clock.c @@ -398,7 +398,8 @@ UInteger8 clock_class(struct clock *c) } struct clock *clock_create(int phc_index, struct interface *iface, int count, - enum timestamp_type timestamping, struct defaultDS *ds) + enum timestamp_type timestamping, struct defaultDS *ds, + enum servo_type servo) { int i, fadj = 0, max_adj, sw_ts = timestamping == TS_SOFTWARE ? 1 : 0; struct clock *c = &the_clock; @@ -437,7 +438,7 @@ struct clock *clock_create(int phc_index, struct interface *iface, int count, if (c->clkid != CLOCK_INVALID) { fadj = (int) clock_ppb_read(c->clkid); } - c->servo = servo_create(CLOCK_SERVO_PI, -fadj, max_adj, sw_ts); + c->servo = servo_create(servo, -fadj, max_adj, sw_ts); if (!c->servo) { pr_err("Failed to create clock servo"); return NULL; diff --git a/clock.h b/clock.h index 7e60334..ca2071d 100644 --- a/clock.h +++ b/clock.h @@ -66,10 +66,12 @@ UInteger8 clock_class(struct clock *c); * @param count The number of elements in @a interfaces. * @param timestamping The timestamping mode for this clock. * @param ds A pointer to a default data set for the clock. + * @param servo The servo that this clock will use. * @return A pointer to the single global clock instance. */ struct clock *clock_create(int phc_index, struct interface *iface, int count, - enum timestamp_type timestamping, struct defaultDS *ds); + enum timestamp_type timestamping, struct defaultDS *ds, + enum servo_type servo); /** * Obtains a clock's default data set. diff --git a/ptp4l.c b/ptp4l.c index 6fc210a..b35f559 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -272,7 +272,7 @@ int main(int argc, char *argv[]) } clock = clock_create(phc_index, iface, cfg_settings.nports, - *timestamping, ds); + *timestamping, ds, CLOCK_SERVO_PI); if (!clock) { fprintf(stderr, "failed to create a clock\n"); return -1;