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 /arch/mips/lasat/sysctl.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 'arch/mips/lasat/sysctl.c')
-rw-r--r-- | arch/mips/lasat/sysctl.c | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/arch/mips/lasat/sysctl.c b/arch/mips/lasat/sysctl.c index 8ff43a1c1e99..e3d5aaa90f0d 100644 --- a/arch/mips/lasat/sysctl.c +++ b/arch/mips/lasat/sysctl.c | |||
@@ -30,12 +30,13 @@ | |||
30 | #include <linux/string.h> | 30 | #include <linux/string.h> |
31 | #include <linux/net.h> | 31 | #include <linux/net.h> |
32 | #include <linux/inet.h> | 32 | #include <linux/inet.h> |
33 | #include <linux/mutex.h> | ||
33 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
34 | 35 | ||
35 | #include "sysctl.h" | 36 | #include "sysctl.h" |
36 | #include "ds1603.h" | 37 | #include "ds1603.h" |
37 | 38 | ||
38 | static DECLARE_MUTEX(lasat_info_sem); | 39 | static DEFINE_MUTEX(lasat_info_mutex); |
39 | 40 | ||
40 | /* Strategy function to write EEPROM after changing string entry */ | 41 | /* Strategy function to write EEPROM after changing string entry */ |
41 | int sysctl_lasatstring(ctl_table *table, int *name, int nlen, | 42 | int sysctl_lasatstring(ctl_table *table, int *name, int nlen, |
@@ -43,17 +44,17 @@ int sysctl_lasatstring(ctl_table *table, int *name, int nlen, | |||
43 | void *newval, size_t newlen, void **context) | 44 | void *newval, size_t newlen, void **context) |
44 | { | 45 | { |
45 | int r; | 46 | int r; |
46 | down(&lasat_info_sem); | 47 | mutex_lock(&lasat_info_mutex); |
47 | r = sysctl_string(table, name, | 48 | r = sysctl_string(table, name, |
48 | nlen, oldval, oldlenp, newval, newlen, context); | 49 | nlen, oldval, oldlenp, newval, newlen, context); |
49 | if (r < 0) { | 50 | if (r < 0) { |
50 | up(&lasat_info_sem); | 51 | mutex_unlock(&lasat_info_mutex); |
51 | return r; | 52 | return r; |
52 | } | 53 | } |
53 | if (newval && newlen) { | 54 | if (newval && newlen) { |
54 | lasat_write_eeprom_info(); | 55 | lasat_write_eeprom_info(); |
55 | } | 56 | } |
56 | up(&lasat_info_sem); | 57 | mutex_unlock(&lasat_info_mutex); |
57 | return 1; | 58 | return 1; |
58 | } | 59 | } |
59 | 60 | ||
@@ -63,14 +64,14 @@ int proc_dolasatstring(ctl_table *table, int write, struct file *filp, | |||
63 | void *buffer, size_t *lenp, loff_t *ppos) | 64 | void *buffer, size_t *lenp, loff_t *ppos) |
64 | { | 65 | { |
65 | int r; | 66 | int r; |
66 | down(&lasat_info_sem); | 67 | mutex_lock(&lasat_info_mutex); |
67 | r = proc_dostring(table, write, filp, buffer, lenp, ppos); | 68 | r = proc_dostring(table, write, filp, buffer, lenp, ppos); |
68 | if ( (!write) || r) { | 69 | if ( (!write) || r) { |
69 | up(&lasat_info_sem); | 70 | mutex_unlock(&lasat_info_mutex); |
70 | return r; | 71 | return r; |
71 | } | 72 | } |
72 | lasat_write_eeprom_info(); | 73 | lasat_write_eeprom_info(); |
73 | up(&lasat_info_sem); | 74 | mutex_unlock(&lasat_info_mutex); |
74 | return 0; | 75 | return 0; |
75 | } | 76 | } |
76 | 77 | ||
@@ -79,14 +80,14 @@ int proc_dolasatint(ctl_table *table, int write, struct file *filp, | |||
79 | void *buffer, size_t *lenp, loff_t *ppos) | 80 | void *buffer, size_t *lenp, loff_t *ppos) |
80 | { | 81 | { |
81 | int r; | 82 | int r; |
82 | down(&lasat_info_sem); | 83 | mutex_lock(&lasat_info_mutex); |
83 | r = proc_dointvec(table, write, filp, buffer, lenp, ppos); | 84 | r = proc_dointvec(table, write, filp, buffer, lenp, ppos); |
84 | if ( (!write) || r) { | 85 | if ( (!write) || r) { |
85 | up(&lasat_info_sem); | 86 | mutex_unlock(&lasat_info_mutex); |
86 | return r; | 87 | return r; |
87 | } | 88 | } |
88 | lasat_write_eeprom_info(); | 89 | lasat_write_eeprom_info(); |
89 | up(&lasat_info_sem); | 90 | mutex_unlock(&lasat_info_mutex); |
90 | return 0; | 91 | return 0; |
91 | } | 92 | } |
92 | 93 | ||
@@ -98,7 +99,7 @@ int proc_dolasatrtc(ctl_table *table, int write, struct file *filp, | |||
98 | void *buffer, size_t *lenp, loff_t *ppos) | 99 | void *buffer, size_t *lenp, loff_t *ppos) |
99 | { | 100 | { |
100 | int r; | 101 | int r; |
101 | down(&lasat_info_sem); | 102 | mutex_lock(&lasat_info_mutex); |
102 | if (!write) { | 103 | if (!write) { |
103 | rtctmp = ds1603_read(); | 104 | rtctmp = ds1603_read(); |
104 | /* check for time < 0 and set to 0 */ | 105 | /* check for time < 0 and set to 0 */ |
@@ -107,11 +108,11 @@ int proc_dolasatrtc(ctl_table *table, int write, struct file *filp, | |||
107 | } | 108 | } |
108 | r = proc_dointvec(table, write, filp, buffer, lenp, ppos); | 109 | r = proc_dointvec(table, write, filp, buffer, lenp, ppos); |
109 | if ( (!write) || r) { | 110 | if ( (!write) || r) { |
110 | up(&lasat_info_sem); | 111 | mutex_unlock(&lasat_info_mutex); |
111 | return r; | 112 | return r; |
112 | } | 113 | } |
113 | ds1603_set(rtctmp); | 114 | ds1603_set(rtctmp); |
114 | up(&lasat_info_sem); | 115 | mutex_unlock(&lasat_info_mutex); |
115 | return 0; | 116 | return 0; |
116 | } | 117 | } |
117 | #endif | 118 | #endif |
@@ -122,16 +123,16 @@ int sysctl_lasat_intvec(ctl_table *table, int *name, int nlen, | |||
122 | void *newval, size_t newlen, void **context) | 123 | void *newval, size_t newlen, void **context) |
123 | { | 124 | { |
124 | int r; | 125 | int r; |
125 | down(&lasat_info_sem); | 126 | mutex_lock(&lasat_info_mutex); |
126 | r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context); | 127 | r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context); |
127 | if (r < 0) { | 128 | if (r < 0) { |
128 | up(&lasat_info_sem); | 129 | mutex_unlock(&lasat_info_mutex); |
129 | return r; | 130 | return r; |
130 | } | 131 | } |
131 | if (newval && newlen) { | 132 | if (newval && newlen) { |
132 | lasat_write_eeprom_info(); | 133 | lasat_write_eeprom_info(); |
133 | } | 134 | } |
134 | up(&lasat_info_sem); | 135 | mutex_unlock(&lasat_info_mutex); |
135 | return 1; | 136 | return 1; |
136 | } | 137 | } |
137 | 138 | ||
@@ -142,19 +143,19 @@ int sysctl_lasat_rtc(ctl_table *table, int *name, int nlen, | |||
142 | void *newval, size_t newlen, void **context) | 143 | void *newval, size_t newlen, void **context) |
143 | { | 144 | { |
144 | int r; | 145 | int r; |
145 | down(&lasat_info_sem); | 146 | mutex_lock(&lasat_info_mutex); |
146 | rtctmp = ds1603_read(); | 147 | rtctmp = ds1603_read(); |
147 | if (rtctmp < 0) | 148 | if (rtctmp < 0) |
148 | rtctmp = 0; | 149 | rtctmp = 0; |
149 | r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context); | 150 | r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context); |
150 | if (r < 0) { | 151 | if (r < 0) { |
151 | up(&lasat_info_sem); | 152 | mutex_unlock(&lasat_info_mutex); |
152 | return r; | 153 | return r; |
153 | } | 154 | } |
154 | if (newval && newlen) { | 155 | if (newval && newlen) { |
155 | ds1603_set(rtctmp); | 156 | ds1603_set(rtctmp); |
156 | } | 157 | } |
157 | up(&lasat_info_sem); | 158 | mutex_unlock(&lasat_info_mutex); |
158 | return 1; | 159 | return 1; |
159 | } | 160 | } |
160 | #endif | 161 | #endif |
@@ -192,13 +193,13 @@ int proc_lasat_ip(ctl_table *table, int write, struct file *filp, | |||
192 | return 0; | 193 | return 0; |
193 | } | 194 | } |
194 | 195 | ||
195 | down(&lasat_info_sem); | 196 | mutex_lock(&lasat_info_mutex); |
196 | if (write) { | 197 | if (write) { |
197 | len = 0; | 198 | len = 0; |
198 | p = buffer; | 199 | p = buffer; |
199 | while (len < *lenp) { | 200 | while (len < *lenp) { |
200 | if(get_user(c, p++)) { | 201 | if(get_user(c, p++)) { |
201 | up(&lasat_info_sem); | 202 | mutex_unlock(&lasat_info_mutex); |
202 | return -EFAULT; | 203 | return -EFAULT; |
203 | } | 204 | } |
204 | if (c == 0 || c == '\n') | 205 | if (c == 0 || c == '\n') |
@@ -209,7 +210,7 @@ int proc_lasat_ip(ctl_table *table, int write, struct file *filp, | |||
209 | len = sizeof(proc_lasat_ipbuf) - 1; | 210 | len = sizeof(proc_lasat_ipbuf) - 1; |
210 | if (copy_from_user(proc_lasat_ipbuf, buffer, len)) | 211 | if (copy_from_user(proc_lasat_ipbuf, buffer, len)) |
211 | { | 212 | { |
212 | up(&lasat_info_sem); | 213 | mutex_unlock(&lasat_info_mutex); |
213 | return -EFAULT; | 214 | return -EFAULT; |
214 | } | 215 | } |
215 | proc_lasat_ipbuf[len] = 0; | 216 | proc_lasat_ipbuf[len] = 0; |
@@ -230,12 +231,12 @@ int proc_lasat_ip(ctl_table *table, int write, struct file *filp, | |||
230 | len = *lenp; | 231 | len = *lenp; |
231 | if (len) | 232 | if (len) |
232 | if(copy_to_user(buffer, proc_lasat_ipbuf, len)) { | 233 | if(copy_to_user(buffer, proc_lasat_ipbuf, len)) { |
233 | up(&lasat_info_sem); | 234 | mutex_unlock(&lasat_info_mutex); |
234 | return -EFAULT; | 235 | return -EFAULT; |
235 | } | 236 | } |
236 | if (len < *lenp) { | 237 | if (len < *lenp) { |
237 | if(put_user('\n', ((char *) buffer) + len)) { | 238 | if(put_user('\n', ((char *) buffer) + len)) { |
238 | up(&lasat_info_sem); | 239 | mutex_unlock(&lasat_info_mutex); |
239 | return -EFAULT; | 240 | return -EFAULT; |
240 | } | 241 | } |
241 | len++; | 242 | len++; |
@@ -244,7 +245,7 @@ int proc_lasat_ip(ctl_table *table, int write, struct file *filp, | |||
244 | *ppos += len; | 245 | *ppos += len; |
245 | } | 246 | } |
246 | update_bcastaddr(); | 247 | update_bcastaddr(); |
247 | up(&lasat_info_sem); | 248 | mutex_unlock(&lasat_info_mutex); |
248 | return 0; | 249 | return 0; |
249 | } | 250 | } |
250 | #endif /* defined(CONFIG_INET) */ | 251 | #endif /* defined(CONFIG_INET) */ |
@@ -256,10 +257,10 @@ static int sysctl_lasat_eeprom_value(ctl_table *table, int *name, int nlen, | |||
256 | { | 257 | { |
257 | int r; | 258 | int r; |
258 | 259 | ||
259 | down(&lasat_info_sem); | 260 | mutex_lock(&lasat_info_mutex); |
260 | r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context); | 261 | r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context); |
261 | if (r < 0) { | 262 | if (r < 0) { |
262 | up(&lasat_info_sem); | 263 | mutex_unlock(&lasat_info_mutex); |
263 | return r; | 264 | return r; |
264 | } | 265 | } |
265 | 266 | ||
@@ -271,7 +272,7 @@ static int sysctl_lasat_eeprom_value(ctl_table *table, int *name, int nlen, | |||
271 | lasat_write_eeprom_info(); | 272 | lasat_write_eeprom_info(); |
272 | lasat_init_board_info(); | 273 | lasat_init_board_info(); |
273 | } | 274 | } |
274 | up(&lasat_info_sem); | 275 | mutex_unlock(&lasat_info_mutex); |
275 | 276 | ||
276 | return 0; | 277 | return 0; |
277 | } | 278 | } |
@@ -280,10 +281,10 @@ int proc_lasat_eeprom_value(ctl_table *table, int write, struct file *filp, | |||
280 | void *buffer, size_t *lenp, loff_t *ppos) | 281 | void *buffer, size_t *lenp, loff_t *ppos) |
281 | { | 282 | { |
282 | int r; | 283 | int r; |
283 | down(&lasat_info_sem); | 284 | mutex_lock(&lasat_info_mutex); |
284 | r = proc_dointvec(table, write, filp, buffer, lenp, ppos); | 285 | r = proc_dointvec(table, write, filp, buffer, lenp, ppos); |
285 | if ( (!write) || r) { | 286 | if ( (!write) || r) { |
286 | up(&lasat_info_sem); | 287 | mutex_unlock(&lasat_info_mutex); |
287 | return r; | 288 | return r; |
288 | } | 289 | } |
289 | if (filp && filp->f_dentry) | 290 | if (filp && filp->f_dentry) |
@@ -294,7 +295,7 @@ int proc_lasat_eeprom_value(ctl_table *table, int write, struct file *filp, | |||
294 | lasat_board_info.li_eeprom_info.debugaccess = lasat_board_info.li_debugaccess; | 295 | lasat_board_info.li_eeprom_info.debugaccess = lasat_board_info.li_debugaccess; |
295 | } | 296 | } |
296 | lasat_write_eeprom_info(); | 297 | lasat_write_eeprom_info(); |
297 | up(&lasat_info_sem); | 298 | mutex_unlock(&lasat_info_mutex); |
298 | return 0; | 299 | return 0; |
299 | } | 300 | } |
300 | 301 | ||