aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2014-04-01 23:49:03 -0500
committerMark Brown <broonie@linaro.org>2014-08-12 13:22:45 +0100
commit11d5af3ce42bb4dd36cc6a5bb2764c6a66ff2212 (patch)
treeb167bdf237148b83789e45e76f5e426759598060 /drivers
parentd90d1980c1ae2c5df3824d9f6d8c7d01eedec34b (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> (cherry picked from commit 9d0c4dfedd96ee54fc075b16d02f82499c8cc3a6) Signed-off-by: Mark Brown <broonie@linaro.org> Conflicts: arch/arm/plat-samsung/s5p-dev-mfc.c arch/powerpc/platforms/powernv/opal.c
Diffstat (limited to 'drivers')
-rw-r--r--drivers/of/fdt.c39
-rw-r--r--drivers/of/of_reserved_mem.c4
2 files changed, 22 insertions, 21 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 359b5b71f294..dfd5b730d4b7 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -40,7 +40,7 @@ char *of_fdt_get_string(struct boot_param_header *blob, u32 offset)
*/
void *of_fdt_get_property(struct boot_param_header *blob,
unsigned long node, const char *name,
- unsigned long *size)
+ int *size)
{
unsigned long p = node;
@@ -90,7 +90,8 @@ int of_fdt_is_compatible(struct boot_param_header *blob,
unsigned long node, const char *compat)
{
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);
if (cp == NULL)
@@ -449,8 +450,8 @@ static int __init __reserved_mem_reserve_reg(unsigned long node,
{
int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32);
phys_addr_t base, size;
- unsigned long len;
- __be32 *prop;
+ int len;
+ const __be32 *prop;
int nomap, first = 1;
prop = of_get_flat_dt_prop(node, "reg", &len);
@@ -493,7 +494,7 @@ static int __init __reserved_mem_reserve_reg(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);
if (!prop || be32_to_cpup(prop) != dt_root_size_cells)
@@ -643,8 +644,8 @@ unsigned long __init of_get_flat_dt_root(void)
* This function can be used within scan_flattened_dt callback to get
* access to properties
*/
-void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
- unsigned long *size)
+const void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
+ int *size)
{
return of_fdt_get_property(initial_boot_params, node, name, size);
}
@@ -715,7 +716,7 @@ const void * __init of_flat_dt_match_machine(const void *default_match,
}
if (!best_data) {
const char *prop;
- long size;
+ int size;
pr_err("\n unrecognized device tree list:\n[ ");
@@ -744,8 +745,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)
{
u64 start, end;
- unsigned long len;
- __be32 *prop;
+ int len;
+ const __be32 *prop;
pr_debug("Looking for initrd properties... ");
@@ -778,7 +779,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 depth, void *data)
{
- __be32 *prop;
+ const __be32 *prop;
if (depth != 0)
return 0;
@@ -800,9 +801,9 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,
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;
return of_read_number(p, s);
@@ -814,9 +815,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 depth, void *data)
{
- char *type = of_get_flat_dt_prop(node, "device_type", NULL);
- __be32 *reg, *endp;
- unsigned long l;
+ const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
+ const __be32 *reg, *endp;
+ int l;
/* We are scanning "memory" nodes only */
if (type == NULL) {
@@ -837,7 +838,7 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
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]);
while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
@@ -860,8 +861,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 depth, void *data)
{
- unsigned long l;
- char *p;
+ int l;
+ const char *p;
pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
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,
int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32);
phys_addr_t start = 0, end = 0;
phys_addr_t base = 0, align = 0, size;
- unsigned long len;
- __be32 *prop;
+ int len;
+ const __be32 *prop;
int nomap;
int ret;