aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/sys.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 29f1291966c1..18febe26caa1 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -21,7 +21,7 @@
21#include <linux/string.h> 21#include <linux/string.h>
22#include <linux/pm.h> 22#include <linux/pm.h>
23#include <linux/device.h> 23#include <linux/device.h>
24#include <asm/semaphore.h> 24#include <linux/mutex.h>
25 25
26#include "base.h" 26#include "base.h"
27 27
@@ -155,7 +155,7 @@ EXPORT_SYMBOL_GPL(sysdev_class_unregister);
155 155
156 156
157static LIST_HEAD(sysdev_drivers); 157static LIST_HEAD(sysdev_drivers);
158static DECLARE_MUTEX(sysdev_drivers_lock); 158static DEFINE_MUTEX(sysdev_drivers_lock);
159 159
160/** 160/**
161 * sysdev_driver_register - Register auxillary driver 161 * sysdev_driver_register - Register auxillary driver
@@ -172,7 +172,7 @@ static DECLARE_MUTEX(sysdev_drivers_lock);
172int sysdev_driver_register(struct sysdev_class * cls, 172int sysdev_driver_register(struct sysdev_class * cls,
173 struct sysdev_driver * drv) 173 struct sysdev_driver * drv)
174{ 174{
175 down(&sysdev_drivers_lock); 175 mutex_lock(&sysdev_drivers_lock);
176 if (cls && kset_get(&cls->kset)) { 176 if (cls && kset_get(&cls->kset)) {
177 list_add_tail(&drv->entry, &cls->drivers); 177 list_add_tail(&drv->entry, &cls->drivers);
178 178
@@ -184,7 +184,7 @@ int sysdev_driver_register(struct sysdev_class * cls,
184 } 184 }
185 } else 185 } else
186 list_add_tail(&drv->entry, &sysdev_drivers); 186 list_add_tail(&drv->entry, &sysdev_drivers);
187 up(&sysdev_drivers_lock); 187 mutex_unlock(&sysdev_drivers_lock);
188 return 0; 188 return 0;
189} 189}
190 190
@@ -197,7 +197,7 @@ int sysdev_driver_register(struct sysdev_class * cls,
197void sysdev_driver_unregister(struct sysdev_class * cls, 197void sysdev_driver_unregister(struct sysdev_class * cls,
198 struct sysdev_driver * drv) 198 struct sysdev_driver * drv)
199{ 199{
200 down(&sysdev_drivers_lock); 200 mutex_lock(&sysdev_drivers_lock);
201 list_del_init(&drv->entry); 201 list_del_init(&drv->entry);
202 if (cls) { 202 if (cls) {
203 if (drv->remove) { 203 if (drv->remove) {
@@ -207,7 +207,7 @@ void sysdev_driver_unregister(struct sysdev_class * cls,
207 } 207 }
208 kset_put(&cls->kset); 208 kset_put(&cls->kset);
209 } 209 }
210 up(&sysdev_drivers_lock); 210 mutex_unlock(&sysdev_drivers_lock);
211} 211}
212 212
213EXPORT_SYMBOL_GPL(sysdev_driver_register); 213EXPORT_SYMBOL_GPL(sysdev_driver_register);
@@ -246,7 +246,7 @@ int sysdev_register(struct sys_device * sysdev)
246 if (!error) { 246 if (!error) {
247 struct sysdev_driver * drv; 247 struct sysdev_driver * drv;
248 248
249 down(&sysdev_drivers_lock); 249 mutex_lock(&sysdev_drivers_lock);
250 /* Generic notification is implicit, because it's that 250 /* Generic notification is implicit, because it's that
251 * code that should have called us. 251 * code that should have called us.
252 */ 252 */
@@ -262,7 +262,7 @@ int sysdev_register(struct sys_device * sysdev)
262 if (drv->add) 262 if (drv->add)
263 drv->add(sysdev); 263 drv->add(sysdev);
264 } 264 }
265 up(&sysdev_drivers_lock); 265 mutex_unlock(&sysdev_drivers_lock);
266 } 266 }
267 return error; 267 return error;
268} 268}
@@ -271,7 +271,7 @@ void sysdev_unregister(struct sys_device * sysdev)
271{ 271{
272 struct sysdev_driver * drv; 272 struct sysdev_driver * drv;
273 273
274 down(&sysdev_drivers_lock); 274 mutex_lock(&sysdev_drivers_lock);
275 list_for_each_entry(drv, &sysdev_drivers, entry) { 275 list_for_each_entry(drv, &sysdev_drivers, entry) {
276 if (drv->remove) 276 if (drv->remove)
277 drv->remove(sysdev); 277 drv->remove(sysdev);
@@ -281,7 +281,7 @@ void sysdev_unregister(struct sys_device * sysdev)
281 if (drv->remove) 281 if (drv->remove)
282 drv->remove(sysdev); 282 drv->remove(sysdev);
283 } 283 }
284 up(&sysdev_drivers_lock); 284 mutex_unlock(&sysdev_drivers_lock);
285 285
286 kobject_unregister(&sysdev->kobj); 286 kobject_unregister(&sysdev->kobj);
287} 287}
@@ -308,7 +308,7 @@ void sysdev_shutdown(void)
308 308
309 pr_debug("Shutting Down System Devices\n"); 309 pr_debug("Shutting Down System Devices\n");
310 310
311 down(&sysdev_drivers_lock); 311 mutex_lock(&sysdev_drivers_lock);
312 list_for_each_entry_reverse(cls, &system_subsys.list, 312 list_for_each_entry_reverse(cls, &system_subsys.list,
313 kset.kobj.entry) { 313 kset.kobj.entry) {
314 struct sys_device * sysdev; 314 struct sys_device * sysdev;
@@ -337,7 +337,7 @@ void sysdev_shutdown(void)
337 cls->shutdown(sysdev); 337 cls->shutdown(sysdev);
338 } 338 }
339 } 339 }
340 up(&sysdev_drivers_lock); 340 mutex_unlock(&sysdev_drivers_lock);
341} 341}
342 342
343static void __sysdev_resume(struct sys_device *dev) 343static void __sysdev_resume(struct sys_device *dev)