aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/lparcfg.c6
-rw-r--r--arch/powerpc/kernel/pci_32.c17
-rw-r--r--arch/powerpc/kernel/prom.c14
-rw-r--r--arch/powerpc/kernel/rtas.c3
-rw-r--r--arch/powerpc/kernel/sysfs.c3
5 files changed, 20 insertions, 23 deletions
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index b8dc1eeb0169..fc1f7a949b2b 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -321,7 +321,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
321 struct device_node *rtas_node; 321 struct device_node *rtas_node;
322 const int *lrdrp = NULL; 322 const int *lrdrp = NULL;
323 323
324 rtas_node = find_path_device("/rtas"); 324 rtas_node = of_find_node_by_path("/rtas");
325 if (rtas_node) 325 if (rtas_node)
326 lrdrp = of_get_property(rtas_node, "ibm,lrdr-capacity", NULL); 326 lrdrp = of_get_property(rtas_node, "ibm,lrdr-capacity", NULL);
327 327
@@ -330,6 +330,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
330 } else { 330 } else {
331 partition_potential_processors = *(lrdrp + 4); 331 partition_potential_processors = *(lrdrp + 4);
332 } 332 }
333 of_node_put(rtas_node);
333 334
334 partition_active_processors = lparcfg_count_active_processors(); 335 partition_active_processors = lparcfg_count_active_processors();
335 336
@@ -537,7 +538,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
537 538
538 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS); 539 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
539 540
540 rootdn = find_path_device("/"); 541 rootdn = of_find_node_by_path("/");
541 if (rootdn) { 542 if (rootdn) {
542 tmp = of_get_property(rootdn, "model", NULL); 543 tmp = of_get_property(rootdn, "model", NULL);
543 if (tmp) { 544 if (tmp) {
@@ -557,6 +558,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
557 NULL); 558 NULL);
558 if (lp_index_ptr) 559 if (lp_index_ptr)
559 lp_index = *lp_index_ptr; 560 lp_index = *lp_index_ptr;
561 of_node_put(rootdn);
560 } 562 }
561 seq_printf(m, "serial_number=%s\n", system_id); 563 seq_printf(m, "serial_number=%s\n", system_id);
562 seq_printf(m, "system_type=%s\n", model); 564 seq_printf(m, "system_type=%s\n", model);
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index ae04f9418363..5b05a09a6bdf 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -669,6 +669,7 @@ pcibios_make_OF_bus_map(void)
669 int i; 669 int i;
670 struct pci_controller* hose; 670 struct pci_controller* hose;
671 struct property *map_prop; 671 struct property *map_prop;
672 struct device_node *dn;
672 673
673 pci_to_OF_bus_map = kmalloc(pci_bus_count, GFP_KERNEL); 674 pci_to_OF_bus_map = kmalloc(pci_bus_count, GFP_KERNEL);
674 if (!pci_to_OF_bus_map) { 675 if (!pci_to_OF_bus_map) {
@@ -690,12 +691,13 @@ pcibios_make_OF_bus_map(void)
690 continue; 691 continue;
691 make_one_node_map(node, hose->first_busno); 692 make_one_node_map(node, hose->first_busno);
692 } 693 }
693 map_prop = of_find_property(find_path_device("/"), 694 dn = of_find_node_by_path("/");
694 "pci-OF-bus-map", NULL); 695 map_prop = of_find_property(dn, "pci-OF-bus-map", NULL);
695 if (map_prop) { 696 if (map_prop) {
696 BUG_ON(pci_bus_count > map_prop->length); 697 BUG_ON(pci_bus_count > map_prop->length);
697 memcpy(map_prop->value, pci_to_OF_bus_map, pci_bus_count); 698 memcpy(map_prop->value, pci_to_OF_bus_map, pci_bus_count);
698 } 699 }
700 of_node_put(dn);
699#ifdef DEBUG 701#ifdef DEBUG
700 printk("PCI->OF bus map:\n"); 702 printk("PCI->OF bus map:\n");
701 for (i=0; i<pci_bus_count; i++) { 703 for (i=0; i<pci_bus_count; i++) {
@@ -1006,14 +1008,19 @@ void __init
1006pci_create_OF_bus_map(void) 1008pci_create_OF_bus_map(void)
1007{ 1009{
1008 struct property* of_prop; 1010 struct property* of_prop;
1009 1011 struct device_node *dn;
1012
1010 of_prop = (struct property*) alloc_bootmem(sizeof(struct property) + 256); 1013 of_prop = (struct property*) alloc_bootmem(sizeof(struct property) + 256);
1011 if (of_prop && find_path_device("/")) { 1014 if (!of_prop)
1015 return;
1016 dn = of_find_node_by_path("/");
1017 if (dn) {
1012 memset(of_prop, -1, sizeof(struct property) + 256); 1018 memset(of_prop, -1, sizeof(struct property) + 256);
1013 of_prop->name = "pci-OF-bus-map"; 1019 of_prop->name = "pci-OF-bus-map";
1014 of_prop->length = 256; 1020 of_prop->length = 256;
1015 of_prop->value = &of_prop[1]; 1021 of_prop->value = &of_prop[1];
1016 prom_add_property(find_path_device("/"), of_prop); 1022 prom_add_property(dn, of_prop);
1023 of_node_put(dn);
1017 } 1024 }
1018} 1025}
1019 1026
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 911ec77a42d2..17c41fefecf2 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1153,20 +1153,6 @@ int machine_is_compatible(const char *compat)
1153} 1153}
1154EXPORT_SYMBOL(machine_is_compatible); 1154EXPORT_SYMBOL(machine_is_compatible);
1155 1155
1156/**
1157 * Find the device_node with a given full_name.
1158 */
1159struct device_node *find_path_device(const char *path)
1160{
1161 struct device_node *np;
1162
1163 for (np = allnodes; np != 0; np = np->allnext)
1164 if (np->full_name != 0 && strcasecmp(np->full_name, path) == 0)
1165 return np;
1166 return NULL;
1167}
1168EXPORT_SYMBOL(find_path_device);
1169
1170/******* 1156/*******
1171 * 1157 *
1172 * New implementation of the OF "find" APIs, return a refcounted 1158 * New implementation of the OF "find" APIs, return a refcounted
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 702fecc93204..214780798289 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -192,7 +192,7 @@ void rtas_progress(char *s, unsigned short hex)
192 192
193 if (display_width == 0) { 193 if (display_width == 0) {
194 display_width = 0x10; 194 display_width = 0x10;
195 if ((root = find_path_device("/rtas"))) { 195 if ((root = of_find_node_by_path("/rtas"))) {
196 if ((p = of_get_property(root, 196 if ((p = of_get_property(root,
197 "ibm,display-line-length", NULL))) 197 "ibm,display-line-length", NULL)))
198 display_width = *p; 198 display_width = *p;
@@ -204,6 +204,7 @@ void rtas_progress(char *s, unsigned short hex)
204 display_lines = *p; 204 display_lines = *p;
205 row_width = of_get_property(root, 205 row_width = of_get_property(root,
206 "ibm,display-truncation-length", NULL); 206 "ibm,display-truncation-length", NULL);
207 of_node_put(root);
207 } 208 }
208 display_character = rtas_token("display-character"); 209 display_character = rtas_token("display-character");
209 set_indicator = rtas_token("set-indicator"); 210 set_indicator = rtas_token("set-indicator");
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 6fc27e771b5a..933e214c33e8 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -66,7 +66,7 @@ static int __init smt_setup(void)
66 if (!cpu_has_feature(CPU_FTR_SMT)) 66 if (!cpu_has_feature(CPU_FTR_SMT))
67 return -ENODEV; 67 return -ENODEV;
68 68
69 options = find_path_device("/options"); 69 options = of_find_node_by_path("/options");
70 if (!options) 70 if (!options)
71 return -ENODEV; 71 return -ENODEV;
72 72
@@ -76,6 +76,7 @@ static int __init smt_setup(void)
76 per_cpu(smt_snooze_delay, cpu) = *val; 76 per_cpu(smt_snooze_delay, cpu) = *val;
77 } 77 }
78 78
79 of_node_put(options);
79 return 0; 80 return 0;
80} 81}
81__initcall(smt_setup); 82__initcall(smt_setup);