diff options
author | David Woodhouse <dwmw2@infradead.org> | 2007-07-23 10:20:10 +0100 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2007-07-23 10:20:10 +0100 |
commit | 39fe5434cb9de5da40510028b17b96bc4eb312b3 (patch) | |
tree | 7a02a317b9ad57da51ca99887c119e779ccf3f13 /drivers/isdn/capi/kcapi_proc.c | |
parent | 0fc72b81d3111d114ab378935b1cf07680ca1289 (diff) | |
parent | f695baf2df9e0413d3521661070103711545207a (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers/isdn/capi/kcapi_proc.c')
-rw-r--r-- | drivers/isdn/capi/kcapi_proc.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/drivers/isdn/capi/kcapi_proc.c b/drivers/isdn/capi/kcapi_proc.c index 31f4fd8b8b0..845a797b003 100644 --- a/drivers/isdn/capi/kcapi_proc.c +++ b/drivers/isdn/capi/kcapi_proc.c @@ -243,36 +243,15 @@ create_seq_entry(char *name, mode_t mode, const struct file_operations *f) // --------------------------------------------------------------------------- - -static __inline__ struct capi_driver *capi_driver_get_idx(loff_t pos) -{ - struct capi_driver *drv = NULL; - struct list_head *l; - loff_t i; - - i = 0; - list_for_each(l, &capi_drivers) { - drv = list_entry(l, struct capi_driver, list); - if (i++ == pos) - return drv; - } - return NULL; -} - static void *capi_driver_start(struct seq_file *seq, loff_t *pos) { - struct capi_driver *drv; read_lock(&capi_drivers_list_lock); - drv = capi_driver_get_idx(*pos); - return drv; + return seq_list_start(&capi_drivers, *pos); } static void *capi_driver_next(struct seq_file *seq, void *v, loff_t *pos) { - struct capi_driver *drv = (struct capi_driver *)v; - ++*pos; - if (drv->list.next == &capi_drivers) return NULL; - return list_entry(drv->list.next, struct capi_driver, list); + return seq_list_next(v, &capi_drivers, pos); } static void capi_driver_stop(struct seq_file *seq, void *v) @@ -282,7 +261,8 @@ static void capi_driver_stop(struct seq_file *seq, void *v) static int capi_driver_show(struct seq_file *seq, void *v) { - struct capi_driver *drv = (struct capi_driver *)v; + struct capi_driver *drv = list_entry(v, struct capi_driver, list); + seq_printf(seq, "%-32s %s\n", drv->name, drv->revision); return 0; } |