Commit 6a23acf3 authored by Stephen Rothwell's avatar Stephen Rothwell Committed by David S. Miller

[SPARC64]: constify of_get_property return: arch/sparc64

Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8271f042
...@@ -32,7 +32,7 @@ static void central_probe_failure(int line) ...@@ -32,7 +32,7 @@ static void central_probe_failure(int line)
static void central_ranges_init(struct linux_central *central) static void central_ranges_init(struct linux_central *central)
{ {
struct device_node *dp = central->prom_node; struct device_node *dp = central->prom_node;
void *pval; const void *pval;
int len; int len;
central->num_central_ranges = 0; central->num_central_ranges = 0;
...@@ -47,7 +47,7 @@ static void central_ranges_init(struct linux_central *central) ...@@ -47,7 +47,7 @@ static void central_ranges_init(struct linux_central *central)
static void fhc_ranges_init(struct linux_fhc *fhc) static void fhc_ranges_init(struct linux_fhc *fhc)
{ {
struct device_node *dp = fhc->prom_node; struct device_node *dp = fhc->prom_node;
void *pval; const void *pval;
int len; int len;
fhc->num_fhc_ranges = 0; fhc->num_fhc_ranges = 0;
...@@ -119,7 +119,7 @@ static unsigned long prom_reg_to_paddr(struct linux_prom_registers *r) ...@@ -119,7 +119,7 @@ static unsigned long prom_reg_to_paddr(struct linux_prom_registers *r)
static void probe_other_fhcs(void) static void probe_other_fhcs(void)
{ {
struct device_node *dp; struct device_node *dp;
struct linux_prom64_registers *fpregs; const struct linux_prom64_registers *fpregs;
for_each_node_by_name(dp, "fhc") { for_each_node_by_name(dp, "fhc") {
struct linux_fhc *fhc; struct linux_fhc *fhc;
...@@ -190,7 +190,8 @@ static void probe_clock_board(struct linux_central *central, ...@@ -190,7 +190,8 @@ static void probe_clock_board(struct linux_central *central,
struct device_node *fp) struct device_node *fp)
{ {
struct device_node *dp; struct device_node *dp;
struct linux_prom_registers cregs[3], *pr; struct linux_prom_registers cregs[3];
const struct linux_prom_registers *pr;
int nslots, tmp, nregs; int nslots, tmp, nregs;
dp = fp->child; dp = fp->child;
...@@ -299,7 +300,8 @@ static void init_all_fhc_hw(void) ...@@ -299,7 +300,8 @@ static void init_all_fhc_hw(void)
void central_probe(void) void central_probe(void)
{ {
struct linux_prom_registers fpregs[6], *pr; struct linux_prom_registers fpregs[6];
const struct linux_prom_registers *pr;
struct linux_fhc *fhc; struct linux_fhc *fhc;
struct device_node *dp, *fp; struct device_node *dp, *fp;
int err; int err;
......
...@@ -343,8 +343,8 @@ static int init_one_mctrl(struct device_node *dp) ...@@ -343,8 +343,8 @@ static int init_one_mctrl(struct device_node *dp)
{ {
struct mctrl_info *mp = kzalloc(sizeof(*mp), GFP_KERNEL); struct mctrl_info *mp = kzalloc(sizeof(*mp), GFP_KERNEL);
int portid = of_getintprop_default(dp, "portid", -1); int portid = of_getintprop_default(dp, "portid", -1);
struct linux_prom64_registers *regs; const struct linux_prom64_registers *regs;
void *pval; const void *pval;
int len; int len;
if (!mp) if (!mp)
......
...@@ -285,7 +285,7 @@ static void __init fill_ebus_child(struct device_node *dp, ...@@ -285,7 +285,7 @@ static void __init fill_ebus_child(struct device_node *dp,
int non_standard_regs) int non_standard_regs)
{ {
struct of_device *op; struct of_device *op;
int *regs; const int *regs;
int i, len; int i, len;
dev->prom_node = dp; dev->prom_node = dp;
......
...@@ -627,7 +627,7 @@ static u64 prom_limit0, prom_limit1; ...@@ -627,7 +627,7 @@ static u64 prom_limit0, prom_limit1;
static void map_prom_timers(void) static void map_prom_timers(void)
{ {
struct device_node *dp; struct device_node *dp;
unsigned int *addr; const unsigned int *addr;
/* PROM timer node hangs out in the top level of device siblings... */ /* PROM timer node hangs out in the top level of device siblings... */
dp = of_find_node_by_path("/"); dp = of_find_node_by_path("/");
......
...@@ -24,7 +24,7 @@ static void __init report_dev(struct sparc_isa_device *isa_dev, int child) ...@@ -24,7 +24,7 @@ static void __init report_dev(struct sparc_isa_device *isa_dev, int child)
static void __init isa_dev_get_resource(struct sparc_isa_device *isa_dev) static void __init isa_dev_get_resource(struct sparc_isa_device *isa_dev)
{ {
struct linux_prom_registers *pregs; const struct linux_prom_registers *pregs;
unsigned long base, len; unsigned long base, len;
int prop_len; int prop_len;
......
...@@ -245,7 +245,7 @@ struct of_bus { ...@@ -245,7 +245,7 @@ struct of_bus {
int *addrc, int *sizec); int *addrc, int *sizec);
int (*map)(u32 *addr, const u32 *range, int (*map)(u32 *addr, const u32 *range,
int na, int ns, int pna); int na, int ns, int pna);
unsigned int (*get_flags)(u32 *addr); unsigned int (*get_flags)(const u32 *addr);
}; };
/* /*
...@@ -305,7 +305,7 @@ static int of_bus_default_map(u32 *addr, const u32 *range, ...@@ -305,7 +305,7 @@ static int of_bus_default_map(u32 *addr, const u32 *range,
return 0; return 0;
} }
static unsigned int of_bus_default_get_flags(u32 *addr) static unsigned int of_bus_default_get_flags(const u32 *addr)
{ {
return IORESOURCE_MEM; return IORESOURCE_MEM;
} }
...@@ -369,7 +369,7 @@ static int of_bus_pci_map(u32 *addr, const u32 *range, ...@@ -369,7 +369,7 @@ static int of_bus_pci_map(u32 *addr, const u32 *range,
return 0; return 0;
} }
static unsigned int of_bus_pci_get_flags(u32 *addr) static unsigned int of_bus_pci_get_flags(const u32 *addr)
{ {
unsigned int flags = 0; unsigned int flags = 0;
u32 w = addr[0]; u32 w = addr[0];
...@@ -482,7 +482,7 @@ static int __init build_one_resource(struct device_node *parent, ...@@ -482,7 +482,7 @@ static int __init build_one_resource(struct device_node *parent,
u32 *addr, u32 *addr,
int na, int ns, int pna) int na, int ns, int pna)
{ {
u32 *ranges; const u32 *ranges;
unsigned int rlen; unsigned int rlen;
int rone; int rone;
...@@ -513,7 +513,7 @@ static int __init build_one_resource(struct device_node *parent, ...@@ -513,7 +513,7 @@ static int __init build_one_resource(struct device_node *parent,
static int __init use_1to1_mapping(struct device_node *pp) static int __init use_1to1_mapping(struct device_node *pp)
{ {
char *model; const char *model;
/* If this is on the PMU bus, don't try to translate it even /* If this is on the PMU bus, don't try to translate it even
* if a ranges property exists. * if a ranges property exists.
...@@ -548,7 +548,7 @@ static void __init build_device_resources(struct of_device *op, ...@@ -548,7 +548,7 @@ static void __init build_device_resources(struct of_device *op,
struct of_bus *bus; struct of_bus *bus;
int na, ns; int na, ns;
int index, num_reg; int index, num_reg;
void *preg; const void *preg;
if (!parent) if (!parent)
return; return;
...@@ -578,7 +578,7 @@ static void __init build_device_resources(struct of_device *op, ...@@ -578,7 +578,7 @@ static void __init build_device_resources(struct of_device *op,
for (index = 0; index < num_reg; index++) { for (index = 0; index < num_reg; index++) {
struct resource *r = &op->resource[index]; struct resource *r = &op->resource[index];
u32 addr[OF_MAX_ADDR_CELLS]; u32 addr[OF_MAX_ADDR_CELLS];
u32 *reg = (preg + (index * ((na + ns) * 4))); const u32 *reg = (preg + (index * ((na + ns) * 4)));
struct device_node *dp = op->node; struct device_node *dp = op->node;
struct device_node *pp = p_op->node; struct device_node *pp = p_op->node;
struct of_bus *pbus, *dbus; struct of_bus *pbus, *dbus;
...@@ -643,14 +643,14 @@ static void __init build_device_resources(struct of_device *op, ...@@ -643,14 +643,14 @@ static void __init build_device_resources(struct of_device *op,
static struct device_node * __init static struct device_node * __init
apply_interrupt_map(struct device_node *dp, struct device_node *pp, apply_interrupt_map(struct device_node *dp, struct device_node *pp,
u32 *imap, int imlen, u32 *imask, const u32 *imap, int imlen, const u32 *imask,
unsigned int *irq_p) unsigned int *irq_p)
{ {
struct device_node *cp; struct device_node *cp;
unsigned int irq = *irq_p; unsigned int irq = *irq_p;
struct of_bus *bus; struct of_bus *bus;
phandle handle; phandle handle;
u32 *reg; const u32 *reg;
int na, num_reg, i; int na, num_reg, i;
bus = of_match_bus(pp); bus = of_match_bus(pp);
...@@ -705,7 +705,7 @@ static unsigned int __init pci_irq_swizzle(struct device_node *dp, ...@@ -705,7 +705,7 @@ static unsigned int __init pci_irq_swizzle(struct device_node *dp,
struct device_node *pp, struct device_node *pp,
unsigned int irq) unsigned int irq)
{ {
struct linux_prom_pci_registers *regs; const struct linux_prom_pci_registers *regs;
unsigned int bus, devfn, slot, ret; unsigned int bus, devfn, slot, ret;
if (irq < 1 || irq > 4) if (irq < 1 || irq > 4)
...@@ -794,7 +794,7 @@ static unsigned int __init build_one_device_irq(struct of_device *op, ...@@ -794,7 +794,7 @@ static unsigned int __init build_one_device_irq(struct of_device *op,
pp = dp->parent; pp = dp->parent;
ip = NULL; ip = NULL;
while (pp) { while (pp) {
void *imap, *imsk; const void *imap, *imsk;
int imlen; int imlen;
imap = of_get_property(pp, "interrupt-map", &imlen); imap = of_get_property(pp, "interrupt-map", &imlen);
...@@ -859,7 +859,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp, ...@@ -859,7 +859,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
struct device *parent) struct device *parent)
{ {
struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL); struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL);
unsigned int *irq; const unsigned int *irq;
int len, i; int len, i;
if (!op) if (!op)
......
...@@ -1281,7 +1281,7 @@ static int msi_queue_alloc(struct pci_pbm_info *pbm) ...@@ -1281,7 +1281,7 @@ static int msi_queue_alloc(struct pci_pbm_info *pbm)
static void pci_sun4v_msi_init(struct pci_pbm_info *pbm) static void pci_sun4v_msi_init(struct pci_pbm_info *pbm)
{ {
u32 *val; const u32 *val;
int len; int len;
val = of_get_property(pbm->prom_node, "#msi-eqs", &len); val = of_get_property(pbm->prom_node, "#msi-eqs", &len);
...@@ -1289,16 +1289,16 @@ static void pci_sun4v_msi_init(struct pci_pbm_info *pbm) ...@@ -1289,16 +1289,16 @@ static void pci_sun4v_msi_init(struct pci_pbm_info *pbm)
goto no_msi; goto no_msi;
pbm->msiq_num = *val; pbm->msiq_num = *val;
if (pbm->msiq_num) { if (pbm->msiq_num) {
struct msiq_prop { const struct msiq_prop {
u32 first_msiq; u32 first_msiq;
u32 num_msiq; u32 num_msiq;
u32 first_devino; u32 first_devino;
} *mqp; } *mqp;
struct msi_range_prop { const struct msi_range_prop {
u32 first_msi; u32 first_msi;
u32 num_msi; u32 num_msi;
} *mrng; } *mrng;
struct addr_range_prop { const struct addr_range_prop {
u32 msi32_high; u32 msi32_high;
u32 msi32_low; u32 msi32_low;
u32 msi32_len; u32 msi32_len;
......
...@@ -196,7 +196,7 @@ EXPORT_SYMBOL(of_getintprop_default); ...@@ -196,7 +196,7 @@ EXPORT_SYMBOL(of_getintprop_default);
int of_n_addr_cells(struct device_node *np) int of_n_addr_cells(struct device_node *np)
{ {
int* ip; const int* ip;
do { do {
if (np->parent) if (np->parent)
np = np->parent; np = np->parent;
...@@ -211,7 +211,7 @@ EXPORT_SYMBOL(of_n_addr_cells); ...@@ -211,7 +211,7 @@ EXPORT_SYMBOL(of_n_addr_cells);
int of_n_size_cells(struct device_node *np) int of_n_size_cells(struct device_node *np)
{ {
int* ip; const int* ip;
do { do {
if (np->parent) if (np->parent)
np = np->parent; np = np->parent;
...@@ -397,7 +397,7 @@ static unsigned int psycho_irq_build(struct device_node *dp, ...@@ -397,7 +397,7 @@ static unsigned int psycho_irq_build(struct device_node *dp,
static void psycho_irq_trans_init(struct device_node *dp) static void psycho_irq_trans_init(struct device_node *dp)
{ {
struct linux_prom64_registers *regs; const struct linux_prom64_registers *regs;
dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller));
dp->irq_trans->irq_build = psycho_irq_build; dp->irq_trans->irq_build = psycho_irq_build;
...@@ -547,7 +547,7 @@ static unsigned long __sabre_onboard_imap_off[] = { ...@@ -547,7 +547,7 @@ static unsigned long __sabre_onboard_imap_off[] = {
static int sabre_device_needs_wsync(struct device_node *dp) static int sabre_device_needs_wsync(struct device_node *dp)
{ {
struct device_node *parent = dp->parent; struct device_node *parent = dp->parent;
char *parent_model, *parent_compat; const char *parent_model, *parent_compat;
/* This traversal up towards the root is meant to /* This traversal up towards the root is meant to
* handle two cases: * handle two cases:
...@@ -589,7 +589,7 @@ static unsigned int sabre_irq_build(struct device_node *dp, ...@@ -589,7 +589,7 @@ static unsigned int sabre_irq_build(struct device_node *dp,
{ {
struct sabre_irq_data *irq_data = _data; struct sabre_irq_data *irq_data = _data;
unsigned long controller_regs = irq_data->controller_regs; unsigned long controller_regs = irq_data->controller_regs;
struct linux_prom_pci_registers *regs; const struct linux_prom_pci_registers *regs;
unsigned long imap, iclr; unsigned long imap, iclr;
unsigned long imap_off, iclr_off; unsigned long imap_off, iclr_off;
int inofixup = 0; int inofixup = 0;
...@@ -639,9 +639,9 @@ static unsigned int sabre_irq_build(struct device_node *dp, ...@@ -639,9 +639,9 @@ static unsigned int sabre_irq_build(struct device_node *dp,
static void sabre_irq_trans_init(struct device_node *dp) static void sabre_irq_trans_init(struct device_node *dp)
{ {
struct linux_prom64_registers *regs; const struct linux_prom64_registers *regs;
struct sabre_irq_data *irq_data; struct sabre_irq_data *irq_data;
u32 *busrange; const u32 *busrange;
dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller));
dp->irq_trans->irq_build = sabre_irq_build; dp->irq_trans->irq_build = sabre_irq_build;
...@@ -795,7 +795,7 @@ static unsigned int schizo_irq_build(struct device_node *dp, ...@@ -795,7 +795,7 @@ static unsigned int schizo_irq_build(struct device_node *dp,
static void __schizo_irq_trans_init(struct device_node *dp, int is_tomatillo) static void __schizo_irq_trans_init(struct device_node *dp, int is_tomatillo)
{ {
struct linux_prom64_registers *regs; const struct linux_prom64_registers *regs;
struct schizo_irq_data *irq_data; struct schizo_irq_data *irq_data;
dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller));
...@@ -836,7 +836,7 @@ static unsigned int pci_sun4v_irq_build(struct device_node *dp, ...@@ -836,7 +836,7 @@ static unsigned int pci_sun4v_irq_build(struct device_node *dp,
static void pci_sun4v_irq_trans_init(struct device_node *dp) static void pci_sun4v_irq_trans_init(struct device_node *dp)
{ {
struct linux_prom64_registers *regs; const struct linux_prom64_registers *regs;
dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller));
dp->irq_trans->irq_build = pci_sun4v_irq_build; dp->irq_trans->irq_build = pci_sun4v_irq_build;
...@@ -940,7 +940,7 @@ static unsigned int sbus_of_build_irq(struct device_node *dp, ...@@ -940,7 +940,7 @@ static unsigned int sbus_of_build_irq(struct device_node *dp,
void *_data) void *_data)
{ {
unsigned long reg_base = (unsigned long) _data; unsigned long reg_base = (unsigned long) _data;
struct linux_prom_registers *regs; const struct linux_prom_registers *regs;
unsigned long imap, iclr; unsigned long imap, iclr;
int sbus_slot = 0; int sbus_slot = 0;
int sbus_level = 0; int sbus_level = 0;
...@@ -994,7 +994,7 @@ static unsigned int sbus_of_build_irq(struct device_node *dp, ...@@ -994,7 +994,7 @@ static unsigned int sbus_of_build_irq(struct device_node *dp,
static void sbus_irq_trans_init(struct device_node *dp) static void sbus_irq_trans_init(struct device_node *dp)
{ {
struct linux_prom64_registers *regs; const struct linux_prom64_registers *regs;
dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller));
dp->irq_trans->irq_build = sbus_of_build_irq; dp->irq_trans->irq_build = sbus_of_build_irq;
...@@ -1080,7 +1080,7 @@ static unsigned int sun4v_vdev_irq_build(struct device_node *dp, ...@@ -1080,7 +1080,7 @@ static unsigned int sun4v_vdev_irq_build(struct device_node *dp,
static void sun4v_vdev_irq_trans_init(struct device_node *dp) static void sun4v_vdev_irq_trans_init(struct device_node *dp)
{ {
struct linux_prom64_registers *regs; const struct linux_prom64_registers *regs;
dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller));
dp->irq_trans->irq_build = sun4v_vdev_irq_build; dp->irq_trans->irq_build = sun4v_vdev_irq_build;
......
...@@ -1025,7 +1025,7 @@ static void __init sysio_register_error_handlers(struct sbus_bus *sbus) ...@@ -1025,7 +1025,7 @@ static void __init sysio_register_error_handlers(struct sbus_bus *sbus)
/* Boot time initialization. */ /* Boot time initialization. */
static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus) static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus)
{ {
struct linux_prom64_registers *pr; const struct linux_prom64_registers *pr;
struct device_node *dp; struct device_node *dp;
struct sbus_iommu *iommu; struct sbus_iommu *iommu;
unsigned long regs; unsigned long regs;
...@@ -1133,7 +1133,7 @@ static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus) ...@@ -1133,7 +1133,7 @@ static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus)
void sbus_fill_device_irq(struct sbus_dev *sdev) void sbus_fill_device_irq(struct sbus_dev *sdev)
{ {
struct device_node *dp = of_find_node_by_phandle(sdev->prom_node); struct device_node *dp = of_find_node_by_phandle(sdev->prom_node);
struct linux_prom_irqs *irqs; const struct linux_prom_irqs *irqs;
irqs = of_get_property(dp, "interrupts", NULL); irqs = of_get_property(dp, "interrupts", NULL);
if (!irqs) { if (!irqs) {
......
...@@ -704,7 +704,7 @@ static int hypervisor_set_time(u32 secs) ...@@ -704,7 +704,7 @@ static int hypervisor_set_time(u32 secs)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static int __init clock_model_matches(char *model) static int __init clock_model_matches(const char *model)
{ {
if (strcmp(model, "mk48t02") && if (strcmp(model, "mk48t02") &&
strcmp(model, "mk48t08") && strcmp(model, "mk48t08") &&
...@@ -721,7 +721,7 @@ static int __init clock_model_matches(char *model) ...@@ -721,7 +721,7 @@ static int __init clock_model_matches(char *model)
static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match) static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match)
{ {
struct device_node *dp = op->node; struct device_node *dp = op->node;
char *model = of_get_property(dp, "model", NULL); const char *model = of_get_property(dp, "model", NULL);
unsigned long size, flags; unsigned long size, flags;
void __iomem *regs; void __iomem *regs;
......
...@@ -224,7 +224,8 @@ static char *serial(char *buffer, int sz) ...@@ -224,7 +224,8 @@ static char *serial(char *buffer, int sz)
*buffer = 0; *buffer = 0;
if (dp) { if (dp) {
char *val = of_get_property(dp, "system-board-serial#", &len); const char *val =
of_get_property(dp, "system-board-serial#", &len);
if (val && len > 0) { if (val && len > 0) {
if (len > sz) if (len > sz)
......
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