aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdcore.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-31 05:29:41 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-31 15:18:48 -0500
commit48b192686dd20cb1576ae1d8ccd17a07971ef24a (patch)
treea4e5f5a74c230439fdbdc895f7874c68bf505565 /drivers/mtd/mtdcore.c
parent040d79f906654d55c810313f29c6605593bf21c5 (diff)
[PATCH] sem2mutex: drivers/mtd/
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: Thomas Gleixner <tglx@linutronix.de> Acked-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/mtd/mtdcore.c')
-rw-r--r--drivers/mtd/mtdcore.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index dade02ab0687..9c3813486a1a 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -27,7 +27,7 @@
27 27
28/* These are exported solely for the purpose of mtd_blkdevs.c. You 28/* These are exported solely for the purpose of mtd_blkdevs.c. You
29 should not use them for _anything_ else */ 29 should not use them for _anything_ else */
30DECLARE_MUTEX(mtd_table_mutex); 30DEFINE_MUTEX(mtd_table_mutex);
31struct mtd_info *mtd_table[MAX_MTD_DEVICES]; 31struct mtd_info *mtd_table[MAX_MTD_DEVICES];
32 32
33EXPORT_SYMBOL_GPL(mtd_table_mutex); 33EXPORT_SYMBOL_GPL(mtd_table_mutex);
@@ -49,7 +49,7 @@ int add_mtd_device(struct mtd_info *mtd)
49{ 49{
50 int i; 50 int i;
51 51
52 down(&mtd_table_mutex); 52 mutex_lock(&mtd_table_mutex);
53 53
54 for (i=0; i < MAX_MTD_DEVICES; i++) 54 for (i=0; i < MAX_MTD_DEVICES; i++)
55 if (!mtd_table[i]) { 55 if (!mtd_table[i]) {
@@ -67,7 +67,7 @@ int add_mtd_device(struct mtd_info *mtd)
67 not->add(mtd); 67 not->add(mtd);
68 } 68 }
69 69
70 up(&mtd_table_mutex); 70 mutex_unlock(&mtd_table_mutex);
71 /* We _know_ we aren't being removed, because 71 /* We _know_ we aren't being removed, because
72 our caller is still holding us here. So none 72 our caller is still holding us here. So none
73 of this try_ nonsense, and no bitching about it 73 of this try_ nonsense, and no bitching about it
@@ -76,7 +76,7 @@ int add_mtd_device(struct mtd_info *mtd)
76 return 0; 76 return 0;
77 } 77 }
78 78
79 up(&mtd_table_mutex); 79 mutex_unlock(&mtd_table_mutex);
80 return 1; 80 return 1;
81} 81}
82 82
@@ -94,7 +94,7 @@ int del_mtd_device (struct mtd_info *mtd)
94{ 94{
95 int ret; 95 int ret;
96 96
97 down(&mtd_table_mutex); 97 mutex_lock(&mtd_table_mutex);
98 98
99 if (mtd_table[mtd->index] != mtd) { 99 if (mtd_table[mtd->index] != mtd) {
100 ret = -ENODEV; 100 ret = -ENODEV;
@@ -118,7 +118,7 @@ int del_mtd_device (struct mtd_info *mtd)
118 ret = 0; 118 ret = 0;
119 } 119 }
120 120
121 up(&mtd_table_mutex); 121 mutex_unlock(&mtd_table_mutex);
122 return ret; 122 return ret;
123} 123}
124 124
@@ -135,7 +135,7 @@ void register_mtd_user (struct mtd_notifier *new)
135{ 135{
136 int i; 136 int i;
137 137
138 down(&mtd_table_mutex); 138 mutex_lock(&mtd_table_mutex);
139 139
140 list_add(&new->list, &mtd_notifiers); 140 list_add(&new->list, &mtd_notifiers);
141 141
@@ -145,7 +145,7 @@ void register_mtd_user (struct mtd_notifier *new)
145 if (mtd_table[i]) 145 if (mtd_table[i])
146 new->add(mtd_table[i]); 146 new->add(mtd_table[i]);
147 147
148 up(&mtd_table_mutex); 148 mutex_unlock(&mtd_table_mutex);
149} 149}
150 150
151/** 151/**
@@ -162,7 +162,7 @@ int unregister_mtd_user (struct mtd_notifier *old)
162{ 162{
163 int i; 163 int i;
164 164
165 down(&mtd_table_mutex); 165 mutex_lock(&mtd_table_mutex);
166 166
167 module_put(THIS_MODULE); 167 module_put(THIS_MODULE);
168 168
@@ -171,7 +171,7 @@ int unregister_mtd_user (struct mtd_notifier *old)
171 old->remove(mtd_table[i]); 171 old->remove(mtd_table[i]);
172 172
173 list_del(&old->list); 173 list_del(&old->list);
174 up(&mtd_table_mutex); 174 mutex_unlock(&mtd_table_mutex);
175 return 0; 175 return 0;
176} 176}
177 177
@@ -193,7 +193,7 @@ struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num)
193 struct mtd_info *ret = NULL; 193 struct mtd_info *ret = NULL;
194 int i; 194 int i;
195 195
196 down(&mtd_table_mutex); 196 mutex_lock(&mtd_table_mutex);
197 197
198 if (num == -1) { 198 if (num == -1) {
199 for (i=0; i< MAX_MTD_DEVICES; i++) 199 for (i=0; i< MAX_MTD_DEVICES; i++)
@@ -211,7 +211,7 @@ struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num)
211 if (ret) 211 if (ret)
212 ret->usecount++; 212 ret->usecount++;
213 213
214 up(&mtd_table_mutex); 214 mutex_unlock(&mtd_table_mutex);
215 return ret; 215 return ret;
216} 216}
217 217
@@ -219,9 +219,9 @@ void put_mtd_device(struct mtd_info *mtd)
219{ 219{
220 int c; 220 int c;
221 221
222 down(&mtd_table_mutex); 222 mutex_lock(&mtd_table_mutex);
223 c = --mtd->usecount; 223 c = --mtd->usecount;
224 up(&mtd_table_mutex); 224 mutex_unlock(&mtd_table_mutex);
225 BUG_ON(c < 0); 225 BUG_ON(c < 0);
226 226
227 module_put(mtd->owner); 227 module_put(mtd->owner);
@@ -319,7 +319,7 @@ static int mtd_read_proc (char *page, char **start, off_t off, int count,
319 int len, l, i; 319 int len, l, i;
320 off_t begin = 0; 320 off_t begin = 0;
321 321
322 down(&mtd_table_mutex); 322 mutex_lock(&mtd_table_mutex);
323 323
324 len = sprintf(page, "dev: size erasesize name\n"); 324 len = sprintf(page, "dev: size erasesize name\n");
325 for (i=0; i< MAX_MTD_DEVICES; i++) { 325 for (i=0; i< MAX_MTD_DEVICES; i++) {
@@ -337,7 +337,7 @@ static int mtd_read_proc (char *page, char **start, off_t off, int count,
337 *eof = 1; 337 *eof = 1;
338 338
339done: 339done:
340 up(&mtd_table_mutex); 340 mutex_unlock(&mtd_table_mutex);
341 if (off >= len+begin) 341 if (off >= len+begin)
342 return 0; 342 return 0;
343 *start = page + (off-begin); 343 *start = page + (off-begin);