aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/user.c
diff options
context:
space:
mode:
authorSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>2011-12-07 16:29:54 -0500
committerRafael J. Wysocki <rjw@sisk.pl>2011-12-08 17:22:29 -0500
commitbcda53faf5814c0c6025a0bd47108adfcbe9f199 (patch)
treea8768204a16b24436f33fac00c1bb4dcfb4fafd5 /kernel/power/user.c
parent9b6fc5dc879bc90f765db0e95eefcf123d0d06dd (diff)
PM / Sleep: Replace mutex_[un]lock(&pm_mutex) with [un]lock_system_sleep()
Using [un]lock_system_sleep() is safer than directly using mutex_[un]lock() on 'pm_mutex', since the latter could lead to freezing failures. Hence convert all the present users of mutex_[un]lock(&pm_mutex) to use these safe APIs instead. Suggested-by: Tejun Heo <tj@kernel.org> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'kernel/power/user.c')
-rw-r--r--kernel/power/user.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 06ea33df8560..98ade217da6c 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -71,7 +71,7 @@ static int snapshot_open(struct inode *inode, struct file *filp)
71 struct snapshot_data *data; 71 struct snapshot_data *data;
72 int error; 72 int error;
73 73
74 mutex_lock(&pm_mutex); 74 lock_system_sleep();
75 75
76 if (!atomic_add_unless(&snapshot_device_available, -1, 0)) { 76 if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
77 error = -EBUSY; 77 error = -EBUSY;
@@ -123,7 +123,7 @@ static int snapshot_open(struct inode *inode, struct file *filp)
123 data->platform_support = 0; 123 data->platform_support = 0;
124 124
125 Unlock: 125 Unlock:
126 mutex_unlock(&pm_mutex); 126 unlock_system_sleep();
127 127
128 return error; 128 return error;
129} 129}
@@ -132,7 +132,7 @@ static int snapshot_release(struct inode *inode, struct file *filp)
132{ 132{
133 struct snapshot_data *data; 133 struct snapshot_data *data;
134 134
135 mutex_lock(&pm_mutex); 135 lock_system_sleep();
136 136
137 swsusp_free(); 137 swsusp_free();
138 free_basic_memory_bitmaps(); 138 free_basic_memory_bitmaps();
@@ -146,7 +146,7 @@ static int snapshot_release(struct inode *inode, struct file *filp)
146 PM_POST_HIBERNATION : PM_POST_RESTORE); 146 PM_POST_HIBERNATION : PM_POST_RESTORE);
147 atomic_inc(&snapshot_device_available); 147 atomic_inc(&snapshot_device_available);
148 148
149 mutex_unlock(&pm_mutex); 149 unlock_system_sleep();
150 150
151 return 0; 151 return 0;
152} 152}
@@ -158,7 +158,7 @@ static ssize_t snapshot_read(struct file *filp, char __user *buf,
158 ssize_t res; 158 ssize_t res;
159 loff_t pg_offp = *offp & ~PAGE_MASK; 159 loff_t pg_offp = *offp & ~PAGE_MASK;
160 160
161 mutex_lock(&pm_mutex); 161 lock_system_sleep();
162 162
163 data = filp->private_data; 163 data = filp->private_data;
164 if (!data->ready) { 164 if (!data->ready) {
@@ -179,7 +179,7 @@ static ssize_t snapshot_read(struct file *filp, char __user *buf,
179 *offp += res; 179 *offp += res;
180 180
181 Unlock: 181 Unlock:
182 mutex_unlock(&pm_mutex); 182 unlock_system_sleep();
183 183
184 return res; 184 return res;
185} 185}
@@ -191,7 +191,7 @@ static ssize_t snapshot_write(struct file *filp, const char __user *buf,
191 ssize_t res; 191 ssize_t res;
192 loff_t pg_offp = *offp & ~PAGE_MASK; 192 loff_t pg_offp = *offp & ~PAGE_MASK;
193 193
194 mutex_lock(&pm_mutex); 194 lock_system_sleep();
195 195
196 data = filp->private_data; 196 data = filp->private_data;
197 197
@@ -208,7 +208,7 @@ static ssize_t snapshot_write(struct file *filp, const char __user *buf,
208 if (res > 0) 208 if (res > 0)
209 *offp += res; 209 *offp += res;
210unlock: 210unlock:
211 mutex_unlock(&pm_mutex); 211 unlock_system_sleep();
212 212
213 return res; 213 return res;
214} 214}