diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2010-01-28 16:06:53 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-01-28 16:06:53 -0500 |
commit | 6016a363f6b56b46b24655bcfc0499b715851cf3 (patch) | |
tree | aaca35be4765ec7c7d847bed702c121bbd1b8a81 | |
parent | 923f7e30b480438f1e86e01e5cde814248b59a39 (diff) |
of: unify phandle name in struct device_node
In struct device_node, the phandle is named 'linux_phandle' for PowerPC
and MicroBlaze, and 'node' for SPARC. There is no good reason for the
difference, it is just an artifact of the code diverging over a couple
of years. This patch renames both to simply .phandle.
Note: the .node also existed in PowerPC/MicroBlaze, but the only user
seems to be arch/powerpc/platforms/powermac/pfunc_core.c. It doesn't
look like the assignment between .linux_phandle and .node is
significantly different enough to warrant the separate code paths
unless ibm,phandle properties actually appear in Apple device trees.
I think it is safe to eliminate the old .node property and use
phandle everywhere.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: David S. Miller <davem@davemloft.net>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/microblaze/kernel/of_platform.c | 2 | ||||
-rw-r--r-- | arch/microblaze/kernel/prom.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/of_platform.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom.c | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spu_manage.c | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/pfunc_core.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/devices.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/of_device_32.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/of_device_64.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/prom_common.c | 8 | ||||
-rw-r--r-- | arch/sparc/kernel/smp_64.c | 2 | ||||
-rw-r--r-- | drivers/of/fdt.c | 7 | ||||
-rw-r--r-- | drivers/sbus/char/openprom.c | 10 | ||||
-rw-r--r-- | drivers/video/aty/atyfb_base.c | 2 | ||||
-rw-r--r-- | include/linux/of.h | 5 | ||||
-rw-r--r-- | sound/aoa/fabrics/layout.c | 2 |
16 files changed, 29 insertions, 33 deletions
diff --git a/arch/microblaze/kernel/of_platform.c b/arch/microblaze/kernel/of_platform.c index acf4574d0f18..1c6d684996d7 100644 --- a/arch/microblaze/kernel/of_platform.c +++ b/arch/microblaze/kernel/of_platform.c | |||
@@ -185,7 +185,7 @@ EXPORT_SYMBOL(of_find_device_by_node); | |||
185 | static int of_dev_phandle_match(struct device *dev, void *data) | 185 | static int of_dev_phandle_match(struct device *dev, void *data) |
186 | { | 186 | { |
187 | phandle *ph = data; | 187 | phandle *ph = data; |
188 | return to_of_device(dev)->node->linux_phandle == *ph; | 188 | return to_of_device(dev)->node->phandle == *ph; |
189 | } | 189 | } |
190 | 190 | ||
191 | struct of_device *of_find_device_by_phandle(phandle ph) | 191 | struct of_device *of_find_device_by_phandle(phandle ph) |
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c index 46407e643926..6eff83a71218 100644 --- a/arch/microblaze/kernel/prom.c +++ b/arch/microblaze/kernel/prom.c | |||
@@ -342,7 +342,7 @@ struct device_node *of_find_node_by_phandle(phandle handle) | |||
342 | 342 | ||
343 | read_lock(&devtree_lock); | 343 | read_lock(&devtree_lock); |
344 | for (np = allnodes; np != NULL; np = np->allnext) | 344 | for (np = allnodes; np != NULL; np = np->allnext) |
345 | if (np->linux_phandle == handle) | 345 | if (np->phandle == handle) |
346 | break; | 346 | break; |
347 | of_node_get(np); | 347 | of_node_get(np); |
348 | read_unlock(&devtree_lock); | 348 | read_unlock(&devtree_lock); |
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c index 1a4fc0d11a03..666d08db319e 100644 --- a/arch/powerpc/kernel/of_platform.c +++ b/arch/powerpc/kernel/of_platform.c | |||
@@ -214,7 +214,7 @@ EXPORT_SYMBOL(of_find_device_by_node); | |||
214 | static int of_dev_phandle_match(struct device *dev, void *data) | 214 | static int of_dev_phandle_match(struct device *dev, void *data) |
215 | { | 215 | { |
216 | phandle *ph = data; | 216 | phandle *ph = data; |
217 | return to_of_device(dev)->node->linux_phandle == *ph; | 217 | return to_of_device(dev)->node->phandle == *ph; |
218 | } | 218 | } |
219 | 219 | ||
220 | struct of_device *of_find_device_by_phandle(phandle ph) | 220 | struct of_device *of_find_device_by_phandle(phandle ph) |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index deccd91d7e81..1ed2ec2ea05b 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -778,7 +778,7 @@ struct device_node *of_find_node_by_phandle(phandle handle) | |||
778 | 778 | ||
779 | read_lock(&devtree_lock); | 779 | read_lock(&devtree_lock); |
780 | for (np = allnodes; np != 0; np = np->allnext) | 780 | for (np = allnodes; np != 0; np = np->allnext) |
781 | if (np->linux_phandle == handle) | 781 | if (np->phandle == handle) |
782 | break; | 782 | break; |
783 | of_node_get(np); | 783 | of_node_get(np); |
784 | read_unlock(&devtree_lock); | 784 | read_unlock(&devtree_lock); |
@@ -907,9 +907,9 @@ static int of_finish_dynamic_node(struct device_node *node) | |||
907 | if (machine_is(powermac)) | 907 | if (machine_is(powermac)) |
908 | return -ENODEV; | 908 | return -ENODEV; |
909 | 909 | ||
910 | /* fix up new node's linux_phandle field */ | 910 | /* fix up new node's phandle field */ |
911 | if ((ibm_phandle = of_get_property(node, "ibm,phandle", NULL))) | 911 | if ((ibm_phandle = of_get_property(node, "ibm,phandle", NULL))) |
912 | node->linux_phandle = *ibm_phandle; | 912 | node->phandle = *ibm_phandle; |
913 | 913 | ||
914 | out: | 914 | out: |
915 | of_node_put(parent); | 915 | of_node_put(parent); |
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c index 4c506c1463cd..891f18e337a2 100644 --- a/arch/powerpc/platforms/cell/spu_manage.c +++ b/arch/powerpc/platforms/cell/spu_manage.c | |||
@@ -457,7 +457,7 @@ neighbour_spu(int cbe, struct device_node *target, struct device_node *avoid) | |||
457 | continue; | 457 | continue; |
458 | vic_handles = of_get_property(spu_dn, "vicinity", &lenp); | 458 | vic_handles = of_get_property(spu_dn, "vicinity", &lenp); |
459 | for (i=0; i < (lenp / sizeof(phandle)); i++) { | 459 | for (i=0; i < (lenp / sizeof(phandle)); i++) { |
460 | if (vic_handles[i] == target->linux_phandle) | 460 | if (vic_handles[i] == target->phandle) |
461 | return spu; | 461 | return spu; |
462 | } | 462 | } |
463 | } | 463 | } |
@@ -499,7 +499,7 @@ static void init_affinity_node(int cbe) | |||
499 | 499 | ||
500 | if (strcmp(name, "spe") == 0) { | 500 | if (strcmp(name, "spe") == 0) { |
501 | spu = devnode_spu(cbe, vic_dn); | 501 | spu = devnode_spu(cbe, vic_dn); |
502 | avoid_ph = last_spu_dn->linux_phandle; | 502 | avoid_ph = last_spu_dn->phandle; |
503 | } else { | 503 | } else { |
504 | /* | 504 | /* |
505 | * "mic-tm" and "bif0" nodes do not have | 505 | * "mic-tm" and "bif0" nodes do not have |
@@ -514,7 +514,7 @@ static void init_affinity_node(int cbe) | |||
514 | last_spu->has_mem_affinity = 1; | 514 | last_spu->has_mem_affinity = 1; |
515 | spu->has_mem_affinity = 1; | 515 | spu->has_mem_affinity = 1; |
516 | } | 516 | } |
517 | avoid_ph = vic_dn->linux_phandle; | 517 | avoid_ph = vic_dn->phandle; |
518 | } | 518 | } |
519 | 519 | ||
520 | list_add_tail(&spu->aff_list, &last_spu->aff_list); | 520 | list_add_tail(&spu->aff_list, &last_spu->aff_list); |
diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c b/arch/powerpc/platforms/powermac/pfunc_core.c index 96d5ce50364e..ede49e78a8da 100644 --- a/arch/powerpc/platforms/powermac/pfunc_core.c +++ b/arch/powerpc/platforms/powermac/pfunc_core.c | |||
@@ -842,7 +842,7 @@ struct pmf_function *__pmf_find_function(struct device_node *target, | |||
842 | list_for_each_entry(func, &dev->functions, link) { | 842 | list_for_each_entry(func, &dev->functions, link) { |
843 | if (name && strcmp(name, func->name)) | 843 | if (name && strcmp(name, func->name)) |
844 | continue; | 844 | continue; |
845 | if (func->phandle && target->node != func->phandle) | 845 | if (func->phandle && target->phandle != func->phandle) |
846 | continue; | 846 | continue; |
847 | if ((func->flags & flags) == 0) | 847 | if ((func->flags & flags) == 0) |
848 | continue; | 848 | continue; |
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c index b171ae8de90d..b062de9424a4 100644 --- a/arch/sparc/kernel/devices.c +++ b/arch/sparc/kernel/devices.c | |||
@@ -59,7 +59,7 @@ static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg, | |||
59 | 59 | ||
60 | cur_inst = 0; | 60 | cur_inst = 0; |
61 | for_each_node_by_type(dp, "cpu") { | 61 | for_each_node_by_type(dp, "cpu") { |
62 | int err = check_cpu_node(dp->node, &cur_inst, | 62 | int err = check_cpu_node(dp->phandle, &cur_inst, |
63 | compare, compare_arg, | 63 | compare, compare_arg, |
64 | prom_node, mid); | 64 | prom_node, mid); |
65 | if (!err) { | 65 | if (!err) { |
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c index 4c26eb59e742..09138d403c7f 100644 --- a/arch/sparc/kernel/of_device_32.c +++ b/arch/sparc/kernel/of_device_32.c | |||
@@ -433,7 +433,7 @@ build_resources: | |||
433 | if (!parent) | 433 | if (!parent) |
434 | dev_set_name(&op->dev, "root"); | 434 | dev_set_name(&op->dev, "root"); |
435 | else | 435 | else |
436 | dev_set_name(&op->dev, "%08x", dp->node); | 436 | dev_set_name(&op->dev, "%08x", dp->phandle); |
437 | 437 | ||
438 | if (of_device_register(op)) { | 438 | if (of_device_register(op)) { |
439 | printk("%s: Could not register of device.\n", | 439 | printk("%s: Could not register of device.\n", |
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c index 881947e59e95..036f18ae59a6 100644 --- a/arch/sparc/kernel/of_device_64.c +++ b/arch/sparc/kernel/of_device_64.c | |||
@@ -666,7 +666,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp, | |||
666 | if (!parent) | 666 | if (!parent) |
667 | dev_set_name(&op->dev, "root"); | 667 | dev_set_name(&op->dev, "root"); |
668 | else | 668 | else |
669 | dev_set_name(&op->dev, "%08x", dp->node); | 669 | dev_set_name(&op->dev, "%08x", dp->phandle); |
670 | 670 | ||
671 | if (of_device_register(op)) { | 671 | if (of_device_register(op)) { |
672 | printk("%s: Could not register of device.\n", | 672 | printk("%s: Could not register of device.\n", |
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index d80a65d9e893..5832e13dfeeb 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c | |||
@@ -42,7 +42,7 @@ struct device_node *of_find_node_by_phandle(phandle handle) | |||
42 | struct device_node *np; | 42 | struct device_node *np; |
43 | 43 | ||
44 | for (np = allnodes; np; np = np->allnext) | 44 | for (np = allnodes; np; np = np->allnext) |
45 | if (np->node == handle) | 45 | if (np->phandle == handle) |
46 | break; | 46 | break; |
47 | 47 | ||
48 | return np; | 48 | return np; |
@@ -89,7 +89,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len | |||
89 | void *old_val = prop->value; | 89 | void *old_val = prop->value; |
90 | int ret; | 90 | int ret; |
91 | 91 | ||
92 | ret = prom_setprop(dp->node, name, val, len); | 92 | ret = prom_setprop(dp->phandle, name, val, len); |
93 | 93 | ||
94 | err = -EINVAL; | 94 | err = -EINVAL; |
95 | if (ret >= 0) { | 95 | if (ret >= 0) { |
@@ -236,7 +236,7 @@ static struct device_node * __init prom_create_node(phandle node, | |||
236 | 236 | ||
237 | dp->name = get_one_property(node, "name"); | 237 | dp->name = get_one_property(node, "name"); |
238 | dp->type = get_one_property(node, "device_type"); | 238 | dp->type = get_one_property(node, "device_type"); |
239 | dp->node = node; | 239 | dp->phandle = node; |
240 | 240 | ||
241 | dp->properties = build_prop_list(node); | 241 | dp->properties = build_prop_list(node); |
242 | 242 | ||
@@ -313,7 +313,7 @@ void __init prom_build_devicetree(void) | |||
313 | 313 | ||
314 | nextp = &allnodes->allnext; | 314 | nextp = &allnodes->allnext; |
315 | allnodes->child = prom_build_tree(allnodes, | 315 | allnodes->child = prom_build_tree(allnodes, |
316 | prom_getchild(allnodes->node), | 316 | prom_getchild(allnodes->phandle), |
317 | &nextp); | 317 | &nextp); |
318 | of_console_init(); | 318 | of_console_init(); |
319 | 319 | ||
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index aa36223497b9..eb14844a0021 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c | |||
@@ -370,7 +370,7 @@ static int __cpuinit smp_boot_one_cpu(unsigned int cpu) | |||
370 | } else { | 370 | } else { |
371 | struct device_node *dp = of_find_node_by_cpuid(cpu); | 371 | struct device_node *dp = of_find_node_by_cpuid(cpu); |
372 | 372 | ||
373 | prom_startcpu(dp->node, entry, cookie); | 373 | prom_startcpu(dp->phandle, entry, cookie); |
374 | } | 374 | } |
375 | 375 | ||
376 | for (timeout = 0; timeout < 50000; timeout++) { | 376 | for (timeout = 0; timeout < 50000; timeout++) { |
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 616a4767a950..7f8861121a31 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -310,12 +310,11 @@ unsigned long __init unflatten_dt_node(unsigned long mem, | |||
310 | __alignof__(struct property)); | 310 | __alignof__(struct property)); |
311 | if (allnextpp) { | 311 | if (allnextpp) { |
312 | if (strcmp(pname, "linux,phandle") == 0) { | 312 | if (strcmp(pname, "linux,phandle") == 0) { |
313 | np->node = *((u32 *)*p); | 313 | if (np->phandle == 0) |
314 | if (np->linux_phandle == 0) | 314 | np->phandle = *((u32 *)*p); |
315 | np->linux_phandle = np->node; | ||
316 | } | 315 | } |
317 | if (strcmp(pname, "ibm,phandle") == 0) | 316 | if (strcmp(pname, "ibm,phandle") == 0) |
318 | np->linux_phandle = *((u32 *)*p); | 317 | np->phandle = *((u32 *)*p); |
319 | pp->name = pname; | 318 | pp->name = pname; |
320 | pp->length = sz; | 319 | pp->length = sz; |
321 | pp->value = (void *)*p; | 320 | pp->value = (void *)*p; |
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c index 75ac19b1192f..fc2f676e984d 100644 --- a/drivers/sbus/char/openprom.c +++ b/drivers/sbus/char/openprom.c | |||
@@ -233,7 +233,7 @@ static int opromnext(void __user *argp, unsigned int cmd, struct device_node *dp | |||
233 | 233 | ||
234 | ph = 0; | 234 | ph = 0; |
235 | if (dp) | 235 | if (dp) |
236 | ph = dp->node; | 236 | ph = dp->phandle; |
237 | 237 | ||
238 | data->current_node = dp; | 238 | data->current_node = dp; |
239 | *((int *) op->oprom_array) = ph; | 239 | *((int *) op->oprom_array) = ph; |
@@ -256,7 +256,7 @@ static int oprompci2node(void __user *argp, struct device_node *dp, struct openp | |||
256 | 256 | ||
257 | dp = pci_device_to_OF_node(pdev); | 257 | dp = pci_device_to_OF_node(pdev); |
258 | data->current_node = dp; | 258 | data->current_node = dp; |
259 | *((int *)op->oprom_array) = dp->node; | 259 | *((int *)op->oprom_array) = dp->phandle; |
260 | op->oprom_size = sizeof(int); | 260 | op->oprom_size = sizeof(int); |
261 | err = copyout(argp, op, bufsize + sizeof(int)); | 261 | err = copyout(argp, op, bufsize + sizeof(int)); |
262 | 262 | ||
@@ -273,7 +273,7 @@ static int oprompath2node(void __user *argp, struct device_node *dp, struct open | |||
273 | 273 | ||
274 | dp = of_find_node_by_path(op->oprom_array); | 274 | dp = of_find_node_by_path(op->oprom_array); |
275 | if (dp) | 275 | if (dp) |
276 | ph = dp->node; | 276 | ph = dp->phandle; |
277 | data->current_node = dp; | 277 | data->current_node = dp; |
278 | *((int *)op->oprom_array) = ph; | 278 | *((int *)op->oprom_array) = ph; |
279 | op->oprom_size = sizeof(int); | 279 | op->oprom_size = sizeof(int); |
@@ -540,7 +540,7 @@ static int opiocgetnext(unsigned int cmd, void __user *argp) | |||
540 | } | 540 | } |
541 | } | 541 | } |
542 | if (dp) | 542 | if (dp) |
543 | nd = dp->node; | 543 | nd = dp->phandle; |
544 | if (copy_to_user(argp, &nd, sizeof(phandle))) | 544 | if (copy_to_user(argp, &nd, sizeof(phandle))) |
545 | return -EFAULT; | 545 | return -EFAULT; |
546 | 546 | ||
@@ -570,7 +570,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file, | |||
570 | case OPIOCGETOPTNODE: | 570 | case OPIOCGETOPTNODE: |
571 | BUILD_BUG_ON(sizeof(phandle) != sizeof(int)); | 571 | BUILD_BUG_ON(sizeof(phandle) != sizeof(int)); |
572 | 572 | ||
573 | if (copy_to_user(argp, &options_node->node, sizeof(phandle))) | 573 | if (copy_to_user(argp, &options_node->phandle, sizeof(phandle))) |
574 | return -EFAULT; | 574 | return -EFAULT; |
575 | 575 | ||
576 | return 0; | 576 | return 0; |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 913b4a47ae52..bb20987d58af 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -3104,7 +3104,7 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev, | |||
3104 | } | 3104 | } |
3105 | 3105 | ||
3106 | dp = pci_device_to_OF_node(pdev); | 3106 | dp = pci_device_to_OF_node(pdev); |
3107 | if (node == dp->node) { | 3107 | if (node == dp->phandle) { |
3108 | struct fb_var_screeninfo *var = &default_var; | 3108 | struct fb_var_screeninfo *var = &default_var; |
3109 | unsigned int N, P, Q, M, T, R; | 3109 | unsigned int N, P, Q, M, T, R; |
3110 | u32 v_total, h_total; | 3110 | u32 v_total, h_total; |
diff --git a/include/linux/of.h b/include/linux/of.h index d4c014a35ea5..dbabf86e0b7a 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -39,10 +39,7 @@ struct of_irq_controller; | |||
39 | struct device_node { | 39 | struct device_node { |
40 | const char *name; | 40 | const char *name; |
41 | const char *type; | 41 | const char *type; |
42 | phandle node; | 42 | phandle phandle; |
43 | #if !defined(CONFIG_SPARC) | ||
44 | phandle linux_phandle; | ||
45 | #endif | ||
46 | char *full_name; | 43 | char *full_name; |
47 | 44 | ||
48 | struct property *properties; | 45 | struct property *properties; |
diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c index 586965f9605f..7a437da05646 100644 --- a/sound/aoa/fabrics/layout.c +++ b/sound/aoa/fabrics/layout.c | |||
@@ -768,7 +768,7 @@ static int check_codec(struct aoa_codec *codec, | |||
768 | "required property %s not present\n", propname); | 768 | "required property %s not present\n", propname); |
769 | return -ENODEV; | 769 | return -ENODEV; |
770 | } | 770 | } |
771 | if (*ref != codec->node->linux_phandle) { | 771 | if (*ref != codec->node->phandle) { |
772 | printk(KERN_INFO "snd-aoa-fabric-layout: " | 772 | printk(KERN_INFO "snd-aoa-fabric-layout: " |
773 | "%s doesn't match!\n", propname); | 773 | "%s doesn't match!\n", propname); |
774 | return -ENODEV; | 774 | return -ENODEV; |