mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-01 00:58:39 +02:00 
			
		
		
		
	async: simplify lowest_in_progress()
The code in lowest_in_progress() are duplicated in two branches, simplify them. tj: Minor indentation adjustment. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Arjan van de Ven <arjan@linux.intel.com>
This commit is contained in:
		
							parent
							
								
									6dbe51c251
								
							
						
					
					
						commit
						92266d6ef6
					
				
					 1 changed files with 8 additions and 12 deletions
				
			
		|  | @ -84,24 +84,20 @@ static atomic_t entry_count; | ||||||
| 
 | 
 | ||||||
| static async_cookie_t lowest_in_progress(struct async_domain *domain) | static async_cookie_t lowest_in_progress(struct async_domain *domain) | ||||||
| { | { | ||||||
| 	struct async_entry *first = NULL; | 	struct list_head *pending; | ||||||
| 	async_cookie_t ret = ASYNC_COOKIE_MAX; | 	async_cookie_t ret = ASYNC_COOKIE_MAX; | ||||||
| 	unsigned long flags; | 	unsigned long flags; | ||||||
| 
 | 
 | ||||||
| 	spin_lock_irqsave(&async_lock, flags); | 	spin_lock_irqsave(&async_lock, flags); | ||||||
| 
 | 
 | ||||||
| 	if (domain) { | 	if (domain) | ||||||
| 		if (!list_empty(&domain->pending)) | 		pending = &domain->pending; | ||||||
| 			first = list_first_entry(&domain->pending, | 	else | ||||||
| 					struct async_entry, domain_list); | 		pending = &async_global_pending; | ||||||
| 	} else { |  | ||||||
| 		if (!list_empty(&async_global_pending)) |  | ||||||
| 			first = list_first_entry(&async_global_pending, |  | ||||||
| 					struct async_entry, global_list); |  | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	if (first) | 	if (!list_empty(pending)) | ||||||
| 		ret = first->cookie; | 		ret = list_first_entry(pending, struct async_entry, | ||||||
|  | 				       domain_list)->cookie; | ||||||
| 
 | 
 | ||||||
| 	spin_unlock_irqrestore(&async_lock, flags); | 	spin_unlock_irqrestore(&async_lock, flags); | ||||||
| 	return ret; | 	return ret; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Lai Jiangshan
						Lai Jiangshan