diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-26 01:37:12 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-26 08:56:55 -0800 |
commit | 353ab6e97b8f209dbecc9f650f1f84e3da2a7bb1 (patch) | |
tree | bffabd9a5a493ffd2b41dd825e71e848ca6ba6d7 /fs/jffs2 | |
parent | e655a250d5fc12b6dfe0d436180ba4a3bfffdc9f (diff) | |
download | op-kernel-dev-353ab6e97b8f209dbecc9f650f1f84e3da2a7bb1.zip op-kernel-dev-353ab6e97b8f209dbecc9f650f1f84e3da2a7bb1.tar.gz |
[PATCH] sem2mutex: fs/
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: Eric Van Hensbergen <ericvh@ericvh.myip.org>
Cc: Robert Love <rml@tech9.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/jffs2')
-rw-r--r-- | fs/jffs2/compr_zlib.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/jffs2/compr_zlib.c b/fs/jffs2/compr_zlib.c index 4db8be8..5c63e0c 100644 --- a/fs/jffs2/compr_zlib.c +++ b/fs/jffs2/compr_zlib.c @@ -33,13 +33,14 @@ */ #define STREAM_END_SPACE 12 -static DECLARE_MUTEX(deflate_sem); -static DECLARE_MUTEX(inflate_sem); +static DEFINE_MUTEX(deflate_mutex); +static DEFINE_MUTEX(inflate_mutex); static z_stream inf_strm, def_strm; #ifdef __KERNEL__ /* Linux-only */ #include <linux/vmalloc.h> #include <linux/init.h> +#include <linux/mutex.h> static int __init alloc_workspaces(void) { @@ -79,11 +80,11 @@ static int jffs2_zlib_compress(unsigned char *data_in, if (*dstlen <= STREAM_END_SPACE) return -1; - down(&deflate_sem); + mutex_lock(&deflate_mutex); if (Z_OK != zlib_deflateInit(&def_strm, 3)) { printk(KERN_WARNING "deflateInit failed\n"); - up(&deflate_sem); + mutex_unlock(&deflate_mutex); return -1; } @@ -104,7 +105,7 @@ static int jffs2_zlib_compress(unsigned char *data_in, if (ret != Z_OK) { D1(printk(KERN_DEBUG "deflate in loop returned %d\n", ret)); zlib_deflateEnd(&def_strm); - up(&deflate_sem); + mutex_unlock(&deflate_mutex); return -1; } } @@ -133,7 +134,7 @@ static int jffs2_zlib_compress(unsigned char *data_in, *sourcelen = def_strm.total_in; ret = 0; out: - up(&deflate_sem); + mutex_unlock(&deflate_mutex); return ret; } @@ -145,7 +146,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in, int ret; int wbits = MAX_WBITS; - down(&inflate_sem); + mutex_lock(&inflate_mutex); inf_strm.next_in = data_in; inf_strm.avail_in = srclen; @@ -173,7 +174,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in, if (Z_OK != zlib_inflateInit2(&inf_strm, wbits)) { printk(KERN_WARNING "inflateInit failed\n"); - up(&inflate_sem); + mutex_unlock(&inflate_mutex); return 1; } @@ -183,7 +184,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in, printk(KERN_NOTICE "inflate returned %d\n", ret); } zlib_inflateEnd(&inf_strm); - up(&inflate_sem); + mutex_unlock(&inflate_mutex); return 0; } |