diff options
Diffstat (limited to 'arch/powerpc/kernel/prom.c')
-rw-r--r-- | arch/powerpc/kernel/prom.c | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index a1787ffb6319..eb913f80bfb1 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -757,24 +757,9 @@ static int __init early_init_dt_scan_root(unsigned long node, | |||
757 | static unsigned long __init dt_mem_next_cell(int s, cell_t **cellp) | 757 | static unsigned long __init dt_mem_next_cell(int s, cell_t **cellp) |
758 | { | 758 | { |
759 | cell_t *p = *cellp; | 759 | cell_t *p = *cellp; |
760 | unsigned long r; | ||
761 | 760 | ||
762 | /* Ignore more than 2 cells */ | 761 | *cellp = p + s; |
763 | while (s > sizeof(unsigned long) / 4) { | 762 | return of_read_ulong(p, s); |
764 | p++; | ||
765 | s--; | ||
766 | } | ||
767 | r = *p++; | ||
768 | #ifdef CONFIG_PPC64 | ||
769 | if (s > 1) { | ||
770 | r <<= 32; | ||
771 | r |= *(p++); | ||
772 | s--; | ||
773 | } | ||
774 | #endif | ||
775 | |||
776 | *cellp = p; | ||
777 | return r; | ||
778 | } | 763 | } |
779 | 764 | ||
780 | 765 | ||
@@ -942,11 +927,11 @@ void __init early_init_devtree(void *params) | |||
942 | int | 927 | int |
943 | prom_n_addr_cells(struct device_node* np) | 928 | prom_n_addr_cells(struct device_node* np) |
944 | { | 929 | { |
945 | int* ip; | 930 | const int *ip; |
946 | do { | 931 | do { |
947 | if (np->parent) | 932 | if (np->parent) |
948 | np = np->parent; | 933 | np = np->parent; |
949 | ip = (int *) get_property(np, "#address-cells", NULL); | 934 | ip = get_property(np, "#address-cells", NULL); |
950 | if (ip != NULL) | 935 | if (ip != NULL) |
951 | return *ip; | 936 | return *ip; |
952 | } while (np->parent); | 937 | } while (np->parent); |
@@ -958,11 +943,11 @@ EXPORT_SYMBOL(prom_n_addr_cells); | |||
958 | int | 943 | int |
959 | prom_n_size_cells(struct device_node* np) | 944 | prom_n_size_cells(struct device_node* np) |
960 | { | 945 | { |
961 | int* ip; | 946 | const int* ip; |
962 | do { | 947 | do { |
963 | if (np->parent) | 948 | if (np->parent) |
964 | np = np->parent; | 949 | np = np->parent; |
965 | ip = (int *) get_property(np, "#size-cells", NULL); | 950 | ip = get_property(np, "#size-cells", NULL); |
966 | if (ip != NULL) | 951 | if (ip != NULL) |
967 | return *ip; | 952 | return *ip; |
968 | } while (np->parent); | 953 | } while (np->parent); |
@@ -1034,7 +1019,7 @@ int device_is_compatible(struct device_node *device, const char *compat) | |||
1034 | const char* cp; | 1019 | const char* cp; |
1035 | int cplen, l; | 1020 | int cplen, l; |
1036 | 1021 | ||
1037 | cp = (char *) get_property(device, "compatible", &cplen); | 1022 | cp = get_property(device, "compatible", &cplen); |
1038 | if (cp == NULL) | 1023 | if (cp == NULL) |
1039 | return 0; | 1024 | return 0; |
1040 | while (cplen > 0) { | 1025 | while (cplen > 0) { |
@@ -1449,7 +1434,7 @@ static int of_finish_dynamic_node(struct device_node *node) | |||
1449 | { | 1434 | { |
1450 | struct device_node *parent = of_get_parent(node); | 1435 | struct device_node *parent = of_get_parent(node); |
1451 | int err = 0; | 1436 | int err = 0; |
1452 | phandle *ibm_phandle; | 1437 | const phandle *ibm_phandle; |
1453 | 1438 | ||
1454 | node->name = get_property(node, "name", NULL); | 1439 | node->name = get_property(node, "name", NULL); |
1455 | node->type = get_property(node, "device_type", NULL); | 1440 | node->type = get_property(node, "device_type", NULL); |
@@ -1466,8 +1451,7 @@ static int of_finish_dynamic_node(struct device_node *node) | |||
1466 | return -ENODEV; | 1451 | return -ENODEV; |
1467 | 1452 | ||
1468 | /* fix up new node's linux_phandle field */ | 1453 | /* fix up new node's linux_phandle field */ |
1469 | if ((ibm_phandle = (unsigned int *)get_property(node, | 1454 | if ((ibm_phandle = get_property(node, "ibm,phandle", NULL))) |
1470 | "ibm,phandle", NULL))) | ||
1471 | node->linux_phandle = *ibm_phandle; | 1455 | node->linux_phandle = *ibm_phandle; |
1472 | 1456 | ||
1473 | out: | 1457 | out: |
@@ -1528,7 +1512,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 | 1512 | * Find a property with a given name for a given node |
1529 | * and return the value. | 1513 | * and return the value. |
1530 | */ | 1514 | */ |
1531 | void *get_property(struct device_node *np, const char *name, int *lenp) | 1515 | const void *get_property(struct device_node *np, const char *name, int *lenp) |
1532 | { | 1516 | { |
1533 | struct property *pp = of_find_property(np,name,lenp); | 1517 | struct property *pp = of_find_property(np,name,lenp); |
1534 | return pp ? pp->value : NULL; | 1518 | return pp ? pp->value : NULL; |
@@ -1658,16 +1642,16 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) | |||
1658 | hardid = get_hard_smp_processor_id(cpu); | 1642 | hardid = get_hard_smp_processor_id(cpu); |
1659 | 1643 | ||
1660 | for_each_node_by_type(np, "cpu") { | 1644 | for_each_node_by_type(np, "cpu") { |
1661 | u32 *intserv; | 1645 | const u32 *intserv; |
1662 | unsigned int plen, t; | 1646 | unsigned int plen, t; |
1663 | 1647 | ||
1664 | /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist | 1648 | /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist |
1665 | * fallback to "reg" property and assume no threads | 1649 | * fallback to "reg" property and assume no threads |
1666 | */ | 1650 | */ |
1667 | intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s", | 1651 | intserv = get_property(np, "ibm,ppc-interrupt-server#s", |
1668 | &plen); | 1652 | &plen); |
1669 | if (intserv == NULL) { | 1653 | if (intserv == NULL) { |
1670 | u32 *reg = (u32 *)get_property(np, "reg", NULL); | 1654 | const u32 *reg = get_property(np, "reg", NULL); |
1671 | if (reg == NULL) | 1655 | if (reg == NULL) |
1672 | continue; | 1656 | continue; |
1673 | if (*reg == hardid) { | 1657 | if (*reg == hardid) { |