mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	timekeeping: Simplify tai updating from do_adjtimex
Since we are taking the timekeeping locks, just go ahead and update any tai change directly, rather then dropping the lock and calling a function that will just take it again. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Richard Cochran <richardcochran@gmail.com> Cc: Prarit Bhargava <prarit@redhat.com> Signed-off-by: John Stultz <john.stultz@linaro.org>
This commit is contained in:
		
							parent
							
								
									06c017fdd4
								
							
						
					
					
						commit
						0b5154fb90
					
				
					 1 changed files with 4 additions and 5 deletions
				
			
		| 
						 | 
					@ -1618,9 +1618,10 @@ EXPORT_SYMBOL_GPL(ktime_get_monotonic_offset);
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
int do_adjtimex(struct timex *txc)
 | 
					int do_adjtimex(struct timex *txc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						struct timekeeper *tk = &timekeeper;
 | 
				
			||||||
	unsigned long flags;
 | 
						unsigned long flags;
 | 
				
			||||||
	struct timespec ts;
 | 
						struct timespec ts;
 | 
				
			||||||
	s32 tai, orig_tai;
 | 
						s32 tai;
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Validate the data before disabling interrupts */
 | 
						/* Validate the data before disabling interrupts */
 | 
				
			||||||
| 
						 | 
					@ -1640,19 +1641,17 @@ int do_adjtimex(struct timex *txc)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	getnstimeofday(&ts);
 | 
						getnstimeofday(&ts);
 | 
				
			||||||
	orig_tai = tai = timekeeping_get_tai_offset();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	raw_spin_lock_irqsave(&timekeeper_lock, flags);
 | 
						raw_spin_lock_irqsave(&timekeeper_lock, flags);
 | 
				
			||||||
	write_seqcount_begin(&timekeeper_seq);
 | 
						write_seqcount_begin(&timekeeper_seq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						tai = tk->tai_offset;
 | 
				
			||||||
	ret = __do_adjtimex(txc, &ts, &tai);
 | 
						ret = __do_adjtimex(txc, &ts, &tai);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						__timekeeping_set_tai_offset(tk, tai);
 | 
				
			||||||
	write_seqcount_end(&timekeeper_seq);
 | 
						write_seqcount_end(&timekeeper_seq);
 | 
				
			||||||
	raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
 | 
						raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (tai != orig_tai)
 | 
					 | 
				
			||||||
		timekeeping_set_tai_offset(tai);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue