Convert call sites to the proper method for testing time stamp info validity.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
master
Richard Cochran 2020-02-09 15:50:03 -08:00
parent 3d388e1992
commit 605abc45dd
2 changed files with 4 additions and 4 deletions

View File

@ -956,7 +956,7 @@ struct clock *clock_create(enum clock_type type, struct config *config,
interface_set_label(iface, ts_label); interface_set_label(iface, ts_label);
interface_ensure_tslabel(iface); interface_ensure_tslabel(iface);
interface_get_tsinfo(iface); interface_get_tsinfo(iface);
if (iface->ts_info.valid && if (interface_tsinfo_valid(iface) &&
((iface->ts_info.so_timestamping & required_modes) != required_modes)) { ((iface->ts_info.so_timestamping & required_modes) != required_modes)) {
pr_err("interface '%s' does not support requested timestamping mode", pr_err("interface '%s' does not support requested timestamping mode",
interface_name(iface)); interface_name(iface));
@ -975,7 +975,7 @@ struct clock *clock_create(enum clock_type type, struct config *config,
if (1 != sscanf(phc_device, "/dev/ptp%d", &phc_index)) { if (1 != sscanf(phc_device, "/dev/ptp%d", &phc_index)) {
phc_index = -1; phc_index = -1;
} }
} else if (iface->ts_info.valid) { } else if (interface_tsinfo_valid(iface)) {
phc_index = interface_phc_index(iface); phc_index = interface_phc_index(iface);
} else { } else {
pr_err("PTP device not specified and automatic determination" pr_err("PTP device not specified and automatic determination"

4
port.c
View File

@ -2511,7 +2511,7 @@ void port_link_status(void *ctx, int linkup, int ts_index)
interface_get_tsinfo(p->iface); interface_get_tsinfo(p->iface);
/* Only switch phc with HW time stamping mode */ /* Only switch phc with HW time stamping mode */
if (p->iface->ts_info.valid && if (interface_tsinfo_valid(p->iface) &&
interface_phc_index(p->iface) >= 0) { interface_phc_index(p->iface) >= 0) {
required_modes = clock_required_modes(p->clock); required_modes = clock_required_modes(p->clock);
if ((p->iface->ts_info.so_timestamping & required_modes) != required_modes) { if ((p->iface->ts_info.so_timestamping & required_modes) != required_modes) {
@ -3001,7 +3001,7 @@ struct port *port_open(const char *phc_device,
if (transport == TRANS_UDS) { if (transport == TRANS_UDS) {
; /* UDS cannot have a PHC. */ ; /* UDS cannot have a PHC. */
} else if (!interface->ts_info.valid) { } else if (!interface_tsinfo_valid(interface)) {
pr_warning("port %d: get_ts_info not supported", number); pr_warning("port %d: get_ts_info not supported", number);
} else if (phc_index >= 0 && } else if (phc_index >= 0 &&
phc_index != interface_phc_index(interface)) { phc_index != interface_phc_index(interface)) {