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> Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git Git-commit: 9d0c4dfedd96ee54fc075b16d02f82499c8cc3a6 [joonwoop@codeaurora.org: updated drivers/base/dma-contiguous.c to use 'const' qualifier. dropped arch/arm/mach-exynos/exynos.c.] Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
This commit is contained in:
parent
3ac3804dfa
commit
51001775c3
|
@ -51,7 +51,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;
|
||||
|
|
|
@ -42,13 +42,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);
|
||||
|
||||
|
@ -79,7 +79,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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -162,7 +162,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)
|
||||
|
@ -201,8 +201,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)
|
||||
|
@ -256,7 +256,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,
|
||||
|
@ -298,7 +298,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
|
|||
const u32 *prop;
|
||||
const u32 *intserv;
|
||||
int i, nthreads;
|
||||
unsigned long len;
|
||||
int len;
|
||||
int found = -1;
|
||||
int found_thread = 0;
|
||||
|
||||
|
@ -440,8 +440,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;
|
||||
|
||||
|
|
|
@ -1135,7 +1135,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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -50,9 +50,9 @@ int __init early_init_dt_scan_opal(unsigned long node,
|
|||
opal.base = of_read_number(basep, basesz/4);
|
||||
opal.entry = of_read_number(entryp, entrysz/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);
|
||||
|
||||
powerpc_firmware_features |= FW_FEATURE_OPAL;
|
||||
|
|
|
@ -646,7 +646,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;
|
||||
|
||||
|
@ -679,7 +679,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;
|
||||
|
|
|
@ -222,15 +222,15 @@ int __init cma_fdt_scan(unsigned long node, const char *uname,
|
|||
int depth, void *data)
|
||||
{
|
||||
phys_addr_t base, size;
|
||||
unsigned long len;
|
||||
__be32 *prop;
|
||||
char *name;
|
||||
int len;
|
||||
const __be32 *prop;
|
||||
const char *name;
|
||||
bool in_system;
|
||||
bool remove;
|
||||
unsigned long size_cells = dt_root_size_cells;
|
||||
unsigned long addr_cells = dt_root_addr_cells;
|
||||
phys_addr_t limit = MEMBLOCK_ALLOC_ANYWHERE;
|
||||
char *status;
|
||||
const char *status;
|
||||
|
||||
if (!of_get_flat_dt_prop(node, "linux,reserve-contiguous-region", NULL))
|
||||
return 0;
|
||||
|
|
|
@ -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,
|
||||
unsigned long node, const char *name,
|
||||
unsigned long *size)
|
||||
int *size)
|
||||
{
|
||||
unsigned long p = node;
|
||||
|
||||
|
@ -85,7 +85,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)
|
||||
|
@ -448,8 +449,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);
|
||||
|
@ -492,7 +493,7 @@ static int __init __reserved_mem_reserve_reg(unsigned long node,
|
|||
*/
|
||||
static int __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)
|
||||
|
@ -639,8 +640,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);
|
||||
}
|
||||
|
@ -702,7 +703,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[ ");
|
||||
|
||||
|
@ -731,8 +732,8 @@ const void * __init of_flat_dt_match_machine(const void *default_match,
|
|||
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... ");
|
||||
|
||||
|
@ -762,7 +763,7 @@ 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;
|
||||
|
@ -784,9 +785,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);
|
||||
|
@ -798,9 +799,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) {
|
||||
|
@ -821,7 +822,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)) {
|
||||
|
@ -867,8 +868,8 @@ static const char *config_cmdline = "";
|
|||
int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
|
||||
int depth, void *data)
|
||||
{
|
||||
unsigned long l = 0;
|
||||
char *p = NULL;
|
||||
int l;
|
||||
const char *p = NULL;
|
||||
char *cmdline = data;
|
||||
|
||||
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,
|
|||
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;
|
||||
|
||||
|
|
|
@ -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,
|
||||
unsigned long node,
|
||||
const char *name,
|
||||
unsigned long *size);
|
||||
int *size);
|
||||
extern int of_fdt_is_compatible(struct boot_param_header *blob,
|
||||
unsigned long node,
|
||||
const char *compat);
|
||||
|
@ -85,8 +85,8 @@ extern char *find_flat_dt_string(u32 offset);
|
|||
extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
|
||||
int depth, void *data),
|
||||
void *data);
|
||||
extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
|
||||
unsigned long *size);
|
||||
extern const void *of_get_flat_dt_prop(unsigned long node, const char *name,
|
||||
int *size);
|
||||
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 unsigned long of_get_flat_dt_root(void);
|
||||
|
@ -122,7 +122,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,
|
||||
bool no_map);
|
||||
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);
|
||||
|
||||
/*
|
||||
* If BLK_DEV_INITRD, the fdt early init code will call this function,
|
||||
|
|
Loading…
Reference in New Issue