diff options
author | Rob Herring <robh@kernel.org> | 2014-04-02 00:49:03 -0400 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2014-04-30 01:59:15 -0400 |
commit | 9d0c4dfedd96ee54fc075b16d02f82499c8cc3a6 (patch) | |
tree | bb76a58e00f5aa436c51c1db9841e89ab102d004 /drivers/of/fdt.c | |
parent | bba04d965d06abbbe10afd3687742389107e198e (diff) |
of/fdt: update of_get_flat_dt_prop in prep for libfdt
Make of_get_flat_dt_prop arguments compatible with libfdt fdt_getprop
call in preparation to convert FDT code to use libfdt. Make the return
value const and the property length ptr type an int.
Signed-off-by: Rob Herring <robh@kernel.org>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Tested-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Stephen Chivers <schivers@csc.com>
Diffstat (limited to 'drivers/of/fdt.c')
-rw-r--r-- | drivers/of/fdt.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 9c8535291909..1d1582bb81fb 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -35,7 +35,7 @@ char *of_fdt_get_string(struct boot_param_header *blob, u32 offset) | |||
35 | */ | 35 | */ |
36 | void *of_fdt_get_property(struct boot_param_header *blob, | 36 | void *of_fdt_get_property(struct boot_param_header *blob, |
37 | unsigned long node, const char *name, | 37 | unsigned long node, const char *name, |
38 | unsigned long *size) | 38 | int *size) |
39 | { | 39 | { |
40 | unsigned long p = node; | 40 | unsigned long p = node; |
41 | 41 | ||
@@ -85,7 +85,8 @@ int of_fdt_is_compatible(struct boot_param_header *blob, | |||
85 | unsigned long node, const char *compat) | 85 | unsigned long node, const char *compat) |
86 | { | 86 | { |
87 | const char *cp; | 87 | const char *cp; |
88 | unsigned long cplen, l, score = 0; | 88 | int cplen; |
89 | unsigned long l, score = 0; | ||
89 | 90 | ||
90 | cp = of_fdt_get_property(blob, node, "compatible", &cplen); | 91 | cp = of_fdt_get_property(blob, node, "compatible", &cplen); |
91 | if (cp == NULL) | 92 | if (cp == NULL) |
@@ -444,8 +445,8 @@ static int __init __reserved_mem_reserve_reg(unsigned long node, | |||
444 | { | 445 | { |
445 | int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32); | 446 | int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32); |
446 | phys_addr_t base, size; | 447 | phys_addr_t base, size; |
447 | unsigned long len; | 448 | int len; |
448 | __be32 *prop; | 449 | const __be32 *prop; |
449 | int nomap, first = 1; | 450 | int nomap, first = 1; |
450 | 451 | ||
451 | prop = of_get_flat_dt_prop(node, "reg", &len); | 452 | prop = of_get_flat_dt_prop(node, "reg", &len); |
@@ -488,7 +489,7 @@ static int __init __reserved_mem_reserve_reg(unsigned long node, | |||
488 | */ | 489 | */ |
489 | static int __init __reserved_mem_check_root(unsigned long node) | 490 | static int __init __reserved_mem_check_root(unsigned long node) |
490 | { | 491 | { |
491 | __be32 *prop; | 492 | const __be32 *prop; |
492 | 493 | ||
493 | prop = of_get_flat_dt_prop(node, "#size-cells", NULL); | 494 | prop = of_get_flat_dt_prop(node, "#size-cells", NULL); |
494 | if (!prop || be32_to_cpup(prop) != dt_root_size_cells) | 495 | if (!prop || be32_to_cpup(prop) != dt_root_size_cells) |
@@ -638,8 +639,8 @@ unsigned long __init of_get_flat_dt_root(void) | |||
638 | * This function can be used within scan_flattened_dt callback to get | 639 | * This function can be used within scan_flattened_dt callback to get |
639 | * access to properties | 640 | * access to properties |
640 | */ | 641 | */ |
641 | void *__init of_get_flat_dt_prop(unsigned long node, const char *name, | 642 | const void *__init of_get_flat_dt_prop(unsigned long node, const char *name, |
642 | unsigned long *size) | 643 | int *size) |
643 | { | 644 | { |
644 | return of_fdt_get_property(initial_boot_params, node, name, size); | 645 | return of_fdt_get_property(initial_boot_params, node, name, size); |
645 | } | 646 | } |
@@ -710,7 +711,7 @@ const void * __init of_flat_dt_match_machine(const void *default_match, | |||
710 | } | 711 | } |
711 | if (!best_data) { | 712 | if (!best_data) { |
712 | const char *prop; | 713 | const char *prop; |
713 | long size; | 714 | int size; |
714 | 715 | ||
715 | pr_err("\n unrecognized device tree list:\n[ "); | 716 | pr_err("\n unrecognized device tree list:\n[ "); |
716 | 717 | ||
@@ -739,8 +740,8 @@ const void * __init of_flat_dt_match_machine(const void *default_match, | |||
739 | static void __init early_init_dt_check_for_initrd(unsigned long node) | 740 | static void __init early_init_dt_check_for_initrd(unsigned long node) |
740 | { | 741 | { |
741 | u64 start, end; | 742 | u64 start, end; |
742 | unsigned long len; | 743 | int len; |
743 | __be32 *prop; | 744 | const __be32 *prop; |
744 | 745 | ||
745 | pr_debug("Looking for initrd properties... "); | 746 | pr_debug("Looking for initrd properties... "); |
746 | 747 | ||
@@ -773,7 +774,7 @@ static inline void early_init_dt_check_for_initrd(unsigned long node) | |||
773 | int __init early_init_dt_scan_root(unsigned long node, const char *uname, | 774 | int __init early_init_dt_scan_root(unsigned long node, const char *uname, |
774 | int depth, void *data) | 775 | int depth, void *data) |
775 | { | 776 | { |
776 | __be32 *prop; | 777 | const __be32 *prop; |
777 | 778 | ||
778 | if (depth != 0) | 779 | if (depth != 0) |
779 | return 0; | 780 | return 0; |
@@ -795,9 +796,9 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname, | |||
795 | return 1; | 796 | return 1; |
796 | } | 797 | } |
797 | 798 | ||
798 | u64 __init dt_mem_next_cell(int s, __be32 **cellp) | 799 | u64 __init dt_mem_next_cell(int s, const __be32 **cellp) |
799 | { | 800 | { |
800 | __be32 *p = *cellp; | 801 | const __be32 *p = *cellp; |
801 | 802 | ||
802 | *cellp = p + s; | 803 | *cellp = p + s; |
803 | return of_read_number(p, s); | 804 | return of_read_number(p, s); |
@@ -809,9 +810,9 @@ u64 __init dt_mem_next_cell(int s, __be32 **cellp) | |||
809 | int __init early_init_dt_scan_memory(unsigned long node, const char *uname, | 810 | int __init early_init_dt_scan_memory(unsigned long node, const char *uname, |
810 | int depth, void *data) | 811 | int depth, void *data) |
811 | { | 812 | { |
812 | char *type = of_get_flat_dt_prop(node, "device_type", NULL); | 813 | const char *type = of_get_flat_dt_prop(node, "device_type", NULL); |
813 | __be32 *reg, *endp; | 814 | const __be32 *reg, *endp; |
814 | unsigned long l; | 815 | int l; |
815 | 816 | ||
816 | /* We are scanning "memory" nodes only */ | 817 | /* We are scanning "memory" nodes only */ |
817 | if (type == NULL) { | 818 | if (type == NULL) { |
@@ -832,7 +833,7 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, | |||
832 | 833 | ||
833 | endp = reg + (l / sizeof(__be32)); | 834 | endp = reg + (l / sizeof(__be32)); |
834 | 835 | ||
835 | pr_debug("memory scan node %s, reg size %ld, data: %x %x %x %x,\n", | 836 | pr_debug("memory scan node %s, reg size %d, data: %x %x %x %x,\n", |
836 | uname, l, reg[0], reg[1], reg[2], reg[3]); | 837 | uname, l, reg[0], reg[1], reg[2], reg[3]); |
837 | 838 | ||
838 | while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) { | 839 | while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) { |
@@ -855,8 +856,8 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, | |||
855 | int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, | 856 | int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, |
856 | int depth, void *data) | 857 | int depth, void *data) |
857 | { | 858 | { |
858 | unsigned long l; | 859 | int l; |
859 | char *p; | 860 | const char *p; |
860 | 861 | ||
861 | pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname); | 862 | pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname); |
862 | 863 | ||