]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - lib/reed_solomon/reed_solomon.c
[PATCH] sem2mutex: kernel/
[karo-tx-linux.git] / lib / reed_solomon / reed_solomon.c
index f5fef948a415e0cb3118b0a22eaab4f374e044b3..f8ac9fa95de12cde5f786c46aca67ffdb343b0bb 100644 (file)
 #include <linux/module.h>
 #include <linux/rslib.h>
 #include <linux/slab.h>
+#include <linux/mutex.h>
 #include <asm/semaphore.h>
 
 /* This list holds all currently allocated rs control structures */
 static LIST_HEAD (rslist);
 /* Protection for the list */
-static DECLARE_MUTEX(rslistlock);
+static DEFINE_MUTEX(rslistlock);
 
 /**
  * rs_init - Initialize a Reed-Solomon codec
@@ -161,7 +162,7 @@ errrs:
  */
 void free_rs(struct rs_control *rs)
 {
-       down(&rslistlock);
+       mutex_lock(&rslistlock);
        rs->users--;
        if(!rs->users) {
                list_del(&rs->list);
@@ -170,7 +171,7 @@ void free_rs(struct rs_control *rs)
                kfree(rs->genpoly);
                kfree(rs);
        }
-       up(&rslistlock);
+       mutex_unlock(&rslistlock);
 }
 
 /**
@@ -201,7 +202,7 @@ struct rs_control *init_rs(int symsize, int gfpoly, int fcr, int prim,
        if (nroots < 0 || nroots >= (1<<symsize))
                return NULL;
 
-       down(&rslistlock);
+       mutex_lock(&rslistlock);
 
        /* Walk through the list and look for a matching entry */
        list_for_each(tmp, &rslist) {
@@ -228,7 +229,7 @@ struct rs_control *init_rs(int symsize, int gfpoly, int fcr, int prim,
                list_add(&rs->list, &rslist);
        }
 out:
-       up(&rslistlock);
+       mutex_unlock(&rslistlock);
        return rs;
 }