tmv: Generalise tmv_eq() to tmv_cmp()
Time values are compared using an inequality test in mmedian.c Generalise tmv_eq() to tmv_cmp() (by analogy with memcmp()) and replace existing uses of tmv_eq(). Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
This commit is contained in:
		
							parent
							
								
									ea82ae6c28
								
							
						
					
					
						commit
						1b7ff890be
					
				
							
								
								
									
										2
									
								
								clock.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								clock.c
									
									
									
									
									
								
							| @ -578,7 +578,7 @@ static enum servo_state clock_no_adjust(struct clock *c, tmv_t ingress, | ||||
| 	if (f->count < f->max_count) { | ||||
| 		return state; | ||||
| 	} | ||||
| 	if (tmv_eq(ingress, f->ingress1)) { | ||||
| 	if (tmv_cmp(ingress, f->ingress1) == 0) { | ||||
| 		pr_warning("bad timestamps in rate ratio calculation"); | ||||
| 		return state; | ||||
| 	} | ||||
|  | ||||
| @ -60,7 +60,8 @@ static tmv_t mmedian_sample(struct filter *filter, tmv_t sample) | ||||
| 
 | ||||
| 	/* Insert index of the new value to order. */ | ||||
| 	for (i = m->cnt - 1; i > 0; i--) { | ||||
| 		if (m->samples[m->order[i - 1]] <= m->samples[m->index]) | ||||
| 		if (tmv_cmp(m->samples[m->order[i - 1]], | ||||
| 			    m->samples[m->index]) <= 0) | ||||
| 			break; | ||||
| 		m->order[i] = m->order[i - 1]; | ||||
| 	} | ||||
|  | ||||
							
								
								
									
										2
									
								
								port.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								port.c
									
									
									
									
									
								
							| @ -933,7 +933,7 @@ static void port_nrate_calculate(struct port *p, tmv_t origin, tmv_t ingress) | ||||
| 	if (n->count < n->max_count) { | ||||
| 		return; | ||||
| 	} | ||||
| 	if (tmv_eq(ingress, n->ingress1)) { | ||||
| 	if (tmv_cmp(ingress, n->ingress1) == 0) { | ||||
| 		pr_warning("bad timestamps in nrate calculation"); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user