Skip to content

Commit d529a18

Browse files
jlintonarmctmarinas
authored andcommitted
drivers: base: cacheinfo: move cache_setup_of_node()
In preparation for the next patch, and to aid in review of that patch, lets move cache_setup_of_node further down in the module without any changes. Tested-by: Ard Biesheuvel <[email protected]> Tested-by: Vijaya Kumar K <[email protected]> Tested-by: Xiongfeng Wang <[email protected]> Tested-by: Tomasz Nowicki <[email protected]> Reviewed-by: Sudeep Holla <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Jeremy Linton <[email protected]> Signed-off-by: Catalin Marinas <[email protected]>
1 parent 1cfc63b commit d529a18

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

drivers/base/cacheinfo.c

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -32,46 +32,6 @@ struct cpu_cacheinfo *get_cpu_cacheinfo(unsigned int cpu)
3232
}
3333

3434
#ifdef CONFIG_OF
35-
static int cache_setup_of_node(unsigned int cpu)
36-
{
37-
struct device_node *np;
38-
struct cacheinfo *this_leaf;
39-
struct device *cpu_dev = get_cpu_device(cpu);
40-
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
41-
unsigned int index = 0;
42-
43-
/* skip if of_node is already populated */
44-
if (this_cpu_ci->info_list->of_node)
45-
return 0;
46-
47-
if (!cpu_dev) {
48-
pr_err("No cpu device for CPU %d\n", cpu);
49-
return -ENODEV;
50-
}
51-
np = cpu_dev->of_node;
52-
if (!np) {
53-
pr_err("Failed to find cpu%d device node\n", cpu);
54-
return -ENOENT;
55-
}
56-
57-
while (index < cache_leaves(cpu)) {
58-
this_leaf = this_cpu_ci->info_list + index;
59-
if (this_leaf->level != 1)
60-
np = of_find_next_cache_node(np);
61-
else
62-
np = of_node_get(np);/* cpu node itself */
63-
if (!np)
64-
break;
65-
this_leaf->of_node = np;
66-
index++;
67-
}
68-
69-
if (index != cache_leaves(cpu)) /* not all OF nodes populated */
70-
return -ENOENT;
71-
72-
return 0;
73-
}
74-
7535
static inline bool cache_leaves_are_shared(struct cacheinfo *this_leaf,
7636
struct cacheinfo *sib_leaf)
7737
{
@@ -202,6 +162,46 @@ static void cache_of_override_properties(unsigned int cpu)
202162
cache_associativity(this_leaf);
203163
}
204164
}
165+
166+
static int cache_setup_of_node(unsigned int cpu)
167+
{
168+
struct device_node *np;
169+
struct cacheinfo *this_leaf;
170+
struct device *cpu_dev = get_cpu_device(cpu);
171+
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
172+
unsigned int index = 0;
173+
174+
/* skip if of_node is already populated */
175+
if (this_cpu_ci->info_list->of_node)
176+
return 0;
177+
178+
if (!cpu_dev) {
179+
pr_err("No cpu device for CPU %d\n", cpu);
180+
return -ENODEV;
181+
}
182+
np = cpu_dev->of_node;
183+
if (!np) {
184+
pr_err("Failed to find cpu%d device node\n", cpu);
185+
return -ENOENT;
186+
}
187+
188+
while (index < cache_leaves(cpu)) {
189+
this_leaf = this_cpu_ci->info_list + index;
190+
if (this_leaf->level != 1)
191+
np = of_find_next_cache_node(np);
192+
else
193+
np = of_node_get(np);/* cpu node itself */
194+
if (!np)
195+
break;
196+
this_leaf->of_node = np;
197+
index++;
198+
}
199+
200+
if (index != cache_leaves(cpu)) /* not all OF nodes populated */
201+
return -ENOENT;
202+
203+
return 0;
204+
}
205205
#else
206206
static void cache_of_override_properties(unsigned int cpu) { }
207207
static inline int cache_setup_of_node(unsigned int cpu) { return 0; }

0 commit comments

Comments
 (0)