diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-26 04:37:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-26 11:56:55 -0500 |
commit | 14cc3e2b633bb64063698980974df4535368e98f (patch) | |
tree | d542c9db7376de199d640b8e34d5630460b217b5 /drivers/telephony/phonedev.c | |
parent | 353ab6e97b8f209dbecc9f650f1f84e3da2a7bb1 (diff) |
[PATCH] sem2mutex: misc static one-file mutexes
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Dave Jones <davej@codemonkey.org.uk>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Jens Axboe <axboe@suse.de>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Acked-by: Alasdair G Kergon <agk@redhat.com>
Cc: Greg KH <greg@kroah.com>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/telephony/phonedev.c')
-rw-r--r-- | drivers/telephony/phonedev.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c index 3c987f49f6b4..7a6db1c5c8c5 100644 --- a/drivers/telephony/phonedev.c +++ b/drivers/telephony/phonedev.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/kmod.h> | 29 | #include <linux/kmod.h> |
30 | #include <linux/sem.h> | 30 | #include <linux/sem.h> |
31 | #include <linux/devfs_fs_kernel.h> | 31 | #include <linux/devfs_fs_kernel.h> |
32 | #include <linux/mutex.h> | ||
32 | 33 | ||
33 | #define PHONE_NUM_DEVICES 256 | 34 | #define PHONE_NUM_DEVICES 256 |
34 | 35 | ||
@@ -37,7 +38,7 @@ | |||
37 | */ | 38 | */ |
38 | 39 | ||
39 | static struct phone_device *phone_device[PHONE_NUM_DEVICES]; | 40 | static struct phone_device *phone_device[PHONE_NUM_DEVICES]; |
40 | static DECLARE_MUTEX(phone_lock); | 41 | static DEFINE_MUTEX(phone_lock); |
41 | 42 | ||
42 | /* | 43 | /* |
43 | * Open a phone device. | 44 | * Open a phone device. |
@@ -53,14 +54,14 @@ static int phone_open(struct inode *inode, struct file *file) | |||
53 | if (minor >= PHONE_NUM_DEVICES) | 54 | if (minor >= PHONE_NUM_DEVICES) |
54 | return -ENODEV; | 55 | return -ENODEV; |
55 | 56 | ||
56 | down(&phone_lock); | 57 | mutex_lock(&phone_lock); |
57 | p = phone_device[minor]; | 58 | p = phone_device[minor]; |
58 | if (p) | 59 | if (p) |
59 | new_fops = fops_get(p->f_op); | 60 | new_fops = fops_get(p->f_op); |
60 | if (!new_fops) { | 61 | if (!new_fops) { |
61 | up(&phone_lock); | 62 | mutex_unlock(&phone_lock); |
62 | request_module("char-major-%d-%d", PHONE_MAJOR, minor); | 63 | request_module("char-major-%d-%d", PHONE_MAJOR, minor); |
63 | down(&phone_lock); | 64 | mutex_lock(&phone_lock); |
64 | p = phone_device[minor]; | 65 | p = phone_device[minor]; |
65 | if (p == NULL || (new_fops = fops_get(p->f_op)) == NULL) | 66 | if (p == NULL || (new_fops = fops_get(p->f_op)) == NULL) |
66 | { | 67 | { |
@@ -78,7 +79,7 @@ static int phone_open(struct inode *inode, struct file *file) | |||
78 | } | 79 | } |
79 | fops_put(old_fops); | 80 | fops_put(old_fops); |
80 | end: | 81 | end: |
81 | up(&phone_lock); | 82 | mutex_unlock(&phone_lock); |
82 | return err; | 83 | return err; |
83 | } | 84 | } |
84 | 85 | ||
@@ -100,18 +101,18 @@ int phone_register_device(struct phone_device *p, int unit) | |||
100 | end = unit + 1; /* enter the loop at least one time */ | 101 | end = unit + 1; /* enter the loop at least one time */ |
101 | } | 102 | } |
102 | 103 | ||
103 | down(&phone_lock); | 104 | mutex_lock(&phone_lock); |
104 | for (i = base; i < end; i++) { | 105 | for (i = base; i < end; i++) { |
105 | if (phone_device[i] == NULL) { | 106 | if (phone_device[i] == NULL) { |
106 | phone_device[i] = p; | 107 | phone_device[i] = p; |
107 | p->minor = i; | 108 | p->minor = i; |
108 | devfs_mk_cdev(MKDEV(PHONE_MAJOR,i), | 109 | devfs_mk_cdev(MKDEV(PHONE_MAJOR,i), |
109 | S_IFCHR|S_IRUSR|S_IWUSR, "phone/%d", i); | 110 | S_IFCHR|S_IRUSR|S_IWUSR, "phone/%d", i); |
110 | up(&phone_lock); | 111 | mutex_unlock(&phone_lock); |
111 | return 0; | 112 | return 0; |
112 | } | 113 | } |
113 | } | 114 | } |
114 | up(&phone_lock); | 115 | mutex_unlock(&phone_lock); |
115 | return -ENFILE; | 116 | return -ENFILE; |
116 | } | 117 | } |
117 | 118 | ||
@@ -121,12 +122,12 @@ int phone_register_device(struct phone_device *p, int unit) | |||
121 | 122 | ||
122 | void phone_unregister_device(struct phone_device *pfd) | 123 | void phone_unregister_device(struct phone_device *pfd) |
123 | { | 124 | { |
124 | down(&phone_lock); | 125 | mutex_lock(&phone_lock); |
125 | if (phone_device[pfd->minor] != pfd) | 126 | if (phone_device[pfd->minor] != pfd) |
126 | panic("phone: bad unregister"); | 127 | panic("phone: bad unregister"); |
127 | devfs_remove("phone/%d", pfd->minor); | 128 | devfs_remove("phone/%d", pfd->minor); |
128 | phone_device[pfd->minor] = NULL; | 129 | phone_device[pfd->minor] = NULL; |
129 | up(&phone_lock); | 130 | mutex_unlock(&phone_lock); |
130 | } | 131 | } |
131 | 132 | ||
132 | 133 | ||