forked from mirrors/linux
		
	PM / Sleep: Use the freezer_count() functions in [un]lock_system_sleep() APIs
Now that freezer_count() and freezer_do_not_count() don't have the restriction that they are effective only when called by userspace processes, use them in lock_system_sleep() and unlock_system_sleep() instead of open-coding their parts. Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
This commit is contained in:
		
							parent
							
								
									43753e58b1
								
							
						
					
					
						commit
						33e638b907
					
				
					 1 changed files with 3 additions and 4 deletions
				
			
		| 
						 | 
					@ -6,6 +6,7 @@
 | 
				
			||||||
#include <linux/init.h>
 | 
					#include <linux/init.h>
 | 
				
			||||||
#include <linux/pm.h>
 | 
					#include <linux/pm.h>
 | 
				
			||||||
#include <linux/mm.h>
 | 
					#include <linux/mm.h>
 | 
				
			||||||
 | 
					#include <linux/freezer.h>
 | 
				
			||||||
#include <asm/errno.h>
 | 
					#include <asm/errno.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CONFIG_VT
 | 
					#ifdef CONFIG_VT
 | 
				
			||||||
| 
						 | 
					@ -380,16 +381,14 @@ static inline void unlock_system_sleep(void) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline void lock_system_sleep(void)
 | 
					static inline void lock_system_sleep(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	/* simplified freezer_do_not_count() */
 | 
						freezer_do_not_count();
 | 
				
			||||||
	current->flags |= PF_FREEZER_SKIP;
 | 
					 | 
				
			||||||
	mutex_lock(&pm_mutex);
 | 
						mutex_lock(&pm_mutex);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline void unlock_system_sleep(void)
 | 
					static inline void unlock_system_sleep(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	mutex_unlock(&pm_mutex);
 | 
						mutex_unlock(&pm_mutex);
 | 
				
			||||||
	/* simplified freezer_count() */
 | 
						freezer_count();
 | 
				
			||||||
	current->flags &= ~PF_FREEZER_SKIP;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue