Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 clock.c |  2 +-
 port.c  | 17 ++++++++++-------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/clock.c b/clock.c
index 5001e66..71b3899 100644
--- a/clock.c
+++ b/clock.c
@@ -976,7 +976,7 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
                        phc_index = -1;
                }
        } else if (iface->ts_info.valid) {
-               phc_index = iface->ts_info.phc_index;
+               phc_index = interface_phc_index(iface);
        } else {
                pr_err("PTP device not specified and automatic determination"
                       " is not supported. Please specify PTP device.");
diff --git a/port.c b/port.c
index c20c3fc..f4834ba 100644
--- a/port.c
+++ b/port.c
@@ -2511,15 +2511,16 @@ void port_link_status(void *ctx, int linkup, int 
ts_index)
                interface_get_tsinfo(p->iface);
 
                /* Only switch phc with HW time stamping mode */
-               if (p->iface->ts_info.valid && p->iface->ts_info.phc_index >= 
0) {
+               if (p->iface->ts_info.valid &&
+                   interface_phc_index(p->iface) >= 0) {
                        required_modes = clock_required_modes(p->clock);
                        if ((p->iface->ts_info.so_timestamping & 
required_modes) != required_modes) {
                                pr_err("interface '%s' does not support 
requested "
                                       "timestamping mode, set link status down 
by force.",
                                       interface_label(p->iface));
                                p->link_status = LINK_DOWN | LINK_STATE_CHANGED;
-                       } else if (p->phc_index != p->iface->ts_info.phc_index) 
{
-                               p->phc_index = p->iface->ts_info.phc_index;
+                       } else if (p->phc_index != 
interface_phc_index(p->iface)) {
+                               p->phc_index = interface_phc_index(p->iface);
 
                                if (clock_switch_phc(p->clock, p->phc_index)) {
                                        p->last_fault_type = FT_SWITCH_PHC;
@@ -3002,19 +3003,21 @@ struct port *port_open(const char *phc_device,
                ; /* UDS cannot have a PHC. */
        } else if (!interface->ts_info.valid) {
                pr_warning("port %d: get_ts_info not supported", number);
-       } else if (phc_index >= 0 && phc_index != interface->ts_info.phc_index) 
{
+       } else if (phc_index >= 0 &&
+                  phc_index != interface_phc_index(interface)) {
                if (p->jbod) {
                        pr_warning("port %d: just a bunch of devices", number);
-                       p->phc_index = interface->ts_info.phc_index;
+                       p->phc_index = interface_phc_index(interface);
                } else if (phc_device) {
                        pr_warning("port %d: taking %s from the command line, "
                                   "not the attached ptp%d", number, phc_device,
-                                  interface->ts_info.phc_index);
+                                  interface_phc_index(interface));
                        p->phc_index = phc_index;
                } else {
                        pr_err("port %d: PHC device mismatch", number);
                        pr_err("port %d: /dev/ptp%d requested, ptp%d attached",
-                              number, phc_index, interface->ts_info.phc_index);
+                              number, phc_index,
+                              interface_phc_index(interface));
                        goto err_port;
                }
        }
-- 
2.20.1



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

Reply via email to