Convert call sites to the proper method for getting the PHC index.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
master
Richard Cochran 2020-02-09 15:36:12 -08:00
parent a228de7dff
commit 02bbf36c2a
2 changed files with 11 additions and 8 deletions

View File

@ -976,7 +976,7 @@ struct clock *clock_create(enum clock_type type, struct config *config,
phc_index = -1;
}
} else if (iface->ts_info.valid) {
phc_index = iface->ts_info.phc_index;
phc_index = interface_phc_index(iface);
} else {
pr_err("PTP device not specified and automatic determination"
" is not supported. Please specify PTP device.");

17
port.c
View File

@ -2511,15 +2511,16 @@ void port_link_status(void *ctx, int linkup, int ts_index)
interface_get_tsinfo(p->iface);
/* Only switch phc with HW time stamping mode */
if (p->iface->ts_info.valid && p->iface->ts_info.phc_index >= 0) {
if (p->iface->ts_info.valid &&
interface_phc_index(p->iface) >= 0) {
required_modes = clock_required_modes(p->clock);
if ((p->iface->ts_info.so_timestamping & required_modes) != required_modes) {
pr_err("interface '%s' does not support requested "
"timestamping mode, set link status down by force.",
interface_label(p->iface));
p->link_status = LINK_DOWN | LINK_STATE_CHANGED;
} else if (p->phc_index != p->iface->ts_info.phc_index) {
p->phc_index = p->iface->ts_info.phc_index;
} else if (p->phc_index != interface_phc_index(p->iface)) {
p->phc_index = interface_phc_index(p->iface);
if (clock_switch_phc(p->clock, p->phc_index)) {
p->last_fault_type = FT_SWITCH_PHC;
@ -3002,19 +3003,21 @@ struct port *port_open(const char *phc_device,
; /* UDS cannot have a PHC. */
} else if (!interface->ts_info.valid) {
pr_warning("port %d: get_ts_info not supported", number);
} else if (phc_index >= 0 && phc_index != interface->ts_info.phc_index) {
} else if (phc_index >= 0 &&
phc_index != interface_phc_index(interface)) {
if (p->jbod) {
pr_warning("port %d: just a bunch of devices", number);
p->phc_index = interface->ts_info.phc_index;
p->phc_index = interface_phc_index(interface);
} else if (phc_device) {
pr_warning("port %d: taking %s from the command line, "
"not the attached ptp%d", number, phc_device,
interface->ts_info.phc_index);
interface_phc_index(interface));
p->phc_index = phc_index;
} else {
pr_err("port %d: PHC device mismatch", number);
pr_err("port %d: /dev/ptp%d requested, ptp%d attached",
number, phc_index, interface->ts_info.phc_index);
number, phc_index,
interface_phc_index(interface));
goto err_port;
}
}