On 11/10/2020 2:21 PM, Richard Cochran wrote: > If the pmc pointer is not set, then there is no need to read the time only > to later discard the result. This patch simplifies the flow by returning > early if there is no work to be done. > > Signed-off-by: Richard Cochran <richardcoch...@gmail.com> Makes sense. Reviewed-by: Jacob Keller <jacob.e.kel...@intel.com> > --- > pmc_agent.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/pmc_agent.c b/pmc_agent.c > index 24587b4..47562bc 100644 > --- a/pmc_agent.c > +++ b/pmc_agent.c > @@ -342,14 +342,16 @@ int update_pmc_node(struct pmc_agent *node) > struct timespec tp; > uint64_t ts; > > + if (!node->pmc) { > + return 0; > + } > if (clock_gettime(CLOCK_MONOTONIC, &tp)) { > pr_err("failed to read clock: %m"); > return -1; > } > ts = tp.tv_sec * NS_PER_SEC + tp.tv_nsec; > > - if (node->pmc && > - !(ts > node->pmc_last_update && > + if (!(ts > node->pmc_last_update && > ts - node->pmc_last_update < PMC_UPDATE_INTERVAL)) { > if (node->subscription_active) { > renew_subscription(node, 0); > _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
- [Linuxptp-devel] [PATCH 0/7] PMC Agent - Part II Richard Cochran
- [Linuxptp-devel] [PATCH 1/7] Introduce error codes fo... Richard Cochran
- Re: [Linuxptp-devel] [PATCH 1/7] Introduce error ... Jacob Keller
- Re: [Linuxptp-devel] [PATCH 1/7] Introduce er... Richard Cochran
- Re: [Linuxptp-devel] [PATCH 1/7] Introduc... Jacob Keller
- Re: [Linuxptp-devel] [PATCH 1/7] Introduce error ... Vladimir Oltean
- [Linuxptp-devel] [PATCH 7/7] pmc_agent: Rename the up... Richard Cochran
- Re: [Linuxptp-devel] [PATCH 7/7] pmc_agent: Renam... Vladimir Oltean
- Re: [Linuxptp-devel] [PATCH 7/7] pmc_agent: R... Richard Cochran
- [Linuxptp-devel] [PATCH 4/7] pmc_agent: Simplify logi... Richard Cochran
- Re: [Linuxptp-devel] [PATCH 4/7] pmc_agent: Simpl... Jacob Keller
- Re: [Linuxptp-devel] [PATCH 4/7] pmc_agent: Simpl... Vladimir Oltean
- Re: [Linuxptp-devel] [PATCH 4/7] pmc_agent: S... Richard Cochran
- [Linuxptp-devel] [PATCH 3/7] pmc_agent: Simplify the ... Richard Cochran
- Re: [Linuxptp-devel] [PATCH 3/7] pmc_agent: Simpl... Jacob Keller
- Re: [Linuxptp-devel] [PATCH 3/7] pmc_agent: S... Richard Cochran
- Re: [Linuxptp-devel] [PATCH 3/7] pmc_agent: Simpl... Vladimir Oltean
- Re: [Linuxptp-devel] [PATCH 3/7] pmc_agent: S... Richard Cochran
- [Linuxptp-devel] [PATCH 5/7] pmc_agent: Simplify logi... Richard Cochran
- Re: [Linuxptp-devel] [PATCH 5/7] pmc_agent: Simpl... Vladimir Oltean
- [Linuxptp-devel] [PATCH 2/7] pmc_agent: Convert the s... Richard Cochran