aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/batman-adv/proc.c
diff options
context:
space:
mode:
authorSimon Wunderlich <siwu@hrz.tu-chemnitz.de>2010-01-02 11:30:39 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-03 16:42:35 -0800
commitb6c359767bc743a7b6830660daa8f7e5c4273ad8 (patch)
tree103f486f27d4e9b586480272b2edffd61eebe34c /drivers/staging/batman-adv/proc.c
parent4ce21a7faf320bdb750a2e1639f8f2dbb27bdb89 (diff)
Staging: batman-adv: initialize static hash iterators
instead of dynamically registering hash iterators, calling functions are changed to register the iterator objects statically. The two advantages are: * no memory leaks when aborting from hash_iterate() * no calls to kmalloc/kfree, therefore a little faster/safer Tested with 9 QEMU instances, no obvious regression found. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/batman-adv/proc.c')
-rw-r--r--drivers/staging/batman-adv/proc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/staging/batman-adv/proc.c b/drivers/staging/batman-adv/proc.c
index ed4c73484d7..9f7136b3be3 100644
--- a/drivers/staging/batman-adv/proc.c
+++ b/drivers/staging/batman-adv/proc.c
@@ -186,7 +186,7 @@ static int proc_orig_interval_open(struct inode *inode, struct file *file)
static int proc_originators_read(struct seq_file *seq, void *offset)
{
- struct hash_it_t *hashit = NULL;
+ HASHIT(hashit);
struct orig_node *orig_node;
struct neigh_node *neigh_node;
int batman_count = 0;
@@ -215,9 +215,9 @@ static int proc_originators_read(struct seq_file *seq, void *offset)
rcu_read_unlock();
spin_lock(&orig_hash_lock);
- while (NULL != (hashit = hash_iterate(orig_hash, hashit))) {
+ while (hash_iterate(orig_hash, &hashit)) {
- orig_node = hashit->bucket->data;
+ orig_node = hashit.bucket->data;
if (!orig_node->router)
continue;
@@ -413,7 +413,7 @@ static void proc_vis_read_entry(struct seq_file *seq,
static int proc_vis_read(struct seq_file *seq, void *offset)
{
- struct hash_it_t *hashit = NULL;
+ HASHIT(hashit);
struct vis_info *info;
struct vis_info_entry *entries;
struct vis_if_list *if_entries = NULL;
@@ -440,8 +440,8 @@ static int proc_vis_read(struct seq_file *seq, void *offset)
seq_printf(seq, "digraph {\n");
spin_lock(&vis_hash_lock);
- while (NULL != (hashit = hash_iterate(vis_hash, hashit))) {
- info = hashit->bucket->data;
+ while (hash_iterate(vis_hash, &hashit)) {
+ info = hashit.bucket->data;
entries = (struct vis_info_entry *)
((char *)info + sizeof(struct vis_info));