diff options
author | Grant Likely <grant.likely@linaro.org> | 2014-10-07 06:30:31 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@linaro.org> | 2014-10-07 06:30:31 -0400 |
commit | 2118f4b8dfc666c3e4a9e262beca79636a0852fe (patch) | |
tree | b0dabd31a3f41cfff12b8d8304b76be8a93019f2 /drivers/of/selftest.c | |
parent | 7419eb064e74fba852f1a51842d3e27e248212fa (diff) |
of/selftest: Move hash table off stack to fix large frame size
The new testcase that checks phandle consistency was using a hash table
on the stack which made the frame size much large than it should be. Fix
the problem by moving the hash table into the file scope.
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Diffstat (limited to 'drivers/of/selftest.c')
-rw-r--r-- | drivers/of/selftest.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index 4fed34bff5cf..78001270a598 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c | |||
@@ -198,20 +198,19 @@ struct node_hash { | |||
198 | struct device_node *np; | 198 | struct device_node *np; |
199 | }; | 199 | }; |
200 | 200 | ||
201 | static DEFINE_HASHTABLE(phandle_ht, 8); | ||
201 | static void __init of_selftest_check_phandles(void) | 202 | static void __init of_selftest_check_phandles(void) |
202 | { | 203 | { |
203 | struct device_node *np; | 204 | struct device_node *np; |
204 | struct node_hash *nh; | 205 | struct node_hash *nh; |
205 | struct hlist_node *tmp; | 206 | struct hlist_node *tmp; |
206 | int i, dup_count = 0, phandle_count = 0; | 207 | int i, dup_count = 0, phandle_count = 0; |
207 | DECLARE_HASHTABLE(ht, 8); | ||
208 | 208 | ||
209 | hash_init(ht); | ||
210 | for_each_of_allnodes(np) { | 209 | for_each_of_allnodes(np) { |
211 | if (!np->phandle) | 210 | if (!np->phandle) |
212 | continue; | 211 | continue; |
213 | 212 | ||
214 | hash_for_each_possible(ht, nh, node, np->phandle) { | 213 | hash_for_each_possible(phandle_ht, nh, node, np->phandle) { |
215 | if (nh->np->phandle == np->phandle) { | 214 | if (nh->np->phandle == np->phandle) { |
216 | pr_info("Duplicate phandle! %i used by %s and %s\n", | 215 | pr_info("Duplicate phandle! %i used by %s and %s\n", |
217 | np->phandle, nh->np->full_name, np->full_name); | 216 | np->phandle, nh->np->full_name, np->full_name); |
@@ -225,14 +224,14 @@ static void __init of_selftest_check_phandles(void) | |||
225 | return; | 224 | return; |
226 | 225 | ||
227 | nh->np = np; | 226 | nh->np = np; |
228 | hash_add(ht, &nh->node, np->phandle); | 227 | hash_add(phandle_ht, &nh->node, np->phandle); |
229 | phandle_count++; | 228 | phandle_count++; |
230 | } | 229 | } |
231 | selftest(dup_count == 0, "Found %i duplicates in %i phandles\n", | 230 | selftest(dup_count == 0, "Found %i duplicates in %i phandles\n", |
232 | dup_count, phandle_count); | 231 | dup_count, phandle_count); |
233 | 232 | ||
234 | /* Clean up */ | 233 | /* Clean up */ |
235 | hash_for_each_safe(ht, i, tmp, nh, node) { | 234 | hash_for_each_safe(phandle_ht, i, tmp, nh, node) { |
236 | hash_del(&nh->node); | 235 | hash_del(&nh->node); |
237 | kfree(nh); | 236 | kfree(nh); |
238 | } | 237 | } |