On Mon, Nov 09, 2020 at 01:44:58PM -0800, Richard Cochran wrote: > Signed-off-by: Richard Cochran <richardcoch...@gmail.com> > --- > msg.h | 12 ++++++++++++ > phc2sys.c | 2 +- > pmc_agent.c | 10 +--------- > pmc_agent.h | 1 - > 4 files changed, 14 insertions(+), 11 deletions(-) > > diff --git a/msg.h b/msg.h > index e71d3ce..b600ff0 100644 > --- a/msg.h > +++ b/msg.h > @@ -247,6 +247,18 @@ static inline uint8_t management_action(struct > ptp_message *m) > return m->management.flags & 0x0f; > } > > +/** > + * Obtain the ID field from the TLV in a management message. > + * @param m A management message. > + * @return The value of the ID field. > + */ > +static inline int management_tlv_id(struct ptp_message *m) > +{ > + struct management_tlv *mgt; > + mgt = (struct management_tlv *) m->management.suffix; > + return mgt->id; > +} > + > /** > * Test a given bit in a message's flag field. > * @param m Message to test. > diff --git a/phc2sys.c b/phc2sys.c > index 9e47b4f..9c6f2ba 100644 > --- a/phc2sys.c > +++ b/phc2sys.c > @@ -808,7 +808,7 @@ static int phc2sys_recv_subscribed(void *context, struct > ptp_message *msg, > struct port *port; > struct clock *clock; > > - mgt_id = get_mgt_id(msg); > + mgt_id = management_tlv_id(msg); > if (mgt_id == excluded) > return 0; > switch (mgt_id) {
This is a lot easier to read, with the new name and the description. Do you think you could specify in this function's comments that it obtains the managementId field, for easier cross-referencing with the standard? _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel