On Tue, Nov 23, 2021 at 02:14:14AM +0200, Vladimir Oltean wrote: > struct ts2phc_pps_sink { > char *name; > STAILQ_ENTRY(ts2phc_pps_sink) list; > struct ptp_pin_desc pin_desc; > - enum servo_state state; > unsigned int polarity; > int32_t correction; > uint32_t ignore_lower; > uint32_t ignore_upper; > - struct servo *servo; > - clockid_t clk; > + struct ts2phc_clock *clock; > int no_adj; > - int fd;
So you removed this pre-computed (cached) value, recomputing the 'fd' over and over, like this: > @@ -314,7 +288,7 @@ ts2phc_pps_sink_offset(struct ts2phc_pps_sink *sink, > uint64_t event_ns, source_ns; > int cnt; > > - cnt = read(sink->fd, &event, sizeof(event)); > + cnt = read(CLOCKID_TO_FD(sink->clock->clkid), &event, sizeof(event)); Please retain the pre-computed .fd as that is better form and makes the code more readable. (Performance hit is probably not huge in this case, but still it is good form to compute values exactly once.) Thanks, Richard _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel