提交 a7f67bdf 编写于 作者: J Jeremy Kerr 提交者: Paul Mackerras

[POWERPC] Constify & voidify get_property()

Now that get_property() returns a void *, there's no need to cast its
return value. Also, treat the return value as const, so we can
constify get_property later.

powerpc core changes.
Signed-off-by: NJeremy Kerr <jk@ozlabs.org>
Signed-off-by: NPaul Mackerras <paulus@samba.org>
上级 4288b92b
...@@ -158,35 +158,35 @@ int btext_initialize(struct device_node *np) ...@@ -158,35 +158,35 @@ int btext_initialize(struct device_node *np)
{ {
unsigned int width, height, depth, pitch; unsigned int width, height, depth, pitch;
unsigned long address = 0; unsigned long address = 0;
u32 *prop; const u32 *prop;
prop = (u32 *)get_property(np, "linux,bootx-width", NULL); prop = get_property(np, "linux,bootx-width", NULL);
if (prop == NULL) if (prop == NULL)
prop = (u32 *)get_property(np, "width", NULL); prop = get_property(np, "width", NULL);
if (prop == NULL) if (prop == NULL)
return -EINVAL; return -EINVAL;
width = *prop; width = *prop;
prop = (u32 *)get_property(np, "linux,bootx-height", NULL); prop = get_property(np, "linux,bootx-height", NULL);
if (prop == NULL) if (prop == NULL)
prop = (u32 *)get_property(np, "height", NULL); prop = get_property(np, "height", NULL);
if (prop == NULL) if (prop == NULL)
return -EINVAL; return -EINVAL;
height = *prop; height = *prop;
prop = (u32 *)get_property(np, "linux,bootx-depth", NULL); prop = get_property(np, "linux,bootx-depth", NULL);
if (prop == NULL) if (prop == NULL)
prop = (u32 *)get_property(np, "depth", NULL); prop = get_property(np, "depth", NULL);
if (prop == NULL) if (prop == NULL)
return -EINVAL; return -EINVAL;
depth = *prop; depth = *prop;
pitch = width * ((depth + 7) / 8); pitch = width * ((depth + 7) / 8);
prop = (u32 *)get_property(np, "linux,bootx-linebytes", NULL); prop = get_property(np, "linux,bootx-linebytes", NULL);
if (prop == NULL) if (prop == NULL)
prop = (u32 *)get_property(np, "linebytes", NULL); prop = get_property(np, "linebytes", NULL);
if (prop) if (prop)
pitch = *prop; pitch = *prop;
if (pitch == 1) if (pitch == 1)
pitch = 0x1000; pitch = 0x1000;
prop = (u32 *)get_property(np, "address", NULL); prop = get_property(np, "address", NULL);
if (prop) if (prop)
address = *prop; address = *prop;
...@@ -214,11 +214,11 @@ int btext_initialize(struct device_node *np) ...@@ -214,11 +214,11 @@ int btext_initialize(struct device_node *np)
int __init btext_find_display(int allow_nonstdout) int __init btext_find_display(int allow_nonstdout)
{ {
char *name; const char *name;
struct device_node *np = NULL; struct device_node *np = NULL;
int rc = -ENODEV; int rc = -ENODEV;
name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); name = get_property(of_chosen, "linux,stdout-path", NULL);
if (name != NULL) { if (name != NULL) {
np = of_find_node_by_path(name); np = of_find_node_by_path(name);
if (np != NULL) { if (np != NULL) {
......
...@@ -167,7 +167,7 @@ static DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, ibmebusdev_show_name, ...@@ -167,7 +167,7 @@ static DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, ibmebusdev_show_name,
NULL); NULL);
static struct ibmebus_dev* __devinit ibmebus_register_device_common( static struct ibmebus_dev* __devinit ibmebus_register_device_common(
struct ibmebus_dev *dev, char *name) struct ibmebus_dev *dev, const char *name)
{ {
int err = 0; int err = 0;
...@@ -194,10 +194,10 @@ static struct ibmebus_dev* __devinit ibmebus_register_device_node( ...@@ -194,10 +194,10 @@ static struct ibmebus_dev* __devinit ibmebus_register_device_node(
struct device_node *dn) struct device_node *dn)
{ {
struct ibmebus_dev *dev; struct ibmebus_dev *dev;
char *loc_code; const char *loc_code;
int length; int length;
loc_code = (char *)get_property(dn, "ibm,loc-code", NULL); loc_code = get_property(dn, "ibm,loc-code", NULL);
if (!loc_code) { if (!loc_code) {
printk(KERN_WARNING "%s: node %s missing 'ibm,loc-code'\n", printk(KERN_WARNING "%s: node %s missing 'ibm,loc-code'\n",
__FUNCTION__, dn->name ? dn->name : "<unknown>"); __FUNCTION__, dn->name ? dn->name : "<unknown>");
......
...@@ -39,16 +39,17 @@ static int __init add_legacy_port(struct device_node *np, int want_index, ...@@ -39,16 +39,17 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
phys_addr_t taddr, unsigned long irq, phys_addr_t taddr, unsigned long irq,
upf_t flags, int irq_check_parent) upf_t flags, int irq_check_parent)
{ {
u32 *clk, *spd, clock = BASE_BAUD * 16; const u32 *clk, *spd;
u32 clock = BASE_BAUD * 16;
int index; int index;
/* get clock freq. if present */ /* get clock freq. if present */
clk = (u32 *)get_property(np, "clock-frequency", NULL); clk = get_property(np, "clock-frequency", NULL);
if (clk && *clk) if (clk && *clk)
clock = *clk; clock = *clk;
/* get default speed if present */ /* get default speed if present */
spd = (u32 *)get_property(np, "current-speed", NULL); spd = get_property(np, "current-speed", NULL);
/* If we have a location index, then try to use it */ /* If we have a location index, then try to use it */
if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS) if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS)
...@@ -113,7 +114,7 @@ static int __init add_legacy_soc_port(struct device_node *np, ...@@ -113,7 +114,7 @@ static int __init add_legacy_soc_port(struct device_node *np,
struct device_node *soc_dev) struct device_node *soc_dev)
{ {
u64 addr; u64 addr;
u32 *addrp; const u32 *addrp;
upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ; upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ;
/* We only support ports that have a clock frequency properly /* We only support ports that have a clock frequency properly
...@@ -140,15 +141,15 @@ static int __init add_legacy_soc_port(struct device_node *np, ...@@ -140,15 +141,15 @@ static int __init add_legacy_soc_port(struct device_node *np,
static int __init add_legacy_isa_port(struct device_node *np, static int __init add_legacy_isa_port(struct device_node *np,
struct device_node *isa_brg) struct device_node *isa_brg)
{ {
u32 *reg; const u32 *reg;
char *typep; const char *typep;
int index = -1; int index = -1;
u64 taddr; u64 taddr;
DBG(" -> add_legacy_isa_port(%s)\n", np->full_name); DBG(" -> add_legacy_isa_port(%s)\n", np->full_name);
/* Get the ISA port number */ /* Get the ISA port number */
reg = (u32 *)get_property(np, "reg", NULL); reg = get_property(np, "reg", NULL);
if (reg == NULL) if (reg == NULL)
return -1; return -1;
...@@ -159,7 +160,7 @@ static int __init add_legacy_isa_port(struct device_node *np, ...@@ -159,7 +160,7 @@ static int __init add_legacy_isa_port(struct device_node *np,
/* Now look for an "ibm,aix-loc" property that gives us ordering /* Now look for an "ibm,aix-loc" property that gives us ordering
* if any... * if any...
*/ */
typep = (char *)get_property(np, "ibm,aix-loc", NULL); typep = get_property(np, "ibm,aix-loc", NULL);
/* If we have a location index, then use it */ /* If we have a location index, then use it */
if (typep && *typep == 'S') if (typep && *typep == 'S')
...@@ -184,7 +185,7 @@ static int __init add_legacy_pci_port(struct device_node *np, ...@@ -184,7 +185,7 @@ static int __init add_legacy_pci_port(struct device_node *np,
struct device_node *pci_dev) struct device_node *pci_dev)
{ {
u64 addr, base; u64 addr, base;
u32 *addrp; const u32 *addrp;
unsigned int flags; unsigned int flags;
int iotype, index = -1, lindex = 0; int iotype, index = -1, lindex = 0;
...@@ -223,7 +224,7 @@ static int __init add_legacy_pci_port(struct device_node *np, ...@@ -223,7 +224,7 @@ static int __init add_legacy_pci_port(struct device_node *np,
* we get to their "reg" property * we get to their "reg" property
*/ */
if (np != pci_dev) { if (np != pci_dev) {
u32 *reg = (u32 *)get_property(np, "reg", NULL); const u32 *reg = get_property(np, "reg", NULL);
if (reg && (*reg < 4)) if (reg && (*reg < 4))
index = lindex = *reg; index = lindex = *reg;
} }
...@@ -281,13 +282,13 @@ static void __init setup_legacy_serial_console(int console) ...@@ -281,13 +282,13 @@ static void __init setup_legacy_serial_console(int console)
void __init find_legacy_serial_ports(void) void __init find_legacy_serial_ports(void)
{ {
struct device_node *np, *stdout = NULL; struct device_node *np, *stdout = NULL;
char *path; const char *path;
int index; int index;
DBG(" -> find_legacy_serial_port()\n"); DBG(" -> find_legacy_serial_port()\n");
/* Now find out if one of these is out firmware console */ /* Now find out if one of these is out firmware console */
path = (char *)get_property(of_chosen, "linux,stdout-path", NULL); path = get_property(of_chosen, "linux,stdout-path", NULL);
if (path != NULL) { if (path != NULL) {
stdout = of_find_node_by_path(path); stdout = of_find_node_by_path(path);
if (stdout) if (stdout)
...@@ -487,8 +488,8 @@ static int __init check_legacy_serial_console(void) ...@@ -487,8 +488,8 @@ static int __init check_legacy_serial_console(void)
{ {
struct device_node *prom_stdout = NULL; struct device_node *prom_stdout = NULL;
int speed = 0, offset = 0; int speed = 0, offset = 0;
char *name; const char *name;
u32 *spd; const u32 *spd;
DBG(" -> check_legacy_serial_console()\n"); DBG(" -> check_legacy_serial_console()\n");
...@@ -509,7 +510,7 @@ static int __init check_legacy_serial_console(void) ...@@ -509,7 +510,7 @@ static int __init check_legacy_serial_console(void)
} }
/* We are getting a weird phandle from OF ... */ /* We are getting a weird phandle from OF ... */
/* ... So use the full path instead */ /* ... So use the full path instead */
name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); name = get_property(of_chosen, "linux,stdout-path", NULL);
if (name == NULL) { if (name == NULL) {
DBG(" no linux,stdout-path !\n"); DBG(" no linux,stdout-path !\n");
return -ENODEV; return -ENODEV;
...@@ -521,12 +522,12 @@ static int __init check_legacy_serial_console(void) ...@@ -521,12 +522,12 @@ static int __init check_legacy_serial_console(void)
} }
DBG("stdout is %s\n", prom_stdout->full_name); DBG("stdout is %s\n", prom_stdout->full_name);
name = (char *)get_property(prom_stdout, "name", NULL); name = get_property(prom_stdout, "name", NULL);
if (!name) { if (!name) {
DBG(" stdout package has no name !\n"); DBG(" stdout package has no name !\n");
goto not_found; goto not_found;
} }
spd = (u32 *)get_property(prom_stdout, "current-speed", NULL); spd = get_property(prom_stdout, "current-speed", NULL);
if (spd) if (spd)
speed = *spd; speed = *spd;
......
...@@ -309,12 +309,11 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v) ...@@ -309,12 +309,11 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
int partition_potential_processors; int partition_potential_processors;
int partition_active_processors; int partition_active_processors;
struct device_node *rtas_node; struct device_node *rtas_node;
int *lrdrp = NULL; const int *lrdrp = NULL;
rtas_node = find_path_device("/rtas"); rtas_node = find_path_device("/rtas");
if (rtas_node) if (rtas_node)
lrdrp = (int *)get_property(rtas_node, "ibm,lrdr-capacity", lrdrp = get_property(rtas_node, "ibm,lrdr-capacity", NULL);
NULL);
if (lrdrp == NULL) { if (lrdrp == NULL) {
partition_potential_processors = vdso_data->processorCount; partition_potential_processors = vdso_data->processorCount;
...@@ -519,7 +518,8 @@ static int lparcfg_data(struct seq_file *m, void *v) ...@@ -519,7 +518,8 @@ static int lparcfg_data(struct seq_file *m, void *v)
const char *model = ""; const char *model = "";
const char *system_id = ""; const char *system_id = "";
const char *tmp; const char *tmp;
unsigned int *lp_index_ptr, lp_index = 0; const unsigned int *lp_index_ptr;
unsigned int lp_index = 0;
seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS); seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
...@@ -539,8 +539,7 @@ static int lparcfg_data(struct seq_file *m, void *v) ...@@ -539,8 +539,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
if (firmware_has_feature(FW_FEATURE_ISERIES)) if (firmware_has_feature(FW_FEATURE_ISERIES))
system_id += 4; system_id += 4;
} }
lp_index_ptr = (unsigned int *) lp_index_ptr = get_property(rootdn, "ibm,partition-no", NULL);
get_property(rootdn, "ibm,partition-no", NULL);
if (lp_index_ptr) if (lp_index_ptr)
lp_index = *lp_index_ptr; lp_index = *lp_index_ptr;
} }
......
...@@ -33,8 +33,8 @@ int default_machine_kexec_prepare(struct kimage *image) ...@@ -33,8 +33,8 @@ int default_machine_kexec_prepare(struct kimage *image)
unsigned long begin, end; /* limits of segment */ unsigned long begin, end; /* limits of segment */
unsigned long low, high; /* limits of blocked memory range */ unsigned long low, high; /* limits of blocked memory range */
struct device_node *node; struct device_node *node;
unsigned long *basep; const unsigned long *basep;
unsigned int *sizep; const unsigned int *sizep;
if (!ppc_md.hpte_clear_all) if (!ppc_md.hpte_clear_all)
return -ENOENT; return -ENOENT;
...@@ -74,10 +74,8 @@ int default_machine_kexec_prepare(struct kimage *image) ...@@ -74,10 +74,8 @@ int default_machine_kexec_prepare(struct kimage *image)
/* We also should not overwrite the tce tables */ /* We also should not overwrite the tce tables */
for (node = of_find_node_by_type(NULL, "pci"); node != NULL; for (node = of_find_node_by_type(NULL, "pci"); node != NULL;
node = of_find_node_by_type(node, "pci")) { node = of_find_node_by_type(node, "pci")) {
basep = (unsigned long *)get_property(node, "linux,tce-base", basep = get_property(node, "linux,tce-base", NULL);
NULL); sizep = get_property(node, "linux,tce-size", NULL);
sizep = (unsigned int *)get_property(node, "linux,tce-size",
NULL);
if (basep == NULL || sizep == NULL) if (basep == NULL || sizep == NULL)
continue; continue;
......
...@@ -633,12 +633,12 @@ pcibios_alloc_controller(void) ...@@ -633,12 +633,12 @@ pcibios_alloc_controller(void)
static void static void
make_one_node_map(struct device_node* node, u8 pci_bus) make_one_node_map(struct device_node* node, u8 pci_bus)
{ {
int *bus_range; const int *bus_range;
int len; int len;
if (pci_bus >= pci_bus_count) if (pci_bus >= pci_bus_count)
return; return;
bus_range = (int *) get_property(node, "bus-range", &len); bus_range = get_property(node, "bus-range", &len);
if (bus_range == NULL || len < 2 * sizeof(int)) { if (bus_range == NULL || len < 2 * sizeof(int)) {
printk(KERN_WARNING "Can't get bus-range for %s, " printk(KERN_WARNING "Can't get bus-range for %s, "
"assuming it starts at 0\n", node->full_name); "assuming it starts at 0\n", node->full_name);
...@@ -648,13 +648,13 @@ make_one_node_map(struct device_node* node, u8 pci_bus) ...@@ -648,13 +648,13 @@ make_one_node_map(struct device_node* node, u8 pci_bus)
for (node=node->child; node != 0;node = node->sibling) { for (node=node->child; node != 0;node = node->sibling) {
struct pci_dev* dev; struct pci_dev* dev;
unsigned int *class_code, *reg; const unsigned int *class_code, *reg;
class_code = (unsigned int *) get_property(node, "class-code", NULL); class_code = get_property(node, "class-code", NULL);
if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
(*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
continue; continue;
reg = (unsigned int *)get_property(node, "reg", NULL); reg = get_property(node, "reg", NULL);
if (!reg) if (!reg)
continue; continue;
dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff)); dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff));
...@@ -669,7 +669,7 @@ pcibios_make_OF_bus_map(void) ...@@ -669,7 +669,7 @@ pcibios_make_OF_bus_map(void)
{ {
int i; int i;
struct pci_controller* hose; struct pci_controller* hose;
u8* of_prop_map; struct property *map_prop;
pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL); pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL);
if (!pci_to_OF_bus_map) { if (!pci_to_OF_bus_map) {
...@@ -691,9 +691,12 @@ pcibios_make_OF_bus_map(void) ...@@ -691,9 +691,12 @@ pcibios_make_OF_bus_map(void)
continue; continue;
make_one_node_map(node, hose->first_busno); make_one_node_map(node, hose->first_busno);
} }
of_prop_map = get_property(find_path_device("/"), "pci-OF-bus-map", NULL); map_prop = of_find_property(find_path_device("/"),
if (of_prop_map) "pci-OF-bus-map", NULL);
memcpy(of_prop_map, pci_to_OF_bus_map, pci_bus_count); if (map_prop) {
BUG_ON(pci_bus_count > map_prop->length);
memcpy(map_prop->value, pci_to_OF_bus_map, pci_bus_count);
}
#ifdef DEBUG #ifdef DEBUG
printk("PCI->OF bus map:\n"); printk("PCI->OF bus map:\n");
for (i=0; i<pci_bus_count; i++) { for (i=0; i<pci_bus_count; i++) {
...@@ -712,7 +715,7 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* ...@@ -712,7 +715,7 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void*
struct device_node* sub_node; struct device_node* sub_node;
for (; node != 0;node = node->sibling) { for (; node != 0;node = node->sibling) {
unsigned int *class_code; const unsigned int *class_code;
if (filter(node, data)) if (filter(node, data))
return node; return node;
...@@ -722,7 +725,7 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* ...@@ -722,7 +725,7 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void*
* a fake root for all functions of a multi-function device, * a fake root for all functions of a multi-function device,
* we go down them as well. * we go down them as well.
*/ */
class_code = (unsigned int *) get_property(node, "class-code", NULL); class_code = get_property(node, "class-code", NULL);
if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
(*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) && (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) &&
strcmp(node->name, "multifunc-device")) strcmp(node->name, "multifunc-device"))
...@@ -737,10 +740,10 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* ...@@ -737,10 +740,10 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void*
static int static int
scan_OF_pci_childs_iterator(struct device_node* node, void* data) scan_OF_pci_childs_iterator(struct device_node* node, void* data)
{ {
unsigned int *reg; const unsigned int *reg;
u8* fdata = (u8*)data; u8* fdata = (u8*)data;
reg = (unsigned int *) get_property(node, "reg", NULL); reg = get_property(node, "reg", NULL);
if (reg && ((reg[0] >> 8) & 0xff) == fdata[1] if (reg && ((reg[0] >> 8) & 0xff) == fdata[1]
&& ((reg[0] >> 16) & 0xff) == fdata[0]) && ((reg[0] >> 16) & 0xff) == fdata[0])
return 1; return 1;
...@@ -841,7 +844,7 @@ find_OF_pci_device_filter(struct device_node* node, void* data) ...@@ -841,7 +844,7 @@ find_OF_pci_device_filter(struct device_node* node, void* data)
int int
pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn) pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn)
{ {
unsigned int *reg; const unsigned int *reg;
struct pci_controller* hose; struct pci_controller* hose;
struct pci_dev* dev = NULL; struct pci_dev* dev = NULL;
...@@ -854,7 +857,7 @@ pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn) ...@@ -854,7 +857,7 @@ pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn)
if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child, if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child,
find_OF_pci_device_filter, (void *)node)) find_OF_pci_device_filter, (void *)node))
return -ENODEV; return -ENODEV;
reg = (unsigned int *) get_property(node, "reg", NULL); reg = get_property(node, "reg", NULL);
if (!reg) if (!reg)
return -ENODEV; return -ENODEV;
*bus = (reg[0] >> 16) & 0xff; *bus = (reg[0] >> 16) & 0xff;
...@@ -885,8 +888,8 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose, ...@@ -885,8 +888,8 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose,
struct device_node *dev, int primary) struct device_node *dev, int primary)
{ {
static unsigned int static_lc_ranges[256] __initdata; static unsigned int static_lc_ranges[256] __initdata;
unsigned int *dt_ranges, *lc_ranges, *ranges, *prev; const unsigned int *dt_ranges;
unsigned int size; unsigned int *lc_ranges, *ranges, *prev, size;
int rlen = 0, orig_rlen; int rlen = 0, orig_rlen;
int memno = 0; int memno = 0;
struct resource *res; struct resource *res;
...@@ -897,7 +900,7 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose, ...@@ -897,7 +900,7 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose,
* that can have more than 3 ranges, fortunately using contiguous * that can have more than 3 ranges, fortunately using contiguous
* addresses -- BenH * addresses -- BenH
*/ */
dt_ranges = (unsigned int *) get_property(dev, "ranges", &rlen); dt_ranges = get_property(dev, "ranges", &rlen);
if (!dt_ranges) if (!dt_ranges)
return; return;
/* Sanity check, though hopefully that never happens */ /* Sanity check, though hopefully that never happens */
......
...@@ -246,10 +246,10 @@ static void __init pcibios_claim_of_setup(void) ...@@ -246,10 +246,10 @@ static void __init pcibios_claim_of_setup(void)
#ifdef CONFIG_PPC_MULTIPLATFORM #ifdef CONFIG_PPC_MULTIPLATFORM
static u32 get_int_prop(struct device_node *np, const char *name, u32 def) static u32 get_int_prop(struct device_node *np, const char *name, u32 def)
{ {
u32 *prop; const u32 *prop;
int len; int len;
prop = (u32 *) get_property(np, name, &len); prop = get_property(np, name, &len);
if (prop && len >= 4) if (prop && len >= 4)
return *prop; return *prop;
return def; return def;
...@@ -278,10 +278,11 @@ static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev) ...@@ -278,10 +278,11 @@ static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev)
u64 base, size; u64 base, size;
unsigned int flags; unsigned int flags;
struct resource *res; struct resource *res;
u32 *addrs, i; const u32 *addrs;
u32 i;
int proplen; int proplen;
addrs = (u32 *) get_property(node, "assigned-addresses", &proplen); addrs = get_property(node, "assigned-addresses", &proplen);
if (!addrs) if (!addrs)
return; return;
DBG(" parse addresses (%d bytes) @ %p\n", proplen, addrs); DBG(" parse addresses (%d bytes) @ %p\n", proplen, addrs);
...@@ -381,7 +382,7 @@ void __devinit of_scan_bus(struct device_node *node, ...@@ -381,7 +382,7 @@ void __devinit of_scan_bus(struct device_node *node,
struct pci_bus *bus) struct pci_bus *bus)
{ {
struct device_node *child = NULL; struct device_node *child = NULL;
u32 *reg; const u32 *reg;
int reglen, devfn; int reglen, devfn;
struct pci_dev *dev; struct pci_dev *dev;
...@@ -389,7 +390,7 @@ void __devinit of_scan_bus(struct device_node *node, ...@@ -389,7 +390,7 @@ void __devinit of_scan_bus(struct device_node *node,
while ((child = of_get_next_child(node, child)) != NULL) { while ((child = of_get_next_child(node, child)) != NULL) {
DBG(" * %s\n", child->full_name); DBG(" * %s\n", child->full_name);
reg = (u32 *) get_property(child, "reg", &reglen); reg = get_property(child, "reg", &reglen);
if (reg == NULL || reglen < 20) if (reg == NULL || reglen < 20)
continue; continue;
devfn = (reg[0] >> 8) & 0xff; devfn = (reg[0] >> 8) & 0xff;
...@@ -413,7 +414,7 @@ void __devinit of_scan_pci_bridge(struct device_node *node, ...@@ -413,7 +414,7 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
struct pci_dev *dev) struct pci_dev *dev)
{ {
struct pci_bus *bus; struct pci_bus *bus;
u32 *busrange, *ranges; const u32 *busrange, *ranges;
int len, i, mode; int len, i, mode;
struct resource *res; struct resource *res;
unsigned int flags; unsigned int flags;
...@@ -422,13 +423,13 @@ void __devinit of_scan_pci_bridge(struct device_node *node, ...@@ -422,13 +423,13 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
DBG("of_scan_pci_bridge(%s)\n", node->full_name); DBG("of_scan_pci_bridge(%s)\n", node->full_name);
/* parse bus-range property */ /* parse bus-range property */
busrange = (u32 *) get_property(node, "bus-range", &len); busrange = get_property(node, "bus-range", &len);
if (busrange == NULL || len != 8) { if (busrange == NULL || len != 8) {
printk(KERN_DEBUG "Can't get bus-range for PCI-PCI bridge %s\n", printk(KERN_DEBUG "Can't get bus-range for PCI-PCI bridge %s\n",
node->full_name); node->full_name);
return; return;
} }
ranges = (u32 *) get_property(node, "ranges", &len); ranges = get_property(node, "ranges", &len);
if (ranges == NULL) { if (ranges == NULL) {
printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %s\n", printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %s\n",
node->full_name); node->full_name);
...@@ -892,13 +893,13 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node, ...@@ -892,13 +893,13 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node,
unsigned int size; unsigned int size;
}; };
struct isa_range *range; const struct isa_range *range;
unsigned long pci_addr; unsigned long pci_addr;
unsigned int isa_addr; unsigned int isa_addr;
unsigned int size; unsigned int size;
int rlen = 0; int rlen = 0;
range = (struct isa_range *) get_property(isa_node, "ranges", &rlen); range = get_property(isa_node, "ranges", &rlen);
if (range == NULL || (rlen < sizeof(struct isa_range))) { if (range == NULL || (rlen < sizeof(struct isa_range))) {
printk(KERN_ERR "no ISA ranges or unexpected isa range size," printk(KERN_ERR "no ISA ranges or unexpected isa range size,"
"mapping 64k\n"); "mapping 64k\n");
...@@ -939,7 +940,8 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node, ...@@ -939,7 +940,8 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node,
void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
struct device_node *dev, int prim) struct device_node *dev, int prim)
{ {
unsigned int *ranges, pci_space; const unsigned int *ranges;
unsigned int pci_space;
unsigned long size; unsigned long size;
int rlen = 0; int rlen = 0;
int memno = 0; int memno = 0;
...@@ -957,7 +959,7 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, ...@@ -957,7 +959,7 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
* (size depending on dev->n_addr_cells) * (size depending on dev->n_addr_cells)
* cells 4+5 or 5+6: the size of the range * cells 4+5 or 5+6: the size of the range
*/ */
ranges = (unsigned int *) get_property(dev, "ranges", &rlen); ranges = get_property(dev, "ranges", &rlen);
if (ranges == NULL) if (ranges == NULL)
return; return;
hose->io_base_phys = 0; hose->io_base_phys = 0;
......
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
static void * __devinit update_dn_pci_info(struct device_node *dn, void *data) static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
{ {
struct pci_controller *phb = data; struct pci_controller *phb = data;
int *type = (int *)get_property(dn, "ibm,pci-config-space-type", NULL); const int *type = get_property(dn, "ibm,pci-config-space-type", NULL);
u32 *regs; const u32 *regs;
struct pci_dn *pdn; struct pci_dn *pdn;
if (mem_init_done) if (mem_init_done)
...@@ -54,14 +54,14 @@ static void * __devinit update_dn_pci_info(struct device_node *dn, void *data) ...@@ -54,14 +54,14 @@ static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
dn->data = pdn; dn->data = pdn;
pdn->node = dn; pdn->node = dn;
pdn->phb = phb; pdn->phb = phb;
regs = (u32 *)get_property(dn, "reg", NULL); regs = get_property(dn, "reg", NULL);
if (regs) { if (regs) {
/* First register entry is addr (00BBSS00) */ /* First register entry is addr (00BBSS00) */
pdn->busno = (regs[0] >> 16) & 0xff; pdn->busno = (regs[0] >> 16) & 0xff;
pdn->devfn = (regs[0] >> 8) & 0xff; pdn->devfn = (regs[0] >> 8) & 0xff;
} }
if (firmware_has_feature(FW_FEATURE_ISERIES)) { if (firmware_has_feature(FW_FEATURE_ISERIES)) {
u32 *busp = (u32 *)get_property(dn, "linux,subbus", NULL); const u32 *busp = get_property(dn, "linux,subbus", NULL);
if (busp) if (busp)
pdn->bussubno = *busp; pdn->bussubno = *busp;
} }
...@@ -96,10 +96,11 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre, ...@@ -96,10 +96,11 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre,
/* We started with a phb, iterate all childs */ /* We started with a phb, iterate all childs */
for (dn = start->child; dn; dn = nextdn) { for (dn = start->child; dn; dn = nextdn) {
u32 *classp, class; const u32 *classp;
u32 class;
nextdn = NULL; nextdn = NULL;
classp = (u32 *)get_property(dn, "class-code", NULL); classp = get_property(dn, "class-code", NULL);
class = classp ? *classp : 0; class = classp ? *classp : 0;
if (pre && ((ret = pre(dn, data)) != NULL)) if (pre && ((ret = pre(dn, data)) != NULL))
......
...@@ -942,11 +942,11 @@ void __init early_init_devtree(void *params) ...@@ -942,11 +942,11 @@ void __init early_init_devtree(void *params)
int int
prom_n_addr_cells(struct device_node* np) prom_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;
ip = (int *) get_property(np, "#address-cells", NULL); ip = get_property(np, "#address-cells", NULL);
if (ip != NULL) if (ip != NULL)
return *ip; return *ip;
} while (np->parent); } while (np->parent);
...@@ -958,11 +958,11 @@ EXPORT_SYMBOL(prom_n_addr_cells); ...@@ -958,11 +958,11 @@ EXPORT_SYMBOL(prom_n_addr_cells);
int int
prom_n_size_cells(struct device_node* np) prom_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;
ip = (int *) get_property(np, "#size-cells", NULL); ip = get_property(np, "#size-cells", NULL);
if (ip != NULL) if (ip != NULL)
return *ip; return *ip;
} while (np->parent); } while (np->parent);
...@@ -1034,7 +1034,7 @@ int device_is_compatible(struct device_node *device, const char *compat) ...@@ -1034,7 +1034,7 @@ int device_is_compatible(struct device_node *device, const char *compat)
const char* cp; const char* cp;
int cplen, l; int cplen, l;
cp = (char *) get_property(device, "compatible", &cplen); cp = get_property(device, "compatible", &cplen);
if (cp == NULL) if (cp == NULL)
return 0; return 0;
while (cplen > 0) { while (cplen > 0) {
...@@ -1449,7 +1449,7 @@ static int of_finish_dynamic_node(struct device_node *node) ...@@ -1449,7 +1449,7 @@ static int of_finish_dynamic_node(struct device_node *node)
{ {
struct device_node *parent = of_get_parent(node); struct device_node *parent = of_get_parent(node);
int err = 0; int err = 0;
phandle *ibm_phandle; const phandle *ibm_phandle;
node->name = get_property(node, "name", NULL); node->name = get_property(node, "name", NULL);
node->type = get_property(node, "device_type", NULL); node->type = get_property(node, "device_type", NULL);
...@@ -1466,8 +1466,7 @@ static int of_finish_dynamic_node(struct device_node *node) ...@@ -1466,8 +1466,7 @@ static int of_finish_dynamic_node(struct device_node *node)
return -ENODEV; return -ENODEV;
/* fix up new node's linux_phandle field */ /* fix up new node's linux_phandle field */
if ((ibm_phandle = (unsigned int *)get_property(node, if ((ibm_phandle = get_property(node, "ibm,phandle", NULL)))
"ibm,phandle", NULL)))
node->linux_phandle = *ibm_phandle; node->linux_phandle = *ibm_phandle;
out: out:
...@@ -1658,16 +1657,16 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) ...@@ -1658,16 +1657,16 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
hardid = get_hard_smp_processor_id(cpu); hardid = get_hard_smp_processor_id(cpu);
for_each_node_by_type(np, "cpu") { for_each_node_by_type(np, "cpu") {
u32 *intserv; const u32 *intserv;
unsigned int plen, t; unsigned int plen, t;
/* Check for ibm,ppc-interrupt-server#s. If it doesn't exist /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist
* fallback to "reg" property and assume no threads * fallback to "reg" property and assume no threads
*/ */
intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s", intserv = get_property(np, "ibm,ppc-interrupt-server#s",
&plen); &plen);
if (intserv == NULL) { if (intserv == NULL) {
u32 *reg = (u32 *)get_property(np, "reg", NULL); const u32 *reg = get_property(np, "reg", NULL);
if (reg == NULL) if (reg == NULL)
continue; continue;
if (*reg == hardid) { if (*reg == hardid) {
......
...@@ -270,7 +270,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, ...@@ -270,7 +270,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
struct of_bus *pbus, u32 *addr, struct of_bus *pbus, 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;
u64 offset = OF_BAD_ADDR; u64 offset = OF_BAD_ADDR;
...@@ -287,7 +287,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, ...@@ -287,7 +287,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
* to translate addresses that aren't supposed to be translated in * to translate addresses that aren't supposed to be translated in
* the first place. --BenH. * the first place. --BenH.
*/ */
ranges = (u32 *)get_property(parent, "ranges", &rlen); ranges = get_property(parent, "ranges", &rlen);
if (ranges == NULL || rlen == 0) { if (ranges == NULL || rlen == 0) {
offset = of_read_number(addr, na); offset = of_read_number(addr, na);
memset(addr, 0, pna * 4); memset(addr, 0, pna * 4);
...@@ -330,7 +330,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, ...@@ -330,7 +330,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
* that can be mapped to a cpu physical address). This is not really specified * that can be mapped to a cpu physical address). This is not really specified
* that way, but this is traditionally the way IBM at least do things * that way, but this is traditionally the way IBM at least do things
*/ */
u64 of_translate_address(struct device_node *dev, u32 *in_addr) u64 of_translate_address(struct device_node *dev, const u32 *in_addr)
{ {
struct device_node *parent = NULL; struct device_node *parent = NULL;
struct of_bus *bus, *pbus; struct of_bus *bus, *pbus;
...@@ -407,10 +407,10 @@ u64 of_translate_address(struct device_node *dev, u32 *in_addr) ...@@ -407,10 +407,10 @@ u64 of_translate_address(struct device_node *dev, u32 *in_addr)
} }
EXPORT_SYMBOL(of_translate_address); EXPORT_SYMBOL(of_translate_address);
u32 *of_get_address(struct device_node *dev, int index, u64 *size, const u32 *of_get_address(struct device_node *dev, int index, u64 *size,
unsigned int *flags) unsigned int *flags)
{ {
u32 *prop; const u32 *prop;
unsigned int psize; unsigned int psize;
struct device_node *parent; struct device_node *parent;
struct of_bus *bus; struct of_bus *bus;
...@@ -427,7 +427,7 @@ u32 *of_get_address(struct device_node *dev, int index, u64 *size, ...@@ -427,7 +427,7 @@ u32 *of_get_address(struct device_node *dev, int index, u64 *size,
return NULL; return NULL;
/* Get "reg" or "assigned-addresses" property */ /* Get "reg" or "assigned-addresses" property */
prop = (u32 *)get_property(dev, bus->addresses, &psize); prop = get_property(dev, bus->addresses, &psize);
if (prop == NULL) if (prop == NULL)
return NULL; return NULL;
psize /= 4; psize /= 4;
...@@ -445,10 +445,10 @@ u32 *of_get_address(struct device_node *dev, int index, u64 *size, ...@@ -445,10 +445,10 @@ u32 *of_get_address(struct device_node *dev, int index, u64 *size,
} }
EXPORT_SYMBOL(of_get_address); EXPORT_SYMBOL(of_get_address);
u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, const u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
unsigned int *flags) unsigned int *flags)
{ {
u32 *prop; const u32 *prop;
unsigned int psize; unsigned int psize;
struct device_node *parent; struct device_node *parent;
struct of_bus *bus; struct of_bus *bus;
...@@ -469,7 +469,7 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, ...@@ -469,7 +469,7 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
return NULL; return NULL;
/* Get "reg" or "assigned-addresses" property */ /* Get "reg" or "assigned-addresses" property */
prop = (u32 *)get_property(dev, bus->addresses, &psize); prop = get_property(dev, bus->addresses, &psize);
if (prop == NULL) if (prop == NULL)
return NULL; return NULL;
psize /= 4; psize /= 4;
...@@ -487,7 +487,7 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, ...@@ -487,7 +487,7 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
} }
EXPORT_SYMBOL(of_get_pci_address); EXPORT_SYMBOL(of_get_pci_address);
static int __of_address_to_resource(struct device_node *dev, u32 *addrp, static int __of_address_to_resource(struct device_node *dev, const u32 *addrp,
u64 size, unsigned int flags, u64 size, unsigned int flags,
struct resource *r) struct resource *r)
{ {
...@@ -518,7 +518,7 @@ static int __of_address_to_resource(struct device_node *dev, u32 *addrp, ...@@ -518,7 +518,7 @@ static int __of_address_to_resource(struct device_node *dev, u32 *addrp,
int of_address_to_resource(struct device_node *dev, int index, int of_address_to_resource(struct device_node *dev, int index,
struct resource *r) struct resource *r)
{ {
u32 *addrp; const u32 *addrp;
u64 size; u64 size;
unsigned int flags; unsigned int flags;
...@@ -532,7 +532,7 @@ EXPORT_SYMBOL_GPL(of_address_to_resource); ...@@ -532,7 +532,7 @@ EXPORT_SYMBOL_GPL(of_address_to_resource);
int of_pci_address_to_resource(struct device_node *dev, int bar, int of_pci_address_to_resource(struct device_node *dev, int bar,
struct resource *r) struct resource *r)
{ {
u32 *addrp; const u32 *addrp;
u64 size; u64 size;
unsigned int flags; unsigned int flags;
...@@ -543,13 +543,14 @@ int of_pci_address_to_resource(struct device_node *dev, int bar, ...@@ -543,13 +543,14 @@ int of_pci_address_to_resource(struct device_node *dev, int bar,
} }
EXPORT_SYMBOL_GPL(of_pci_address_to_resource); EXPORT_SYMBOL_GPL(of_pci_address_to_resource);
void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop, void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
unsigned long *busno, unsigned long *phys, unsigned long *size) unsigned long *busno, unsigned long *phys, unsigned long *size)
{ {
u32 *dma_window, cells; const u32 *dma_window;
unsigned char *prop; u32 cells;
const unsigned char *prop;
dma_window = (u32 *)dma_window_prop; dma_window = dma_window_prop;
/* busno is always one cell */ /* busno is always one cell */
*busno = *(dma_window++); *busno = *(dma_window++);
...@@ -578,13 +579,13 @@ static struct device_node *of_irq_dflt_pic; ...@@ -578,13 +579,13 @@ static struct device_node *of_irq_dflt_pic;
static struct device_node *of_irq_find_parent(struct device_node *child) static struct device_node *of_irq_find_parent(struct device_node *child)
{ {
struct device_node *p; struct device_node *p;
phandle *parp; const phandle *parp;
if (!of_node_get(child)) if (!of_node_get(child))
return NULL; return NULL;
do { do {
parp = (phandle *)get_property(child, "interrupt-parent", NULL); parp = get_property(child, "interrupt-parent", NULL);
if (parp == NULL) if (parp == NULL)
p = of_get_parent(child); p = of_get_parent(child);
else { else {
...@@ -646,11 +647,11 @@ void of_irq_map_init(unsigned int flags) ...@@ -646,11 +647,11 @@ void of_irq_map_init(unsigned int flags)
} }
int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr, int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
struct of_irq *out_irq) const u32 *addr, struct of_irq *out_irq)
{ {
struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
u32 *tmp, *imap, *imask; const u32 *tmp, *imap, *imask;
u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
int imaplen, match, i; int imaplen, match, i;
...@@ -661,7 +662,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr, ...@@ -661,7 +662,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr,
* is none, we are nice and just walk up the tree * is none, we are nice and just walk up the tree
*/ */
do { do {
tmp = (u32 *)get_property(ipar, "#interrupt-cells", NULL); tmp = get_property(ipar, "#interrupt-cells", NULL);
if (tmp != NULL) { if (tmp != NULL) {
intsize = *tmp; intsize = *tmp;
break; break;
...@@ -682,7 +683,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr, ...@@ -682,7 +683,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr,
*/ */
old = of_node_get(ipar); old = of_node_get(ipar);
do { do {
tmp = (u32 *)get_property(old, "#address-cells", NULL); tmp = get_property(old, "#address-cells", NULL);
tnode = of_get_parent(old); tnode = of_get_parent(old);
of_node_put(old); of_node_put(old);
old = tnode; old = tnode;
...@@ -709,7 +710,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr, ...@@ -709,7 +710,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr,
} }
/* Now look for an interrupt-map */ /* Now look for an interrupt-map */
imap = (u32 *)get_property(ipar, "interrupt-map", &imaplen); imap = get_property(ipar, "interrupt-map", &imaplen);
/* No interrupt map, check for an interrupt parent */ /* No interrupt map, check for an interrupt parent */
if (imap == NULL) { if (imap == NULL) {
DBG(" -> no map, getting parent\n"); DBG(" -> no map, getting parent\n");
...@@ -719,7 +720,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr, ...@@ -719,7 +720,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr,
imaplen /= sizeof(u32); imaplen /= sizeof(u32);
/* Look for a mask */ /* Look for a mask */
imask = (u32 *)get_property(ipar, "interrupt-map-mask", NULL); imask = get_property(ipar, "interrupt-map-mask", NULL);
/* If we were passed no "reg" property and we attempt to parse /* If we were passed no "reg" property and we attempt to parse
* an interrupt-map, then #address-cells must be 0. * an interrupt-map, then #address-cells must be 0.
...@@ -766,14 +767,14 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr, ...@@ -766,14 +767,14 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr,
/* Get #interrupt-cells and #address-cells of new /* Get #interrupt-cells and #address-cells of new
* parent * parent
*/ */
tmp = (u32 *)get_property(newpar, "#interrupt-cells", tmp = get_property(newpar, "#interrupt-cells",
NULL); NULL);
if (tmp == NULL) { if (tmp == NULL) {
DBG(" -> parent lacks #interrupt-cells !\n"); DBG(" -> parent lacks #interrupt-cells !\n");
goto fail; goto fail;
} }
newintsize = *tmp; newintsize = *tmp;
tmp = (u32 *)get_property(newpar, "#address-cells", tmp = get_property(newpar, "#address-cells",
NULL); NULL);
newaddrsize = (tmp == NULL) ? 0 : *tmp; newaddrsize = (tmp == NULL) ? 0 : *tmp;
...@@ -819,14 +820,14 @@ EXPORT_SYMBOL_GPL(of_irq_map_raw); ...@@ -819,14 +820,14 @@ EXPORT_SYMBOL_GPL(of_irq_map_raw);
static int of_irq_map_oldworld(struct device_node *device, int index, static int of_irq_map_oldworld(struct device_node *device, int index,
struct of_irq *out_irq) struct of_irq *out_irq)
{ {
u32 *ints; const u32 *ints;
int intlen; int intlen;
/* /*
* Old machines just have a list of interrupt numbers * Old machines just have a list of interrupt numbers
* and no interrupt-controller nodes. * and no interrupt-controller nodes.
*/ */
ints = (u32 *) get_property(device, "AAPL,interrupts", &intlen); ints = get_property(device, "AAPL,interrupts", &intlen);
if (ints == NULL) if (ints == NULL)
return -EINVAL; return -EINVAL;
intlen /= sizeof(u32); intlen /= sizeof(u32);
...@@ -851,7 +852,8 @@ static int of_irq_map_oldworld(struct device_node *device, int index, ...@@ -851,7 +852,8 @@ static int of_irq_map_oldworld(struct device_node *device, int index,
int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq) int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq)
{ {
struct device_node *p; struct device_node *p;
u32 *intspec, *tmp, intsize, intlen, *addr; const u32 *intspec, *tmp, *addr;
u32 intsize, intlen;
int res; int res;
DBG("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index); DBG("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index);
...@@ -861,13 +863,13 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq ...@@ -861,13 +863,13 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq
return of_irq_map_oldworld(device, index, out_irq); return of_irq_map_oldworld(device, index, out_irq);
/* Get the interrupts property */ /* Get the interrupts property */
intspec = (u32 *)get_property(device, "interrupts", &intlen); intspec = get_property(device, "interrupts", &intlen);
if (intspec == NULL) if (intspec == NULL)
return -EINVAL; return -EINVAL;
intlen /= sizeof(u32); intlen /= sizeof(u32);
/* Get the reg property (if any) */ /* Get the reg property (if any) */
addr = (u32 *)get_property(device, "reg", NULL); addr = get_property(device, "reg", NULL);
/* Look for the interrupt parent. */ /* Look for the interrupt parent. */
p = of_irq_find_parent(device); p = of_irq_find_parent(device);
...@@ -875,7 +877,7 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq ...@@ -875,7 +877,7 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq
return -EINVAL; return -EINVAL;
/* Get size of interrupt specifier */ /* Get size of interrupt specifier */
tmp = (u32 *)get_property(p, "#interrupt-cells", NULL); tmp = get_property(p, "#interrupt-cells", NULL);
if (tmp == NULL) { if (tmp == NULL) {
of_node_put(p); of_node_put(p);
return -EINVAL; return -EINVAL;
......
...@@ -246,12 +246,12 @@ struct file_operations ppc_rtas_rmo_buf_ops = { ...@@ -246,12 +246,12 @@ struct file_operations ppc_rtas_rmo_buf_ops = {
static int ppc_rtas_find_all_sensors(void); static int ppc_rtas_find_all_sensors(void);
static void ppc_rtas_process_sensor(struct seq_file *m, static void ppc_rtas_process_sensor(struct seq_file *m,
struct individual_sensor *s, int state, int error, char *loc); struct individual_sensor *s, int state, int error, const char *loc);
static char *ppc_rtas_process_error(int error); static char *ppc_rtas_process_error(int error);
static void get_location_code(struct seq_file *m, static void get_location_code(struct seq_file *m,
struct individual_sensor *s, char *loc); struct individual_sensor *s, const char *loc);
static void check_location_string(struct seq_file *m, char *c); static void check_location_string(struct seq_file *m, const char *c);
static void check_location(struct seq_file *m, char *c); static void check_location(struct seq_file *m, const char *c);
static int __init proc_rtas_init(void) static int __init proc_rtas_init(void)
{ {
...@@ -446,11 +446,11 @@ static int ppc_rtas_sensors_show(struct seq_file *m, void *v) ...@@ -446,11 +446,11 @@ static int ppc_rtas_sensors_show(struct seq_file *m, void *v)
for (i=0; i<sensors.quant; i++) { for (i=0; i<sensors.quant; i++) {
struct individual_sensor *p = &sensors.sensor[i]; struct individual_sensor *p = &sensors.sensor[i];
char rstr[64]; char rstr[64];
char *loc; const char *loc;
int llen, offs; int llen, offs;
sprintf (rstr, SENSOR_PREFIX"%04d", p->token); sprintf (rstr, SENSOR_PREFIX"%04d", p->token);
loc = (char *) get_property(rtas_node, rstr, &llen); loc = get_property(rtas_node, rstr, &llen);
/* A sensor may have multiple instances */ /* A sensor may have multiple instances */
for (j = 0, offs = 0; j <= p->quant; j++) { for (j = 0, offs = 0; j <= p->quant; j++) {
...@@ -474,10 +474,10 @@ static int ppc_rtas_sensors_show(struct seq_file *m, void *v) ...@@ -474,10 +474,10 @@ static int ppc_rtas_sensors_show(struct seq_file *m, void *v)
static int ppc_rtas_find_all_sensors(void) static int ppc_rtas_find_all_sensors(void)
{ {
unsigned int *utmp; const unsigned int *utmp;
int len, i; int len, i;
utmp = (unsigned int *) get_property(rtas_node, "rtas-sensors", &len); utmp = get_property(rtas_node, "rtas-sensors", &len);
if (utmp == NULL) { if (utmp == NULL) {
printk (KERN_ERR "error: could not get rtas-sensors\n"); printk (KERN_ERR "error: could not get rtas-sensors\n");
return 1; return 1;
...@@ -530,7 +530,7 @@ static char *ppc_rtas_process_error(int error) ...@@ -530,7 +530,7 @@ static char *ppc_rtas_process_error(int error)
*/ */
static void ppc_rtas_process_sensor(struct seq_file *m, static void ppc_rtas_process_sensor(struct seq_file *m,
struct individual_sensor *s, int state, int error, char *loc) struct individual_sensor *s, int state, int error, const char *loc)
{ {
/* Defined return vales */ /* Defined return vales */
const char * key_switch[] = { "Off\t", "Normal\t", "Secure\t", const char * key_switch[] = { "Off\t", "Normal\t", "Secure\t",
...@@ -682,7 +682,7 @@ static void ppc_rtas_process_sensor(struct seq_file *m, ...@@ -682,7 +682,7 @@ static void ppc_rtas_process_sensor(struct seq_file *m,
/* ****************************************************************** */ /* ****************************************************************** */
static void check_location(struct seq_file *m, char *c) static void check_location(struct seq_file *m, const char *c)
{ {
switch (c[0]) { switch (c[0]) {
case LOC_PLANAR: case LOC_PLANAR:
...@@ -719,7 +719,7 @@ static void check_location(struct seq_file *m, char *c) ...@@ -719,7 +719,7 @@ static void check_location(struct seq_file *m, char *c)
* ${LETTER}${NUMBER}[[-/]${LETTER}${NUMBER} [ ... ] ] * ${LETTER}${NUMBER}[[-/]${LETTER}${NUMBER} [ ... ] ]
* the '.' may be an abbrevation * the '.' may be an abbrevation
*/ */
static void check_location_string(struct seq_file *m, char *c) static void check_location_string(struct seq_file *m, const char *c)
{ {
while (*c) { while (*c) {
if (isalpha(*c) || *c == '.') if (isalpha(*c) || *c == '.')
...@@ -733,7 +733,8 @@ static void check_location_string(struct seq_file *m, char *c) ...@@ -733,7 +733,8 @@ static void check_location_string(struct seq_file *m, char *c)
/* ****************************************************************** */ /* ****************************************************************** */
static void get_location_code(struct seq_file *m, struct individual_sensor *s, char *loc) static void get_location_code(struct seq_file *m, struct individual_sensor *s,
const char *loc)
{ {
if (!loc || !*loc) { if (!loc || !*loc) {
seq_printf(m, "---");/* does not have a location */ seq_printf(m, "---");/* does not have a location */
......
...@@ -177,10 +177,12 @@ void __init udbg_init_rtas_console(void) ...@@ -177,10 +177,12 @@ void __init udbg_init_rtas_console(void)
void rtas_progress(char *s, unsigned short hex) void rtas_progress(char *s, unsigned short hex)
{ {
struct device_node *root; struct device_node *root;
int width, *p; int width;
const int *p;
char *os; char *os;
static int display_character, set_indicator; static int display_character, set_indicator;
static int display_width, display_lines, *row_width, form_feed; static int display_width, display_lines, form_feed;
const static int *row_width;
static DEFINE_SPINLOCK(progress_lock); static DEFINE_SPINLOCK(progress_lock);
static int current_line; static int current_line;
static int pending_newline = 0; /* did last write end with unprinted newline? */ static int pending_newline = 0; /* did last write end with unprinted newline? */
...@@ -191,16 +193,16 @@ void rtas_progress(char *s, unsigned short hex) ...@@ -191,16 +193,16 @@ void rtas_progress(char *s, unsigned short hex)
if (display_width == 0) { if (display_width == 0) {
display_width = 0x10; display_width = 0x10;
if ((root = find_path_device("/rtas"))) { if ((root = find_path_device("/rtas"))) {
if ((p = (unsigned int *)get_property(root, if ((p = get_property(root,
"ibm,display-line-length", NULL))) "ibm,display-line-length", NULL)))
display_width = *p; display_width = *p;
if ((p = (unsigned int *)get_property(root, if ((p = get_property(root,
"ibm,form-feed", NULL))) "ibm,form-feed", NULL)))
form_feed = *p; form_feed = *p;
if ((p = (unsigned int *)get_property(root, if ((p = get_property(root,
"ibm,display-number-of-lines", NULL))) "ibm,display-number-of-lines", NULL)))
display_lines = *p; display_lines = *p;
row_width = (unsigned int *)get_property(root, row_width = get_property(root,
"ibm,display-truncation-length", NULL); "ibm,display-truncation-length", NULL);
} }
display_character = rtas_token("display-character"); display_character = rtas_token("display-character");
...@@ -293,10 +295,10 @@ EXPORT_SYMBOL(rtas_progress); /* needed by rtas_flash module */ ...@@ -293,10 +295,10 @@ EXPORT_SYMBOL(rtas_progress); /* needed by rtas_flash module */
int rtas_token(const char *service) int rtas_token(const char *service)
{ {
int *tokp; const int *tokp;
if (rtas.dev == NULL) if (rtas.dev == NULL)
return RTAS_UNKNOWN_SERVICE; return RTAS_UNKNOWN_SERVICE;
tokp = (int *) get_property(rtas.dev, service, NULL); tokp = get_property(rtas.dev, service, NULL);
return tokp ? *tokp : RTAS_UNKNOWN_SERVICE; return tokp ? *tokp : RTAS_UNKNOWN_SERVICE;
} }
EXPORT_SYMBOL(rtas_token); EXPORT_SYMBOL(rtas_token);
...@@ -824,15 +826,15 @@ void __init rtas_initialize(void) ...@@ -824,15 +826,15 @@ void __init rtas_initialize(void)
*/ */
rtas.dev = of_find_node_by_name(NULL, "rtas"); rtas.dev = of_find_node_by_name(NULL, "rtas");
if (rtas.dev) { if (rtas.dev) {
u32 *basep, *entryp; const u32 *basep, *entryp, *sizep;
u32 *sizep;
basep = (u32 *)get_property(rtas.dev, "linux,rtas-base", NULL); basep = get_property(rtas.dev, "linux,rtas-base", NULL);
sizep = (u32 *)get_property(rtas.dev, "rtas-size", NULL); sizep = get_property(rtas.dev, "rtas-size", NULL);
if (basep != NULL && sizep != NULL) { if (basep != NULL && sizep != NULL) {
rtas.base = *basep; rtas.base = *basep;
rtas.size = *sizep; rtas.size = *sizep;
entryp = (u32 *)get_property(rtas.dev, "linux,rtas-entry", NULL); entryp = get_property(rtas.dev,
"linux,rtas-entry", NULL);
if (entryp == NULL) /* Ugh */ if (entryp == NULL) /* Ugh */
rtas.entry = rtas.base; rtas.entry = rtas.base;
else else
......
...@@ -57,7 +57,7 @@ static inline int config_access_valid(struct pci_dn *dn, int where) ...@@ -57,7 +57,7 @@ static inline int config_access_valid(struct pci_dn *dn, int where)
static int of_device_available(struct device_node * dn) static int of_device_available(struct device_node * dn)
{ {
char * status; const char *status;
status = get_property(dn, "status", NULL); status = get_property(dn, "status", NULL);
...@@ -178,7 +178,7 @@ struct pci_ops rtas_pci_ops = { ...@@ -178,7 +178,7 @@ struct pci_ops rtas_pci_ops = {
int is_python(struct device_node *dev) int is_python(struct device_node *dev)
{ {
char *model = (char *)get_property(dev, "model", NULL); const char *model = get_property(dev, "model", NULL);
if (model && strstr(model, "Python")) if (model && strstr(model, "Python"))
return 1; return 1;
...@@ -234,7 +234,7 @@ void __init init_pci_config_tokens (void) ...@@ -234,7 +234,7 @@ void __init init_pci_config_tokens (void)
unsigned long __devinit get_phb_buid (struct device_node *phb) unsigned long __devinit get_phb_buid (struct device_node *phb)
{ {
int addr_cells; int addr_cells;
unsigned int *buid_vals; const unsigned int *buid_vals;
unsigned int len; unsigned int len;
unsigned long buid; unsigned long buid;
...@@ -247,7 +247,7 @@ unsigned long __devinit get_phb_buid (struct device_node *phb) ...@@ -247,7 +247,7 @@ unsigned long __devinit get_phb_buid (struct device_node *phb)
if (phb->parent->parent) if (phb->parent->parent)
return 0; return 0;
buid_vals = (unsigned int *) get_property(phb, "reg", &len); buid_vals = get_property(phb, "reg", &len);
if (buid_vals == NULL) if (buid_vals == NULL)
return 0; return 0;
...@@ -264,10 +264,10 @@ unsigned long __devinit get_phb_buid (struct device_node *phb) ...@@ -264,10 +264,10 @@ unsigned long __devinit get_phb_buid (struct device_node *phb)
static int phb_set_bus_ranges(struct device_node *dev, static int phb_set_bus_ranges(struct device_node *dev,
struct pci_controller *phb) struct pci_controller *phb)
{ {
int *bus_range; const int *bus_range;
unsigned int len; unsigned int len;
bus_range = (int *) get_property(dev, "bus-range", &len); bus_range = get_property(dev, "bus-range", &len);
if (bus_range == NULL || len < 2 * sizeof(int)) { if (bus_range == NULL || len < 2 * sizeof(int)) {
return 1; return 1;
} }
...@@ -325,15 +325,15 @@ unsigned long __init find_and_init_phbs(void) ...@@ -325,15 +325,15 @@ unsigned long __init find_and_init_phbs(void)
* in chosen. * in chosen.
*/ */
if (of_chosen) { if (of_chosen) {
int *prop; const int *prop;
prop = (int *)get_property(of_chosen, "linux,pci-probe-only", prop = get_property(of_chosen,
NULL); "linux,pci-probe-only", NULL);
if (prop) if (prop)
pci_probe_only = *prop; pci_probe_only = *prop;
prop = (int *)get_property(of_chosen, prop = get_property(of_chosen,
"linux,pci-assign-all-buses", NULL); "linux,pci-assign-all-buses", NULL);
if (prop) if (prop)
pci_assign_all_buses = *prop; pci_assign_all_buses = *prop;
} }
......
...@@ -304,16 +304,15 @@ struct seq_operations cpuinfo_op = { ...@@ -304,16 +304,15 @@ struct seq_operations cpuinfo_op = {
void __init check_for_initrd(void) void __init check_for_initrd(void)
{ {
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
unsigned long *prop; const unsigned long *prop;
DBG(" -> check_for_initrd()\n"); DBG(" -> check_for_initrd()\n");
if (of_chosen) { if (of_chosen) {
prop = (unsigned long *)get_property(of_chosen, prop = get_property(of_chosen, "linux,initrd-start", NULL);
"linux,initrd-start", NULL);
if (prop != NULL) { if (prop != NULL) {
initrd_start = (unsigned long)__va(*prop); initrd_start = (unsigned long)__va(*prop);
prop = (unsigned long *)get_property(of_chosen, prop = get_property(of_chosen,
"linux,initrd-end", NULL); "linux,initrd-end", NULL);
if (prop != NULL) { if (prop != NULL) {
initrd_end = (unsigned long)__va(*prop); initrd_end = (unsigned long)__va(*prop);
...@@ -366,15 +365,14 @@ void __init smp_setup_cpu_maps(void) ...@@ -366,15 +365,14 @@ void __init smp_setup_cpu_maps(void)
int cpu = 0; int cpu = 0;
while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) { while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) {
int *intserv; const int *intserv;
int j, len = sizeof(u32), nthreads = 1; int j, len = sizeof(u32), nthreads = 1;
intserv = (int *)get_property(dn, "ibm,ppc-interrupt-server#s", intserv = get_property(dn, "ibm,ppc-interrupt-server#s", &len);
&len);
if (intserv) if (intserv)
nthreads = len / sizeof(int); nthreads = len / sizeof(int);
else { else {
intserv = (int *) get_property(dn, "reg", NULL); intserv = get_property(dn, "reg", NULL);
if (!intserv) if (!intserv)
intserv = &cpu; /* assume logical == phys */ intserv = &cpu; /* assume logical == phys */
} }
...@@ -395,13 +393,12 @@ void __init smp_setup_cpu_maps(void) ...@@ -395,13 +393,12 @@ void __init smp_setup_cpu_maps(void)
if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) && if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) &&
(dn = of_find_node_by_path("/rtas"))) { (dn = of_find_node_by_path("/rtas"))) {
int num_addr_cell, num_size_cell, maxcpus; int num_addr_cell, num_size_cell, maxcpus;
unsigned int *ireg; const unsigned int *ireg;
num_addr_cell = prom_n_addr_cells(dn); num_addr_cell = prom_n_addr_cells(dn);
num_size_cell = prom_n_size_cells(dn); num_size_cell = prom_n_size_cells(dn);
ireg = (unsigned int *) ireg = get_property(dn, "ibm,lrdr-capacity", NULL);
get_property(dn, "ibm,lrdr-capacity", NULL);
if (!ireg) if (!ireg)
goto out; goto out;
......
...@@ -106,7 +106,7 @@ static int smt_enabled_cmdline; ...@@ -106,7 +106,7 @@ static int smt_enabled_cmdline;
static void check_smt_enabled(void) static void check_smt_enabled(void)
{ {
struct device_node *dn; struct device_node *dn;
char *smt_option; const char *smt_option;
/* Allow the command line to overrule the OF option */ /* Allow the command line to overrule the OF option */
if (smt_enabled_cmdline) if (smt_enabled_cmdline)
...@@ -115,7 +115,7 @@ static void check_smt_enabled(void) ...@@ -115,7 +115,7 @@ static void check_smt_enabled(void)
dn = of_find_node_by_path("/options"); dn = of_find_node_by_path("/options");
if (dn) { if (dn) {
smt_option = (char *)get_property(dn, "ibm,smt-enabled", NULL); smt_option = get_property(dn, "ibm,smt-enabled", NULL);
if (smt_option) { if (smt_option) {
if (!strcmp(smt_option, "on")) if (!strcmp(smt_option, "on"))
...@@ -292,7 +292,7 @@ static void __init initialize_cache_info(void) ...@@ -292,7 +292,7 @@ static void __init initialize_cache_info(void)
*/ */
if ( num_cpus == 1 ) { if ( num_cpus == 1 ) {
u32 *sizep, *lsizep; const u32 *sizep, *lsizep;
u32 size, lsize; u32 size, lsize;
const char *dc, *ic; const char *dc, *ic;
...@@ -307,10 +307,10 @@ static void __init initialize_cache_info(void) ...@@ -307,10 +307,10 @@ static void __init initialize_cache_info(void)
size = 0; size = 0;
lsize = cur_cpu_spec->dcache_bsize; lsize = cur_cpu_spec->dcache_bsize;
sizep = (u32 *)get_property(np, "d-cache-size", NULL); sizep = get_property(np, "d-cache-size", NULL);
if (sizep != NULL) if (sizep != NULL)
size = *sizep; size = *sizep;
lsizep = (u32 *) get_property(np, dc, NULL); lsizep = get_property(np, dc, NULL);
if (lsizep != NULL) if (lsizep != NULL)
lsize = *lsizep; lsize = *lsizep;
if (sizep == 0 || lsizep == 0) if (sizep == 0 || lsizep == 0)
...@@ -324,10 +324,10 @@ static void __init initialize_cache_info(void) ...@@ -324,10 +324,10 @@ static void __init initialize_cache_info(void)
size = 0; size = 0;
lsize = cur_cpu_spec->icache_bsize; lsize = cur_cpu_spec->icache_bsize;
sizep = (u32 *)get_property(np, "i-cache-size", NULL); sizep = get_property(np, "i-cache-size", NULL);
if (sizep != NULL) if (sizep != NULL)
size = *sizep; size = *sizep;
lsizep = (u32 *)get_property(np, ic, NULL); lsizep = get_property(np, ic, NULL);
if (lsizep != NULL) if (lsizep != NULL)
lsize = *lsizep; lsize = *lsizep;
if (sizep == 0 || lsizep == 0) if (sizep == 0 || lsizep == 0)
......
...@@ -60,7 +60,7 @@ static int smt_snooze_cmdline; ...@@ -60,7 +60,7 @@ static int smt_snooze_cmdline;
static int __init smt_setup(void) static int __init smt_setup(void)
{ {
struct device_node *options; struct device_node *options;
unsigned int *val; const unsigned int *val;
unsigned int cpu; unsigned int cpu;
if (!cpu_has_feature(CPU_FTR_SMT)) if (!cpu_has_feature(CPU_FTR_SMT))
...@@ -70,8 +70,7 @@ static int __init smt_setup(void) ...@@ -70,8 +70,7 @@ static int __init smt_setup(void)
if (!options) if (!options)
return -ENODEV; return -ENODEV;
val = (unsigned int *)get_property(options, "ibm,smt-snooze-delay", val = get_property(options, "ibm,smt-snooze-delay", NULL);
NULL);
if (!smt_snooze_cmdline && val) { if (!smt_snooze_cmdline && val) {
for_each_possible_cpu(cpu) for_each_possible_cpu(cpu)
per_cpu(smt_snooze_delay, cpu) = *val; per_cpu(smt_snooze_delay, cpu) = *val;
......
...@@ -859,14 +859,14 @@ EXPORT_SYMBOL(do_settimeofday); ...@@ -859,14 +859,14 @@ EXPORT_SYMBOL(do_settimeofday);
static int __init get_freq(char *name, int cells, unsigned long *val) static int __init get_freq(char *name, int cells, unsigned long *val)
{ {
struct device_node *cpu; struct device_node *cpu;
unsigned int *fp; const unsigned int *fp;
int found = 0; int found = 0;
/* The cpu node should have timebase and clock frequency properties */ /* The cpu node should have timebase and clock frequency properties */
cpu = of_find_node_by_type(NULL, "cpu"); cpu = of_find_node_by_type(NULL, "cpu");
if (cpu) { if (cpu) {
fp = (unsigned int *)get_property(cpu, name, NULL); fp = get_property(cpu, name, NULL);
if (fp) { if (fp) {
found = 1; found = 1;
*val = 0; *val = 0;
......
...@@ -77,7 +77,7 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev) ...@@ -77,7 +77,7 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
} else } else
#endif #endif
{ {
unsigned char *dma_window; const unsigned char *dma_window;
struct iommu_table *tbl; struct iommu_table *tbl;
unsigned long offset, size; unsigned long offset, size;
...@@ -217,7 +217,7 @@ static void __devinit vio_dev_release(struct device *dev) ...@@ -217,7 +217,7 @@ static void __devinit vio_dev_release(struct device *dev)
struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
{ {
struct vio_dev *viodev; struct vio_dev *viodev;
unsigned int *unit_address; const unsigned int *unit_address;
/* we need the 'device_type' property, in order to match with drivers */ /* we need the 'device_type' property, in order to match with drivers */
if (of_node->type == NULL) { if (of_node->type == NULL) {
...@@ -227,7 +227,7 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) ...@@ -227,7 +227,7 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
return NULL; return NULL;
} }
unit_address = (unsigned int *)get_property(of_node, "reg", NULL); unit_address = get_property(of_node, "reg", NULL);
if (unit_address == NULL) { if (unit_address == NULL) {
printk(KERN_WARNING "%s: node %s missing 'reg'\n", printk(KERN_WARNING "%s: node %s missing 'reg'\n",
__FUNCTION__, __FUNCTION__,
...@@ -249,7 +249,7 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) ...@@ -249,7 +249,7 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
viodev->type = of_node->type; viodev->type = of_node->type;
viodev->unit_address = *unit_address; viodev->unit_address = *unit_address;
if (firmware_has_feature(FW_FEATURE_ISERIES)) { if (firmware_has_feature(FW_FEATURE_ISERIES)) {
unit_address = (unsigned int *)get_property(of_node, unit_address = get_property(of_node,
"linux,unit_address", NULL); "linux,unit_address", NULL);
if (unit_address != NULL) if (unit_address != NULL)
viodev->unit_address = *unit_address; viodev->unit_address = *unit_address;
...@@ -423,7 +423,7 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp, ...@@ -423,7 +423,7 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp,
{ {
const struct vio_dev *vio_dev = to_vio_dev(dev); const struct vio_dev *vio_dev = to_vio_dev(dev);
struct device_node *dn = dev->platform_data; struct device_node *dn = dev->platform_data;
char *cp; const char *cp;
int length; int length;
if (!num_envp) if (!num_envp)
...@@ -431,7 +431,7 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp, ...@@ -431,7 +431,7 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp,
if (!dn) if (!dn)
return -ENODEV; return -ENODEV;
cp = (char *)get_property(dn, "compatible", &length); cp = get_property(dn, "compatible", &length);
if (!cp) if (!cp)
return -ENODEV; return -ENODEV;
...@@ -493,11 +493,11 @@ static struct vio_dev *vio_find_name(const char *kobj_name) ...@@ -493,11 +493,11 @@ static struct vio_dev *vio_find_name(const char *kobj_name)
*/ */
struct vio_dev *vio_find_node(struct device_node *vnode) struct vio_dev *vio_find_node(struct device_node *vnode)
{ {
uint32_t *unit_address; const uint32_t *unit_address;
char kobj_name[BUS_ID_SIZE]; char kobj_name[BUS_ID_SIZE];
/* construct the kobject name from the device node */ /* construct the kobject name from the device node */
unit_address = (uint32_t *)get_property(vnode, "reg", NULL); unit_address = get_property(vnode, "reg", NULL);
if (!unit_address) if (!unit_address)
return NULL; return NULL;
snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address); snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address);
......
...@@ -159,12 +159,12 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu) ...@@ -159,12 +159,12 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu)
{ {
unsigned int hw_cpuid = get_hard_smp_processor_id(cpu); unsigned int hw_cpuid = get_hard_smp_processor_id(cpu);
struct device_node *cpu_node = NULL; struct device_node *cpu_node = NULL;
unsigned int *interrupt_server, *reg; const unsigned int *interrupt_server, *reg;
int len; int len;
while ((cpu_node = of_find_node_by_type(cpu_node, "cpu")) != NULL) { while ((cpu_node = of_find_node_by_type(cpu_node, "cpu")) != NULL) {
/* Try interrupt server first */ /* Try interrupt server first */
interrupt_server = (unsigned int *)get_property(cpu_node, interrupt_server = get_property(cpu_node,
"ibm,ppc-interrupt-server#s", &len); "ibm,ppc-interrupt-server#s", &len);
len = len / sizeof(u32); len = len / sizeof(u32);
...@@ -175,8 +175,7 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu) ...@@ -175,8 +175,7 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu)
return cpu_node; return cpu_node;
} }
} else { } else {
reg = (unsigned int *)get_property(cpu_node, reg = get_property(cpu_node, "reg", &len);
"reg", &len);
if (reg && (len > 0) && (reg[0] == hw_cpuid)) if (reg && (len > 0) && (reg[0] == hw_cpuid))
return cpu_node; return cpu_node;
} }
...@@ -186,9 +185,9 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu) ...@@ -186,9 +185,9 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu)
} }
/* must hold reference to node during call */ /* must hold reference to node during call */
static int *of_get_associativity(struct device_node *dev) static const int *of_get_associativity(struct device_node *dev)
{ {
return (unsigned int *)get_property(dev, "ibm,associativity", NULL); return get_property(dev, "ibm,associativity", NULL);
} }
/* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa /* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa
...@@ -197,7 +196,7 @@ static int *of_get_associativity(struct device_node *dev) ...@@ -197,7 +196,7 @@ static int *of_get_associativity(struct device_node *dev)
static int of_node_to_nid_single(struct device_node *device) static int of_node_to_nid_single(struct device_node *device)
{ {
int nid = -1; int nid = -1;
unsigned int *tmp; const unsigned int *tmp;
if (min_common_depth == -1) if (min_common_depth == -1)
goto out; goto out;
...@@ -255,7 +254,7 @@ EXPORT_SYMBOL_GPL(of_node_to_nid); ...@@ -255,7 +254,7 @@ EXPORT_SYMBOL_GPL(of_node_to_nid);
static int __init find_min_common_depth(void) static int __init find_min_common_depth(void)
{ {
int depth; int depth;
unsigned int *ref_points; const unsigned int *ref_points;
struct device_node *rtas_root; struct device_node *rtas_root;
unsigned int len; unsigned int len;
...@@ -270,7 +269,7 @@ static int __init find_min_common_depth(void) ...@@ -270,7 +269,7 @@ static int __init find_min_common_depth(void)
* configuration (should be all 0's) and the second is for a normal * configuration (should be all 0's) and the second is for a normal
* NUMA configuration. * NUMA configuration.
*/ */
ref_points = (unsigned int *)get_property(rtas_root, ref_points = get_property(rtas_root,
"ibm,associativity-reference-points", &len); "ibm,associativity-reference-points", &len);
if ((len >= 1) && ref_points) { if ((len >= 1) && ref_points) {
...@@ -297,7 +296,7 @@ static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells) ...@@ -297,7 +296,7 @@ static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells)
of_node_put(memory); of_node_put(memory);
} }
static unsigned long __devinit read_n_cells(int n, unsigned int **buf) static unsigned long __devinit read_n_cells(int n, const unsigned int **buf)
{ {
unsigned long result = 0; unsigned long result = 0;
...@@ -435,15 +434,13 @@ static int __init parse_numa_properties(void) ...@@ -435,15 +434,13 @@ static int __init parse_numa_properties(void)
unsigned long size; unsigned long size;
int nid; int nid;
int ranges; int ranges;
unsigned int *memcell_buf; const unsigned int *memcell_buf;
unsigned int len; unsigned int len;
memcell_buf = (unsigned int *)get_property(memory, memcell_buf = get_property(memory,
"linux,usable-memory", &len); "linux,usable-memory", &len);
if (!memcell_buf || len <= 0) if (!memcell_buf || len <= 0)
memcell_buf = memcell_buf = get_property(memory, "reg", &len);
(unsigned int *)get_property(memory, "reg",
&len);
if (!memcell_buf || len <= 0) if (!memcell_buf || len <= 0)
continue; continue;
...@@ -787,10 +784,10 @@ int hot_add_scn_to_nid(unsigned long scn_addr) ...@@ -787,10 +784,10 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
unsigned long start, size; unsigned long start, size;
int ranges; int ranges;
unsigned int *memcell_buf; const unsigned int *memcell_buf;
unsigned int len; unsigned int len;
memcell_buf = (unsigned int *)get_property(memory, "reg", &len); memcell_buf = get_property(memory, "reg", &len);
if (!memcell_buf || len <= 0) if (!memcell_buf || len <= 0)
continue; continue;
......
...@@ -41,7 +41,7 @@ phys_addr_t get_immrbase(void) ...@@ -41,7 +41,7 @@ phys_addr_t get_immrbase(void)
soc = of_find_node_by_type(NULL, "soc"); soc = of_find_node_by_type(NULL, "soc");
if (soc) { if (soc) {
unsigned int size; unsigned int size;
void *prop = get_property(soc, "reg", &size); const void *prop = get_property(soc, "reg", &size);
immrbase = of_translate_address(soc, prop); immrbase = of_translate_address(soc, prop);
of_node_put(soc); of_node_put(soc);
}; };
...@@ -86,8 +86,8 @@ static int __init gfar_mdio_of_init(void) ...@@ -86,8 +86,8 @@ static int __init gfar_mdio_of_init(void)
while ((child = of_get_next_child(np, child)) != NULL) { while ((child = of_get_next_child(np, child)) != NULL) {
if (child->n_intrs) { if (child->n_intrs) {
u32 *id = const u32 *id =
(u32 *) get_property(child, "reg", NULL); get_property(child, "reg", NULL);
mdio_data.irq[*id] = child->intrs[0].line; mdio_data.irq[*id] = child->intrs[0].line;
} }
} }
...@@ -127,10 +127,10 @@ static int __init gfar_of_init(void) ...@@ -127,10 +127,10 @@ static int __init gfar_of_init(void)
struct resource r[4]; struct resource r[4];
struct device_node *phy, *mdio; struct device_node *phy, *mdio;
struct gianfar_platform_data gfar_data; struct gianfar_platform_data gfar_data;
unsigned int *id; const unsigned int *id;
char *model; const char *model;
void *mac_addr; const void *mac_addr;
phandle *ph; const phandle *ph;
memset(r, 0, sizeof(r)); memset(r, 0, sizeof(r));
memset(&gfar_data, 0, sizeof(gfar_data)); memset(&gfar_data, 0, sizeof(gfar_data));
...@@ -188,7 +188,7 @@ static int __init gfar_of_init(void) ...@@ -188,7 +188,7 @@ static int __init gfar_of_init(void)
FSL_GIANFAR_DEV_HAS_VLAN | FSL_GIANFAR_DEV_HAS_VLAN |
FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
ph = (phandle *) get_property(np, "phy-handle", NULL); ph = get_property(np, "phy-handle", NULL);
phy = of_find_node_by_phandle(*ph); phy = of_find_node_by_phandle(*ph);
if (phy == NULL) { if (phy == NULL) {
...@@ -198,7 +198,7 @@ static int __init gfar_of_init(void) ...@@ -198,7 +198,7 @@ static int __init gfar_of_init(void)
mdio = of_get_parent(phy); mdio = of_get_parent(phy);
id = (u32 *) get_property(phy, "reg", NULL); id = get_property(phy, "reg", NULL);
ret = of_address_to_resource(mdio, 0, &res); ret = of_address_to_resource(mdio, 0, &res);
if (ret) { if (ret) {
of_node_put(phy); of_node_put(phy);
...@@ -242,7 +242,7 @@ static int __init fsl_i2c_of_init(void) ...@@ -242,7 +242,7 @@ static int __init fsl_i2c_of_init(void)
i++) { i++) {
struct resource r[2]; struct resource r[2];
struct fsl_i2c_platform_data i2c_data; struct fsl_i2c_platform_data i2c_data;
unsigned char *flags = NULL; const unsigned char *flags = NULL;
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));
memset(&i2c_data, 0, sizeof(i2c_data)); memset(&i2c_data, 0, sizeof(i2c_data));
...@@ -294,7 +294,7 @@ static int __init mpc83xx_wdt_init(void) ...@@ -294,7 +294,7 @@ static int __init mpc83xx_wdt_init(void)
struct resource r; struct resource r;
struct device_node *soc, *np; struct device_node *soc, *np;
struct platform_device *dev; struct platform_device *dev;
unsigned int *freq; const unsigned int *freq;
int ret; int ret;
np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt"); np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt");
...@@ -311,7 +311,7 @@ static int __init mpc83xx_wdt_init(void) ...@@ -311,7 +311,7 @@ static int __init mpc83xx_wdt_init(void)
goto nosoc; goto nosoc;
} }
freq = (unsigned int *)get_property(soc, "bus-frequency", NULL); freq = get_property(soc, "bus-frequency", NULL);
if (!freq) { if (!freq) {
ret = -ENODEV; ret = -ENODEV;
goto err; goto err;
...@@ -351,7 +351,7 @@ nodev: ...@@ -351,7 +351,7 @@ nodev:
arch_initcall(mpc83xx_wdt_init); arch_initcall(mpc83xx_wdt_init);
#endif #endif
static enum fsl_usb2_phy_modes determine_usb_phy(char * phy_type) static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type)
{ {
if (!phy_type) if (!phy_type)
return FSL_USB2_PHY_NONE; return FSL_USB2_PHY_NONE;
...@@ -379,7 +379,7 @@ static int __init fsl_usb_of_init(void) ...@@ -379,7 +379,7 @@ static int __init fsl_usb_of_init(void)
i++) { i++) {
struct resource r[2]; struct resource r[2];
struct fsl_usb2_platform_data usb_data; struct fsl_usb2_platform_data usb_data;
unsigned char *prop = NULL; const unsigned char *prop = NULL;
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));
memset(&usb_data, 0, sizeof(usb_data)); memset(&usb_data, 0, sizeof(usb_data));
...@@ -428,7 +428,7 @@ static int __init fsl_usb_of_init(void) ...@@ -428,7 +428,7 @@ static int __init fsl_usb_of_init(void)
i++) { i++) {
struct resource r[2]; struct resource r[2];
struct fsl_usb2_platform_data usb_data; struct fsl_usb2_platform_data usb_data;
unsigned char *prop = NULL; const unsigned char *prop = NULL;
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));
memset(&usb_data, 0, sizeof(usb_data)); memset(&usb_data, 0, sizeof(usb_data));
......
...@@ -80,7 +80,7 @@ static ssize_t mmio_nvram_get_size(void) ...@@ -80,7 +80,7 @@ static ssize_t mmio_nvram_get_size(void)
int __init mmio_nvram_init(void) int __init mmio_nvram_init(void)
{ {
struct device_node *nvram_node; struct device_node *nvram_node;
unsigned long *buffer; const unsigned long *buffer;
int proplen; int proplen;
unsigned long nvram_addr; unsigned long nvram_addr;
int ret; int ret;
...@@ -91,7 +91,7 @@ int __init mmio_nvram_init(void) ...@@ -91,7 +91,7 @@ int __init mmio_nvram_init(void)
goto out; goto out;
ret = -EIO; ret = -EIO;
buffer = (unsigned long *)get_property(nvram_node, "reg", &proplen); buffer = get_property(nvram_node, "reg", &proplen);
if (proplen != 2*sizeof(unsigned long)) if (proplen != 2*sizeof(unsigned long))
goto out; goto out;
......
...@@ -48,7 +48,7 @@ extern struct dma_mapping_ops ibmebus_dma_ops; ...@@ -48,7 +48,7 @@ extern struct dma_mapping_ops ibmebus_dma_ops;
extern struct bus_type ibmebus_bus_type; extern struct bus_type ibmebus_bus_type;
struct ibmebus_dev { struct ibmebus_dev {
char *name; const char *name;
struct of_device ofdev; struct of_device ofdev;
}; };
......
...@@ -72,8 +72,8 @@ struct property { ...@@ -72,8 +72,8 @@ struct property {
}; };
struct device_node { struct device_node {
char *name; const char *name;
char *type; const char *type;
phandle node; phandle node;
phandle linux_phandle; phandle linux_phandle;
char *full_name; char *full_name;
...@@ -209,15 +209,15 @@ static inline u64 of_read_number(const u32 *cell, int size) ...@@ -209,15 +209,15 @@ static inline u64 of_read_number(const u32 *cell, int size)
/* Translate an OF address block into a CPU physical address /* Translate an OF address block into a CPU physical address
*/ */
#define OF_BAD_ADDR ((u64)-1) #define OF_BAD_ADDR ((u64)-1)
extern u64 of_translate_address(struct device_node *np, u32 *addr); extern u64 of_translate_address(struct device_node *np, const u32 *addr);
/* Extract an address from a device, returns the region size and /* Extract an address from a device, returns the region size and
* the address space flags too. The PCI version uses a BAR number * the address space flags too. The PCI version uses a BAR number
* instead of an absolute index * instead of an absolute index
*/ */
extern u32 *of_get_address(struct device_node *dev, int index, extern const u32 *of_get_address(struct device_node *dev, int index,
u64 *size, unsigned int *flags); u64 *size, unsigned int *flags);
extern u32 *of_get_pci_address(struct device_node *dev, int bar_no, extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
u64 *size, unsigned int *flags); u64 *size, unsigned int *flags);
/* Get an address as a resource. Note that if your address is /* Get an address as a resource. Note that if your address is
...@@ -234,7 +234,7 @@ extern int of_pci_address_to_resource(struct device_node *dev, int bar, ...@@ -234,7 +234,7 @@ extern int of_pci_address_to_resource(struct device_node *dev, int bar,
/* Parse the ibm,dma-window property of an OF node into the busno, phys and /* Parse the ibm,dma-window property of an OF node into the busno, phys and
* size parameters. * size parameters.
*/ */
void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop, void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
unsigned long *busno, unsigned long *phys, unsigned long *size); unsigned long *busno, unsigned long *phys, unsigned long *size);
extern void kdump_move_device_tree(void); extern void kdump_move_device_tree(void);
...@@ -288,8 +288,8 @@ extern void of_irq_map_init(unsigned int flags); ...@@ -288,8 +288,8 @@ extern void of_irq_map_init(unsigned int flags);
* *
*/ */
extern int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr, extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
struct of_irq *out_irq); const u32 *addr, struct of_irq *out_irq);
/*** /***
......
...@@ -46,8 +46,8 @@ struct iommu_table; ...@@ -46,8 +46,8 @@ struct iommu_table;
*/ */
struct vio_dev { struct vio_dev {
struct iommu_table *iommu_table; /* vio_map_* uses this */ struct iommu_table *iommu_table; /* vio_map_* uses this */
char *name; const char *name;
char *type; const char *type;
uint32_t unit_address; uint32_t unit_address;
unsigned int irq; unsigned int irq;
struct device dev; struct device dev;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册