Commit 0ac1759abc69fb62438c30a7e422f628a1120d67
Committed by
Linus Torvalds
1 parent
7cf34c761d
Exists in
master
and in
4 other branches
[PATCH] sem2mutex: fs/seq_file.c
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> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 2 changed files with 7 additions and 7 deletions Side-by-side Diff
fs/seq_file.c
... | ... | @@ -37,7 +37,7 @@ |
37 | 37 | file->private_data = p; |
38 | 38 | } |
39 | 39 | memset(p, 0, sizeof(*p)); |
40 | - sema_init(&p->sem, 1); | |
40 | + mutex_init(&p->lock); | |
41 | 41 | p->op = op; |
42 | 42 | |
43 | 43 | /* |
... | ... | @@ -71,7 +71,7 @@ |
71 | 71 | void *p; |
72 | 72 | int err = 0; |
73 | 73 | |
74 | - down(&m->sem); | |
74 | + mutex_lock(&m->lock); | |
75 | 75 | /* |
76 | 76 | * seq_file->op->..m_start/m_stop/m_next may do special actions |
77 | 77 | * or optimisations based on the file->f_version, so we want to |
... | ... | @@ -164,7 +164,7 @@ |
164 | 164 | else |
165 | 165 | *ppos += copied; |
166 | 166 | file->f_version = m->version; |
167 | - up(&m->sem); | |
167 | + mutex_unlock(&m->lock); | |
168 | 168 | return copied; |
169 | 169 | Enomem: |
170 | 170 | err = -ENOMEM; |
... | ... | @@ -237,7 +237,7 @@ |
237 | 237 | struct seq_file *m = (struct seq_file *)file->private_data; |
238 | 238 | long long retval = -EINVAL; |
239 | 239 | |
240 | - down(&m->sem); | |
240 | + mutex_lock(&m->lock); | |
241 | 241 | m->version = file->f_version; |
242 | 242 | switch (origin) { |
243 | 243 | case 1: |
... | ... | @@ -260,7 +260,7 @@ |
260 | 260 | } |
261 | 261 | } |
262 | 262 | } |
263 | - up(&m->sem); | |
263 | + mutex_unlock(&m->lock); | |
264 | 264 | file->f_version = m->version; |
265 | 265 | return retval; |
266 | 266 | } |
include/linux/seq_file.h
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | |
5 | 5 | #include <linux/types.h> |
6 | 6 | #include <linux/string.h> |
7 | -#include <asm/semaphore.h> | |
7 | +#include <linux/mutex.h> | |
8 | 8 | |
9 | 9 | struct seq_operations; |
10 | 10 | struct file; |
... | ... | @@ -19,7 +19,7 @@ |
19 | 19 | size_t count; |
20 | 20 | loff_t index; |
21 | 21 | loff_t version; |
22 | - struct semaphore sem; | |
22 | + struct mutex lock; | |
23 | 23 | struct seq_operations *op; |
24 | 24 | void *private; |
25 | 25 | }; |