Skip to content

Commit

Permalink
pmc_agent: make pmc_agent_query_port_properties take an enum port_sta…
Browse files Browse the repository at this point in the history
…te argument

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

[ RC: trivial fix up for current git head ]

Signed-off-by: Vladimir Oltean <[email protected]>
Signed-off-by: Richard Cochran <[email protected]>
  • Loading branch information
vladimiroltean authored and richardcochran committed May 15, 2022
1 parent 4eca5f8 commit f63907a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions phc2sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,9 @@ 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;
char iface[IFNAMSIZ], phc_device[19];
enum port_state state;
struct port *p;
clockid_t clkid = CLOCK_INVALID;

Expand Down Expand Up @@ -824,7 +825,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, phc_index, state, timestamping;
int err, number_ports, phc_index, timestamping;
enum port_state state;
char iface[IFNAMSIZ];
struct clock *clock;
struct port *port;
Expand Down
2 changes: 1 addition & 1 deletion pmc_agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,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, int *phc_index, char *iface)
{
struct port_properties_np *ppn;
Expand Down
3 changes: 2 additions & 1 deletion pmc_agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <stdbool.h>

#include "fsm.h"
#include "pmc_common.h"

struct pmc_agent;
Expand Down Expand Up @@ -108,7 +109,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, int *phc_index,
char *iface);

Expand Down

0 comments on commit f63907a

Please sign in to comment.