[POWERPC] pseries: 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.

pseries platform changes.

Built for pseries_defconfig

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
Jeremy Kerr 2006-07-12 15:39:43 +10:00 коммит произвёл Paul Mackerras
Родитель a7f67bdf2c
Коммит 954a46e2d5
16 изменённых файлов: 72 добавлений и 73 удалений

Просмотреть файл

@ -691,11 +691,11 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
{ {
struct eeh_early_enable_info *info = data; struct eeh_early_enable_info *info = data;
int ret; int ret;
char *status = get_property(dn, "status", NULL); const char *status = get_property(dn, "status", NULL);
u32 *class_code = (u32 *)get_property(dn, "class-code", NULL); const u32 *class_code = get_property(dn, "class-code", NULL);
u32 *vendor_id = (u32 *)get_property(dn, "vendor-id", NULL); const u32 *vendor_id = get_property(dn, "vendor-id", NULL);
u32 *device_id = (u32 *)get_property(dn, "device-id", NULL); const u32 *device_id = get_property(dn, "device-id", NULL);
u32 *regs; const u32 *regs;
int enable; int enable;
struct pci_dn *pdn = PCI_DN(dn); struct pci_dn *pdn = PCI_DN(dn);
@ -737,7 +737,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
/* Ok... see if this device supports EEH. Some do, some don't, /* Ok... see if this device supports EEH. Some do, some don't,
* and the only way to find out is to check each and every one. */ * and the only way to find out is to check each and every one. */
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) */
/* Try to enable eeh */ /* Try to enable eeh */

Просмотреть файл

@ -268,14 +268,14 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
if (!frozen_dn) { if (!frozen_dn) {
location = (char *) get_property(event->dn, "ibm,loc-code", NULL); location = get_property(event->dn, "ibm,loc-code", NULL);
location = location ? location : "unknown"; location = location ? location : "unknown";
printk(KERN_ERR "EEH: Error: Cannot find partition endpoint " printk(KERN_ERR "EEH: Error: Cannot find partition endpoint "
"for location=%s pci addr=%s\n", "for location=%s pci addr=%s\n",
location, pci_name(event->dev)); location, pci_name(event->dev));
return NULL; return NULL;
} }
location = (char *) get_property(frozen_dn, "ibm,loc-code", NULL); location = get_property(frozen_dn, "ibm,loc-code", NULL);
location = location ? location : "unknown"; location = location ? location : "unknown";
/* There are two different styles for coming up with the PE. /* There are two different styles for coming up with the PE.

Просмотреть файл

@ -124,11 +124,11 @@ int eeh_send_failure_event (struct device_node *dn,
{ {
unsigned long flags; unsigned long flags;
struct eeh_event *event; struct eeh_event *event;
char *location; const char *location;
if (!mem_init_done) { if (!mem_init_done) {
printk(KERN_ERR "EEH: event during early boot not handled\n"); printk(KERN_ERR "EEH: event during early boot not handled\n");
location = (char *) get_property(dn, "ibm,loc-code", NULL); location = get_property(dn, "ibm,loc-code", NULL);
printk(KERN_ERR "EEH: device node = %s\n", dn->full_name); printk(KERN_ERR "EEH: device node = %s\n", dn->full_name);
printk(KERN_ERR "EEH: PCI location = %s\n", location); printk(KERN_ERR "EEH: PCI location = %s\n", location);
return 1; return 1;

Просмотреть файл

@ -68,7 +68,7 @@ firmware_features_table[FIRMWARE_MAX_FEATURES] = {
void __init fw_feature_init(void) void __init fw_feature_init(void)
{ {
struct device_node *dn; struct device_node *dn;
char *hypertas, *s; const char *hypertas, *s;
int len, i; int len, i;
DBG(" -> fw_feature_init()\n"); DBG(" -> fw_feature_init()\n");

Просмотреть файл

@ -267,13 +267,12 @@ static void iommu_table_setparms(struct pci_controller *phb,
struct iommu_table *tbl) struct iommu_table *tbl)
{ {
struct device_node *node; struct device_node *node;
unsigned long *basep; const unsigned long *basep, *sizep;
unsigned int *sizep;
node = (struct device_node *)phb->arch_data; node = (struct device_node *)phb->arch_data;
basep = (unsigned long *)get_property(node, "linux,tce-base", NULL); basep = get_property(node, "linux,tce-base", NULL);
sizep = (unsigned int *)get_property(node, "linux,tce-size", NULL); sizep = get_property(node, "linux,tce-size", NULL);
if (basep == NULL || sizep == NULL) { if (basep == NULL || sizep == NULL) {
printk(KERN_ERR "PCI_DMA: iommu_table_setparms: %s has " printk(KERN_ERR "PCI_DMA: iommu_table_setparms: %s has "
"missing tce entries !\n", dn->full_name); "missing tce entries !\n", dn->full_name);
@ -315,7 +314,7 @@ static void iommu_table_setparms(struct pci_controller *phb,
static void iommu_table_setparms_lpar(struct pci_controller *phb, static void iommu_table_setparms_lpar(struct pci_controller *phb,
struct device_node *dn, struct device_node *dn,
struct iommu_table *tbl, struct iommu_table *tbl,
unsigned char *dma_window) const void *dma_window)
{ {
unsigned long offset, size; unsigned long offset, size;
@ -415,7 +414,7 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
struct iommu_table *tbl; struct iommu_table *tbl;
struct device_node *dn, *pdn; struct device_node *dn, *pdn;
struct pci_dn *ppci; struct pci_dn *ppci;
unsigned char *dma_window = NULL; const void *dma_window = NULL;
DBG("iommu_bus_setup_pSeriesLP, bus %p, bus->self %p\n", bus, bus->self); DBG("iommu_bus_setup_pSeriesLP, bus %p, bus->self %p\n", bus, bus->self);
@ -519,7 +518,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
{ {
struct device_node *pdn, *dn; struct device_node *pdn, *dn;
struct iommu_table *tbl; struct iommu_table *tbl;
unsigned char *dma_window = NULL; const void *dma_window = NULL;
struct pci_dn *pci; struct pci_dn *pci;
DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, pci_name(dev)); DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, pci_name(dev));

Просмотреть файл

@ -204,20 +204,20 @@ void __init udbg_init_debug_lpar(void)
void __init find_udbg_vterm(void) void __init find_udbg_vterm(void)
{ {
struct device_node *stdout_node; struct device_node *stdout_node;
u32 *termno; const u32 *termno;
char *name; const char *name;
int add_console; int add_console;
/* find the boot console from /chosen/stdout */ /* find the boot console from /chosen/stdout */
if (!of_chosen) if (!of_chosen)
return; return;
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)
return; return;
stdout_node = of_find_node_by_path(name); stdout_node = of_find_node_by_path(name);
if (!stdout_node) if (!stdout_node)
return; return;
name = (char *)get_property(stdout_node, "name", NULL); name = get_property(stdout_node, "name", NULL);
if (!name) { if (!name) {
printk(KERN_WARNING "stdout node missing 'name' property!\n"); printk(KERN_WARNING "stdout node missing 'name' property!\n");
goto out; goto out;
@ -228,7 +228,7 @@ void __init find_udbg_vterm(void)
/* Check if it's a virtual terminal */ /* Check if it's a virtual terminal */
if (strncmp(name, "vty", 3) != 0) if (strncmp(name, "vty", 3) != 0)
goto out; goto out;
termno = (u32 *)get_property(stdout_node, "reg", NULL); termno = get_property(stdout_node, "reg", NULL);
if (termno == NULL) if (termno == NULL)
goto out; goto out;
vtermno = termno[0]; vtermno = termno[0];

Просмотреть файл

@ -123,13 +123,14 @@ static ssize_t pSeries_nvram_get_size(void)
int __init pSeries_nvram_init(void) int __init pSeries_nvram_init(void)
{ {
struct device_node *nvram; struct device_node *nvram;
unsigned int *nbytes_p, proplen; const unsigned int *nbytes_p;
unsigned int proplen;
nvram = of_find_node_by_type(NULL, "nvram"); nvram = of_find_node_by_type(NULL, "nvram");
if (nvram == NULL) if (nvram == NULL)
return -ENODEV; return -ENODEV;
nbytes_p = (unsigned int *)get_property(nvram, "#bytes", &proplen); nbytes_p = get_property(nvram, "#bytes", &proplen);
if (nbytes_p == NULL || proplen != sizeof(unsigned int)) if (nbytes_p == NULL || proplen != sizeof(unsigned int))
return -EIO; return -EIO;

Просмотреть файл

@ -60,7 +60,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_name_device);
static void __devinit check_s7a(void) static void __devinit check_s7a(void)
{ {
struct device_node *root; struct device_node *root;
char *model; const char *model;
s7a_workaround = 0; s7a_workaround = 0;
root = of_find_node_by_path("/"); root = of_find_node_by_path("/");

Просмотреть файл

@ -79,7 +79,7 @@ static void request_ras_irqs(struct device_node *np,
{ {
int i, index, count = 0; int i, index, count = 0;
struct of_irq oirq; struct of_irq oirq;
u32 *opicprop; const u32 *opicprop;
unsigned int opicplen; unsigned int opicplen;
unsigned int virqs[16]; unsigned int virqs[16];
@ -87,7 +87,7 @@ static void request_ras_irqs(struct device_node *np,
* map those interrupts using the default interrupt host and default * map those interrupts using the default interrupt host and default
* trigger * trigger
*/ */
opicprop = (u32 *)get_property(np, "open-pic-interrupt", &opicplen); opicprop = get_property(np, "open-pic-interrupt", &opicplen);
if (opicprop) { if (opicprop) {
opicplen /= sizeof(u32); opicplen /= sizeof(u32);
for (i = 0; i < opicplen; i++) { for (i = 0; i < opicplen; i++) {

Просмотреть файл

@ -359,11 +359,11 @@ static int enable_surveillance(int timeout)
static int get_eventscan_parms(void) static int get_eventscan_parms(void)
{ {
struct device_node *node; struct device_node *node;
int *ip; const int *ip;
node = of_find_node_by_path("/rtas"); node = of_find_node_by_path("/rtas");
ip = (int *)get_property(node, "rtas-event-scan-rate", NULL); ip = get_property(node, "rtas-event-scan-rate", NULL);
if (ip == NULL) { if (ip == NULL) {
printk(KERN_ERR "rtasd: no rtas-event-scan-rate\n"); printk(KERN_ERR "rtasd: no rtas-event-scan-rate\n");
of_node_put(node); of_node_put(node);

Просмотреть файл

@ -133,9 +133,9 @@ void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc,
static void __init pseries_mpic_init_IRQ(void) static void __init pseries_mpic_init_IRQ(void)
{ {
struct device_node *np, *old, *cascade = NULL; struct device_node *np, *old, *cascade = NULL;
unsigned int *addrp; const unsigned int *addrp;
unsigned long intack = 0; unsigned long intack = 0;
unsigned int *opprop; const unsigned int *opprop;
unsigned long openpic_addr = 0; unsigned long openpic_addr = 0;
unsigned int cascade_irq; unsigned int cascade_irq;
int naddr, n, i, opplen; int naddr, n, i, opplen;
@ -143,7 +143,7 @@ static void __init pseries_mpic_init_IRQ(void)
np = of_find_node_by_path("/"); np = of_find_node_by_path("/");
naddr = prom_n_addr_cells(np); naddr = prom_n_addr_cells(np);
opprop = (unsigned int *) get_property(np, "platform-open-pic", &opplen); opprop = get_property(np, "platform-open-pic", &opplen);
if (opprop != 0) { if (opprop != 0) {
openpic_addr = of_read_number(opprop, naddr); openpic_addr = of_read_number(opprop, naddr);
printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
@ -192,7 +192,7 @@ static void __init pseries_mpic_init_IRQ(void)
break; break;
if (strcmp(np->name, "pci") != 0) if (strcmp(np->name, "pci") != 0)
continue; continue;
addrp = (u32 *)get_property(np, "8259-interrupt-acknowledge", addrp = get_property(np, "8259-interrupt-acknowledge",
NULL); NULL);
if (addrp == NULL) if (addrp == NULL)
continue; continue;
@ -249,11 +249,11 @@ static void pseries_kexec_cpu_down_xics(int crash_shutdown, int secondary)
static void __init pseries_discover_pic(void) static void __init pseries_discover_pic(void)
{ {
struct device_node *np; struct device_node *np;
char *typep; const char *typep;
for (np = NULL; (np = of_find_node_by_name(np, for (np = NULL; (np = of_find_node_by_name(np,
"interrupt-controller"));) { "interrupt-controller"));) {
typep = (char *)get_property(np, "compatible", NULL); typep = get_property(np, "compatible", NULL);
if (strstr(typep, "open-pic")) { if (strstr(typep, "open-pic")) {
pSeries_mpic_node = of_node_get(np); pSeries_mpic_node = of_node_get(np);
ppc_md.init_IRQ = pseries_mpic_init_IRQ; ppc_md.init_IRQ = pseries_mpic_init_IRQ;

Просмотреть файл

@ -145,9 +145,9 @@ static int pSeries_add_processor(struct device_node *np)
unsigned int cpu; unsigned int cpu;
cpumask_t candidate_map, tmp = CPU_MASK_NONE; cpumask_t candidate_map, tmp = CPU_MASK_NONE;
int err = -ENOSPC, len, nthreads, i; int err = -ENOSPC, len, nthreads, i;
u32 *intserv; const u32 *intserv;
intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s", &len); intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len);
if (!intserv) if (!intserv)
return 0; return 0;
@ -205,9 +205,9 @@ static void pSeries_remove_processor(struct device_node *np)
{ {
unsigned int cpu; unsigned int cpu;
int len, nthreads, i; int len, nthreads, i;
u32 *intserv; const u32 *intserv;
intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s", &len); intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len);
if (!intserv) if (!intserv)
return; return;

Просмотреть файл

@ -604,14 +604,14 @@ static void __init xics_init_one_node(struct device_node *np,
unsigned int *indx) unsigned int *indx)
{ {
unsigned int ilen; unsigned int ilen;
u32 *ireg; const u32 *ireg;
/* This code does the theorically broken assumption that the interrupt /* This code does the theorically broken assumption that the interrupt
* server numbers are the same as the hard CPU numbers. * server numbers are the same as the hard CPU numbers.
* This happens to be the case so far but we are playing with fire... * This happens to be the case so far but we are playing with fire...
* should be fixed one of these days. -BenH. * should be fixed one of these days. -BenH.
*/ */
ireg = (u32 *)get_property(np, "ibm,interrupt-server-ranges", NULL); ireg = get_property(np, "ibm,interrupt-server-ranges", NULL);
/* Do that ever happen ? we'll know soon enough... but even good'old /* Do that ever happen ? we'll know soon enough... but even good'old
* f80 does have that property .. * f80 does have that property ..
@ -623,7 +623,7 @@ static void __init xics_init_one_node(struct device_node *np,
*/ */
*indx = *ireg; *indx = *ireg;
} }
ireg = (u32 *)get_property(np, "reg", &ilen); ireg = get_property(np, "reg", &ilen);
if (!ireg) if (!ireg)
panic("xics_init_IRQ: can't find interrupt reg property"); panic("xics_init_IRQ: can't find interrupt reg property");
@ -649,7 +649,7 @@ static void __init xics_setup_8259_cascade(void)
{ {
struct device_node *np, *old, *found = NULL; struct device_node *np, *old, *found = NULL;
int cascade, naddr; int cascade, naddr;
u32 *addrp; const u32 *addrp;
unsigned long intack = 0; unsigned long intack = 0;
for_each_node_by_type(np, "interrupt-controller") for_each_node_by_type(np, "interrupt-controller")
@ -675,7 +675,7 @@ static void __init xics_setup_8259_cascade(void)
break; break;
if (strcmp(np->name, "pci") != 0) if (strcmp(np->name, "pci") != 0)
continue; continue;
addrp = (u32 *)get_property(np, "8259-interrupt-acknowledge", NULL); addrp = get_property(np, "8259-interrupt-acknowledge", NULL);
if (addrp == NULL) if (addrp == NULL)
continue; continue;
naddr = prom_n_addr_cells(np); naddr = prom_n_addr_cells(np);
@ -694,7 +694,8 @@ void __init xics_init_IRQ(void)
{ {
int i; int i;
struct device_node *np; struct device_node *np;
u32 *ireg, ilen, indx = 0; u32 ilen, indx = 0;
const u32 *ireg;
int found = 0; int found = 0;
ppc64_boot_msg(0x20, "XICS Init"); ppc64_boot_msg(0x20, "XICS Init");
@ -719,18 +720,17 @@ void __init xics_init_IRQ(void)
for (np = of_find_node_by_type(NULL, "cpu"); for (np = of_find_node_by_type(NULL, "cpu");
np; np;
np = of_find_node_by_type(np, "cpu")) { np = of_find_node_by_type(np, "cpu")) {
ireg = (u32 *)get_property(np, "reg", &ilen); ireg = get_property(np, "reg", &ilen);
if (ireg && ireg[0] == get_hard_smp_processor_id(boot_cpuid)) { if (ireg && ireg[0] == get_hard_smp_processor_id(boot_cpuid)) {
ireg = (u32 *)get_property(np, ireg = get_property(np,
"ibm,ppc-interrupt-gserver#s", "ibm,ppc-interrupt-gserver#s", &ilen);
&ilen);
i = ilen / sizeof(int); i = ilen / sizeof(int);
if (ireg && i > 0) { if (ireg && i > 0) {
default_server = ireg[0]; default_server = ireg[0];
/* take last element */ /* take last element */
default_distrib_server = ireg[i-1]; default_distrib_server = ireg[i-1];
} }
ireg = (u32 *)get_property(np, ireg = get_property(np,
"ibm,interrupt-server#-size", NULL); "ibm,interrupt-server#-size", NULL);
if (ireg) if (ireg)
interrupt_server_size = *ireg; interrupt_server_size = *ireg;

Просмотреть файл

@ -141,7 +141,7 @@ static int hvc_find_vtys(void)
for (vty = of_find_node_by_name(NULL, "vty"); vty != NULL; for (vty = of_find_node_by_name(NULL, "vty"); vty != NULL;
vty = of_find_node_by_name(vty, "vty")) { vty = of_find_node_by_name(vty, "vty")) {
uint32_t *vtermno; const uint32_t *vtermno;
/* We have statically defined space for only a certain number /* We have statically defined space for only a certain number
* of console adapters. * of console adapters.
@ -149,7 +149,7 @@ static int hvc_find_vtys(void)
if (num_found >= MAX_NR_HVC_CONSOLES) if (num_found >= MAX_NR_HVC_CONSOLES)
break; break;
vtermno = (uint32_t *)get_property(vty, "reg", NULL); vtermno = get_property(vty, "reg", NULL);
if (!vtermno) if (!vtermno)
continue; continue;

Просмотреть файл

@ -1276,11 +1276,10 @@ static int __init hvsi_console_init(void)
vty != NULL; vty != NULL;
vty = of_find_compatible_node(vty, "serial", "hvterm-protocol")) { vty = of_find_compatible_node(vty, "serial", "hvterm-protocol")) {
struct hvsi_struct *hp; struct hvsi_struct *hp;
uint32_t *vtermno; const uint32_t *vtermno, *irq;
uint32_t *irq;
vtermno = (uint32_t *)get_property(vty, "reg", NULL); vtermno = get_property(vty, "reg", NULL);
irq = (uint32_t *)get_property(vty, "interrupts", NULL); irq = get_property(vty, "interrupts", NULL);
if (!vtermno || !irq) if (!vtermno || !irq)
continue; continue;

Просмотреть файл

@ -176,16 +176,16 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe
return 0; return 0;
} }
static int get_children_props(struct device_node *dn, int **drc_indexes, static int get_children_props(struct device_node *dn, const int **drc_indexes,
int **drc_names, int **drc_types, int **drc_power_domains) const int **drc_names, const int **drc_types,
const int **drc_power_domains)
{ {
int *indexes, *names; const int *indexes, *names, *types, *domains;
int *types, *domains;
indexes = (int *) get_property(dn, "ibm,drc-indexes", NULL); indexes = get_property(dn, "ibm,drc-indexes", NULL);
names = (int *) get_property(dn, "ibm,drc-names", NULL); names = get_property(dn, "ibm,drc-names", NULL);
types = (int *) get_property(dn, "ibm,drc-types", NULL); types = get_property(dn, "ibm,drc-types", NULL);
domains = (int *) get_property(dn, "ibm,drc-power-domains", NULL); domains = get_property(dn, "ibm,drc-power-domains", NULL);
if (!indexes || !names || !types || !domains) { if (!indexes || !names || !types || !domains) {
/* Slot does not have dynamically-removable children */ /* Slot does not have dynamically-removable children */
@ -212,13 +212,13 @@ static int get_children_props(struct device_node *dn, int **drc_indexes,
int rpaphp_get_drc_props(struct device_node *dn, int *drc_index, int rpaphp_get_drc_props(struct device_node *dn, int *drc_index,
char **drc_name, char **drc_type, int *drc_power_domain) char **drc_name, char **drc_type, int *drc_power_domain)
{ {
int *indexes, *names; const int *indexes, *names;
int *types, *domains; const int *types, *domains;
unsigned int *my_index; const unsigned int *my_index;
char *name_tmp, *type_tmp; char *name_tmp, *type_tmp;
int i, rc; int i, rc;
my_index = (int *) get_property(dn, "ibm,my-drc-index", NULL); my_index = get_property(dn, "ibm,my-drc-index", NULL);
if (!my_index) { if (!my_index) {
/* Node isn't DLPAR/hotplug capable */ /* Node isn't DLPAR/hotplug capable */
return -EINVAL; return -EINVAL;
@ -265,10 +265,10 @@ static int is_php_type(char *drc_type)
return 1; return 1;
} }
static int is_php_dn(struct device_node *dn, int **indexes, int **names, static int is_php_dn(struct device_node *dn, const int **indexes,
int **types, int **power_domains) const int **names, const int **types, const int **power_domains)
{ {
int *drc_types; const int *drc_types;
int rc; int rc;
rc = get_children_props(dn, indexes, names, &drc_types, power_domains); rc = get_children_props(dn, indexes, names, &drc_types, power_domains);
@ -296,7 +296,7 @@ int rpaphp_add_slot(struct device_node *dn)
struct slot *slot; struct slot *slot;
int retval = 0; int retval = 0;
int i; int i;
int *indexes, *names, *types, *power_domains; const int *indexes, *names, *types, *power_domains;
char *name, *type; char *name, *type;
dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name); dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name);