Enforce type correctness and make all callers of pmc_agent_query_port_properties
pass an enum port_state argument instead of plain int.

Signed-off-by: Vladimir Oltean <olte...@gmail.com>
---
 phc2sys.c   | 6 ++++--
 pmc_agent.c | 2 +-
 pmc_agent.h | 2 +-
 ts2phc.c    | 3 ++-
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/phc2sys.c b/phc2sys.c
index c706a72f144a..67954ed4a699 100644
--- a/phc2sys.c
+++ b/phc2sys.c
@@ -292,7 +292,8 @@ static struct port *port_add(struct phc2sys_private *priv, 
unsigned int number,
 static void clock_reinit(struct phc2sys_private *priv, struct clock *clock,
                         int new_state)
 {
-       int err = -1, phc_index = -1, phc_switched = 0, state, timestamping;
+       int err = -1, phc_index = -1, phc_switched = 0, timestamping;
+       enum port_state state;
        struct port *p;
        struct sk_ts_info ts_info;
        char iface[IFNAMSIZ];
@@ -844,7 +845,8 @@ static int phc2sys_recv_subscribed(void *context, struct 
ptp_message *msg,
 
 static int auto_init_ports(struct phc2sys_private *priv, int add_rt)
 {
-       int err, number_ports, state, timestamping;
+       int err, number_ports, timestamping;
+       enum port_state state;
        char iface[IFNAMSIZ];
        struct clock *clock;
        struct port *port;
diff --git a/pmc_agent.c b/pmc_agent.c
index e1c513fe10da..68300f4303f6 100644
--- a/pmc_agent.c
+++ b/pmc_agent.c
@@ -321,7 +321,7 @@ int pmc_agent_query_dds(struct pmc_agent *node, int timeout)
 }
 
 int pmc_agent_query_port_properties(struct pmc_agent *node, int timeout,
-                                   unsigned int port, int *state,
+                                   unsigned int port, enum port_state *state,
                                    int *tstamping, char *iface)
 {
        struct port_properties_np *ppn;
diff --git a/pmc_agent.h b/pmc_agent.h
index 9dc85e300f9e..6469f0f70e57 100644
--- a/pmc_agent.h
+++ b/pmc_agent.h
@@ -121,7 +121,7 @@ int pmc_agent_query_dds(struct pmc_agent *agent, int 
timeout);
  * @return           Zero on success, negative error code otherwise.
  */
 int pmc_agent_query_port_properties(struct pmc_agent *agent, int timeout,
-                                   unsigned int port, int *state,
+                                   unsigned int port, enum port_state *state,
                                    int *tstamping, char *iface);
 
 /**
diff --git a/ts2phc.c b/ts2phc.c
index 0d2ed4280eee..f0b63baa6f8b 100644
--- a/ts2phc.c
+++ b/ts2phc.c
@@ -268,11 +268,12 @@ static struct port *port_add(struct ts2phc_private *priv, 
unsigned int number,
 
 static int auto_init_ports(struct ts2phc_private *priv)
 {
-       int state, timestamping;
+       enum port_state state;
        int number_ports, err;
        char iface[IFNAMSIZ];
        struct clock *clock;
        struct port *port;
+       int timestamping;
        unsigned int i;
 
        while (1) {
-- 
2.25.1



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

Reply via email to