On Thu, Oct 26, 2023 at 02:40:11PM +0200, Miroslav Lichvar wrote:

> @@ -803,9 +808,9 @@ static int update_domain_clocks(struct domain *domain)
>  
>  static int do_loop(struct domain *domains, int n_domains)
>  {
> +     int i, state_changed, prev_sub;
>       struct timespec interval;
>       struct domain *domain;
> -     int i, state_changed;
>  
>       /* All domains have the same interval */
>       interval.tv_sec = domains[0].phc_interval;
> @@ -821,6 +826,18 @@ static int do_loop(struct domain *domains, int n_domains)
>                               continue;
>                       }
>  
> +                     prev_sub = domain->agent_subscribed;
> +                     domain->agent_subscribed =
> +                             pmc_agent_is_subscribed(domain->agent);
> +                     if (!domain->has_rt_clock && !domain->agent_subscribed) 
> {
> +                             if (prev_sub) {
> +                                     pr_err("Lost connection to ptp4l #%d",
> +                                            i + 1);

I think we can relax the 80 char width limit and put that on one line.

> +                                     state_changed = 1;
> +                             }
> +                             continue;
> +                     }
> +
>                       if (domain->state_changed) {
>                               state_changed = 1;
>  
> @@ -880,8 +897,6 @@ static int phc2sys_recv_subscribed(void *context, struct 
> ptp_message *msg,
>       struct port *port;
>       struct clock *clock;
>  
> -     domain->agent_subscribed = 1;
> -
>       mgt_id = management_tlv_id(msg);
>       if (mgt_id == excluded)
>               return 0;
> @@ -942,8 +957,8 @@ static int auto_init_ports(struct domain *domain)
>       }
>  
>       err = pmc_agent_subscribe(domain->agent, 1000,
> -                               (60 > domain->phc_interval ?
> -                                60 : domain->phc_interval) * 3);
> +                               (10 > domain->phc_interval ?
> +                                10 : domain->phc_interval) * 3);

This magic number 3 keeps reappearing... can it be a macro?

Thanks,
Richard


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

Reply via email to