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>
This commit is contained in:
		
							parent
							
								
									a228de7dff
								
							
						
					
					
						commit
						02bbf36c2a
					
				
							
								
								
									
										2
									
								
								clock.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								clock.c
									
									
									
									
									
								
							@ -976,7 +976,7 @@ struct clock *clock_create(enum clock_type type, struct config *config,
 | 
				
			|||||||
			phc_index = -1;
 | 
								phc_index = -1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else if (iface->ts_info.valid) {
 | 
						} else if (iface->ts_info.valid) {
 | 
				
			||||||
		phc_index = iface->ts_info.phc_index;
 | 
							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"
 | 
				
			||||||
		       " is not supported. Please specify PTP device.");
 | 
							       " is not supported. Please specify PTP device.");
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										17
									
								
								port.c
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								port.c
									
									
									
									
									
								
							@ -2511,15 +2511,16 @@ 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 && 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);
 | 
								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) {
 | 
				
			||||||
				pr_err("interface '%s' does not support requested "
 | 
									pr_err("interface '%s' does not support requested "
 | 
				
			||||||
				       "timestamping mode, set link status down by force.",
 | 
									       "timestamping mode, set link status down by force.",
 | 
				
			||||||
				       interface_label(p->iface));
 | 
									       interface_label(p->iface));
 | 
				
			||||||
				p->link_status = LINK_DOWN | LINK_STATE_CHANGED;
 | 
									p->link_status = LINK_DOWN | LINK_STATE_CHANGED;
 | 
				
			||||||
			} else if (p->phc_index != p->iface->ts_info.phc_index) {
 | 
								} else if (p->phc_index != interface_phc_index(p->iface)) {
 | 
				
			||||||
				p->phc_index = p->iface->ts_info.phc_index;
 | 
									p->phc_index = interface_phc_index(p->iface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (clock_switch_phc(p->clock, p->phc_index)) {
 | 
									if (clock_switch_phc(p->clock, p->phc_index)) {
 | 
				
			||||||
					p->last_fault_type = FT_SWITCH_PHC;
 | 
										p->last_fault_type = FT_SWITCH_PHC;
 | 
				
			||||||
@ -3002,19 +3003,21 @@ struct port *port_open(const char *phc_device,
 | 
				
			|||||||
		; /* UDS cannot have a PHC. */
 | 
							; /* UDS cannot have a PHC. */
 | 
				
			||||||
	} else if (!interface->ts_info.valid) {
 | 
						} else if (!interface->ts_info.valid) {
 | 
				
			||||||
		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 && phc_index != interface->ts_info.phc_index) {
 | 
						} else if (phc_index >= 0 &&
 | 
				
			||||||
 | 
							   phc_index != interface_phc_index(interface)) {
 | 
				
			||||||
		if (p->jbod) {
 | 
							if (p->jbod) {
 | 
				
			||||||
			pr_warning("port %d: just a bunch of devices", number);
 | 
								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) {
 | 
							} else if (phc_device) {
 | 
				
			||||||
			pr_warning("port %d: taking %s from the command line, "
 | 
								pr_warning("port %d: taking %s from the command line, "
 | 
				
			||||||
				   "not the attached ptp%d", number, phc_device,
 | 
									   "not the attached ptp%d", number, phc_device,
 | 
				
			||||||
				   interface->ts_info.phc_index);
 | 
									   interface_phc_index(interface));
 | 
				
			||||||
			p->phc_index = phc_index;
 | 
								p->phc_index = phc_index;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			pr_err("port %d: PHC device mismatch", number);
 | 
								pr_err("port %d: PHC device mismatch", number);
 | 
				
			||||||
			pr_err("port %d: /dev/ptp%d requested, ptp%d attached",
 | 
								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;
 | 
								goto err_port;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user