base.c (f445d05328a2d627c2fb70c79d8b01455c254609) | base.c (d25d86949b6799c35d78f4910498c2b65a3f0841) |
---|---|
1/* 2 * Procedures for creating, accessing and interpreting the device tree. 3 * 4 * Paul Mackerras August 1996. 5 * Copyright (C) 1996-2005 Paul Mackerras. 6 * 7 * Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner. 8 * {engebret|bergner}@us.ibm.com --- 178 unchanged lines hidden (view full) --- 187 * of_node_put() will be called on it 188 * 189 * Returns a node pointer with refcount incremented, use 190 * of_node_put() on it when done. 191 */ 192struct device_node *of_find_all_nodes(struct device_node *prev) 193{ 194 struct device_node *np; | 1/* 2 * Procedures for creating, accessing and interpreting the device tree. 3 * 4 * Paul Mackerras August 1996. 5 * Copyright (C) 1996-2005 Paul Mackerras. 6 * 7 * Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner. 8 * {engebret|bergner}@us.ibm.com --- 178 unchanged lines hidden (view full) --- 187 * of_node_put() will be called on it 188 * 189 * Returns a node pointer with refcount incremented, use 190 * of_node_put() on it when done. 191 */ 192struct device_node *of_find_all_nodes(struct device_node *prev) 193{ 194 struct device_node *np; |
195 unsigned long flags; |
|
195 | 196 |
196 raw_spin_lock(&devtree_lock); | 197 raw_spin_lock_irqsave(&devtree_lock, flags); |
197 np = prev ? prev->allnext : of_allnodes; 198 for (; np != NULL; np = np->allnext) 199 if (of_node_get(np)) 200 break; 201 of_node_put(prev); | 198 np = prev ? prev->allnext : of_allnodes; 199 for (; np != NULL; np = np->allnext) 200 if (of_node_get(np)) 201 break; 202 of_node_put(prev); |
202 raw_spin_unlock(&devtree_lock); | 203 raw_spin_unlock_irqrestore(&devtree_lock, flags); |
203 return np; 204} 205EXPORT_SYMBOL(of_find_all_nodes); 206 207/* 208 * Find a property with a given name for a given node 209 * and return the value. 210 */ --- 205 unchanged lines hidden (view full) --- 416 * 417 * This function is like of_get_next_child(), except that it 418 * automatically skips any disabled nodes (i.e. status = "disabled"). 419 */ 420struct device_node *of_get_next_available_child(const struct device_node *node, 421 struct device_node *prev) 422{ 423 struct device_node *next; | 204 return np; 205} 206EXPORT_SYMBOL(of_find_all_nodes); 207 208/* 209 * Find a property with a given name for a given node 210 * and return the value. 211 */ --- 205 unchanged lines hidden (view full) --- 417 * 418 * This function is like of_get_next_child(), except that it 419 * automatically skips any disabled nodes (i.e. status = "disabled"). 420 */ 421struct device_node *of_get_next_available_child(const struct device_node *node, 422 struct device_node *prev) 423{ 424 struct device_node *next; |
425 unsigned long flags; |
|
424 | 426 |
425 raw_spin_lock(&devtree_lock); | 427 raw_spin_lock_irqsave(&devtree_lock, flags); |
426 next = prev ? prev->sibling : node->child; 427 for (; next; next = next->sibling) { 428 if (!__of_device_is_available(next)) 429 continue; 430 if (of_node_get(next)) 431 break; 432 } 433 of_node_put(prev); | 428 next = prev ? prev->sibling : node->child; 429 for (; next; next = next->sibling) { 430 if (!__of_device_is_available(next)) 431 continue; 432 if (of_node_get(next)) 433 break; 434 } 435 of_node_put(prev); |
434 raw_spin_unlock(&devtree_lock); | 436 raw_spin_unlock_irqrestore(&devtree_lock, flags); |
435 return next; 436} 437EXPORT_SYMBOL(of_get_next_available_child); 438 439/** 440 * of_get_child_by_name - Find the child node by name for a given parent 441 * @node: parent node 442 * @name: child name to look for. --- 287 unchanged lines hidden (view full) --- 730 * @handle: phandle of the node to find 731 * 732 * Returns a node pointer with refcount incremented, use 733 * of_node_put() on it when done. 734 */ 735struct device_node *of_find_node_by_phandle(phandle handle) 736{ 737 struct device_node *np; | 437 return next; 438} 439EXPORT_SYMBOL(of_get_next_available_child); 440 441/** 442 * of_get_child_by_name - Find the child node by name for a given parent 443 * @node: parent node 444 * @name: child name to look for. --- 287 unchanged lines hidden (view full) --- 732 * @handle: phandle of the node to find 733 * 734 * Returns a node pointer with refcount incremented, use 735 * of_node_put() on it when done. 736 */ 737struct device_node *of_find_node_by_phandle(phandle handle) 738{ 739 struct device_node *np; |
740 unsigned long flags; |
|
738 | 741 |
739 raw_spin_lock(&devtree_lock); | 742 raw_spin_lock_irqsave(&devtree_lock, flags); |
740 for (np = of_allnodes; np; np = np->allnext) 741 if (np->phandle == handle) 742 break; 743 of_node_get(np); | 743 for (np = of_allnodes; np; np = np->allnext) 744 if (np->phandle == handle) 745 break; 746 of_node_get(np); |
744 raw_spin_unlock(&devtree_lock); | 747 raw_spin_unlock_irqrestore(&devtree_lock, flags); |
745 return np; 746} 747EXPORT_SYMBOL(of_find_node_by_phandle); 748 749/** 750 * of_find_property_value_of_size 751 * 752 * @np: device node from which the property value is to be read. --- 950 unchanged lines hidden --- | 748 return np; 749} 750EXPORT_SYMBOL(of_find_node_by_phandle); 751 752/** 753 * of_find_property_value_of_size 754 * 755 * @np: device node from which the property value is to be read. --- 950 unchanged lines hidden --- |