diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/kthread.c | 7 | ||||
-rw-r--r-- | kernel/module.c | 15 | ||||
-rw-r--r-- | kernel/posix-timers.c | 1 | ||||
-rw-r--r-- | kernel/power/pm.c | 21 | ||||
-rw-r--r-- | kernel/profile.c | 11 |
5 files changed, 30 insertions, 25 deletions
diff --git a/kernel/kthread.c b/kernel/kthread.c index e75950a1092c..6a5373868a98 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/unistd.h> | 12 | #include <linux/unistd.h> |
13 | #include <linux/file.h> | 13 | #include <linux/file.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/mutex.h> | ||
15 | #include <asm/semaphore.h> | 16 | #include <asm/semaphore.h> |
16 | 17 | ||
17 | /* | 18 | /* |
@@ -41,7 +42,7 @@ struct kthread_stop_info | |||
41 | 42 | ||
42 | /* Thread stopping is done by setthing this var: lock serializes | 43 | /* Thread stopping is done by setthing this var: lock serializes |
43 | * multiple kthread_stop calls. */ | 44 | * multiple kthread_stop calls. */ |
44 | static DECLARE_MUTEX(kthread_stop_lock); | 45 | static DEFINE_MUTEX(kthread_stop_lock); |
45 | static struct kthread_stop_info kthread_stop_info; | 46 | static struct kthread_stop_info kthread_stop_info; |
46 | 47 | ||
47 | int kthread_should_stop(void) | 48 | int kthread_should_stop(void) |
@@ -173,7 +174,7 @@ int kthread_stop_sem(struct task_struct *k, struct semaphore *s) | |||
173 | { | 174 | { |
174 | int ret; | 175 | int ret; |
175 | 176 | ||
176 | down(&kthread_stop_lock); | 177 | mutex_lock(&kthread_stop_lock); |
177 | 178 | ||
178 | /* It could exit after stop_info.k set, but before wake_up_process. */ | 179 | /* It could exit after stop_info.k set, but before wake_up_process. */ |
179 | get_task_struct(k); | 180 | get_task_struct(k); |
@@ -194,7 +195,7 @@ int kthread_stop_sem(struct task_struct *k, struct semaphore *s) | |||
194 | wait_for_completion(&kthread_stop_info.done); | 195 | wait_for_completion(&kthread_stop_info.done); |
195 | kthread_stop_info.k = NULL; | 196 | kthread_stop_info.k = NULL; |
196 | ret = kthread_stop_info.err; | 197 | ret = kthread_stop_info.err; |
197 | up(&kthread_stop_lock); | 198 | mutex_unlock(&kthread_stop_lock); |
198 | 199 | ||
199 | return ret; | 200 | return ret; |
200 | } | 201 | } |
diff --git a/kernel/module.c b/kernel/module.c index 77764f22f021..de6312da6bb5 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/device.h> | 39 | #include <linux/device.h> |
40 | #include <linux/string.h> | 40 | #include <linux/string.h> |
41 | #include <linux/sched.h> | 41 | #include <linux/sched.h> |
42 | #include <linux/mutex.h> | ||
42 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
43 | #include <asm/semaphore.h> | 44 | #include <asm/semaphore.h> |
44 | #include <asm/cacheflush.h> | 45 | #include <asm/cacheflush.h> |
@@ -63,15 +64,15 @@ static DEFINE_SPINLOCK(modlist_lock); | |||
63 | static DECLARE_MUTEX(module_mutex); | 64 | static DECLARE_MUTEX(module_mutex); |
64 | static LIST_HEAD(modules); | 65 | static LIST_HEAD(modules); |
65 | 66 | ||
66 | static DECLARE_MUTEX(notify_mutex); | 67 | static DEFINE_MUTEX(notify_mutex); |
67 | static struct notifier_block * module_notify_list; | 68 | static struct notifier_block * module_notify_list; |
68 | 69 | ||
69 | int register_module_notifier(struct notifier_block * nb) | 70 | int register_module_notifier(struct notifier_block * nb) |
70 | { | 71 | { |
71 | int err; | 72 | int err; |
72 | down(¬ify_mutex); | 73 | mutex_lock(¬ify_mutex); |
73 | err = notifier_chain_register(&module_notify_list, nb); | 74 | err = notifier_chain_register(&module_notify_list, nb); |
74 | up(¬ify_mutex); | 75 | mutex_unlock(¬ify_mutex); |
75 | return err; | 76 | return err; |
76 | } | 77 | } |
77 | EXPORT_SYMBOL(register_module_notifier); | 78 | EXPORT_SYMBOL(register_module_notifier); |
@@ -79,9 +80,9 @@ EXPORT_SYMBOL(register_module_notifier); | |||
79 | int unregister_module_notifier(struct notifier_block * nb) | 80 | int unregister_module_notifier(struct notifier_block * nb) |
80 | { | 81 | { |
81 | int err; | 82 | int err; |
82 | down(¬ify_mutex); | 83 | mutex_lock(¬ify_mutex); |
83 | err = notifier_chain_unregister(&module_notify_list, nb); | 84 | err = notifier_chain_unregister(&module_notify_list, nb); |
84 | up(¬ify_mutex); | 85 | mutex_unlock(¬ify_mutex); |
85 | return err; | 86 | return err; |
86 | } | 87 | } |
87 | EXPORT_SYMBOL(unregister_module_notifier); | 88 | EXPORT_SYMBOL(unregister_module_notifier); |
@@ -1989,9 +1990,9 @@ sys_init_module(void __user *umod, | |||
1989 | /* Drop lock so they can recurse */ | 1990 | /* Drop lock so they can recurse */ |
1990 | up(&module_mutex); | 1991 | up(&module_mutex); |
1991 | 1992 | ||
1992 | down(¬ify_mutex); | 1993 | mutex_lock(¬ify_mutex); |
1993 | notifier_call_chain(&module_notify_list, MODULE_STATE_COMING, mod); | 1994 | notifier_call_chain(&module_notify_list, MODULE_STATE_COMING, mod); |
1994 | up(¬ify_mutex); | 1995 | mutex_unlock(¬ify_mutex); |
1995 | 1996 | ||
1996 | /* Start the module */ | 1997 | /* Start the module */ |
1997 | if (mod->init != NULL) | 1998 | if (mod->init != NULL) |
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index fa895fc2ecf5..9944379360b5 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/interrupt.h> | 35 | #include <linux/interrupt.h> |
36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
37 | #include <linux/time.h> | 37 | #include <linux/time.h> |
38 | #include <linux/mutex.h> | ||
38 | 39 | ||
39 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
40 | #include <asm/semaphore.h> | 41 | #include <asm/semaphore.h> |
diff --git a/kernel/power/pm.c b/kernel/power/pm.c index 33c508e857dd..0f6908cce1dd 100644 --- a/kernel/power/pm.c +++ b/kernel/power/pm.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/pm.h> | 25 | #include <linux/pm.h> |
26 | #include <linux/pm_legacy.h> | 26 | #include <linux/pm_legacy.h> |
27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
28 | #include <linux/mutex.h> | ||
28 | 29 | ||
29 | int pm_active; | 30 | int pm_active; |
30 | 31 | ||
@@ -40,7 +41,7 @@ int pm_active; | |||
40 | * until a resume but that will be fine. | 41 | * until a resume but that will be fine. |
41 | */ | 42 | */ |
42 | 43 | ||
43 | static DECLARE_MUTEX(pm_devs_lock); | 44 | static DEFINE_MUTEX(pm_devs_lock); |
44 | static LIST_HEAD(pm_devs); | 45 | static LIST_HEAD(pm_devs); |
45 | 46 | ||
46 | /** | 47 | /** |
@@ -67,9 +68,9 @@ struct pm_dev *pm_register(pm_dev_t type, | |||
67 | dev->id = id; | 68 | dev->id = id; |
68 | dev->callback = callback; | 69 | dev->callback = callback; |
69 | 70 | ||
70 | down(&pm_devs_lock); | 71 | mutex_lock(&pm_devs_lock); |
71 | list_add(&dev->entry, &pm_devs); | 72 | list_add(&dev->entry, &pm_devs); |
72 | up(&pm_devs_lock); | 73 | mutex_unlock(&pm_devs_lock); |
73 | } | 74 | } |
74 | return dev; | 75 | return dev; |
75 | } | 76 | } |
@@ -85,9 +86,9 @@ struct pm_dev *pm_register(pm_dev_t type, | |||
85 | void pm_unregister(struct pm_dev *dev) | 86 | void pm_unregister(struct pm_dev *dev) |
86 | { | 87 | { |
87 | if (dev) { | 88 | if (dev) { |
88 | down(&pm_devs_lock); | 89 | mutex_lock(&pm_devs_lock); |
89 | list_del(&dev->entry); | 90 | list_del(&dev->entry); |
90 | up(&pm_devs_lock); | 91 | mutex_unlock(&pm_devs_lock); |
91 | 92 | ||
92 | kfree(dev); | 93 | kfree(dev); |
93 | } | 94 | } |
@@ -118,7 +119,7 @@ void pm_unregister_all(pm_callback callback) | |||
118 | if (!callback) | 119 | if (!callback) |
119 | return; | 120 | return; |
120 | 121 | ||
121 | down(&pm_devs_lock); | 122 | mutex_lock(&pm_devs_lock); |
122 | entry = pm_devs.next; | 123 | entry = pm_devs.next; |
123 | while (entry != &pm_devs) { | 124 | while (entry != &pm_devs) { |
124 | struct pm_dev *dev = list_entry(entry, struct pm_dev, entry); | 125 | struct pm_dev *dev = list_entry(entry, struct pm_dev, entry); |
@@ -126,7 +127,7 @@ void pm_unregister_all(pm_callback callback) | |||
126 | if (dev->callback == callback) | 127 | if (dev->callback == callback) |
127 | __pm_unregister(dev); | 128 | __pm_unregister(dev); |
128 | } | 129 | } |
129 | up(&pm_devs_lock); | 130 | mutex_unlock(&pm_devs_lock); |
130 | } | 131 | } |
131 | 132 | ||
132 | /** | 133 | /** |
@@ -234,7 +235,7 @@ int pm_send_all(pm_request_t rqst, void *data) | |||
234 | { | 235 | { |
235 | struct list_head *entry; | 236 | struct list_head *entry; |
236 | 237 | ||
237 | down(&pm_devs_lock); | 238 | mutex_lock(&pm_devs_lock); |
238 | entry = pm_devs.next; | 239 | entry = pm_devs.next; |
239 | while (entry != &pm_devs) { | 240 | while (entry != &pm_devs) { |
240 | struct pm_dev *dev = list_entry(entry, struct pm_dev, entry); | 241 | struct pm_dev *dev = list_entry(entry, struct pm_dev, entry); |
@@ -246,13 +247,13 @@ int pm_send_all(pm_request_t rqst, void *data) | |||
246 | */ | 247 | */ |
247 | if (rqst == PM_SUSPEND) | 248 | if (rqst == PM_SUSPEND) |
248 | pm_undo_all(dev); | 249 | pm_undo_all(dev); |
249 | up(&pm_devs_lock); | 250 | mutex_unlock(&pm_devs_lock); |
250 | return status; | 251 | return status; |
251 | } | 252 | } |
252 | } | 253 | } |
253 | entry = entry->next; | 254 | entry = entry->next; |
254 | } | 255 | } |
255 | up(&pm_devs_lock); | 256 | mutex_unlock(&pm_devs_lock); |
256 | return 0; | 257 | return 0; |
257 | } | 258 | } |
258 | 259 | ||
diff --git a/kernel/profile.c b/kernel/profile.c index f89248e6d704..ad81f799a9b4 100644 --- a/kernel/profile.c +++ b/kernel/profile.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/cpu.h> | 23 | #include <linux/cpu.h> |
24 | #include <linux/profile.h> | 24 | #include <linux/profile.h> |
25 | #include <linux/highmem.h> | 25 | #include <linux/highmem.h> |
26 | #include <linux/mutex.h> | ||
26 | #include <asm/sections.h> | 27 | #include <asm/sections.h> |
27 | #include <asm/semaphore.h> | 28 | #include <asm/semaphore.h> |
28 | 29 | ||
@@ -44,7 +45,7 @@ static cpumask_t prof_cpu_mask = CPU_MASK_ALL; | |||
44 | #ifdef CONFIG_SMP | 45 | #ifdef CONFIG_SMP |
45 | static DEFINE_PER_CPU(struct profile_hit *[2], cpu_profile_hits); | 46 | static DEFINE_PER_CPU(struct profile_hit *[2], cpu_profile_hits); |
46 | static DEFINE_PER_CPU(int, cpu_profile_flip); | 47 | static DEFINE_PER_CPU(int, cpu_profile_flip); |
47 | static DECLARE_MUTEX(profile_flip_mutex); | 48 | static DEFINE_MUTEX(profile_flip_mutex); |
48 | #endif /* CONFIG_SMP */ | 49 | #endif /* CONFIG_SMP */ |
49 | 50 | ||
50 | static int __init profile_setup(char * str) | 51 | static int __init profile_setup(char * str) |
@@ -243,7 +244,7 @@ static void profile_flip_buffers(void) | |||
243 | { | 244 | { |
244 | int i, j, cpu; | 245 | int i, j, cpu; |
245 | 246 | ||
246 | down(&profile_flip_mutex); | 247 | mutex_lock(&profile_flip_mutex); |
247 | j = per_cpu(cpu_profile_flip, get_cpu()); | 248 | j = per_cpu(cpu_profile_flip, get_cpu()); |
248 | put_cpu(); | 249 | put_cpu(); |
249 | on_each_cpu(__profile_flip_buffers, NULL, 0, 1); | 250 | on_each_cpu(__profile_flip_buffers, NULL, 0, 1); |
@@ -259,14 +260,14 @@ static void profile_flip_buffers(void) | |||
259 | hits[i].hits = hits[i].pc = 0; | 260 | hits[i].hits = hits[i].pc = 0; |
260 | } | 261 | } |
261 | } | 262 | } |
262 | up(&profile_flip_mutex); | 263 | mutex_unlock(&profile_flip_mutex); |
263 | } | 264 | } |
264 | 265 | ||
265 | static void profile_discard_flip_buffers(void) | 266 | static void profile_discard_flip_buffers(void) |
266 | { | 267 | { |
267 | int i, cpu; | 268 | int i, cpu; |
268 | 269 | ||
269 | down(&profile_flip_mutex); | 270 | mutex_lock(&profile_flip_mutex); |
270 | i = per_cpu(cpu_profile_flip, get_cpu()); | 271 | i = per_cpu(cpu_profile_flip, get_cpu()); |
271 | put_cpu(); | 272 | put_cpu(); |
272 | on_each_cpu(__profile_flip_buffers, NULL, 0, 1); | 273 | on_each_cpu(__profile_flip_buffers, NULL, 0, 1); |
@@ -274,7 +275,7 @@ static void profile_discard_flip_buffers(void) | |||
274 | struct profile_hit *hits = per_cpu(cpu_profile_hits, cpu)[i]; | 275 | struct profile_hit *hits = per_cpu(cpu_profile_hits, cpu)[i]; |
275 | memset(hits, 0, NR_PROFILE_HIT*sizeof(struct profile_hit)); | 276 | memset(hits, 0, NR_PROFILE_HIT*sizeof(struct profile_hit)); |
276 | } | 277 | } |
277 | up(&profile_flip_mutex); | 278 | mutex_unlock(&profile_flip_mutex); |
278 | } | 279 | } |
279 | 280 | ||
280 | void profile_hit(int type, void *__pc) | 281 | void profile_hit(int type, void *__pc) |