This will allow modules to read out various user options.

Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 pmc_common.c        | 2 +-
 port.c              | 2 +-
 transport.c         | 7 +++++--
 transport.h         | 6 +++++-
 transport_private.h | 1 +
 5 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/pmc_common.c b/pmc_common.c
index 0a365f5..d92b0cd 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -85,7 +85,7 @@ struct pmc *pmc_create(struct config *cfg, enum 
transport_type transport_type,
        pmc->domain_number = domain_number;
        pmc->transport_specific = transport_specific;
 
-       pmc->transport = transport_create(transport_type);
+       pmc->transport = transport_create(cfg, transport_type);
        if (!pmc->transport) {
                pr_err("failed to create transport");
                goto failed;
diff --git a/port.c b/port.c
index 3ed5e7b..e5d62b9 100644
--- a/port.c
+++ b/port.c
@@ -2524,7 +2524,7 @@ struct port *port_open(int phc_index,
        p->pod = interface->pod;
        p->name = interface->name;
        p->clock = clock;
-       p->trp = transport_create(interface->transport);
+       p->trp = transport_create(clock_config(clock), interface->transport);
        if (!p->trp)
                goto err_port;
        p->timestamping = timestamping;
diff --git a/transport.c b/transport.c
index fc18740..d24c05b 100644
--- a/transport.c
+++ b/transport.c
@@ -87,7 +87,8 @@ enum transport_type transport_type(struct transport *t)
        return t->type;
 }
 
-struct transport *transport_create(enum transport_type type)
+struct transport *transport_create(struct config *cfg,
+                                  enum transport_type type)
 {
        struct transport *t = NULL;
        switch (type) {
@@ -108,8 +109,10 @@ struct transport *transport_create(enum transport_type 
type)
        case TRANS_PROFINET:
                break;
        }
-       if (t)
+       if (t) {
                t->type = type;
+               t->cfg = cfg;
+       }
        return t;
 }
 
diff --git a/transport.h b/transport.h
index 8e0d421..5d6ba98 100644
--- a/transport.h
+++ b/transport.h
@@ -26,6 +26,8 @@
 #include "fd.h"
 #include "msg.h"
 
+struct config;
+
 /* Values from networkProtocol enumeration 7.4.1 Table 3 */
 enum transport_type {
        /* 0 is Reserved in spec. Use it for UDS */
@@ -123,10 +125,12 @@ int transport_protocol_addr(struct transport *t, uint8_t 
*addr);
 
 /**
  * Allocate an instance of the specified transport.
+ * @param config Pointer to the configuration database.
  * @param type  Which transport to obtain.
  * @return      Pointer to a transport instance on success, NULL otherwise.
  */
-struct transport *transport_create(enum transport_type type);
+struct transport *transport_create(struct config *cfg,
+                                  enum transport_type type);
 
 /**
  * Free an instance of a transport.
diff --git a/transport_private.h b/transport_private.h
index 3e0ba9a..b54f32a 100644
--- a/transport_private.h
+++ b/transport_private.h
@@ -28,6 +28,7 @@
 
 struct transport {
        enum transport_type type;
+       struct config *cfg;
 
        int (*close)(struct transport *t, struct fdarray *fda);
 
-- 
2.1.4


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

Reply via email to