Skip to content

Commit 465aac6

Browse files
rddunlapglikely
authored andcommitted
Fix build when CONFIG_W1_MASTER_GPIO=m b exporting "allnodes"
ERROR: "allnodes" [drivers/w1/masters/w1-gpio.ko] undefined! Signed-off-by: Randy Dunlap <rdunlap@infradead.org> [grant.likely: allnodes is too generic; rename to of_allnodes] Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Cc: Ville Syrjala <syrjala@sci.fi>
1 parent f3b6159 commit 465aac6

5 files changed

Lines changed: 25 additions & 24 deletions

File tree

‎arch/arm/mach-vexpress/v2m.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ void __init v2m_dt_init_early(void)
589589
return;
590590

591591
/* Confirm board type against DT property, if available */
592-
if (of_property_read_u32(allnodes, "arm,hbi", &dt_hbi) == 0) {
592+
if (of_property_read_u32(of_allnodes, "arm,hbi", &dt_hbi) == 0) {
593593
int site = v2m_get_master_site();
594594
u32 id = readl(v2m_sysreg_base + (site == SYS_CFG_SITE_DB2 ?
595595
V2M_SYS_PROCID1 : V2M_SYS_PROCID0));

‎drivers/of/base.c‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ struct alias_prop {
4545

4646
static LIST_HEAD(aliases_lookup);
4747

48-
struct device_node *allnodes;
48+
struct device_node *of_allnodes;
49+
EXPORT_SYMBOL(of_allnodes);
4950
struct device_node *of_chosen;
5051
struct device_node *of_aliases;
5152

@@ -199,7 +200,7 @@ struct device_node *of_find_all_nodes(struct device_node *prev)
199200
struct device_node *np;
200201

201202
read_lock(&devtree_lock);
202-
np = prev ? prev->allnext : allnodes;
203+
np = prev ? prev->allnext : of_allnodes;
203204
for (; np != NULL; np = np->allnext)
204205
if (of_node_get(np))
205206
break;
@@ -422,7 +423,7 @@ EXPORT_SYMBOL(of_get_child_by_name);
422423
*/
423424
struct device_node *of_find_node_by_path(const char *path)
424425
{
425-
struct device_node *np = allnodes;
426+
struct device_node *np = of_allnodes;
426427

427428
read_lock(&devtree_lock);
428429
for (; np; np = np->allnext) {
@@ -452,7 +453,7 @@ struct device_node *of_find_node_by_name(struct device_node *from,
452453
struct device_node *np;
453454

454455
read_lock(&devtree_lock);
455-
np = from ? from->allnext : allnodes;
456+
np = from ? from->allnext : of_allnodes;
456457
for (; np; np = np->allnext)
457458
if (np->name && (of_node_cmp(np->name, name) == 0)
458459
&& of_node_get(np))
@@ -481,7 +482,7 @@ struct device_node *of_find_node_by_type(struct device_node *from,
481482
struct device_node *np;
482483

483484
read_lock(&devtree_lock);
484-
np = from ? from->allnext : allnodes;
485+
np = from ? from->allnext : of_allnodes;
485486
for (; np; np = np->allnext)
486487
if (np->type && (of_node_cmp(np->type, type) == 0)
487488
&& of_node_get(np))
@@ -512,7 +513,7 @@ struct device_node *of_find_compatible_node(struct device_node *from,
512513
struct device_node *np;
513514

514515
read_lock(&devtree_lock);
515-
np = from ? from->allnext : allnodes;
516+
np = from ? from->allnext : of_allnodes;
516517
for (; np; np = np->allnext) {
517518
if (type
518519
&& !(np->type && (of_node_cmp(np->type, type) == 0)))
@@ -545,7 +546,7 @@ struct device_node *of_find_node_with_property(struct device_node *from,
545546
struct property *pp;
546547

547548
read_lock(&devtree_lock);
548-
np = from ? from->allnext : allnodes;
549+
np = from ? from->allnext : of_allnodes;
549550
for (; np; np = np->allnext) {
550551
for (pp = np->properties; pp; pp = pp->next) {
551552
if (of_prop_cmp(pp->name, prop_name) == 0) {
@@ -616,7 +617,7 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from,
616617
*match = NULL;
617618

618619
read_lock(&devtree_lock);
619-
np = from ? from->allnext : allnodes;
620+
np = from ? from->allnext : of_allnodes;
620621
for (; np; np = np->allnext) {
621622
if (of_match_node(matches, np) && of_node_get(np)) {
622623
if (match)
@@ -669,7 +670,7 @@ struct device_node *of_find_node_by_phandle(phandle handle)
669670
struct device_node *np;
670671

671672
read_lock(&devtree_lock);
672-
for (np = allnodes; np; np = np->allnext)
673+
for (np = of_allnodes; np; np = np->allnext)
673674
if (np->phandle == handle)
674675
break;
675676
of_node_get(np);
@@ -1254,9 +1255,9 @@ void of_attach_node(struct device_node *np)
12541255

12551256
write_lock_irqsave(&devtree_lock, flags);
12561257
np->sibling = np->parent->child;
1257-
np->allnext = allnodes;
1258+
np->allnext = of_allnodes;
12581259
np->parent->child = np;
1259-
allnodes = np;
1260+
of_allnodes = np;
12601261
write_unlock_irqrestore(&devtree_lock, flags);
12611262
}
12621263

@@ -1277,11 +1278,11 @@ void of_detach_node(struct device_node *np)
12771278
if (!parent)
12781279
goto out_unlock;
12791280

1280-
if (allnodes == np)
1281-
allnodes = np->allnext;
1281+
if (of_allnodes == np)
1282+
of_allnodes = np->allnext;
12821283
else {
12831284
struct device_node *prev;
1284-
for (prev = allnodes;
1285+
for (prev = of_allnodes;
12851286
prev->allnext != np;
12861287
prev = prev->allnext)
12871288
;

‎drivers/of/fdt.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
712712
*/
713713
void __init unflatten_device_tree(void)
714714
{
715-
__unflatten_device_tree(initial_boot_params, &allnodes,
715+
__unflatten_device_tree(initial_boot_params, &of_allnodes,
716716
early_init_dt_alloc_memory_arch);
717717

718718
/* Get pointer to "/chosen" and "/aliasas" nodes for use everywhere */

‎drivers/of/pdt.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,15 @@ void __init of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops)
241241
BUG_ON(!ops);
242242
of_pdt_prom_ops = ops;
243243

244-
allnodes = of_pdt_create_node(root_node, NULL);
244+
of_allnodes = of_pdt_create_node(root_node, NULL);
245245
#if defined(CONFIG_SPARC)
246-
allnodes->path_component_name = "";
246+
of_allnodes->path_component_name = "";
247247
#endif
248-
allnodes->full_name = "/";
248+
of_allnodes->full_name = "/";
249249

250-
nextp = &allnodes->allnext;
251-
allnodes->child = of_pdt_build_tree(allnodes,
252-
of_pdt_prom_ops->getchild(allnodes->phandle), &nextp);
250+
nextp = &of_allnodes->allnext;
251+
of_allnodes->child = of_pdt_build_tree(of_allnodes,
252+
of_pdt_prom_ops->getchild(of_allnodes->phandle), &nextp);
253253

254254
/* Get pointer to "/chosen" and "/aliasas" nodes for use everywhere */
255255
of_alias_scan(kernel_tree_alloc);

‎include/linux/of.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ static inline void of_node_put(struct device_node *node) { }
8888
#ifdef CONFIG_OF
8989

9090
/* Pointer for first entry in chain of all nodes. */
91-
extern struct device_node *allnodes;
91+
extern struct device_node *of_allnodes;
9292
extern struct device_node *of_chosen;
9393
extern struct device_node *of_aliases;
9494
extern rwlock_t devtree_lock;
9595

9696
static inline bool of_have_populated_dt(void)
9797
{
98-
return allnodes != NULL;
98+
return of_allnodes != NULL;
9999
}
100100

101101
static inline bool of_node_is_root(const struct device_node *node)

0 commit comments

Comments
 (0)