mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	PM / core: Re-factor some code dealing with parents in __device_suspend()
Let's make the code a bit more readable by moving some of the code, which deals with adjustments for parent devices in __device_suspend(), into its own function. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
		
							parent
							
								
									47acbd77e6
								
							
						
					
					
						commit
						1172ee3125
					
				
					 1 changed files with 17 additions and 12 deletions
				
			
		| 
						 | 
					@ -1479,6 +1479,22 @@ static int legacy_suspend(struct device *dev, pm_message_t state,
 | 
				
			||||||
	return error;
 | 
						return error;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void dpm_propagate_to_parent(struct device *dev)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct device *parent = dev->parent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!parent)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_lock_irq(&parent->power.lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						parent->power.direct_complete = false;
 | 
				
			||||||
 | 
						if (dev->power.wakeup_path && !parent->power.ignore_children)
 | 
				
			||||||
 | 
							parent->power.wakeup_path = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_unlock_irq(&parent->power.lock);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void dpm_clear_suppliers_direct_complete(struct device *dev)
 | 
					static void dpm_clear_suppliers_direct_complete(struct device *dev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct device_link *link;
 | 
						struct device_link *link;
 | 
				
			||||||
| 
						 | 
					@ -1590,19 +1606,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 End:
 | 
					 End:
 | 
				
			||||||
	if (!error) {
 | 
						if (!error) {
 | 
				
			||||||
		struct device *parent = dev->parent;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		dev->power.is_suspended = true;
 | 
							dev->power.is_suspended = true;
 | 
				
			||||||
		if (parent) {
 | 
							dpm_propagate_to_parent(dev);
 | 
				
			||||||
			spin_lock_irq(&parent->power.lock);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			dev->parent->power.direct_complete = false;
 | 
					 | 
				
			||||||
			if (dev->power.wakeup_path
 | 
					 | 
				
			||||||
			    && !dev->parent->power.ignore_children)
 | 
					 | 
				
			||||||
				dev->parent->power.wakeup_path = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			spin_unlock_irq(&parent->power.lock);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		dpm_clear_suppliers_direct_complete(dev);
 | 
							dpm_clear_suppliers_direct_complete(dev);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue