aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2014-04-02 00:49:03 -0400
committerRob Herring <robh@kernel.org>2014-04-30 01:59:15 -0400
commit9d0c4dfedd96ee54fc075b16d02f82499c8cc3a6 (patch)
treebb76a58e00f5aa436c51c1db9841e89ab102d004
parentbba04d965d06abbbe10afd3687742389107e198e (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>
-rw-r--r--arch/arc/kernel/devtree.c2
-rw-r--r--arch/arm/kernel/devtree.c2
-rw-r--r--arch/arm/mach-exynos/exynos.c2
-rw-r--r--arch/arm/mach-vexpress/platsmp.c2
-rw-r--r--arch/arm/plat-samsung/s5p-dev-mfc.c4
-rw-r--r--arch/microblaze/kernel/prom.c8
-rw-r--r--arch/powerpc/kernel/epapr_paravirt.c2
-rw-r--r--arch/powerpc/kernel/fadump.c4
-rw-r--r--arch/powerpc/kernel/prom.c24
-rw-r--r--arch/powerpc/kernel/rtas.c2
-rw-r--r--arch/powerpc/mm/hash_utils_64.c22
-rw-r--r--arch/powerpc/platforms/52xx/efika.c4
-rw-r--r--arch/powerpc/platforms/chrp/setup.c4
-rw-r--r--arch/powerpc/platforms/powernv/opal.c12
-rw-r--r--arch/powerpc/platforms/pseries/setup.c4
-rw-r--r--arch/xtensa/kernel/setup.c2
-rw-r--r--drivers/of/fdt.c39
-rw-r--r--drivers/of/of_reserved_mem.c4
-rw-r--r--include/linux/of_fdt.h8
19 files changed, 77 insertions, 74 deletions
diff --git a/arch/arc/kernel/devtree.c b/arch/arc/kernel/devtree.c
index b6dc4e21fd32..0b3ef4025d89 100644
--- a/arch/arc/kernel/devtree.c
+++ b/arch/arc/kernel/devtree.c
@@ -42,7 +42,7 @@ const struct machine_desc * __init setup_machine_fdt(void *dt)
42 const struct machine_desc *mdesc; 42 const struct machine_desc *mdesc;
43 unsigned long dt_root; 43 unsigned long dt_root;
44 void *clk; 44 void *clk;
45 unsigned long len; 45 int len;
46 46
47 if (!early_init_dt_scan(dt)) 47 if (!early_init_dt_scan(dt))
48 return NULL; 48 return NULL;
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index dff9cc0e9bd6..38f4711b4995 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -247,7 +247,7 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
247 247
248 if (!mdesc) { 248 if (!mdesc) {
249 const char *prop; 249 const char *prop;
250 long size; 250 int size;
251 unsigned long dt_root; 251 unsigned long dt_root;
252 252
253 early_print("\nError: unrecognized/unsupported " 253 early_print("\nError: unrecognized/unsupported "
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index b32a907d021d..77293d39dfc9 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -250,7 +250,7 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
250{ 250{
251 struct map_desc iodesc; 251 struct map_desc iodesc;
252 __be32 *reg; 252 __be32 *reg;
253 unsigned long len; 253 int len;
254 254
255 if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") && 255 if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") &&
256 !of_flat_dt_is_compatible(node, "samsung,exynos5440-clock")) 256 !of_flat_dt_is_compatible(node, "samsung,exynos5440-clock"))
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index 993c9ae5dc5e..b4a5f0d8390d 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -53,7 +53,7 @@ static int __init vexpress_dt_find_scu(unsigned long node,
53{ 53{
54 if (of_flat_dt_match(node, vexpress_dt_cortex_a9_match)) { 54 if (of_flat_dt_match(node, vexpress_dt_cortex_a9_match)) {
55 phys_addr_t phys_addr; 55 phys_addr_t phys_addr;
56 __be32 *reg = of_get_flat_dt_prop(node, "reg", NULL); 56 const __be32 *reg = of_get_flat_dt_prop(node, "reg", NULL);
57 57
58 if (WARN_ON(!reg)) 58 if (WARN_ON(!reg))
59 return -EINVAL; 59 return -EINVAL;
diff --git a/arch/arm/plat-samsung/s5p-dev-mfc.c b/arch/arm/plat-samsung/s5p-dev-mfc.c
index 98087b655df0..469b86260fe3 100644
--- a/arch/arm/plat-samsung/s5p-dev-mfc.c
+++ b/arch/arm/plat-samsung/s5p-dev-mfc.c
@@ -125,8 +125,8 @@ device_initcall(s5p_mfc_memory_init);
125int __init s5p_fdt_alloc_mfc_mem(unsigned long node, const char *uname, 125int __init s5p_fdt_alloc_mfc_mem(unsigned long node, const char *uname,
126 int depth, void *data) 126 int depth, void *data)
127{ 127{
128 __be32 *prop; 128 const __be32 *prop;
129 unsigned long len; 129 int len;
130 struct s5p_mfc_dt_meminfo mfc_mem; 130 struct s5p_mfc_dt_meminfo mfc_mem;
131 131
132 if (!data) 132 if (!data)
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index abdfb10e7eca..c76630603058 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -43,13 +43,13 @@
43#include <asm/pci-bridge.h> 43#include <asm/pci-bridge.h>
44 44
45#ifdef CONFIG_EARLY_PRINTK 45#ifdef CONFIG_EARLY_PRINTK
46static char *stdout; 46static const char *stdout;
47 47
48static int __init early_init_dt_scan_chosen_serial(unsigned long node, 48static int __init early_init_dt_scan_chosen_serial(unsigned long node,
49 const char *uname, int depth, void *data) 49 const char *uname, int depth, void *data)
50{ 50{
51 unsigned long l; 51 int l;
52 char *p; 52 const char *p;
53 53
54 pr_debug("%s: depth: %d, uname: %s\n", __func__, depth, uname); 54 pr_debug("%s: depth: %d, uname: %s\n", __func__, depth, uname);
55 55
@@ -80,7 +80,7 @@ static int __init early_init_dt_scan_chosen_serial(unsigned long node,
80 (strncmp(p, "xlnx,opb-uartlite", 17) == 0) || 80 (strncmp(p, "xlnx,opb-uartlite", 17) == 0) ||
81 (strncmp(p, "xlnx,axi-uartlite", 17) == 0) || 81 (strncmp(p, "xlnx,axi-uartlite", 17) == 0) ||
82 (strncmp(p, "xlnx,mdm", 8) == 0)) { 82 (strncmp(p, "xlnx,mdm", 8) == 0)) {
83 unsigned int *addrp; 83 const unsigned int *addrp;
84 84
85 *(u32 *)data = UARTLITE; 85 *(u32 *)data = UARTLITE;
86 86
diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
index 7898be90f2dc..d64e92b22dd8 100644
--- a/arch/powerpc/kernel/epapr_paravirt.c
+++ b/arch/powerpc/kernel/epapr_paravirt.c
@@ -36,7 +36,7 @@ static int __init early_init_dt_scan_epapr(unsigned long node,
36 int depth, void *data) 36 int depth, void *data)
37{ 37{
38 const u32 *insts; 38 const u32 *insts;
39 unsigned long len; 39 int len;
40 int i; 40 int i;
41 41
42 insts = of_get_flat_dt_prop(node, "hcall-instructions", &len); 42 insts = of_get_flat_dt_prop(node, "hcall-instructions", &len);
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 2230fd0ca3e4..7213d930918d 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -55,9 +55,9 @@ int crash_mem_ranges;
55int __init early_init_dt_scan_fw_dump(unsigned long node, 55int __init early_init_dt_scan_fw_dump(unsigned long node,
56 const char *uname, int depth, void *data) 56 const char *uname, int depth, void *data)
57{ 57{
58 __be32 *sections; 58 const __be32 *sections;
59 int i, num_sections; 59 int i, num_sections;
60 unsigned long size; 60 int size;
61 const int *token; 61 const int *token;
62 62
63 if (depth != 1 || strcmp(uname, "rtas") != 0) 63 if (depth != 1 || strcmp(uname, "rtas") != 0)
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index d65754935652..483273e5c3e0 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -163,7 +163,7 @@ static struct ibm_pa_feature {
163 {CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0}, 163 {CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0},
164}; 164};
165 165
166static void __init scan_features(unsigned long node, unsigned char *ftrs, 166static void __init scan_features(unsigned long node, const unsigned char *ftrs,
167 unsigned long tablelen, 167 unsigned long tablelen,
168 struct ibm_pa_feature *fp, 168 struct ibm_pa_feature *fp,
169 unsigned long ft_size) 169 unsigned long ft_size)
@@ -202,8 +202,8 @@ static void __init scan_features(unsigned long node, unsigned char *ftrs,
202 202
203static void __init check_cpu_pa_features(unsigned long node) 203static void __init check_cpu_pa_features(unsigned long node)
204{ 204{
205 unsigned char *pa_ftrs; 205 const unsigned char *pa_ftrs;
206 unsigned long tablelen; 206 int tablelen;
207 207
208 pa_ftrs = of_get_flat_dt_prop(node, "ibm,pa-features", &tablelen); 208 pa_ftrs = of_get_flat_dt_prop(node, "ibm,pa-features", &tablelen);
209 if (pa_ftrs == NULL) 209 if (pa_ftrs == NULL)
@@ -216,7 +216,7 @@ static void __init check_cpu_pa_features(unsigned long node)
216#ifdef CONFIG_PPC_STD_MMU_64 216#ifdef CONFIG_PPC_STD_MMU_64
217static void __init check_cpu_slb_size(unsigned long node) 217static void __init check_cpu_slb_size(unsigned long node)
218{ 218{
219 __be32 *slb_size_ptr; 219 const __be32 *slb_size_ptr;
220 220
221 slb_size_ptr = of_get_flat_dt_prop(node, "slb-size", NULL); 221 slb_size_ptr = of_get_flat_dt_prop(node, "slb-size", NULL);
222 if (slb_size_ptr != NULL) { 222 if (slb_size_ptr != NULL) {
@@ -257,7 +257,7 @@ static struct feature_property {
257static inline void identical_pvr_fixup(unsigned long node) 257static inline void identical_pvr_fixup(unsigned long node)
258{ 258{
259 unsigned int pvr; 259 unsigned int pvr;
260 char *model = of_get_flat_dt_prop(node, "model", NULL); 260 const char *model = of_get_flat_dt_prop(node, "model", NULL);
261 261
262 /* 262 /*
263 * Since 440GR(x)/440EP(x) processors have the same pvr, 263 * 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 const char *uname, int depth, 295 const char *uname, int depth,
296 void *data) 296 void *data)
297{ 297{
298 char *type = of_get_flat_dt_prop(node, "device_type", NULL); 298 const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
299 const __be32 *prop; 299 const __be32 *prop;
300 const __be32 *intserv; 300 const __be32 *intserv;
301 int i, nthreads; 301 int i, nthreads;
302 unsigned long len; 302 int len;
303 int found = -1; 303 int found = -1;
304 int found_thread = 0; 304 int found_thread = 0;
305 305
@@ -392,7 +392,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
392int __init early_init_dt_scan_chosen_ppc(unsigned long node, const char *uname, 392int __init early_init_dt_scan_chosen_ppc(unsigned long node, const char *uname,
393 int depth, void *data) 393 int depth, void *data)
394{ 394{
395 unsigned long *lprop; /* All these set by kernel, so no need to convert endian */ 395 const unsigned long *lprop; /* All these set by kernel, so no need to convert endian */
396 396
397 /* Use common scan routine to determine if this is the chosen node */ 397 /* Use common scan routine to determine if this is the chosen node */
398 if (early_init_dt_scan_chosen(node, uname, depth, data) == 0) 398 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 */ 443 */
444static int __init early_init_dt_scan_drconf_memory(unsigned long node) 444static int __init early_init_dt_scan_drconf_memory(unsigned long node)
445{ 445{
446 __be32 *dm, *ls, *usm; 446 const __be32 *dm, *ls, *usm;
447 unsigned long l, n, flags; 447 int l;
448 unsigned long n, flags;
448 u64 base, size, memblock_size; 449 u64 base, size, memblock_size;
449 unsigned int is_kexec_kdump = 0, rngs; 450 unsigned int is_kexec_kdump = 0, rngs;
450 451
@@ -564,7 +565,8 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
564 565
565static void __init early_reserve_mem_dt(void) 566static void __init early_reserve_mem_dt(void)
566{ 567{
567 unsigned long i, len, dt_root; 568 unsigned long i, dt_root;
569 int len;
568 const __be32 *prop; 570 const __be32 *prop;
569 571
570 early_init_fdt_scan_reserved_mem(); 572 early_init_fdt_scan_reserved_mem();
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 8cd5ed049b5d..8b4c857c1421 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -1142,7 +1142,7 @@ void __init rtas_initialize(void)
1142int __init early_init_dt_scan_rtas(unsigned long node, 1142int __init early_init_dt_scan_rtas(unsigned long node,
1143 const char *uname, int depth, void *data) 1143 const char *uname, int depth, void *data)
1144{ 1144{
1145 u32 *basep, *entryp, *sizep; 1145 const u32 *basep, *entryp, *sizep;
1146 1146
1147 if (depth != 1 || strcmp(uname, "rtas") != 0) 1147 if (depth != 1 || strcmp(uname, "rtas") != 0)
1148 return 0; 1148 return 0;
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index d766d6ee33fe..59cc19a23a7a 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -265,9 +265,9 @@ static int __init htab_dt_scan_seg_sizes(unsigned long node,
265 const char *uname, int depth, 265 const char *uname, int depth,
266 void *data) 266 void *data)
267{ 267{
268 char *type = of_get_flat_dt_prop(node, "device_type", NULL); 268 const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
269 __be32 *prop; 269 const __be32 *prop;
270 unsigned long size = 0; 270 int size = 0;
271 271
272 /* We are scanning "cpu" nodes only */ 272 /* We are scanning "cpu" nodes only */
273 if (type == NULL || strcmp(type, "cpu") != 0) 273 if (type == NULL || strcmp(type, "cpu") != 0)
@@ -320,9 +320,9 @@ static int __init htab_dt_scan_page_sizes(unsigned long node,
320 const char *uname, int depth, 320 const char *uname, int depth,
321 void *data) 321 void *data)
322{ 322{
323 char *type = of_get_flat_dt_prop(node, "device_type", NULL); 323 const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
324 __be32 *prop; 324 const __be32 *prop;
325 unsigned long size = 0; 325 int size = 0;
326 326
327 /* We are scanning "cpu" nodes only */ 327 /* We are scanning "cpu" nodes only */
328 if (type == NULL || strcmp(type, "cpu") != 0) 328 if (type == NULL || strcmp(type, "cpu") != 0)
@@ -402,9 +402,9 @@ static int __init htab_dt_scan_page_sizes(unsigned long node,
402static int __init htab_dt_scan_hugepage_blocks(unsigned long node, 402static int __init htab_dt_scan_hugepage_blocks(unsigned long node,
403 const char *uname, int depth, 403 const char *uname, int depth,
404 void *data) { 404 void *data) {
405 char *type = of_get_flat_dt_prop(node, "device_type", NULL); 405 const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
406 __be64 *addr_prop; 406 const __be64 *addr_prop;
407 __be32 *page_count_prop; 407 const __be32 *page_count_prop;
408 unsigned int expected_pages; 408 unsigned int expected_pages;
409 long unsigned int phys_addr; 409 long unsigned int phys_addr;
410 long unsigned int block_size; 410 long unsigned int block_size;
@@ -546,8 +546,8 @@ static int __init htab_dt_scan_pftsize(unsigned long node,
546 const char *uname, int depth, 546 const char *uname, int depth,
547 void *data) 547 void *data)
548{ 548{
549 char *type = of_get_flat_dt_prop(node, "device_type", NULL); 549 const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
550 __be32 *prop; 550 const __be32 *prop;
551 551
552 /* We are scanning "cpu" nodes only */ 552 /* We are scanning "cpu" nodes only */
553 if (type == NULL || strcmp(type, "cpu") != 0) 553 if (type == NULL || strcmp(type, "cpu") != 0)
diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c
index 18c104820198..6e19b0ad5d26 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -199,8 +199,8 @@ static void __init efika_setup_arch(void)
199 199
200static int __init efika_probe(void) 200static int __init efika_probe(void)
201{ 201{
202 char *model = of_get_flat_dt_prop(of_get_flat_dt_root(), 202 const char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
203 "model", NULL); 203 "model", NULL);
204 204
205 if (model == NULL) 205 if (model == NULL)
206 return 0; 206 return 0;
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index c665d7de6c99..7044fd36197b 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -574,8 +574,8 @@ chrp_init2(void)
574 574
575static int __init chrp_probe(void) 575static int __init chrp_probe(void)
576{ 576{
577 char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(), 577 const char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(),
578 "device_type", NULL); 578 "device_type", NULL);
579 if (dtype == NULL) 579 if (dtype == NULL)
580 return 0; 580 return 0;
581 if (strcmp(dtype, "chrp")) 581 if (strcmp(dtype, "chrp"))
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 49d2f00019e5..c1329846bfa3 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -61,7 +61,7 @@ int __init early_init_dt_scan_opal(unsigned long node,
61 const char *uname, int depth, void *data) 61 const char *uname, int depth, void *data)
62{ 62{
63 const void *basep, *entryp, *sizep; 63 const void *basep, *entryp, *sizep;
64 unsigned long basesz, entrysz, runtimesz; 64 int basesz, entrysz, runtimesz;
65 65
66 if (depth != 1 || strcmp(uname, "ibm,opal") != 0) 66 if (depth != 1 || strcmp(uname, "ibm,opal") != 0)
67 return 0; 67 return 0;
@@ -77,11 +77,11 @@ int __init early_init_dt_scan_opal(unsigned long node,
77 opal.entry = of_read_number(entryp, entrysz/4); 77 opal.entry = of_read_number(entryp, entrysz/4);
78 opal.size = of_read_number(sizep, runtimesz/4); 78 opal.size = of_read_number(sizep, runtimesz/4);
79 79
80 pr_debug("OPAL Base = 0x%llx (basep=%p basesz=%ld)\n", 80 pr_debug("OPAL Base = 0x%llx (basep=%p basesz=%d)\n",
81 opal.base, basep, basesz); 81 opal.base, basep, basesz);
82 pr_debug("OPAL Entry = 0x%llx (entryp=%p basesz=%ld)\n", 82 pr_debug("OPAL Entry = 0x%llx (entryp=%p basesz=%d)\n",
83 opal.entry, entryp, entrysz); 83 opal.entry, entryp, entrysz);
84 pr_debug("OPAL Entry = 0x%llx (sizep=%p runtimesz=%ld)\n", 84 pr_debug("OPAL Entry = 0x%llx (sizep=%p runtimesz=%d)\n",
85 opal.size, sizep, runtimesz); 85 opal.size, sizep, runtimesz);
86 86
87 powerpc_firmware_features |= FW_FEATURE_OPAL; 87 powerpc_firmware_features |= FW_FEATURE_OPAL;
@@ -102,7 +102,7 @@ int __init early_init_dt_scan_opal(unsigned long node,
102int __init early_init_dt_scan_recoverable_ranges(unsigned long node, 102int __init early_init_dt_scan_recoverable_ranges(unsigned long node,
103 const char *uname, int depth, void *data) 103 const char *uname, int depth, void *data)
104{ 104{
105 unsigned long i, psize, size; 105 int i, psize, size;
106 const __be32 *prop; 106 const __be32 *prop;
107 107
108 if (depth != 1 || strcmp(uname, "ibm,opal") != 0) 108 if (depth != 1 || strcmp(uname, "ibm,opal") != 0)
@@ -359,7 +359,7 @@ int opal_get_chars(uint32_t vtermno, char *buf, int count)
359 if ((be64_to_cpu(evt) & OPAL_EVENT_CONSOLE_INPUT) == 0) 359 if ((be64_to_cpu(evt) & OPAL_EVENT_CONSOLE_INPUT) == 0)
360 return 0; 360 return 0;
361 len = cpu_to_be64(count); 361 len = cpu_to_be64(count);
362 rc = opal_console_read(vtermno, &len, buf); 362 rc = opal_console_read(vtermno, &len, buf);
363 if (rc == OPAL_SUCCESS) 363 if (rc == OPAL_SUCCESS)
364 return be64_to_cpu(len); 364 return be64_to_cpu(len);
365 return 0; 365 return 0;
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 2db8cc691bf4..099d2df976a2 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -665,7 +665,7 @@ static int __init pseries_probe_fw_features(unsigned long node,
665 void *data) 665 void *data)
666{ 666{
667 const char *prop; 667 const char *prop;
668 unsigned long len; 668 int len;
669 static int hypertas_found; 669 static int hypertas_found;
670 static int vec5_found; 670 static int vec5_found;
671 671
@@ -698,7 +698,7 @@ static int __init pseries_probe_fw_features(unsigned long node,
698static int __init pSeries_probe(void) 698static int __init pSeries_probe(void)
699{ 699{
700 unsigned long root = of_get_flat_dt_root(); 700 unsigned long root = of_get_flat_dt_root();
701 char *dtype = of_get_flat_dt_prop(root, "device_type", NULL); 701 const char *dtype = of_get_flat_dt_prop(root, "device_type", NULL);
702 702
703 if (dtype == NULL) 703 if (dtype == NULL)
704 return 0; 704 return 0;
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 89986e55d594..1991a3d0b2f8 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -220,7 +220,7 @@ static int __init xtensa_dt_io_area(unsigned long node, const char *uname,
220 int depth, void *data) 220 int depth, void *data)
221{ 221{
222 const __be32 *ranges; 222 const __be32 *ranges;
223 unsigned long len; 223 int len;
224 224
225 if (depth > 1) 225 if (depth > 1)
226 return 0; 226 return 0;
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 */
36void *of_fdt_get_property(struct boot_param_header *blob, 36void *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 */
489static int __init __reserved_mem_check_root(unsigned long node) 490static 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 */
641void *__init of_get_flat_dt_prop(unsigned long node, const char *name, 642const 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,
739static void __init early_init_dt_check_for_initrd(unsigned long node) 740static 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)
773int __init early_init_dt_scan_root(unsigned long node, const char *uname, 774int __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
798u64 __init dt_mem_next_cell(int s, __be32 **cellp) 799u64 __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)
809int __init early_init_dt_scan_memory(unsigned long node, const char *uname, 810int __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,
855int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, 856int __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
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index daaaf935911d..e420eb52e5c9 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -95,8 +95,8 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
95 int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32); 95 int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32);
96 phys_addr_t start = 0, end = 0; 96 phys_addr_t start = 0, end = 0;
97 phys_addr_t base = 0, align = 0, size; 97 phys_addr_t base = 0, align = 0, size;
98 unsigned long len; 98 int len;
99 __be32 *prop; 99 const __be32 *prop;
100 int nomap; 100 int nomap;
101 int ret; 101 int ret;
102 102
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 991ec74b4e11..b36a50d6af37 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -66,7 +66,7 @@ extern char *of_fdt_get_string(struct boot_param_header *blob, u32 offset);
66extern void *of_fdt_get_property(struct boot_param_header *blob, 66extern void *of_fdt_get_property(struct boot_param_header *blob,
67 unsigned long node, 67 unsigned long node,
68 const char *name, 68 const char *name,
69 unsigned long *size); 69 int *size);
70extern int of_fdt_is_compatible(struct boot_param_header *blob, 70extern int of_fdt_is_compatible(struct boot_param_header *blob,
71 unsigned long node, 71 unsigned long node,
72 const char *compat); 72 const char *compat);
@@ -88,8 +88,8 @@ extern char *find_flat_dt_string(u32 offset);
88extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname, 88extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
89 int depth, void *data), 89 int depth, void *data),
90 void *data); 90 void *data);
91extern void *of_get_flat_dt_prop(unsigned long node, const char *name, 91extern const void *of_get_flat_dt_prop(unsigned long node, const char *name,
92 unsigned long *size); 92 int *size);
93extern int of_flat_dt_is_compatible(unsigned long node, const char *name); 93extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
94extern int of_flat_dt_match(unsigned long node, const char *const *matches); 94extern int of_flat_dt_match(unsigned long node, const char *const *matches);
95extern unsigned long of_get_flat_dt_root(void); 95extern unsigned long of_get_flat_dt_root(void);
@@ -103,7 +103,7 @@ extern void early_init_dt_add_memory_arch(u64 base, u64 size);
103extern int early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size, 103extern int early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size,
104 bool no_map); 104 bool no_map);
105extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align); 105extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align);
106extern u64 dt_mem_next_cell(int s, __be32 **cellp); 106extern u64 dt_mem_next_cell(int s, const __be32 **cellp);
107 107
108/* Early flat tree scan hooks */ 108/* Early flat tree scan hooks */
109extern int early_init_dt_scan_root(unsigned long node, const char *uname, 109extern int early_init_dt_scan_root(unsigned long node, const char *uname,