On Thu, Dec 24, 2020 at 06:36:18PM +0200, Grygorii Strashko wrote:
> Add dbg print about clock state change events in clock_reinit() in the
> form:
>     pru10: state change DISABLED -> MASTER
>     pru20: state change MASTER -> UNCALIBRATED
> 
> Signed-off-by: Grygorii Strashko <grygorii.stras...@ti.com>
> ---
>  phc2sys.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/phc2sys.c b/phc2sys.c
> index 38a7a2d..b15127d 100644
> --- a/phc2sys.c
> +++ b/phc2sys.c
> @@ -348,6 +348,9 @@ static void clock_reinit(struct phc2sys_private *priv, 
> struct clock *clock,
>                       stats_reset(clock->delay_stats);
>               }
>       }
> +
> +     pr_debug("%s: state change %s -> %s", clock->device,
> +              ps_str[clock->state], ps_str[new_state]);
>  }
>  
>  static struct clock *find_dst_clock(struct phc2sys_private *priv,
> -- 
> 2.17.1
> 

This looks useful.

But you might want to fix up this call path in reconfigure:

        } else if (rt) {
                if (rt->state != PS_MASTER) {
                        rt->state = PS_MASTER;
                        clock_reinit(priv, rt, rt->state);
                }
                LIST_INSERT_HEAD(&priv->dst_clocks, rt, dst_list);
                pr_info("selecting %s for synchronization", rt->device);
        }

Because rt->state is assigned before calling clock_reinit(), I think it
would print something like:

CLOCK_REALTIME: state changed MASTER -> MASTER


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

Reply via email to