diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-08-17 01:40:39 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-17 03:54:41 -0400 |
commit | 12aac19d4ba41019a1748f49d3c5d259b1bfb26d (patch) | |
tree | 27cdb377eed18aebaed7600b63d2962418b7af95 /kernel/lockdep_proc.c | |
parent | 8109e1de8502421f9efff1359f2779b1adcc0724 (diff) |
lockdep: Simplify lockdep_chains seqfile code
- make lc_next() call lc_start()
- use lock_chains directly instead of storing it in m->private
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <4A88ED57.5060609@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/lockdep_proc.c')
-rw-r--r-- | kernel/lockdep_proc.c | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/kernel/lockdep_proc.c b/kernel/lockdep_proc.c index 05fb5fde9b17..2bbe25f55d09 100644 --- a/kernel/lockdep_proc.c +++ b/kernel/lockdep_proc.c | |||
@@ -113,26 +113,6 @@ static const struct file_operations proc_lockdep_operations = { | |||
113 | }; | 113 | }; |
114 | 114 | ||
115 | #ifdef CONFIG_PROVE_LOCKING | 115 | #ifdef CONFIG_PROVE_LOCKING |
116 | static void *lc_next(struct seq_file *m, void *v, loff_t *pos) | ||
117 | { | ||
118 | struct lock_chain *chain; | ||
119 | |||
120 | (*pos)++; | ||
121 | |||
122 | if (v == SEQ_START_TOKEN) | ||
123 | chain = m->private; | ||
124 | else { | ||
125 | chain = v; | ||
126 | |||
127 | if (*pos - 1 < nr_lock_chains) | ||
128 | chain = lock_chains + (*pos - 1); | ||
129 | else | ||
130 | chain = NULL; | ||
131 | } | ||
132 | |||
133 | return chain; | ||
134 | } | ||
135 | |||
136 | static void *lc_start(struct seq_file *m, loff_t *pos) | 116 | static void *lc_start(struct seq_file *m, loff_t *pos) |
137 | { | 117 | { |
138 | if (*pos == 0) | 118 | if (*pos == 0) |
@@ -144,6 +124,12 @@ static void *lc_start(struct seq_file *m, loff_t *pos) | |||
144 | return NULL; | 124 | return NULL; |
145 | } | 125 | } |
146 | 126 | ||
127 | static void *lc_next(struct seq_file *m, void *v, loff_t *pos) | ||
128 | { | ||
129 | (*pos)++; | ||
130 | return lc_start(m, pos); | ||
131 | } | ||
132 | |||
147 | static void lc_stop(struct seq_file *m, void *v) | 133 | static void lc_stop(struct seq_file *m, void *v) |
148 | { | 134 | { |
149 | } | 135 | } |
@@ -184,16 +170,7 @@ static const struct seq_operations lockdep_chains_ops = { | |||
184 | 170 | ||
185 | static int lockdep_chains_open(struct inode *inode, struct file *file) | 171 | static int lockdep_chains_open(struct inode *inode, struct file *file) |
186 | { | 172 | { |
187 | int res = seq_open(file, &lockdep_chains_ops); | 173 | return seq_open(file, &lockdep_chains_ops); |
188 | if (!res) { | ||
189 | struct seq_file *m = file->private_data; | ||
190 | |||
191 | if (nr_lock_chains) | ||
192 | m->private = lock_chains; | ||
193 | else | ||
194 | m->private = NULL; | ||
195 | } | ||
196 | return res; | ||
197 | } | 174 | } |
198 | 175 | ||
199 | static const struct file_operations proc_lockdep_chains_operations = { | 176 | static const struct file_operations proc_lockdep_chains_operations = { |