aboutsummaryrefslogtreecommitdiffstats
path: root/lib/reed_solomon/reed_solomon.c
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2006-03-23 06:00:24 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 10:38:10 -0500
commit97d1f15b7ef52c1e9c28dc48b454024bb53a5fd2 (patch)
tree7bdb928096eec577e75897351f639d3f94441c87 /lib/reed_solomon/reed_solomon.c
parente723ccd805857a46d3b63fbd20edea8579c6c541 (diff)
[PATCH] sem2mutex: kernel/
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'lib/reed_solomon/reed_solomon.c')
-rw-r--r--lib/reed_solomon/reed_solomon.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/reed_solomon/reed_solomon.c b/lib/reed_solomon/reed_solomon.c
index f5fef948a415..f8ac9fa95de1 100644
--- a/lib/reed_solomon/reed_solomon.c
+++ b/lib/reed_solomon/reed_solomon.c
@@ -44,12 +44,13 @@
44#include <linux/module.h> 44#include <linux/module.h>
45#include <linux/rslib.h> 45#include <linux/rslib.h>
46#include <linux/slab.h> 46#include <linux/slab.h>
47#include <linux/mutex.h>
47#include <asm/semaphore.h> 48#include <asm/semaphore.h>
48 49
49/* This list holds all currently allocated rs control structures */ 50/* This list holds all currently allocated rs control structures */
50static LIST_HEAD (rslist); 51static LIST_HEAD (rslist);
51/* Protection for the list */ 52/* Protection for the list */
52static DECLARE_MUTEX(rslistlock); 53static DEFINE_MUTEX(rslistlock);
53 54
54/** 55/**
55 * rs_init - Initialize a Reed-Solomon codec 56 * rs_init - Initialize a Reed-Solomon codec
@@ -161,7 +162,7 @@ errrs:
161 */ 162 */
162void free_rs(struct rs_control *rs) 163void free_rs(struct rs_control *rs)
163{ 164{
164 down(&rslistlock); 165 mutex_lock(&rslistlock);
165 rs->users--; 166 rs->users--;
166 if(!rs->users) { 167 if(!rs->users) {
167 list_del(&rs->list); 168 list_del(&rs->list);
@@ -170,7 +171,7 @@ void free_rs(struct rs_control *rs)
170 kfree(rs->genpoly); 171 kfree(rs->genpoly);
171 kfree(rs); 172 kfree(rs);
172 } 173 }
173 up(&rslistlock); 174 mutex_unlock(&rslistlock);
174} 175}
175 176
176/** 177/**
@@ -201,7 +202,7 @@ struct rs_control *init_rs(int symsize, int gfpoly, int fcr, int prim,
201 if (nroots < 0 || nroots >= (1<<symsize)) 202 if (nroots < 0 || nroots >= (1<<symsize))
202 return NULL; 203 return NULL;
203 204
204 down(&rslistlock); 205 mutex_lock(&rslistlock);
205 206
206 /* Walk through the list and look for a matching entry */ 207 /* Walk through the list and look for a matching entry */
207 list_for_each(tmp, &rslist) { 208 list_for_each(tmp, &rslist) {
@@ -228,7 +229,7 @@ struct rs_control *init_rs(int symsize, int gfpoly, int fcr, int prim,
228 list_add(&rs->list, &rslist); 229 list_add(&rs->list, &rslist);
229 } 230 }
230out: 231out:
231 up(&rslistlock); 232 mutex_unlock(&rslistlock);
232 return rs; 233 return rs;
233} 234}
234 235