Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

maple platform changes.

Built for maple_defconfig

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by

Jeremy Kerr and committed by
Paul Mackerras
eeb2b723 ae6b4101

+21 -26
+11 -9
arch/powerpc/platforms/maple/pci.c
··· 38 38 static int __init fixup_one_level_bus_range(struct device_node *node, int higher) 39 39 { 40 40 for (; node != 0;node = node->sibling) { 41 - int * bus_range; 42 - unsigned int *class_code; 41 + const int *bus_range; 42 + const unsigned int *class_code; 43 43 int len; 44 44 45 45 /* For PCI<->PCI bridges or CardBus bridges, we go down */ 46 - class_code = (unsigned int *) get_property(node, "class-code", NULL); 46 + class_code = get_property(node, "class-code", NULL); 47 47 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && 48 48 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) 49 49 continue; 50 - bus_range = (int *) get_property(node, "bus-range", &len); 50 + bus_range = get_property(node, "bus-range", &len); 51 51 if (bus_range != NULL && len > 2 * sizeof(int)) { 52 52 if (bus_range[1] > higher) 53 53 higher = bus_range[1]; ··· 65 65 */ 66 66 static void __init fixup_bus_range(struct device_node *bridge) 67 67 { 68 - int * bus_range; 68 + int *bus_range; 69 + struct property *prop; 69 70 int len; 70 71 71 72 /* Lookup the "bus-range" property for the hose */ 72 - bus_range = (int *) get_property(bridge, "bus-range", &len); 73 - if (bus_range == NULL || len < 2 * sizeof(int)) { 73 + prop = of_find_property(bridge, "bus-range", &len); 74 + if (prop == NULL || prop->value == NULL || len < 2 * sizeof(int)) { 74 75 printk(KERN_WARNING "Can't get bus-range for %s\n", 75 76 bridge->full_name); 76 77 return; 77 78 } 79 + bus_range = (int *)prop->value; 78 80 bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); 79 81 } 80 82 ··· 316 314 int len; 317 315 struct pci_controller *hose; 318 316 char* disp_name; 319 - int *bus_range; 317 + const int *bus_range; 320 318 int primary = 1; 321 319 322 320 DBG("Adding PCI host bridge %s\n", dev->full_name); 323 321 324 - bus_range = (int *) get_property(dev, "bus-range", &len); 322 + bus_range = get_property(dev, "bus-range", &len); 325 323 if (bus_range == NULL || len < 2 * sizeof(int)) { 326 324 printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", 327 325 dev->full_name);
+10 -17
arch/powerpc/platforms/maple/setup.c
··· 99 99 static void maple_restart(char *cmd) 100 100 { 101 101 unsigned int maple_nvram_base; 102 - unsigned int maple_nvram_offset; 103 - unsigned int maple_nvram_command; 102 + const unsigned int *maple_nvram_offset, *maple_nvram_command; 104 103 struct device_node *sp; 105 104 106 105 maple_nvram_base = maple_find_nvram_base(); ··· 112 113 printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); 113 114 goto fail; 114 115 } 115 - maple_nvram_offset = *(unsigned int*) get_property(sp, 116 - "restart-addr", NULL); 117 - maple_nvram_command = *(unsigned int*) get_property(sp, 118 - "restart-value", NULL); 116 + maple_nvram_offset = get_property(sp, "restart-addr", NULL); 117 + maple_nvram_command = get_property(sp, "restart-value", NULL); 119 118 of_node_put(sp); 120 119 121 120 /* send command */ 122 - outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); 121 + outb_p(*maple_nvram_command, maple_nvram_base + *maple_nvram_offset); 123 122 for (;;) ; 124 123 fail: 125 124 printk(KERN_EMERG "Maple: Manual Restart Required\n"); ··· 126 129 static void maple_power_off(void) 127 130 { 128 131 unsigned int maple_nvram_base; 129 - unsigned int maple_nvram_offset; 130 - unsigned int maple_nvram_command; 132 + const unsigned int *maple_nvram_offset, *maple_nvram_command; 131 133 struct device_node *sp; 132 134 133 135 maple_nvram_base = maple_find_nvram_base(); ··· 139 143 printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); 140 144 goto fail; 141 145 } 142 - maple_nvram_offset = *(unsigned int*) get_property(sp, 143 - "power-off-addr", NULL); 144 - maple_nvram_command = *(unsigned int*) get_property(sp, 145 - "power-off-value", NULL); 146 + maple_nvram_offset = get_property(sp, "power-off-addr", NULL); 147 + maple_nvram_command = get_property(sp, "power-off-value", NULL); 146 148 of_node_put(sp); 147 149 148 150 /* send command */ 149 - outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); 151 + outb_p(*maple_nvram_command, maple_nvram_base + *maple_nvram_offset); 150 152 for (;;) ; 151 153 fail: 152 154 printk(KERN_EMERG "Maple: Manual Power-Down Required\n"); ··· 205 211 static void __init maple_init_IRQ(void) 206 212 { 207 213 struct device_node *root, *np, *mpic_node = NULL; 208 - unsigned int *opprop; 214 + const unsigned int *opprop; 209 215 unsigned long openpic_addr = 0; 210 216 int naddr, n, i, opplen, has_isus = 0; 211 217 struct mpic *mpic; ··· 228 234 /* Find address list in /platform-open-pic */ 229 235 root = of_find_node_by_path("/"); 230 236 naddr = prom_n_addr_cells(root); 231 - opprop = (unsigned int *) get_property(root, "platform-open-pic", 232 - &opplen); 237 + opprop = get_property(root, "platform-open-pic", &opplen); 233 238 if (opprop != 0) { 234 239 openpic_addr = of_read_number(opprop, naddr); 235 240 has_isus = (opplen > naddr);