From adf36154f5f9b4fa57e8e1efd67766a586992423 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sat, 31 Oct 2015 20:44:15 +0100 Subject: [PATCH] clock: offer a method to get the first port in the list. This function will allow the TC code to iterate over the ports without calling into the clock logic. Signed-off-by: Richard Cochran --- clock.c | 5 +++++ clock.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/clock.c b/clock.c index d8a2616..ab238fb 100644 --- a/clock.c +++ b/clock.c @@ -1066,6 +1066,11 @@ UInteger8 clock_domain_number(struct clock *c) return c->dds.domainNumber; } +struct port *clock_first_port(struct clock *c) +{ + return LIST_FIRST(&c->ports); +} + void clock_follow_up_info(struct clock *c, struct follow_up_info_tlv *f) { c->status.cumulativeScaledRateOffset = f->cumulativeScaledRateOffset; diff --git a/clock.h b/clock.h index 47863dc..ec38146 100644 --- a/clock.h +++ b/clock.h @@ -103,6 +103,13 @@ void clock_destroy(struct clock *c); */ UInteger8 clock_domain_number(struct clock *c); +/** + * Obtains a reference to the first port in the clock's list. + * @param c The clock instance. + * @return A pointer to a port, or NULL if no ports are present. + */ +struct port *clock_first_port(struct clock *c); + /** * Provide the follow_up info TLV from a slave port. * @param c The clock instance.