Now that the PMC agent update method polls for port state notifications,
there is no need to call run_pmc_events().

Previously the 'subscriptions' flag shaped the program flow according to
whether auto-configuration or manual mode was in effect.  But now the
PMC agent tracks this difference internally, resulting in two parallel
sets of bookkeeping.

Remove the superfluous logic.

Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 phc2sys.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/phc2sys.c b/phc2sys.c
index 33f2da6..38a7a2d 100644
--- a/phc2sys.c
+++ b/phc2sys.c
@@ -700,7 +700,7 @@ static int update_needed(struct clock *c)
        return 0;
 }
 
-static int do_loop(struct phc2sys_private *priv, int subscriptions)
+static int do_loop(struct phc2sys_private *priv)
 {
        struct timespec interval;
        struct clock *clock;
@@ -716,18 +716,14 @@ static int do_loop(struct phc2sys_private *priv, int 
subscriptions)
                if (pmc_agent_update(priv->agent) < 0) {
                        continue;
                }
-
-               if (subscriptions) {
-                       run_pmc_events(priv->agent);
-                       if (priv->state_changed) {
-                               /* force getting offset, as it may have
-                                * changed after the port state change */
-                               if (pmc_agent_query_utc_offset(priv->agent, 
1000)) {
-                                       pr_err("failed to get UTC offset");
-                                       continue;
-                               }
-                               reconfigure(priv);
+               if (priv->state_changed) {
+                       /* force getting offset, as it may have
+                        * changed after the port state change */
+                       if (pmc_agent_query_utc_offset(priv->agent, 1000)) {
+                               pr_err("failed to get UTC offset");
+                               continue;
                        }
+                       reconfigure(priv);
                }
                if (!priv->master)
                        continue;
@@ -1317,7 +1313,7 @@ int main(int argc, char *argv[])
                        goto end;
                if (auto_init_ports(&priv, rt) < 0)
                        goto end;
-               r = do_loop(&priv, 1);
+               r = do_loop(&priv);
                goto end;
        }
 
@@ -1367,7 +1363,7 @@ int main(int argc, char *argv[])
                servo_sync_interval(dst->servo, 1.0);
                r = do_pps_loop(&priv, dst, pps_fd);
        } else {
-               r = do_loop(&priv, 0);
+               r = do_loop(&priv);
        }
 
 end:
-- 
2.20.1



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to