]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[POWERPC] pseries: Constify & voidify get_property()
authorJeremy Kerr <jk@ozlabs.org>
Wed, 12 Jul 2006 05:39:43 +0000 (15:39 +1000)
committerPaul Mackerras <paulus@samba.org>
Mon, 31 Jul 2006 05:55:04 +0000 (15:55 +1000)
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>
16 files changed:
arch/powerpc/platforms/pseries/eeh.c
arch/powerpc/platforms/pseries/eeh_driver.c
arch/powerpc/platforms/pseries/eeh_event.c
arch/powerpc/platforms/pseries/firmware.c
arch/powerpc/platforms/pseries/iommu.c
arch/powerpc/platforms/pseries/lpar.c
arch/powerpc/platforms/pseries/nvram.c
arch/powerpc/platforms/pseries/pci.c
arch/powerpc/platforms/pseries/ras.c
arch/powerpc/platforms/pseries/rtasd.c
arch/powerpc/platforms/pseries/setup.c
arch/powerpc/platforms/pseries/smp.c
arch/powerpc/platforms/pseries/xics.c
drivers/char/hvc_vio.c
drivers/char/hvsi.c
drivers/pci/hotplug/rpaphp_core.c

index 32eaddfa5470a635741228ada3365e4b9f20b5de..5a23ce5e16ff147ac6621989d2e9d0eeaa0570d6 100644 (file)
@@ -691,11 +691,11 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
 {
        struct eeh_early_enable_info *info = data;
        int ret;
-       char *status = get_property(dn, "status", NULL);
-       u32 *class_code = (u32 *)get_property(dn, "class-code", NULL);
-       u32 *vendor_id = (u32 *)get_property(dn, "vendor-id", NULL);
-       u32 *device_id = (u32 *)get_property(dn, "device-id", NULL);
-       u32 *regs;
+       const char *status = get_property(dn, "status", NULL);
+       const u32 *class_code = get_property(dn, "class-code", NULL);
+       const u32 *vendor_id = get_property(dn, "vendor-id", NULL);
+       const u32 *device_id = get_property(dn, "device-id", NULL);
+       const u32 *regs;
        int enable;
        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,
         * 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) {
                /* First register entry is addr (00BBSS00)  */
                /* Try to enable eeh */
index aaad2c0afcbf93868c581bf9d1f971bcbdc41794..3269d2cd428bcd174ce4422504b330d861e3fa44 100644 (file)
@@ -268,14 +268,14 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
 
        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";
                printk(KERN_ERR "EEH: Error: Cannot find partition endpoint "
                                "for location=%s pci addr=%s\n",
                        location, pci_name(event->dev));
                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";
 
        /* There are two different styles for coming up with the PE.
index 45ccc687e57cbedc3395f0c113b7117a5c6c1b53..137077451316b7f83f8e88f1a0aebc026a4b3092 100644 (file)
@@ -124,11 +124,11 @@ int eeh_send_failure_event (struct device_node *dn,
 {
        unsigned long flags;
        struct eeh_event *event;
-       char *location;
+       const char *location;
 
        if (!mem_init_done) {
                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: PCI location = %s\n", location);
                return 1;
index c01d8f0cbe6d01a6537e0f5f295a3a910d1d892b..1c7b2baa5f73cf97758bf681a2420c75865bfaf3 100644 (file)
@@ -68,7 +68,7 @@ firmware_features_table[FIRMWARE_MAX_FEATURES] = {
 void __init fw_feature_init(void)
 {
        struct device_node *dn;
-       char *hypertas, *s;
+       const char *hypertas, *s;
        int len, i;
 
        DBG(" -> fw_feature_init()\n");
index d67af2c657544ef5b0a6386a9c45a31de2fb4681..bbf2e34dc3582442a9e65c2a404c4e7ddd31619e 100644 (file)
@@ -267,13 +267,12 @@ static void iommu_table_setparms(struct pci_controller *phb,
                                 struct iommu_table *tbl)
 {
        struct device_node *node;
-       unsigned long *basep;
-       unsigned int *sizep;
+       const unsigned long *basep, *sizep;
 
        node = (struct device_node *)phb->arch_data;
 
-       basep = (unsigned long *)get_property(node, "linux,tce-base", NULL);
-       sizep = (unsigned int *)get_property(node, "linux,tce-size", NULL);
+       basep = get_property(node, "linux,tce-base", NULL);
+       sizep = get_property(node, "linux,tce-size", NULL);
        if (basep == NULL || sizep == NULL) {
                printk(KERN_ERR "PCI_DMA: iommu_table_setparms: %s has "
                                "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,
                                      struct device_node *dn,
                                      struct iommu_table *tbl,
-                                     unsigned char *dma_window)
+                                     const void *dma_window)
 {
        unsigned long offset, size;
 
@@ -415,7 +414,7 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
        struct iommu_table *tbl;
        struct device_node *dn, *pdn;
        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);
 
@@ -519,7 +518,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
 {
        struct device_node *pdn, *dn;
        struct iommu_table *tbl;
-       unsigned char *dma_window = NULL;
+       const void *dma_window = NULL;
        struct pci_dn *pci;
 
        DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, pci_name(dev));
index 3aeb4069904203e8e2c7d6e4f71bdc70a7d2da01..4cb7ff227f72e12a3e62c84751cd66dc7f470966 100644 (file)
@@ -204,20 +204,20 @@ void __init udbg_init_debug_lpar(void)
 void __init find_udbg_vterm(void)
 {
        struct device_node *stdout_node;
-       u32 *termno;
-       char *name;
+       const u32 *termno;
+       const char *name;
        int add_console;
 
        /* find the boot console from /chosen/stdout */
        if (!of_chosen)
                return;
-       name = (char *)get_property(of_chosen, "linux,stdout-path", NULL);
+       name = get_property(of_chosen, "linux,stdout-path", NULL);
        if (name == NULL)
                return;
        stdout_node = of_find_node_by_path(name);
        if (!stdout_node)
                return;
-       name = (char *)get_property(stdout_node, "name", NULL);
+       name = get_property(stdout_node, "name", NULL);
        if (!name) {
                printk(KERN_WARNING "stdout node missing 'name' property!\n");
                goto out;
@@ -228,7 +228,7 @@ void __init find_udbg_vterm(void)
        /* Check if it's a virtual terminal */
        if (strncmp(name, "vty", 3) != 0)
                goto out;
-       termno = (u32 *)get_property(stdout_node, "reg", NULL);
+       termno = get_property(stdout_node, "reg", NULL);
        if (termno == NULL)
                goto out;
        vtermno = termno[0];
index 18abfb1f4e24852383671ddf6e82fd62ae784be4..64163cecdf93f2819fd74481b034de89e470dda1 100644 (file)
@@ -123,13 +123,14 @@ static ssize_t pSeries_nvram_get_size(void)
 int __init pSeries_nvram_init(void)
 {
        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");
        if (nvram == NULL)
                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))
                return -EIO;
 
index e97e67f5e07914eaded444fdb499e576b8a5a183..410a6bcc4ca008b9444e92ed567d9f29ac487577 100644 (file)
@@ -60,7 +60,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_name_device);
 static void __devinit check_s7a(void)
 {
        struct device_node *root;
-       char *model;
+       const char *model;
 
        s7a_workaround = 0;
        root = of_find_node_by_path("/");
index 9df783088b618347471e2afd7e446bd387b6f4c9..0e6339ee45a15290edfea66ca2b6f6ddec749aea 100644 (file)
@@ -79,7 +79,7 @@ static void request_ras_irqs(struct device_node *np,
 {
        int i, index, count = 0;
        struct of_irq oirq;
-       u32 *opicprop;
+       const u32 *opicprop;
        unsigned int opicplen;
        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
         * trigger
         */
-       opicprop = (u32 *)get_property(np, "open-pic-interrupt", &opicplen);
+       opicprop = get_property(np, "open-pic-interrupt", &opicplen);
        if (opicprop) {
                opicplen /= sizeof(u32);
                for (i = 0; i < opicplen; i++) {
index 2e4e04042d85705f9700de82ba8aabe001e8239c..8ca2612221d65c2f85763b5ba09f6d69d22098cf 100644 (file)
@@ -359,11 +359,11 @@ static int enable_surveillance(int timeout)
 static int get_eventscan_parms(void)
 {
        struct device_node *node;
-       int *ip;
+       const int *ip;
 
        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) {
                printk(KERN_ERR "rtasd: no rtas-event-scan-rate\n");
                of_node_put(node);
index 54a52437265c50ecb5d0038a3c070c67d1945a9c..927e0a423b87ae3f86c313430f73ef98ed468b7a 100644 (file)
@@ -133,9 +133,9 @@ void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc,
 static void __init pseries_mpic_init_IRQ(void)
 {
        struct device_node *np, *old, *cascade = NULL;
-        unsigned int *addrp;
+        const unsigned int *addrp;
        unsigned long intack = 0;
-       unsigned int *opprop;
+       const unsigned int *opprop;
        unsigned long openpic_addr = 0;
        unsigned int cascade_irq;
        int naddr, n, i, opplen;
@@ -143,7 +143,7 @@ static void __init pseries_mpic_init_IRQ(void)
 
        np = of_find_node_by_path("/");
        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) {
                openpic_addr = of_read_number(opprop, naddr);
                printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
@@ -192,7 +192,7 @@ static void __init pseries_mpic_init_IRQ(void)
                        break;
                if (strcmp(np->name, "pci") != 0)
                        continue;
-               addrp = (u32 *)get_property(np, "8259-interrupt-acknowledge",
+               addrp = get_property(np, "8259-interrupt-acknowledge",
                                            NULL);
                if (addrp == NULL)
                        continue;
@@ -249,11 +249,11 @@ static void pseries_kexec_cpu_down_xics(int crash_shutdown, int secondary)
 static void __init pseries_discover_pic(void)
 {
        struct device_node *np;
-       char *typep;
+       const char *typep;
 
        for (np = NULL; (np = of_find_node_by_name(np,
                                                   "interrupt-controller"));) {
-               typep = (char *)get_property(np, "compatible", NULL);
+               typep = get_property(np, "compatible", NULL);
                if (strstr(typep, "open-pic")) {
                        pSeries_mpic_node = of_node_get(np);
                        ppc_md.init_IRQ       = pseries_mpic_init_IRQ;
index ac61098ff401ca90c586243cb7f3b17eacdf5a1a..f39dad8b99e0dd287c88f45f86176d3ed896f275 100644 (file)
@@ -145,9 +145,9 @@ static int pSeries_add_processor(struct device_node *np)
        unsigned int cpu;
        cpumask_t candidate_map, tmp = CPU_MASK_NONE;
        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)
                return 0;
 
@@ -205,9 +205,9 @@ static void pSeries_remove_processor(struct device_node *np)
 {
        unsigned int cpu;
        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)
                return;
 
index 716972aa9777298fd308ff2c1d01c27b6ea290ef..75642104944147e18a14eea0afdf87c22a19b3e8 100644 (file)
@@ -604,14 +604,14 @@ static void __init xics_init_one_node(struct device_node *np,
                                      unsigned int *indx)
 {
        unsigned int ilen;
-       u32 *ireg;
+       const u32 *ireg;
 
        /* This code does the theorically broken assumption that the interrupt
         * server numbers are the same as the hard CPU numbers.
         * This happens to be the case so far but we are playing with fire...
         * 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
         * f80 does have that property ..
@@ -623,7 +623,7 @@ static void __init xics_init_one_node(struct device_node *np,
                 */
                *indx = *ireg;
        }
-       ireg = (u32 *)get_property(np, "reg", &ilen);
+       ireg = get_property(np, "reg", &ilen);
        if (!ireg)
                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;
        int cascade, naddr;
-       u32 *addrp;
+       const u32 *addrp;
        unsigned long intack = 0;
 
        for_each_node_by_type(np, "interrupt-controller")
@@ -675,7 +675,7 @@ static void __init xics_setup_8259_cascade(void)
                        break;
                if (strcmp(np->name, "pci") != 0)
                        continue;
-               addrp = (u32 *)get_property(np, "8259-interrupt-acknowledge", NULL);
+               addrp = get_property(np, "8259-interrupt-acknowledge", NULL);
                if (addrp == NULL)
                        continue;
                naddr = prom_n_addr_cells(np);
@@ -694,7 +694,8 @@ void __init xics_init_IRQ(void)
 {
        int i;
        struct device_node *np;
-       u32 *ireg, ilen, indx = 0;
+       u32 ilen, indx = 0;
+       const u32 *ireg;
        int found = 0;
 
        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");
             np;
             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)) {
-                       ireg = (u32 *)get_property(np,
-                                                 "ibm,ppc-interrupt-gserver#s",
-                                                  &ilen);
+                       ireg = get_property(np,
+                                       "ibm,ppc-interrupt-gserver#s", &ilen);
                        i = ilen / sizeof(int);
                        if (ireg && i > 0) {
                                default_server = ireg[0];
                                /* take last element */
                                default_distrib_server = ireg[i-1];
                        }
-                       ireg = (u32 *)get_property(np,
+                       ireg = get_property(np,
                                        "ibm,interrupt-server#-size", NULL);
                        if (ireg)
                                interrupt_server_size = *ireg;
index 651e5d25f58b6437aeea17fc7f31b2cd5ed5ffc2..cc95941148fbfe2d824200413f58f08fcb3baafb 100644 (file)
@@ -141,7 +141,7 @@ static int hvc_find_vtys(void)
 
        for (vty = of_find_node_by_name(NULL, "vty"); vty != NULL;
                        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
                 * of console adapters.
@@ -149,7 +149,7 @@ static int hvc_find_vtys(void)
                if (num_found >= MAX_NR_HVC_CONSOLES)
                        break;
 
-               vtermno = (uint32_t *)get_property(vty, "reg", NULL);
+               vtermno = get_property(vty, "reg", NULL);
                if (!vtermno)
                        continue;
 
index 56612a2dca6be14d2cf05d84552f6a1f2a1c538c..542de0e51f353267cee292d8b2b06266fa7d1e7e 100644 (file)
@@ -1276,11 +1276,10 @@ static int __init hvsi_console_init(void)
                        vty != NULL;
                        vty = of_find_compatible_node(vty, "serial", "hvterm-protocol")) {
                struct hvsi_struct *hp;
-               uint32_t *vtermno;
-               uint32_t *irq;
+               const uint32_t *vtermno, *irq;
 
-               vtermno = (uint32_t *)get_property(vty, "reg", NULL);
-               irq = (uint32_t *)get_property(vty, "interrupts", NULL);
+               vtermno = get_property(vty, "reg", NULL);
+               irq = get_property(vty, "interrupts", NULL);
                if (!vtermno || !irq)
                        continue;
 
index 076bd6dcafae6ffa588898f2930f47c3f9833a10..7288a3eccfb3e34b1bab1a8d2d9e6a762858d746 100644 (file)
@@ -176,16 +176,16 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe
        return 0;
 }
 
-static int get_children_props(struct device_node *dn, int **drc_indexes,
-               int **drc_names, int **drc_types, int **drc_power_domains)
+static int get_children_props(struct device_node *dn, const int **drc_indexes,
+               const int **drc_names, const int **drc_types,
+               const int **drc_power_domains)
 {
-       int *indexes, *names;
-       int *types, *domains;
+       const int *indexes, *names, *types, *domains;
 
-       indexes = (int *) get_property(dn, "ibm,drc-indexes", NULL);
-       names = (int *) get_property(dn, "ibm,drc-names", NULL);
-       types = (int *) get_property(dn, "ibm,drc-types", NULL);
-       domains = (int *) get_property(dn, "ibm,drc-power-domains", NULL);
+       indexes = get_property(dn, "ibm,drc-indexes", NULL);
+       names = get_property(dn, "ibm,drc-names", NULL);
+       types = get_property(dn, "ibm,drc-types", NULL);
+       domains = get_property(dn, "ibm,drc-power-domains", NULL);
 
        if (!indexes || !names || !types || !domains) {
                /* 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,
                char **drc_name, char **drc_type, int *drc_power_domain)
 {
-       int *indexes, *names;
-       int *types, *domains;
-       unsigned int *my_index;
+       const int *indexes, *names;
+       const int *types, *domains;
+       const unsigned int *my_index;
        char *name_tmp, *type_tmp;
        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) {
                /* Node isn't DLPAR/hotplug capable */
                return -EINVAL;
@@ -265,10 +265,10 @@ static int is_php_type(char *drc_type)
        return 1;
 }
 
-static int is_php_dn(struct device_node *dn, int **indexes, int **names,
-               int **types, int **power_domains)
+static int is_php_dn(struct device_node *dn, const int **indexes,
+               const int **names, const int **types, const int **power_domains)
 {
-       int *drc_types;
+       const int *drc_types;
        int rc;
 
        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;
        int retval = 0;
        int i;
-       int *indexes, *names, *types, *power_domains;
+       const int *indexes, *names, *types, *power_domains;
        char *name, *type;
 
        dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name);