aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/prom.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/prom.c')
-rw-r--r--arch/powerpc/kernel/prom.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index a1787ffb6319..bf2005b2feb6 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -942,11 +942,11 @@ void __init early_init_devtree(void *params)
942int 942int
943prom_n_addr_cells(struct device_node* np) 943prom_n_addr_cells(struct device_node* np)
944{ 944{
945 int* ip; 945 const int *ip;
946 do { 946 do {
947 if (np->parent) 947 if (np->parent)
948 np = np->parent; 948 np = np->parent;
949 ip = (int *) get_property(np, "#address-cells", NULL); 949 ip = get_property(np, "#address-cells", NULL);
950 if (ip != NULL) 950 if (ip != NULL)
951 return *ip; 951 return *ip;
952 } while (np->parent); 952 } while (np->parent);
@@ -958,11 +958,11 @@ EXPORT_SYMBOL(prom_n_addr_cells);
958int 958int
959prom_n_size_cells(struct device_node* np) 959prom_n_size_cells(struct device_node* np)
960{ 960{
961 int* ip; 961 const int* ip;
962 do { 962 do {
963 if (np->parent) 963 if (np->parent)
964 np = np->parent; 964 np = np->parent;
965 ip = (int *) get_property(np, "#size-cells", NULL); 965 ip = get_property(np, "#size-cells", NULL);
966 if (ip != NULL) 966 if (ip != NULL)
967 return *ip; 967 return *ip;
968 } while (np->parent); 968 } while (np->parent);
@@ -1034,7 +1034,7 @@ int device_is_compatible(struct device_node *device, const char *compat)
1034 const char* cp; 1034 const char* cp;
1035 int cplen, l; 1035 int cplen, l;
1036 1036
1037 cp = (char *) get_property(device, "compatible", &cplen); 1037 cp = get_property(device, "compatible", &cplen);
1038 if (cp == NULL) 1038 if (cp == NULL)
1039 return 0; 1039 return 0;
1040 while (cplen > 0) { 1040 while (cplen > 0) {
@@ -1449,7 +1449,7 @@ static int of_finish_dynamic_node(struct device_node *node)
1449{ 1449{
1450 struct device_node *parent = of_get_parent(node); 1450 struct device_node *parent = of_get_parent(node);
1451 int err = 0; 1451 int err = 0;
1452 phandle *ibm_phandle; 1452 const phandle *ibm_phandle;
1453 1453
1454 node->name = get_property(node, "name", NULL); 1454 node->name = get_property(node, "name", NULL);
1455 node->type = get_property(node, "device_type", NULL); 1455 node->type = get_property(node, "device_type", NULL);
@@ -1466,8 +1466,7 @@ static int of_finish_dynamic_node(struct device_node *node)
1466 return -ENODEV; 1466 return -ENODEV;
1467 1467
1468 /* fix up new node's linux_phandle field */ 1468 /* fix up new node's linux_phandle field */
1469 if ((ibm_phandle = (unsigned int *)get_property(node, 1469 if ((ibm_phandle = get_property(node, "ibm,phandle", NULL)))
1470 "ibm,phandle", NULL)))
1471 node->linux_phandle = *ibm_phandle; 1470 node->linux_phandle = *ibm_phandle;
1472 1471
1473out: 1472out:
@@ -1528,7 +1527,7 @@ struct property *of_find_property(struct device_node *np, const char *name,
1528 * Find a property with a given name for a given node 1527 * Find a property with a given name for a given node
1529 * and return the value. 1528 * and return the value.
1530 */ 1529 */
1531void *get_property(struct device_node *np, const char *name, int *lenp) 1530const void *get_property(struct device_node *np, const char *name, int *lenp)
1532{ 1531{
1533 struct property *pp = of_find_property(np,name,lenp); 1532 struct property *pp = of_find_property(np,name,lenp);
1534 return pp ? pp->value : NULL; 1533 return pp ? pp->value : NULL;
@@ -1658,16 +1657,16 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
1658 hardid = get_hard_smp_processor_id(cpu); 1657 hardid = get_hard_smp_processor_id(cpu);
1659 1658
1660 for_each_node_by_type(np, "cpu") { 1659 for_each_node_by_type(np, "cpu") {
1661 u32 *intserv; 1660 const u32 *intserv;
1662 unsigned int plen, t; 1661 unsigned int plen, t;
1663 1662
1664 /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist 1663 /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist
1665 * fallback to "reg" property and assume no threads 1664 * fallback to "reg" property and assume no threads
1666 */ 1665 */
1667 intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s", 1666 intserv = get_property(np, "ibm,ppc-interrupt-server#s",
1668 &plen); 1667 &plen);
1669 if (intserv == NULL) { 1668 if (intserv == NULL) {
1670 u32 *reg = (u32 *)get_property(np, "reg", NULL); 1669 const u32 *reg = get_property(np, "reg", NULL);
1671 if (reg == NULL) 1670 if (reg == NULL)
1672 continue; 1671 continue;
1673 if (*reg == hardid) { 1672 if (*reg == hardid) {