diff options
author | Arjan van de Ven <arjan@infradead.org> | 2006-01-11 09:55:29 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-03-20 17:49:55 -0500 |
commit | 4186ecf8ad16dd05759a09594de6a87e48759ba6 (patch) | |
tree | 3ee5292d9f4a36e3eb359b586289ec972bcbaf39 /drivers/usb/mon/mon_main.c | |
parent | 35cce732d9d4d9af6b4ad4d26d8f8c0eddb573a2 (diff) |
[PATCH] USB: convert a bunch of USB semaphores to mutexes
the patch below converts a bunch of semaphores-used-as-mutex in the USB
code to mutexes
Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/mon/mon_main.c')
-rw-r--r-- | drivers/usb/mon/mon_main.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/usb/mon/mon_main.c b/drivers/usb/mon/mon_main.c index c34944c75047..b03e346e33f1 100644 --- a/drivers/usb/mon/mon_main.c +++ b/drivers/usb/mon/mon_main.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/debugfs.h> | 12 | #include <linux/debugfs.h> |
13 | #include <linux/smp_lock.h> | 13 | #include <linux/smp_lock.h> |
14 | #include <linux/notifier.h> | 14 | #include <linux/notifier.h> |
15 | #include <linux/mutex.h> | ||
15 | 16 | ||
16 | #include "usb_mon.h" | 17 | #include "usb_mon.h" |
17 | #include "../core/hcd.h" | 18 | #include "../core/hcd.h" |
@@ -23,7 +24,7 @@ static void mon_dissolve(struct mon_bus *mbus, struct usb_bus *ubus); | |||
23 | static void mon_bus_drop(struct kref *r); | 24 | static void mon_bus_drop(struct kref *r); |
24 | static void mon_bus_init(struct dentry *mondir, struct usb_bus *ubus); | 25 | static void mon_bus_init(struct dentry *mondir, struct usb_bus *ubus); |
25 | 26 | ||
26 | DECLARE_MUTEX(mon_lock); | 27 | DEFINE_MUTEX(mon_lock); |
27 | 28 | ||
28 | static struct dentry *mon_dir; /* /dbg/usbmon */ | 29 | static struct dentry *mon_dir; /* /dbg/usbmon */ |
29 | static LIST_HEAD(mon_buses); /* All buses we know: struct mon_bus */ | 30 | static LIST_HEAD(mon_buses); /* All buses we know: struct mon_bus */ |
@@ -196,14 +197,14 @@ static void mon_bus_remove(struct usb_bus *ubus) | |||
196 | { | 197 | { |
197 | struct mon_bus *mbus = ubus->mon_bus; | 198 | struct mon_bus *mbus = ubus->mon_bus; |
198 | 199 | ||
199 | down(&mon_lock); | 200 | mutex_lock(&mon_lock); |
200 | list_del(&mbus->bus_link); | 201 | list_del(&mbus->bus_link); |
201 | debugfs_remove(mbus->dent_t); | 202 | debugfs_remove(mbus->dent_t); |
202 | debugfs_remove(mbus->dent_s); | 203 | debugfs_remove(mbus->dent_s); |
203 | 204 | ||
204 | mon_dissolve(mbus, ubus); | 205 | mon_dissolve(mbus, ubus); |
205 | kref_put(&mbus->ref, mon_bus_drop); | 206 | kref_put(&mbus->ref, mon_bus_drop); |
206 | up(&mon_lock); | 207 | mutex_unlock(&mon_lock); |
207 | } | 208 | } |
208 | 209 | ||
209 | static int mon_notify(struct notifier_block *self, unsigned long action, | 210 | static int mon_notify(struct notifier_block *self, unsigned long action, |
@@ -307,9 +308,9 @@ static void mon_bus_init(struct dentry *mondir, struct usb_bus *ubus) | |||
307 | goto err_create_s; | 308 | goto err_create_s; |
308 | mbus->dent_s = d; | 309 | mbus->dent_s = d; |
309 | 310 | ||
310 | down(&mon_lock); | 311 | mutex_lock(&mon_lock); |
311 | list_add_tail(&mbus->bus_link, &mon_buses); | 312 | list_add_tail(&mbus->bus_link, &mon_buses); |
312 | up(&mon_lock); | 313 | mutex_unlock(&mon_lock); |
313 | return; | 314 | return; |
314 | 315 | ||
315 | err_create_s: | 316 | err_create_s: |
@@ -347,11 +348,11 @@ static int __init mon_init(void) | |||
347 | 348 | ||
348 | usb_register_notify(&mon_nb); | 349 | usb_register_notify(&mon_nb); |
349 | 350 | ||
350 | down(&usb_bus_list_lock); | 351 | mutex_lock(&usb_bus_list_lock); |
351 | list_for_each_entry (ubus, &usb_bus_list, bus_list) { | 352 | list_for_each_entry (ubus, &usb_bus_list, bus_list) { |
352 | mon_bus_init(mondir, ubus); | 353 | mon_bus_init(mondir, ubus); |
353 | } | 354 | } |
354 | up(&usb_bus_list_lock); | 355 | mutex_unlock(&usb_bus_list_lock); |
355 | return 0; | 356 | return 0; |
356 | } | 357 | } |
357 | 358 | ||
@@ -363,7 +364,7 @@ static void __exit mon_exit(void) | |||
363 | usb_unregister_notify(&mon_nb); | 364 | usb_unregister_notify(&mon_nb); |
364 | usb_mon_deregister(); | 365 | usb_mon_deregister(); |
365 | 366 | ||
366 | down(&mon_lock); | 367 | mutex_lock(&mon_lock); |
367 | while (!list_empty(&mon_buses)) { | 368 | while (!list_empty(&mon_buses)) { |
368 | p = mon_buses.next; | 369 | p = mon_buses.next; |
369 | mbus = list_entry(p, struct mon_bus, bus_link); | 370 | mbus = list_entry(p, struct mon_bus, bus_link); |
@@ -387,7 +388,7 @@ static void __exit mon_exit(void) | |||
387 | mon_dissolve(mbus, mbus->u_bus); | 388 | mon_dissolve(mbus, mbus->u_bus); |
388 | kref_put(&mbus->ref, mon_bus_drop); | 389 | kref_put(&mbus->ref, mon_bus_drop); |
389 | } | 390 | } |
390 | up(&mon_lock); | 391 | mutex_unlock(&mon_lock); |
391 | 392 | ||
392 | debugfs_remove(mon_dir); | 393 | debugfs_remove(mon_dir); |
393 | } | 394 | } |