Commit 9d0c4dfe authored by Rob Herring's avatar Rob Herring

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: default avatarRob Herring <robh@kernel.org>
Tested-by: default avatarMichal Simek <michal.simek@xilinx.com>
Tested-by: default avatarGrant Likely <grant.likely@linaro.org>
Tested-by: default avatarStephen Chivers <schivers@csc.com>
parent bba04d96
...@@ -42,7 +42,7 @@ const struct machine_desc * __init setup_machine_fdt(void *dt) ...@@ -42,7 +42,7 @@ const struct machine_desc * __init setup_machine_fdt(void *dt)
const struct machine_desc *mdesc; const struct machine_desc *mdesc;
unsigned long dt_root; unsigned long dt_root;
void *clk; void *clk;
unsigned long len; int len;
if (!early_init_dt_scan(dt)) if (!early_init_dt_scan(dt))
return NULL; return NULL;
......
...@@ -247,7 +247,7 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) ...@@ -247,7 +247,7 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
if (!mdesc) { if (!mdesc) {
const char *prop; const char *prop;
long size; int size;
unsigned long dt_root; unsigned long dt_root;
early_print("\nError: unrecognized/unsupported " early_print("\nError: unrecognized/unsupported "
......
...@@ -250,7 +250,7 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname, ...@@ -250,7 +250,7 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
{ {
struct map_desc iodesc; struct map_desc iodesc;
__be32 *reg; __be32 *reg;
unsigned long len; int len;
if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") && if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") &&
!of_flat_dt_is_compatible(node, "samsung,exynos5440-clock")) !of_flat_dt_is_compatible(node, "samsung,exynos5440-clock"))
......
...@@ -53,7 +53,7 @@ static int __init vexpress_dt_find_scu(unsigned long node, ...@@ -53,7 +53,7 @@ static int __init vexpress_dt_find_scu(unsigned long node,
{ {
if (of_flat_dt_match(node, vexpress_dt_cortex_a9_match)) { if (of_flat_dt_match(node, vexpress_dt_cortex_a9_match)) {
phys_addr_t phys_addr; phys_addr_t phys_addr;
__be32 *reg = of_get_flat_dt_prop(node, "reg", NULL); const __be32 *reg = of_get_flat_dt_prop(node, "reg", NULL);
if (WARN_ON(!reg)) if (WARN_ON(!reg))
return -EINVAL; return -EINVAL;
......
...@@ -125,8 +125,8 @@ device_initcall(s5p_mfc_memory_init); ...@@ -125,8 +125,8 @@ device_initcall(s5p_mfc_memory_init);
int __init s5p_fdt_alloc_mfc_mem(unsigned long node, const char *uname, int __init s5p_fdt_alloc_mfc_mem(unsigned long node, const char *uname,
int depth, void *data) int depth, void *data)
{ {
__be32 *prop; const __be32 *prop;
unsigned long len; int len;
struct s5p_mfc_dt_meminfo mfc_mem; struct s5p_mfc_dt_meminfo mfc_mem;
if (!data) if (!data)
......
...@@ -43,13 +43,13 @@ ...@@ -43,13 +43,13 @@
#include <asm/pci-bridge.h> #include <asm/pci-bridge.h>
#ifdef CONFIG_EARLY_PRINTK #ifdef CONFIG_EARLY_PRINTK
static char *stdout; static const char *stdout;
static int __init early_init_dt_scan_chosen_serial(unsigned long node, static int __init early_init_dt_scan_chosen_serial(unsigned long node,
const char *uname, int depth, void *data) const char *uname, int depth, void *data)
{ {
unsigned long l; int l;
char *p; const char *p;
pr_debug("%s: depth: %d, uname: %s\n", __func__, depth, uname); pr_debug("%s: depth: %d, uname: %s\n", __func__, depth, uname);
...@@ -80,7 +80,7 @@ static int __init early_init_dt_scan_chosen_serial(unsigned long node, ...@@ -80,7 +80,7 @@ static int __init early_init_dt_scan_chosen_serial(unsigned long node,
(strncmp(p, "xlnx,opb-uartlite", 17) == 0) || (strncmp(p, "xlnx,opb-uartlite", 17) == 0) ||
(strncmp(p, "xlnx,axi-uartlite", 17) == 0) || (strncmp(p, "xlnx,axi-uartlite", 17) == 0) ||
(strncmp(p, "xlnx,mdm", 8) == 0)) { (strncmp(p, "xlnx,mdm", 8) == 0)) {
unsigned int *addrp; const unsigned int *addrp;
*(u32 *)data = UARTLITE; *(u32 *)data = UARTLITE;
......
...@@ -36,7 +36,7 @@ static int __init early_init_dt_scan_epapr(unsigned long node, ...@@ -36,7 +36,7 @@ static int __init early_init_dt_scan_epapr(unsigned long node,
int depth, void *data) int depth, void *data)
{ {
const u32 *insts; const u32 *insts;
unsigned long len; int len;
int i; int i;
insts = of_get_flat_dt_prop(node, "hcall-instructions", &len); insts = of_get_flat_dt_prop(node, "hcall-instructions", &len);
......
...@@ -55,9 +55,9 @@ int crash_mem_ranges; ...@@ -55,9 +55,9 @@ int crash_mem_ranges;
int __init early_init_dt_scan_fw_dump(unsigned long node, int __init early_init_dt_scan_fw_dump(unsigned long node,
const char *uname, int depth, void *data) const char *uname, int depth, void *data)
{ {
__be32 *sections; const __be32 *sections;
int i, num_sections; int i, num_sections;
unsigned long size; int size;
const int *token; const int *token;
if (depth != 1 || strcmp(uname, "rtas") != 0) if (depth != 1 || strcmp(uname, "rtas") != 0)
......
...@@ -163,7 +163,7 @@ static struct ibm_pa_feature { ...@@ -163,7 +163,7 @@ static struct ibm_pa_feature {
{CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0}, {CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0},
}; };
static void __init scan_features(unsigned long node, unsigned char *ftrs, static void __init scan_features(unsigned long node, const unsigned char *ftrs,
unsigned long tablelen, unsigned long tablelen,
struct ibm_pa_feature *fp, struct ibm_pa_feature *fp,
unsigned long ft_size) unsigned long ft_size)
...@@ -202,8 +202,8 @@ static void __init scan_features(unsigned long node, unsigned char *ftrs, ...@@ -202,8 +202,8 @@ static void __init scan_features(unsigned long node, unsigned char *ftrs,
static void __init check_cpu_pa_features(unsigned long node) static void __init check_cpu_pa_features(unsigned long node)
{ {
unsigned char *pa_ftrs; const unsigned char *pa_ftrs;
unsigned long tablelen; int tablelen;
pa_ftrs = of_get_flat_dt_prop(node, "ibm,pa-features", &tablelen); pa_ftrs = of_get_flat_dt_prop(node, "ibm,pa-features", &tablelen);
if (pa_ftrs == NULL) if (pa_ftrs == NULL)
...@@ -216,7 +216,7 @@ static void __init check_cpu_pa_features(unsigned long node) ...@@ -216,7 +216,7 @@ static void __init check_cpu_pa_features(unsigned long node)
#ifdef CONFIG_PPC_STD_MMU_64 #ifdef CONFIG_PPC_STD_MMU_64
static void __init check_cpu_slb_size(unsigned long node) static void __init check_cpu_slb_size(unsigned long node)
{ {
__be32 *slb_size_ptr; const __be32 *slb_size_ptr;
slb_size_ptr = of_get_flat_dt_prop(node, "slb-size", NULL); slb_size_ptr = of_get_flat_dt_prop(node, "slb-size", NULL);
if (slb_size_ptr != NULL) { if (slb_size_ptr != NULL) {
...@@ -257,7 +257,7 @@ static struct feature_property { ...@@ -257,7 +257,7 @@ static struct feature_property {
static inline void identical_pvr_fixup(unsigned long node) static inline void identical_pvr_fixup(unsigned long node)
{ {
unsigned int pvr; unsigned int pvr;
char *model = of_get_flat_dt_prop(node, "model", NULL); const char *model = of_get_flat_dt_prop(node, "model", NULL);
/* /*
* Since 440GR(x)/440EP(x) processors have the same pvr, * Since 440GR(x)/440EP(x) processors have the same pvr,
...@@ -295,11 +295,11 @@ static int __init early_init_dt_scan_cpus(unsigned long node, ...@@ -295,11 +295,11 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
const char *uname, int depth, const char *uname, int depth,
void *data) void *data)
{ {
char *type = of_get_flat_dt_prop(node, "device_type", NULL); const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
const __be32 *prop; const __be32 *prop;
const __be32 *intserv; const __be32 *intserv;
int i, nthreads; int i, nthreads;
unsigned long len; int len;
int found = -1; int found = -1;
int found_thread = 0; int found_thread = 0;
...@@ -392,7 +392,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node, ...@@ -392,7 +392,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
int __init early_init_dt_scan_chosen_ppc(unsigned long node, const char *uname, int __init early_init_dt_scan_chosen_ppc(unsigned long node, const char *uname,
int depth, void *data) int depth, void *data)
{ {
unsigned long *lprop; /* All these set by kernel, so no need to convert endian */ const unsigned long *lprop; /* All these set by kernel, so no need to convert endian */
/* Use common scan routine to determine if this is the chosen node */ /* Use common scan routine to determine if this is the chosen node */
if (early_init_dt_scan_chosen(node, uname, depth, data) == 0) if (early_init_dt_scan_chosen(node, uname, depth, data) == 0)
...@@ -443,8 +443,9 @@ int __init early_init_dt_scan_chosen_ppc(unsigned long node, const char *uname, ...@@ -443,8 +443,9 @@ int __init early_init_dt_scan_chosen_ppc(unsigned long node, const char *uname,
*/ */
static int __init early_init_dt_scan_drconf_memory(unsigned long node) static int __init early_init_dt_scan_drconf_memory(unsigned long node)
{ {
__be32 *dm, *ls, *usm; const __be32 *dm, *ls, *usm;
unsigned long l, n, flags; int l;
unsigned long n, flags;
u64 base, size, memblock_size; u64 base, size, memblock_size;
unsigned int is_kexec_kdump = 0, rngs; unsigned int is_kexec_kdump = 0, rngs;
...@@ -564,7 +565,8 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size) ...@@ -564,7 +565,8 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
static void __init early_reserve_mem_dt(void) static void __init early_reserve_mem_dt(void)
{ {
unsigned long i, len, dt_root; unsigned long i, dt_root;
int len;
const __be32 *prop; const __be32 *prop;
early_init_fdt_scan_reserved_mem(); early_init_fdt_scan_reserved_mem();
......
...@@ -1142,7 +1142,7 @@ void __init rtas_initialize(void) ...@@ -1142,7 +1142,7 @@ void __init rtas_initialize(void)
int __init early_init_dt_scan_rtas(unsigned long node, int __init early_init_dt_scan_rtas(unsigned long node,
const char *uname, int depth, void *data) const char *uname, int depth, void *data)
{ {
u32 *basep, *entryp, *sizep; const u32 *basep, *entryp, *sizep;
if (depth != 1 || strcmp(uname, "rtas") != 0) if (depth != 1 || strcmp(uname, "rtas") != 0)
return 0; return 0;
......
...@@ -265,9 +265,9 @@ static int __init htab_dt_scan_seg_sizes(unsigned long node, ...@@ -265,9 +265,9 @@ static int __init htab_dt_scan_seg_sizes(unsigned long node,
const char *uname, int depth, const char *uname, int depth,
void *data) void *data)
{ {
char *type = of_get_flat_dt_prop(node, "device_type", NULL); const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
__be32 *prop; const __be32 *prop;
unsigned long size = 0; int size = 0;
/* We are scanning "cpu" nodes only */ /* We are scanning "cpu" nodes only */
if (type == NULL || strcmp(type, "cpu") != 0) if (type == NULL || strcmp(type, "cpu") != 0)
...@@ -320,9 +320,9 @@ static int __init htab_dt_scan_page_sizes(unsigned long node, ...@@ -320,9 +320,9 @@ static int __init htab_dt_scan_page_sizes(unsigned long node,
const char *uname, int depth, const char *uname, int depth,
void *data) void *data)
{ {
char *type = of_get_flat_dt_prop(node, "device_type", NULL); const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
__be32 *prop; const __be32 *prop;
unsigned long size = 0; int size = 0;
/* We are scanning "cpu" nodes only */ /* We are scanning "cpu" nodes only */
if (type == NULL || strcmp(type, "cpu") != 0) if (type == NULL || strcmp(type, "cpu") != 0)
...@@ -402,9 +402,9 @@ static int __init htab_dt_scan_page_sizes(unsigned long node, ...@@ -402,9 +402,9 @@ static int __init htab_dt_scan_page_sizes(unsigned long node,
static int __init htab_dt_scan_hugepage_blocks(unsigned long node, static int __init htab_dt_scan_hugepage_blocks(unsigned long node,
const char *uname, int depth, const char *uname, int depth,
void *data) { void *data) {
char *type = of_get_flat_dt_prop(node, "device_type", NULL); const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
__be64 *addr_prop; const __be64 *addr_prop;
__be32 *page_count_prop; const __be32 *page_count_prop;
unsigned int expected_pages; unsigned int expected_pages;
long unsigned int phys_addr; long unsigned int phys_addr;
long unsigned int block_size; long unsigned int block_size;
...@@ -546,8 +546,8 @@ static int __init htab_dt_scan_pftsize(unsigned long node, ...@@ -546,8 +546,8 @@ static int __init htab_dt_scan_pftsize(unsigned long node,
const char *uname, int depth, const char *uname, int depth,
void *data) void *data)
{ {
char *type = of_get_flat_dt_prop(node, "device_type", NULL); const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
__be32 *prop; const __be32 *prop;
/* We are scanning "cpu" nodes only */ /* We are scanning "cpu" nodes only */
if (type == NULL || strcmp(type, "cpu") != 0) if (type == NULL || strcmp(type, "cpu") != 0)
......
...@@ -199,8 +199,8 @@ static void __init efika_setup_arch(void) ...@@ -199,8 +199,8 @@ static void __init efika_setup_arch(void)
static int __init efika_probe(void) static int __init efika_probe(void)
{ {
char *model = of_get_flat_dt_prop(of_get_flat_dt_root(), const char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
"model", NULL); "model", NULL);
if (model == NULL) if (model == NULL)
return 0; return 0;
......
...@@ -574,8 +574,8 @@ chrp_init2(void) ...@@ -574,8 +574,8 @@ chrp_init2(void)
static int __init chrp_probe(void) static int __init chrp_probe(void)
{ {
char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(), const char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(),
"device_type", NULL); "device_type", NULL);
if (dtype == NULL) if (dtype == NULL)
return 0; return 0;
if (strcmp(dtype, "chrp")) if (strcmp(dtype, "chrp"))
......
...@@ -61,7 +61,7 @@ int __init early_init_dt_scan_opal(unsigned long node, ...@@ -61,7 +61,7 @@ int __init early_init_dt_scan_opal(unsigned long node,
const char *uname, int depth, void *data) const char *uname, int depth, void *data)
{ {
const void *basep, *entryp, *sizep; const void *basep, *entryp, *sizep;
unsigned long basesz, entrysz, runtimesz; int basesz, entrysz, runtimesz;
if (depth != 1 || strcmp(uname, "ibm,opal") != 0) if (depth != 1 || strcmp(uname, "ibm,opal") != 0)
return 0; return 0;
...@@ -77,11 +77,11 @@ int __init early_init_dt_scan_opal(unsigned long node, ...@@ -77,11 +77,11 @@ int __init early_init_dt_scan_opal(unsigned long node,
opal.entry = of_read_number(entryp, entrysz/4); opal.entry = of_read_number(entryp, entrysz/4);
opal.size = of_read_number(sizep, runtimesz/4); opal.size = of_read_number(sizep, runtimesz/4);
pr_debug("OPAL Base = 0x%llx (basep=%p basesz=%ld)\n", pr_debug("OPAL Base = 0x%llx (basep=%p basesz=%d)\n",
opal.base, basep, basesz); opal.base, basep, basesz);
pr_debug("OPAL Entry = 0x%llx (entryp=%p basesz=%ld)\n", pr_debug("OPAL Entry = 0x%llx (entryp=%p basesz=%d)\n",
opal.entry, entryp, entrysz); opal.entry, entryp, entrysz);
pr_debug("OPAL Entry = 0x%llx (sizep=%p runtimesz=%ld)\n", pr_debug("OPAL Entry = 0x%llx (sizep=%p runtimesz=%d)\n",
opal.size, sizep, runtimesz); opal.size, sizep, runtimesz);
powerpc_firmware_features |= FW_FEATURE_OPAL; powerpc_firmware_features |= FW_FEATURE_OPAL;
...@@ -102,7 +102,7 @@ int __init early_init_dt_scan_opal(unsigned long node, ...@@ -102,7 +102,7 @@ int __init early_init_dt_scan_opal(unsigned long node,
int __init early_init_dt_scan_recoverable_ranges(unsigned long node, int __init early_init_dt_scan_recoverable_ranges(unsigned long node,
const char *uname, int depth, void *data) const char *uname, int depth, void *data)
{ {
unsigned long i, psize, size; int i, psize, size;
const __be32 *prop; const __be32 *prop;
if (depth != 1 || strcmp(uname, "ibm,opal") != 0) if (depth != 1 || strcmp(uname, "ibm,opal") != 0)
...@@ -359,7 +359,7 @@ int opal_get_chars(uint32_t vtermno, char *buf, int count) ...@@ -359,7 +359,7 @@ int opal_get_chars(uint32_t vtermno, char *buf, int count)
if ((be64_to_cpu(evt) & OPAL_EVENT_CONSOLE_INPUT) == 0) if ((be64_to_cpu(evt) & OPAL_EVENT_CONSOLE_INPUT) == 0)
return 0; return 0;
len = cpu_to_be64(count); len = cpu_to_be64(count);
rc = opal_console_read(vtermno, &len, buf); rc = opal_console_read(vtermno, &len, buf);
if (rc == OPAL_SUCCESS) if (rc == OPAL_SUCCESS)
return be64_to_cpu(len); return be64_to_cpu(len);
return 0; return 0;
......
...@@ -665,7 +665,7 @@ static int __init pseries_probe_fw_features(unsigned long node, ...@@ -665,7 +665,7 @@ static int __init pseries_probe_fw_features(unsigned long node,
void *data) void *data)
{ {
const char *prop; const char *prop;
unsigned long len; int len;
static int hypertas_found; static int hypertas_found;
static int vec5_found; static int vec5_found;
...@@ -698,7 +698,7 @@ static int __init pseries_probe_fw_features(unsigned long node, ...@@ -698,7 +698,7 @@ static int __init pseries_probe_fw_features(unsigned long node,
static int __init pSeries_probe(void) static int __init pSeries_probe(void)
{ {
unsigned long root = of_get_flat_dt_root(); unsigned long root = of_get_flat_dt_root();
char *dtype = of_get_flat_dt_prop(root, "device_type", NULL); const char *dtype = of_get_flat_dt_prop(root, "device_type", NULL);
if (dtype == NULL) if (dtype == NULL)
return 0; return 0;
......
...@@ -220,7 +220,7 @@ static int __init xtensa_dt_io_area(unsigned long node, const char *uname, ...@@ -220,7 +220,7 @@ static int __init xtensa_dt_io_area(unsigned long node, const char *uname,
int depth, void *data) int depth, void *data)
{ {
const __be32 *ranges; const __be32 *ranges;
unsigned long len; int len;
if (depth > 1) if (depth > 1)
return 0; return 0;
......
...@@ -35,7 +35,7 @@ char *of_fdt_get_string(struct boot_param_header *blob, u32 offset) ...@@ -35,7 +35,7 @@ char *of_fdt_get_string(struct boot_param_header *blob, u32 offset)
*/ */
void *of_fdt_get_property(struct boot_param_header *blob, void *of_fdt_get_property(struct boot_param_header *blob,
unsigned long node, const char *name, unsigned long node, const char *name,
unsigned long *size) int *size)
{ {
unsigned long p = node; unsigned long p = node;
...@@ -85,7 +85,8 @@ int of_fdt_is_compatible(struct boot_param_header *blob, ...@@ -85,7 +85,8 @@ int of_fdt_is_compatible(struct boot_param_header *blob,
unsigned long node, const char *compat) unsigned long node, const char *compat)
{ {
const char *cp; const char *cp;
unsigned long cplen, l, score = 0; int cplen;
unsigned long l, score = 0;
cp = of_fdt_get_property(blob, node, "compatible", &cplen); cp = of_fdt_get_property(blob, node, "compatible", &cplen);
if (cp == NULL) if (cp == NULL)
...@@ -444,8 +445,8 @@ static int __init __reserved_mem_reserve_reg(unsigned long node, ...@@ -444,8 +445,8 @@ static int __init __reserved_mem_reserve_reg(unsigned long node,
{ {
int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32); int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32);
phys_addr_t base, size; phys_addr_t base, size;
unsigned long len; int len;
__be32 *prop; const __be32 *prop;
int nomap, first = 1; int nomap, first = 1;
prop = of_get_flat_dt_prop(node, "reg", &len); prop = of_get_flat_dt_prop(node, "reg", &len);
...@@ -488,7 +489,7 @@ static int __init __reserved_mem_reserve_reg(unsigned long node, ...@@ -488,7 +489,7 @@ static int __init __reserved_mem_reserve_reg(unsigned long node,
*/ */
static int __init __reserved_mem_check_root(unsigned long node) static int __init __reserved_mem_check_root(unsigned long node)
{ {
__be32 *prop; const __be32 *prop;
prop = of_get_flat_dt_prop(node, "#size-cells", NULL); prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
if (!prop || be32_to_cpup(prop) != dt_root_size_cells) if (!prop || be32_to_cpup(prop) != dt_root_size_cells)
...@@ -638,8 +639,8 @@ unsigned long __init of_get_flat_dt_root(void) ...@@ -638,8 +639,8 @@ unsigned long __init of_get_flat_dt_root(void)
* This function can be used within scan_flattened_dt callback to get * This function can be used within scan_flattened_dt callback to get
* access to properties * access to properties
*/ */
void *__init of_get_flat_dt_prop(unsigned long node, const char *name, const void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
unsigned long *size) int *size)
{ {
return of_fdt_get_property(initial_boot_params, node, name, size); return of_fdt_get_property(initial_boot_params, node, name, size);
} }
...@@ -710,7 +711,7 @@ const void * __init of_flat_dt_match_machine(const void *default_match, ...@@ -710,7 +711,7 @@ const void * __init of_flat_dt_match_machine(const void *default_match,
} }
if (!best_data) { if (!best_data) {
const char *prop; const char *prop;
long size; int size;
pr_err("\n unrecognized device tree list:\n[ "); pr_err("\n unrecognized device tree list:\n[ ");
...@@ -739,8 +740,8 @@ const void * __init of_flat_dt_match_machine(const void *default_match, ...@@ -739,8 +740,8 @@ const void * __init of_flat_dt_match_machine(const void *default_match,
static void __init early_init_dt_check_for_initrd(unsigned long node) static void __init early_init_dt_check_for_initrd(unsigned long node)
{ {
u64 start, end; u64 start, end;
unsigned long len; int len;
__be32 *prop; const __be32 *prop;
pr_debug("Looking for initrd properties... "); pr_debug("Looking for initrd properties... ");
...@@ -773,7 +774,7 @@ static inline void early_init_dt_check_for_initrd(unsigned long node) ...@@ -773,7 +774,7 @@ static inline void early_init_dt_check_for_initrd(unsigned long node)
int __init early_init_dt_scan_root(unsigned long node, const char *uname, int __init early_init_dt_scan_root(unsigned long node, const char *uname,
int depth, void *data) int depth, void *data)
{ {
__be32 *prop; const __be32 *prop;
if (depth != 0) if (depth != 0)
return 0; return 0;
...@@ -795,9 +796,9 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname, ...@@ -795,9 +796,9 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,
return 1; return 1;
} }
u64 __init dt_mem_next_cell(int s, __be32 **cellp) u64 __init dt_mem_next_cell(int s, const __be32 **cellp)
{ {
__be32 *p = *cellp; const __be32 *p = *cellp;
*cellp = p + s; *cellp = p + s;
return of_read_number(p, s); return of_read_number(p, s);
...@@ -809,9 +810,9 @@ u64 __init dt_mem_next_cell(int s, __be32 **cellp) ...@@ -809,9 +810,9 @@ u64 __init dt_mem_next_cell(int s, __be32 **cellp)
int __init early_init_dt_scan_memory(unsigned long node, const char *uname, int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
int depth, void *data) int depth, void *data)
{ {
char *type = of_get_flat_dt_prop(node, "device_type", NULL); const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
__be32 *reg, *endp; const __be32 *reg, *endp;
unsigned long l; int l;
/* We are scanning "memory" nodes only */ /* We are scanning "memory" nodes only */
if (type == NULL) { if (type == NULL) {
...@@ -832,7 +833,7 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, ...@@ -832,7 +833,7 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
endp = reg + (l / sizeof(__be32)); endp = reg + (l / sizeof(__be32));
pr_debug("memory scan node %s, reg size %ld, data: %x %x %x %x,\n", pr_debug("memory scan node %s, reg size %d, data: %x %x %x %x,\n",
uname, l, reg[0], reg[1], reg[2], reg[3]); uname, l, reg[0], reg[1], reg[2], reg[3]);
while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) { 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,8 +856,8 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
int depth, void *data) int depth, void *data)
{ {
unsigned long l; int l;
char *p; const char *p;
pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname); pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
......
...@@ -95,8 +95,8 @@ static int __init __reserved_mem_alloc_size(unsigned long node, ...@@ -95,8 +95,8 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32); int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32);
phys_addr_t start = 0, end = 0; phys_addr_t start = 0, end = 0;
phys_addr_t base = 0, align = 0, size; phys_addr_t base = 0, align = 0, size;
unsigned long len; int len;
__be32 *prop; const __be32 *prop;
int nomap; int nomap;
int ret; int ret;
......
...@@ -66,7 +66,7 @@ extern char *of_fdt_get_string(struct boot_param_header *blob, u32 offset); ...@@ -66,7 +66,7 @@ extern char *of_fdt_get_string(struct boot_param_header *blob, u32 offset);
extern void *of_fdt_get_property(struct boot_param_header *blob, extern void *of_fdt_get_property(struct boot_param_header *blob,
unsigned long node, unsigned long node,
const char *name, const char *name,
unsigned long *size); int *size);
extern int of_fdt_is_compatible(struct boot_param_header *blob, extern int of_fdt_is_compatible(struct boot_param_header *blob,
unsigned long node, unsigned long node,
const char *compat); const char *compat);
...@@ -88,8 +88,8 @@ extern char *find_flat_dt_string(u32 offset); ...@@ -88,8 +88,8 @@ extern char *find_flat_dt_string(u32 offset);
extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname, extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
int depth, void *data), int depth, void *data),
void *data); void *data);
extern void *of_get_flat_dt_prop(unsigned long node, const char *name, extern const void *of_get_flat_dt_prop(unsigned long node, const char *name,
unsigned long *size); int *size);
extern int of_flat_dt_is_compatible(unsigned long node, const char *name); extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
extern int of_flat_dt_match(unsigned long node, const char *const *matches); extern int of_flat_dt_match(unsigned long node, const char *const *matches);
extern unsigned long of_get_flat_dt_root(void); extern unsigned long of_get_flat_dt_root(void);
...@@ -103,7 +103,7 @@ extern void early_init_dt_add_memory_arch(u64 base, u64 size); ...@@ -103,7 +103,7 @@ extern void early_init_dt_add_memory_arch(u64 base, u64 size);
extern int early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size, extern int early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size,
bool no_map); bool no_map);
extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align); extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align);
extern u64 dt_mem_next_cell(int s, __be32 **cellp); extern u64 dt_mem_next_cell(int s, const __be32 **cellp);
/* Early flat tree scan hooks */ /* Early flat tree scan hooks */
extern int early_init_dt_scan_root(unsigned long node, const char *uname, extern int early_init_dt_scan_root(unsigned long node, const char *uname,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment