diff options
Diffstat (limited to 'net/batman-adv/hash.c')
-rw-r--r-- | net/batman-adv/hash.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/net/batman-adv/hash.c b/net/batman-adv/hash.c index 117687bedf25..1fb961c8d9a0 100644 --- a/net/batman-adv/hash.c +++ b/net/batman-adv/hash.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Simon Wunderlich, Marek Lindner | 3 | * Simon Wunderlich, Marek Lindner |
5 | * | 4 | * |
@@ -16,14 +15,13 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
23 | #include "hash.h" | 21 | #include "hash.h" |
24 | 22 | ||
25 | /* clears the hash */ | 23 | /* clears the hash */ |
26 | static void hash_init(struct hashtable_t *hash) | 24 | static void batadv_hash_init(struct hashtable_t *hash) |
27 | { | 25 | { |
28 | uint32_t i; | 26 | uint32_t i; |
29 | 27 | ||
@@ -34,7 +32,7 @@ static void hash_init(struct hashtable_t *hash) | |||
34 | } | 32 | } |
35 | 33 | ||
36 | /* free only the hashtable and the hash itself. */ | 34 | /* free only the hashtable and the hash itself. */ |
37 | void hash_destroy(struct hashtable_t *hash) | 35 | void batadv_hash_destroy(struct hashtable_t *hash) |
38 | { | 36 | { |
39 | kfree(hash->list_locks); | 37 | kfree(hash->list_locks); |
40 | kfree(hash->table); | 38 | kfree(hash->table); |
@@ -42,7 +40,7 @@ void hash_destroy(struct hashtable_t *hash) | |||
42 | } | 40 | } |
43 | 41 | ||
44 | /* allocates and clears the hash */ | 42 | /* allocates and clears the hash */ |
45 | struct hashtable_t *hash_new(uint32_t size) | 43 | struct hashtable_t *batadv_hash_new(uint32_t size) |
46 | { | 44 | { |
47 | struct hashtable_t *hash; | 45 | struct hashtable_t *hash; |
48 | 46 | ||
@@ -60,7 +58,7 @@ struct hashtable_t *hash_new(uint32_t size) | |||
60 | goto free_table; | 58 | goto free_table; |
61 | 59 | ||
62 | hash->size = size; | 60 | hash->size = size; |
63 | hash_init(hash); | 61 | batadv_hash_init(hash); |
64 | return hash; | 62 | return hash; |
65 | 63 | ||
66 | free_table: | 64 | free_table: |
@@ -69,3 +67,12 @@ free_hash: | |||
69 | kfree(hash); | 67 | kfree(hash); |
70 | return NULL; | 68 | return NULL; |
71 | } | 69 | } |
70 | |||
71 | void batadv_hash_set_lock_class(struct hashtable_t *hash, | ||
72 | struct lock_class_key *key) | ||
73 | { | ||
74 | uint32_t i; | ||
75 | |||
76 | for (i = 0; i < hash->size; i++) | ||
77 | lockdep_set_class(&hash->list_locks[i], key); | ||
78 | } | ||