diff options
| -rw-r--r-- | arch/powerpc/include/asm/prom.h | 3 | ||||
| -rw-r--r-- | arch/powerpc/kernel/prom.c | 31 | ||||
| -rw-r--r-- | drivers/of/base.c | 31 | ||||
| -rw-r--r-- | include/linux/of.h | 2 |
4 files changed, 33 insertions, 34 deletions
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h index 7d0c7f3a7171..bf09e5a065b8 100644 --- a/arch/powerpc/include/asm/prom.h +++ b/arch/powerpc/include/asm/prom.h | |||
| @@ -44,9 +44,6 @@ void of_parse_dma_window(struct device_node *dn, const __be32 *dma_window, | |||
| 44 | 44 | ||
| 45 | extern void kdump_move_device_tree(void); | 45 | extern void kdump_move_device_tree(void); |
| 46 | 46 | ||
| 47 | /* cache lookup */ | ||
| 48 | struct device_node *of_find_next_cache_node(struct device_node *np); | ||
| 49 | |||
| 50 | #ifdef CONFIG_NUMA | 47 | #ifdef CONFIG_NUMA |
| 51 | extern int of_node_to_nid(struct device_node *device); | 48 | extern int of_node_to_nid(struct device_node *device); |
| 52 | #else | 49 | #else |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 09be2759c314..4432fd86a6d2 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
| @@ -761,37 +761,6 @@ void __init early_init_devtree(void *params) | |||
| 761 | *******/ | 761 | *******/ |
| 762 | 762 | ||
| 763 | /** | 763 | /** |
| 764 | * of_find_next_cache_node - Find a node's subsidiary cache | ||
| 765 | * @np: node of type "cpu" or "cache" | ||
| 766 | * | ||
| 767 | * Returns a node pointer with refcount incremented, use | ||
| 768 | * of_node_put() on it when done. Caller should hold a reference | ||
| 769 | * to np. | ||
| 770 | */ | ||
| 771 | struct device_node *of_find_next_cache_node(struct device_node *np) | ||
| 772 | { | ||
| 773 | struct device_node *child; | ||
| 774 | const phandle *handle; | ||
| 775 | |||
| 776 | handle = of_get_property(np, "l2-cache", NULL); | ||
| 777 | if (!handle) | ||
| 778 | handle = of_get_property(np, "next-level-cache", NULL); | ||
| 779 | |||
| 780 | if (handle) | ||
| 781 | return of_find_node_by_phandle(be32_to_cpup(handle)); | ||
| 782 | |||
| 783 | /* OF on pmac has nodes instead of properties named "l2-cache" | ||
| 784 | * beneath CPU nodes. | ||
| 785 | */ | ||
| 786 | if (!strcmp(np->type, "cpu")) | ||
| 787 | for_each_child_of_node(np, child) | ||
| 788 | if (!strcmp(child->type, "cache")) | ||
| 789 | return child; | ||
| 790 | |||
| 791 | return NULL; | ||
| 792 | } | ||
| 793 | |||
| 794 | /** | ||
| 795 | * of_get_ibm_chip_id - Returns the IBM "chip-id" of a device | 764 | * of_get_ibm_chip_id - Returns the IBM "chip-id" of a device |
| 796 | * @np: device node of the device | 765 | * @np: device node of the device |
| 797 | * | 766 | * |
diff --git a/drivers/of/base.c b/drivers/of/base.c index 865d3f66c86b..b2cee3db5ceb 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
| @@ -1884,3 +1884,34 @@ int of_device_is_stdout_path(struct device_node *dn) | |||
| 1884 | return of_stdout == dn; | 1884 | return of_stdout == dn; |
| 1885 | } | 1885 | } |
| 1886 | EXPORT_SYMBOL_GPL(of_device_is_stdout_path); | 1886 | EXPORT_SYMBOL_GPL(of_device_is_stdout_path); |
| 1887 | |||
| 1888 | /** | ||
| 1889 | * of_find_next_cache_node - Find a node's subsidiary cache | ||
| 1890 | * @np: node of type "cpu" or "cache" | ||
| 1891 | * | ||
| 1892 | * Returns a node pointer with refcount incremented, use | ||
| 1893 | * of_node_put() on it when done. Caller should hold a reference | ||
| 1894 | * to np. | ||
| 1895 | */ | ||
| 1896 | struct device_node *of_find_next_cache_node(const struct device_node *np) | ||
| 1897 | { | ||
| 1898 | struct device_node *child; | ||
| 1899 | const phandle *handle; | ||
| 1900 | |||
| 1901 | handle = of_get_property(np, "l2-cache", NULL); | ||
| 1902 | if (!handle) | ||
| 1903 | handle = of_get_property(np, "next-level-cache", NULL); | ||
| 1904 | |||
| 1905 | if (handle) | ||
| 1906 | return of_find_node_by_phandle(be32_to_cpup(handle)); | ||
| 1907 | |||
| 1908 | /* OF on pmac has nodes instead of properties named "l2-cache" | ||
| 1909 | * beneath CPU nodes. | ||
| 1910 | */ | ||
| 1911 | if (!strcmp(np->type, "cpu")) | ||
| 1912 | for_each_child_of_node(np, child) | ||
| 1913 | if (!strcmp(child->type, "cache")) | ||
| 1914 | return child; | ||
| 1915 | |||
| 1916 | return NULL; | ||
| 1917 | } | ||
diff --git a/include/linux/of.h b/include/linux/of.h index f95aee391e30..c08c07e249b3 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
| @@ -226,6 +226,8 @@ static inline int of_get_child_count(const struct device_node *np) | |||
| 226 | return num; | 226 | return num; |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | /* cache lookup */ | ||
| 230 | extern struct device_node *of_find_next_cache_node(const struct device_node *); | ||
| 229 | extern struct device_node *of_find_node_with_property( | 231 | extern struct device_node *of_find_node_with_property( |
| 230 | struct device_node *from, const char *prop_name); | 232 | struct device_node *from, const char *prop_name); |
| 231 | #define for_each_node_with_property(dn, prop_name) \ | 233 | #define for_each_node_with_property(dn, prop_name) \ |
