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/core/notify.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/core/notify.c')
-rw-r--r-- | drivers/usb/core/notify.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/usb/core/notify.c b/drivers/usb/core/notify.c index fbbebab52fbd..4b55285de9a0 100644 --- a/drivers/usb/core/notify.c +++ b/drivers/usb/core/notify.c | |||
@@ -13,16 +13,17 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/notifier.h> | 14 | #include <linux/notifier.h> |
15 | #include <linux/usb.h> | 15 | #include <linux/usb.h> |
16 | #include <linux/mutex.h> | ||
16 | #include "usb.h" | 17 | #include "usb.h" |
17 | 18 | ||
18 | 19 | ||
19 | static struct notifier_block *usb_notifier_list; | 20 | static struct notifier_block *usb_notifier_list; |
20 | static DECLARE_MUTEX(usb_notifier_lock); | 21 | static DEFINE_MUTEX(usb_notifier_lock); |
21 | 22 | ||
22 | static void usb_notifier_chain_register(struct notifier_block **list, | 23 | static void usb_notifier_chain_register(struct notifier_block **list, |
23 | struct notifier_block *n) | 24 | struct notifier_block *n) |
24 | { | 25 | { |
25 | down(&usb_notifier_lock); | 26 | mutex_lock(&usb_notifier_lock); |
26 | while (*list) { | 27 | while (*list) { |
27 | if (n->priority > (*list)->priority) | 28 | if (n->priority > (*list)->priority) |
28 | break; | 29 | break; |
@@ -30,13 +31,13 @@ static void usb_notifier_chain_register(struct notifier_block **list, | |||
30 | } | 31 | } |
31 | n->next = *list; | 32 | n->next = *list; |
32 | *list = n; | 33 | *list = n; |
33 | up(&usb_notifier_lock); | 34 | mutex_unlock(&usb_notifier_lock); |
34 | } | 35 | } |
35 | 36 | ||
36 | static void usb_notifier_chain_unregister(struct notifier_block **nl, | 37 | static void usb_notifier_chain_unregister(struct notifier_block **nl, |
37 | struct notifier_block *n) | 38 | struct notifier_block *n) |
38 | { | 39 | { |
39 | down(&usb_notifier_lock); | 40 | mutex_lock(&usb_notifier_lock); |
40 | while ((*nl)!=NULL) { | 41 | while ((*nl)!=NULL) { |
41 | if ((*nl)==n) { | 42 | if ((*nl)==n) { |
42 | *nl = n->next; | 43 | *nl = n->next; |
@@ -45,7 +46,7 @@ static void usb_notifier_chain_unregister(struct notifier_block **nl, | |||
45 | nl=&((*nl)->next); | 46 | nl=&((*nl)->next); |
46 | } | 47 | } |
47 | exit: | 48 | exit: |
48 | up(&usb_notifier_lock); | 49 | mutex_unlock(&usb_notifier_lock); |
49 | } | 50 | } |
50 | 51 | ||
51 | static int usb_notifier_call_chain(struct notifier_block **n, | 52 | static int usb_notifier_call_chain(struct notifier_block **n, |
@@ -54,7 +55,7 @@ static int usb_notifier_call_chain(struct notifier_block **n, | |||
54 | int ret=NOTIFY_DONE; | 55 | int ret=NOTIFY_DONE; |
55 | struct notifier_block *nb = *n; | 56 | struct notifier_block *nb = *n; |
56 | 57 | ||
57 | down(&usb_notifier_lock); | 58 | mutex_lock(&usb_notifier_lock); |
58 | while (nb) { | 59 | while (nb) { |
59 | ret = nb->notifier_call(nb,val,v); | 60 | ret = nb->notifier_call(nb,val,v); |
60 | if (ret&NOTIFY_STOP_MASK) { | 61 | if (ret&NOTIFY_STOP_MASK) { |
@@ -63,7 +64,7 @@ static int usb_notifier_call_chain(struct notifier_block **n, | |||
63 | nb = nb->next; | 64 | nb = nb->next; |
64 | } | 65 | } |
65 | exit: | 66 | exit: |
66 | up(&usb_notifier_lock); | 67 | mutex_unlock(&usb_notifier_lock); |
67 | return ret; | 68 | return ret; |
68 | } | 69 | } |
69 | 70 | ||