diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-26 04:37:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-26 11:56:55 -0500 |
commit | 353ab6e97b8f209dbecc9f650f1f84e3da2a7bb1 (patch) | |
tree | bffabd9a5a493ffd2b41dd825e71e848ca6ba6d7 /fs/jffs2 | |
parent | e655a250d5fc12b6dfe0d436180ba4a3bfffdc9f (diff) |
[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 4db8be8e90cc..5c63e0cdcf4c 100644 --- a/fs/jffs2/compr_zlib.c +++ b/fs/jffs2/compr_zlib.c | |||
@@ -33,13 +33,14 @@ | |||
33 | */ | 33 | */ |
34 | #define STREAM_END_SPACE 12 | 34 | #define STREAM_END_SPACE 12 |
35 | 35 | ||
36 | static DECLARE_MUTEX(deflate_sem); | 36 | static DEFINE_MUTEX(deflate_mutex); |
37 | static DECLARE_MUTEX(inflate_sem); | 37 | static DEFINE_MUTEX(inflate_mutex); |
38 | static z_stream inf_strm, def_strm; | 38 | static z_stream inf_strm, def_strm; |
39 | 39 | ||
40 | #ifdef __KERNEL__ /* Linux-only */ | 40 | #ifdef __KERNEL__ /* Linux-only */ |
41 | #include <linux/vmalloc.h> | 41 | #include <linux/vmalloc.h> |
42 | #include <linux/init.h> | 42 | #include <linux/init.h> |
43 | #include <linux/mutex.h> | ||
43 | 44 | ||
44 | static int __init alloc_workspaces(void) | 45 | static int __init alloc_workspaces(void) |
45 | { | 46 | { |
@@ -79,11 +80,11 @@ static int jffs2_zlib_compress(unsigned char *data_in, | |||
79 | if (*dstlen <= STREAM_END_SPACE) | 80 | if (*dstlen <= STREAM_END_SPACE) |
80 | return -1; | 81 | return -1; |
81 | 82 | ||
82 | down(&deflate_sem); | 83 | mutex_lock(&deflate_mutex); |
83 | 84 | ||
84 | if (Z_OK != zlib_deflateInit(&def_strm, 3)) { | 85 | if (Z_OK != zlib_deflateInit(&def_strm, 3)) { |
85 | printk(KERN_WARNING "deflateInit failed\n"); | 86 | printk(KERN_WARNING "deflateInit failed\n"); |
86 | up(&deflate_sem); | 87 | mutex_unlock(&deflate_mutex); |
87 | return -1; | 88 | return -1; |
88 | } | 89 | } |
89 | 90 | ||
@@ -104,7 +105,7 @@ static int jffs2_zlib_compress(unsigned char *data_in, | |||
104 | if (ret != Z_OK) { | 105 | if (ret != Z_OK) { |
105 | D1(printk(KERN_DEBUG "deflate in loop returned %d\n", ret)); | 106 | D1(printk(KERN_DEBUG "deflate in loop returned %d\n", ret)); |
106 | zlib_deflateEnd(&def_strm); | 107 | zlib_deflateEnd(&def_strm); |
107 | up(&deflate_sem); | 108 | mutex_unlock(&deflate_mutex); |
108 | return -1; | 109 | return -1; |
109 | } | 110 | } |
110 | } | 111 | } |
@@ -133,7 +134,7 @@ static int jffs2_zlib_compress(unsigned char *data_in, | |||
133 | *sourcelen = def_strm.total_in; | 134 | *sourcelen = def_strm.total_in; |
134 | ret = 0; | 135 | ret = 0; |
135 | out: | 136 | out: |
136 | up(&deflate_sem); | 137 | mutex_unlock(&deflate_mutex); |
137 | return ret; | 138 | return ret; |
138 | } | 139 | } |
139 | 140 | ||
@@ -145,7 +146,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in, | |||
145 | int ret; | 146 | int ret; |
146 | int wbits = MAX_WBITS; | 147 | int wbits = MAX_WBITS; |
147 | 148 | ||
148 | down(&inflate_sem); | 149 | mutex_lock(&inflate_mutex); |
149 | 150 | ||
150 | inf_strm.next_in = data_in; | 151 | inf_strm.next_in = data_in; |
151 | inf_strm.avail_in = srclen; | 152 | inf_strm.avail_in = srclen; |
@@ -173,7 +174,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in, | |||
173 | 174 | ||
174 | if (Z_OK != zlib_inflateInit2(&inf_strm, wbits)) { | 175 | if (Z_OK != zlib_inflateInit2(&inf_strm, wbits)) { |
175 | printk(KERN_WARNING "inflateInit failed\n"); | 176 | printk(KERN_WARNING "inflateInit failed\n"); |
176 | up(&inflate_sem); | 177 | mutex_unlock(&inflate_mutex); |
177 | return 1; | 178 | return 1; |
178 | } | 179 | } |
179 | 180 | ||
@@ -183,7 +184,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in, | |||
183 | printk(KERN_NOTICE "inflate returned %d\n", ret); | 184 | printk(KERN_NOTICE "inflate returned %d\n", ret); |
184 | } | 185 | } |
185 | zlib_inflateEnd(&inf_strm); | 186 | zlib_inflateEnd(&inf_strm); |
186 | up(&inflate_sem); | 187 | mutex_unlock(&inflate_mutex); |
187 | return 0; | 188 | return 0; |
188 | } | 189 | } |
189 | 190 | ||