diff options
author | Simon Wunderlich <siwu@hrz.tu-chemnitz.de> | 2010-01-02 05:30:39 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-03 19:42:35 -0500 |
commit | b6c359767bc743a7b6830660daa8f7e5c4273ad8 (patch) | |
tree | 103f486f27d4e9b586480272b2edffd61eebe34c /drivers/staging/batman-adv/routing.c | |
parent | 4ce21a7faf320bdb750a2e1639f8f2dbb27bdb89 (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/routing.c')
-rw-r--r-- | drivers/staging/batman-adv/routing.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c index e8d712788da..68dea76b0ca 100644 --- a/drivers/staging/batman-adv/routing.c +++ b/drivers/staging/batman-adv/routing.c | |||
@@ -40,14 +40,14 @@ static atomic_t data_ready_cond; | |||
40 | atomic_t exit_cond; | 40 | atomic_t exit_cond; |
41 | void slide_own_bcast_window(struct batman_if *batman_if) | 41 | void slide_own_bcast_window(struct batman_if *batman_if) |
42 | { | 42 | { |
43 | struct hash_it_t *hashit = NULL; | 43 | HASHIT(hashit); |
44 | struct orig_node *orig_node; | 44 | struct orig_node *orig_node; |
45 | TYPE_OF_WORD *word; | 45 | TYPE_OF_WORD *word; |
46 | 46 | ||
47 | spin_lock(&orig_hash_lock); | 47 | spin_lock(&orig_hash_lock); |
48 | 48 | ||
49 | while (NULL != (hashit = hash_iterate(orig_hash, hashit))) { | 49 | while (hash_iterate(orig_hash, &hashit)) { |
50 | orig_node = hashit->bucket->data; | 50 | orig_node = hashit.bucket->data; |
51 | word = &(orig_node->bcast_own[batman_if->if_num * NUM_WORDS]); | 51 | word = &(orig_node->bcast_own[batman_if->if_num * NUM_WORDS]); |
52 | 52 | ||
53 | bit_get_packet(word, 1, 0); | 53 | bit_get_packet(word, 1, 0); |