996523
commit 7455c241485e01da12d107f5b665e10794330967
996523
Author: Jiri Benc <jbenc@redhat.com>
996523
Date:   Thu Nov 13 18:18:12 2014 +0100
996523
996523
    phc2sys: fix overwriting of the clock state
996523
    
996523
    The reconfigure function is missing a check whether state for the given
996523
    clock actually changed or not. This caused state for all unchanged ports to
996523
    be zeroed.
996523
    
996523
    Reported-by: Richard Cochran <richardcochran@gmail.com>
996523
    Signed-off-by: Jiri Benc <jbenc@redhat.com>
996523
996523
diff --git a/phc2sys.c b/phc2sys.c
996523
index 22eb9c9..67d8a58 100644
996523
--- a/phc2sys.c
996523
+++ b/phc2sys.c
996523
@@ -305,11 +305,13 @@ static void reconfigure(struct node *node)
996523
 			continue;
996523
 		}
996523
 
996523
-		if (c->new_state == PS_MASTER)
996523
-			clock_reinit(c);
996523
+		if (c->new_state) {
996523
+			if (c->new_state == PS_MASTER)
996523
+				clock_reinit(c);
996523
 
996523
-		c->state = c->new_state;
996523
-		c->new_state = 0;
996523
+			c->state = c->new_state;
996523
+			c->new_state = 0;
996523
+		}
996523
 
996523
 		if (c->state == PS_SLAVE) {
996523
 			src = c;