Skip to content

Commit

Permalink
of/fdt: update of_get_flat_dt_prop in prep for libfdt
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rob Herring committed Apr 30, 2014
1 parent bba04d9 commit 9d0c4df
Show file tree
Hide file tree
Showing 19 changed files with 77 additions and 74 deletions.
2 changes: 1 addition & 1 deletion arch/arc/kernel/devtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const struct machine_desc * __init setup_machine_fdt(void *dt)
const struct machine_desc *mdesc;
unsigned long dt_root;
void *clk;
unsigned long len;
int len;

if (!early_init_dt_scan(dt))
return NULL;
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/devtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)

if (!mdesc) {
const char *prop;
long size;
int size;
unsigned long dt_root;

early_print("\nError: unrecognized/unsupported "
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-exynos/exynos.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
{
struct map_desc iodesc;
__be32 *reg;
unsigned long len;
int len;

if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") &&
!of_flat_dt_is_compatible(node, "samsung,exynos5440-clock"))
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-vexpress/platsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
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))
return -EINVAL;
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/plat-samsung/s5p-dev-mfc.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ device_initcall(s5p_mfc_memory_init);
int __init s5p_fdt_alloc_mfc_mem(unsigned long node, const char *uname,
int depth, void *data)
{
__be32 *prop;
unsigned long len;
const __be32 *prop;
int len;
struct s5p_mfc_dt_meminfo mfc_mem;

if (!data)
Expand Down
8 changes: 4 additions & 4 deletions arch/microblaze/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
#include <asm/pci-bridge.h>

#ifdef CONFIG_EARLY_PRINTK
static char *stdout;
static const char *stdout;

static int __init early_init_dt_scan_chosen_serial(unsigned long node,
const char *uname, int depth, void *data)
{
unsigned long l;
char *p;
int l;
const char *p;

pr_debug("%s: depth: %d, uname: %s\n", __func__, depth, uname);

Expand Down Expand Up @@ -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,axi-uartlite", 17) == 0) ||
(strncmp(p, "xlnx,mdm", 8) == 0)) {
unsigned int *addrp;
const unsigned int *addrp;

*(u32 *)data = UARTLITE;

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/epapr_paravirt.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static int __init early_init_dt_scan_epapr(unsigned long node,
int depth, void *data)
{
const u32 *insts;
unsigned long len;
int len;
int i;

insts = of_get_flat_dt_prop(node, "hcall-instructions", &len);
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/kernel/fadump.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ int crash_mem_ranges;
int __init early_init_dt_scan_fw_dump(unsigned long node,
const char *uname, int depth, void *data)
{
__be32 *sections;
const __be32 *sections;
int i, num_sections;
unsigned long size;
int size;
const int *token;

if (depth != 1 || strcmp(uname, "rtas") != 0)
Expand Down
24 changes: 13 additions & 11 deletions arch/powerpc/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static struct ibm_pa_feature {
{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,
struct ibm_pa_feature *fp,
unsigned long ft_size)
Expand Down Expand Up @@ -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)
{
unsigned char *pa_ftrs;
unsigned long tablelen;
const unsigned char *pa_ftrs;
int tablelen;

pa_ftrs = of_get_flat_dt_prop(node, "ibm,pa-features", &tablelen);
if (pa_ftrs == NULL)
Expand All @@ -216,7 +216,7 @@ static void __init check_cpu_pa_features(unsigned long node)
#ifdef CONFIG_PPC_STD_MMU_64
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);
if (slb_size_ptr != NULL) {
Expand Down Expand Up @@ -257,7 +257,7 @@ static struct feature_property {
static inline void identical_pvr_fixup(unsigned long node)
{
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,
Expand Down Expand Up @@ -295,11 +295,11 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
const char *uname, 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);
const __be32 *prop;
const __be32 *intserv;
int i, nthreads;
unsigned long len;
int len;
int found = -1;
int found_thread = 0;

Expand Down Expand Up @@ -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 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 */
if (early_init_dt_scan_chosen(node, uname, depth, data) == 0)
Expand Down Expand Up @@ -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)
{
__be32 *dm, *ls, *usm;
unsigned long l, n, flags;
const __be32 *dm, *ls, *usm;
int l;
unsigned long n, flags;
u64 base, size, memblock_size;
unsigned int is_kexec_kdump = 0, rngs;

Expand Down Expand Up @@ -564,7 +565,8 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)

static void __init early_reserve_mem_dt(void)
{
unsigned long i, len, dt_root;
unsigned long i, dt_root;
int len;
const __be32 *prop;

early_init_fdt_scan_reserved_mem();
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/rtas.c
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ void __init rtas_initialize(void)
int __init early_init_dt_scan_rtas(unsigned long node,
const char *uname, int depth, void *data)
{
u32 *basep, *entryp, *sizep;
const u32 *basep, *entryp, *sizep;

if (depth != 1 || strcmp(uname, "rtas") != 0)
return 0;
Expand Down
22 changes: 11 additions & 11 deletions arch/powerpc/mm/hash_utils_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ static int __init htab_dt_scan_seg_sizes(unsigned long node,
const char *uname, int depth,
void *data)
{
char *type = of_get_flat_dt_prop(node, "device_type", NULL);
__be32 *prop;
unsigned long size = 0;
const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
const __be32 *prop;
int size = 0;

/* We are scanning "cpu" nodes only */
if (type == NULL || strcmp(type, "cpu") != 0)
Expand Down Expand Up @@ -320,9 +320,9 @@ static int __init htab_dt_scan_page_sizes(unsigned long node,
const char *uname, int depth,
void *data)
{
char *type = of_get_flat_dt_prop(node, "device_type", NULL);
__be32 *prop;
unsigned long size = 0;
const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
const __be32 *prop;
int size = 0;

/* We are scanning "cpu" nodes only */
if (type == NULL || strcmp(type, "cpu") != 0)
Expand Down Expand Up @@ -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,
const char *uname, int depth,
void *data) {
char *type = of_get_flat_dt_prop(node, "device_type", NULL);
__be64 *addr_prop;
__be32 *page_count_prop;
const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
const __be64 *addr_prop;
const __be32 *page_count_prop;
unsigned int expected_pages;
long unsigned int phys_addr;
long unsigned int block_size;
Expand Down Expand Up @@ -546,8 +546,8 @@ static int __init htab_dt_scan_pftsize(unsigned long node,
const char *uname, int depth,
void *data)
{
char *type = of_get_flat_dt_prop(node, "device_type", NULL);
__be32 *prop;
const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
const __be32 *prop;

/* We are scanning "cpu" nodes only */
if (type == NULL || strcmp(type, "cpu") != 0)
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/52xx/efika.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ static void __init efika_setup_arch(void)

static int __init efika_probe(void)
{
char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
"model", NULL);
const char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
"model", NULL);

if (model == NULL)
return 0;
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/chrp/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,8 @@ chrp_init2(void)

static int __init chrp_probe(void)
{
char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(),
"device_type", NULL);
const char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(),
"device_type", NULL);
if (dtype == NULL)
return 0;
if (strcmp(dtype, "chrp"))
Expand Down
12 changes: 6 additions & 6 deletions arch/powerpc/platforms/powernv/opal.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int __init early_init_dt_scan_opal(unsigned long node,
const char *uname, int depth, void *data)
{
const void *basep, *entryp, *sizep;
unsigned long basesz, entrysz, runtimesz;
int basesz, entrysz, runtimesz;

if (depth != 1 || strcmp(uname, "ibm,opal") != 0)
return 0;
Expand All @@ -77,11 +77,11 @@ int __init early_init_dt_scan_opal(unsigned long node,
opal.entry = of_read_number(entryp, entrysz/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);
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);
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);

powerpc_firmware_features |= FW_FEATURE_OPAL;
Expand All @@ -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,
const char *uname, int depth, void *data)
{
unsigned long i, psize, size;
int i, psize, size;
const __be32 *prop;

if (depth != 1 || strcmp(uname, "ibm,opal") != 0)
Expand Down Expand Up @@ -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)
return 0;
len = cpu_to_be64(count);
rc = opal_console_read(vtermno, &len, buf);
rc = opal_console_read(vtermno, &len, buf);
if (rc == OPAL_SUCCESS)
return be64_to_cpu(len);
return 0;
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/pseries/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ static int __init pseries_probe_fw_features(unsigned long node,
void *data)
{
const char *prop;
unsigned long len;
int len;
static int hypertas_found;
static int vec5_found;

Expand Down Expand Up @@ -698,7 +698,7 @@ static int __init pseries_probe_fw_features(unsigned long node,
static int __init pSeries_probe(void)
{
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)
return 0;
Expand Down
2 changes: 1 addition & 1 deletion arch/xtensa/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static int __init xtensa_dt_io_area(unsigned long node, const char *uname,
int depth, void *data)
{
const __be32 *ranges;
unsigned long len;
int len;

if (depth > 1)
return 0;
Expand Down
Loading

0 comments on commit 9d0c4df

Please sign in to comment.