aboutsummaryrefslogtreecommitdiff
path: root/net/atm/resources.c
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2010-02-08 23:21:51 +0000
committerDavid S. Miller <davem@davemloft.net>2010-02-10 12:31:10 -0800
commit67de792420be2daa1c6fec07ec8552af9ea0bde3 (patch)
tree5a0141ea6d3d0f6557a6bd9ec3351d00d6a95f58 /net/atm/resources.c
parenta2b79b414df97a70c33f874b631e06830431d233 (diff)
downloadlinux-67de792420be2daa1c6fec07ec8552af9ea0bde3.tar.gz
net: atm: use seq_list_foo() helpers
Simplify seq_file code. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm/resources.c')
-rw-r--r--net/atm/resources.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/net/atm/resources.c b/net/atm/resources.c
index 447ed89205d..90082904f20 100644
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -444,21 +444,10 @@ done:
return error;
}
-static inline void *dev_get_idx(loff_t left)
-{
- struct list_head *p;
-
- list_for_each(p, &atm_devs) {
- if (!--left)
- break;
- }
- return (p != &atm_devs) ? p : NULL;
-}
-
void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos)
{
mutex_lock(&atm_dev_mutex);
- return *pos ? dev_get_idx(*pos) : SEQ_START_TOKEN;
+ return seq_list_start_head(&atm_devs, *pos);
}
void atm_dev_seq_stop(struct seq_file *seq, void *v)
@@ -468,8 +457,5 @@ void atm_dev_seq_stop(struct seq_file *seq, void *v)
void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
- ++*pos;
- v = (v == SEQ_START_TOKEN)
- ? atm_devs.next : ((struct list_head *)v)->next;
- return (v == &atm_devs) ? NULL : v;
+ return seq_list_next(v, &atm_devs, pos);
}