Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 clock.c      | 12 +-----------
 nsm.c        |  4 +---
 pmc_common.c |  4 +---
 3 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/clock.c b/clock.c
index f987965..3895d09 100644
--- a/clock.c
+++ b/clock.c
@@ -842,16 +842,6 @@ int clock_required_modes(struct clock *c)
        return required_modes;
 }
 
-/*
- * If we do not have a slave or the rtnl query failed, then use our
- * own interface name as the time stamping interface name.
- */
-static void ensure_ts_label(struct interface *iface)
-{
-       if (iface->ts_label[0] == '\0')
-               strncpy(iface->ts_label, interface_name(iface), 
MAX_IFNAME_SIZE);
-}
-
 struct clock *clock_create(enum clock_type type, struct config *config,
                           const char *phc_device)
 {
@@ -961,7 +951,7 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
        required_modes = clock_required_modes(c);
        STAILQ_FOREACH(iface, &config->interfaces, list) {
                rtnl_get_ts_device(interface_name(iface), iface->ts_label);
-               ensure_ts_label(iface);
+               interface_ensure_tslabel(iface);
                interface_get_tsinfo(iface);
                if (iface->ts_info.valid &&
                    ((iface->ts_info.so_timestamping & required_modes) != 
required_modes)) {
diff --git a/nsm.c b/nsm.c
index 269c3c8..e82fc37 100644
--- a/nsm.c
+++ b/nsm.c
@@ -269,9 +269,7 @@ static int nsm_open(struct nsm *nsm, struct config *cfg)
        STAILQ_FOREACH(iface, &cfg->interfaces, list) {
                ifname = interface_name(iface);
                rtnl_get_ts_device(ifname, iface->ts_label);
-               if (iface->ts_label[0] == '\0') {
-                       strncpy(iface->ts_label, ifname, MAX_IFNAME_SIZE);
-               }
+               interface_ensure_tslabel(iface);
                count++;
        }
        if (count != 1) {
diff --git a/pmc_common.c b/pmc_common.c
index d5c8b61..6bdaa94 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -351,9 +351,7 @@ struct pmc *pmc_create(struct config *cfg, enum 
transport_type transport_type,
        }
 
        strncpy(iface.name, iface_name, MAX_IFNAME_SIZE);
-       if (iface.ts_label[0] == '\0') {
-               strncpy(iface.ts_label, interface_name(&iface), 
MAX_IFNAME_SIZE);
-       }
+       interface_ensure_tslabel(&iface);
 
        if (transport_open(pmc->transport, &iface,
                           &pmc->fdarray, TS_SOFTWARE)) {
-- 
2.20.1



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

Reply via email to