aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powermac/pci.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2006-07-12 01:40:29 -0400
committerPaul Mackerras <paulus@samba.org>2006-07-31 01:55:05 -0400
commit018a3d1db7cdb6127656c1622ee1d2302e16436d (patch)
tree5b6714fa9fcd1441f7c1b30e0391484c095925b6 /arch/powerpc/platforms/powermac/pci.c
parenteeb2b723ef5100fafa381d92eb70d83e98516a44 (diff)
[POWERPC] powermac: 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. powermac platform & macintosh driver changes. Built for pmac32_defconfig, g5_defconfig Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/powermac/pci.c')
-rw-r--r--arch/powerpc/platforms/powermac/pci.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 556b349797e8..787ffd999bc2 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -69,16 +69,16 @@ struct device_node *k2_skiplist[2];
69static int __init fixup_one_level_bus_range(struct device_node *node, int higher) 69static int __init fixup_one_level_bus_range(struct device_node *node, int higher)
70{ 70{
71 for (; node != 0;node = node->sibling) { 71 for (; node != 0;node = node->sibling) {
72 int * bus_range; 72 const int * bus_range;
73 unsigned int *class_code; 73 const unsigned int *class_code;
74 int len; 74 int len;
75 75
76 /* For PCI<->PCI bridges or CardBus bridges, we go down */ 76 /* For PCI<->PCI bridges or CardBus bridges, we go down */
77 class_code = (unsigned int *) get_property(node, "class-code", NULL); 77 class_code = get_property(node, "class-code", NULL);
78 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && 78 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
79 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) 79 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
80 continue; 80 continue;
81 bus_range = (int *) get_property(node, "bus-range", &len); 81 bus_range = get_property(node, "bus-range", &len);
82 if (bus_range != NULL && len > 2 * sizeof(int)) { 82 if (bus_range != NULL && len > 2 * sizeof(int)) {
83 if (bus_range[1] > higher) 83 if (bus_range[1] > higher)
84 higher = bus_range[1]; 84 higher = bus_range[1];
@@ -96,13 +96,15 @@ static int __init fixup_one_level_bus_range(struct device_node *node, int higher
96 */ 96 */
97static void __init fixup_bus_range(struct device_node *bridge) 97static void __init fixup_bus_range(struct device_node *bridge)
98{ 98{
99 int * bus_range; 99 int *bus_range, len;
100 int len; 100 struct property *prop;
101 101
102 /* Lookup the "bus-range" property for the hose */ 102 /* Lookup the "bus-range" property for the hose */
103 bus_range = (int *) get_property(bridge, "bus-range", &len); 103 prop = of_find_property(bridge, "bus-range", &len);
104 if (bus_range == NULL || len < 2 * sizeof(int)) 104 if (prop == NULL || prop->length < 2 * sizeof(int))
105 return; 105 return;
106
107 bus_range = (int *)prop->value;
106 bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); 108 bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]);
107} 109}
108 110
@@ -240,7 +242,7 @@ static struct pci_ops macrisc_pci_ops =
240static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset) 242static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset)
241{ 243{
242 struct device_node *np; 244 struct device_node *np;
243 u32 *vendor, *device; 245 const u32 *vendor, *device;
244 246
245 if (offset >= 0x100) 247 if (offset >= 0x100)
246 return PCIBIOS_BAD_REGISTER_NUMBER; 248 return PCIBIOS_BAD_REGISTER_NUMBER;
@@ -248,8 +250,8 @@ static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset)
248 if (np == NULL) 250 if (np == NULL)
249 return PCIBIOS_DEVICE_NOT_FOUND; 251 return PCIBIOS_DEVICE_NOT_FOUND;
250 252
251 vendor = (u32 *)get_property(np, "vendor-id", NULL); 253 vendor = get_property(np, "vendor-id", NULL);
252 device = (u32 *)get_property(np, "device-id", NULL); 254 device = get_property(np, "device-id", NULL);
253 if (vendor == NULL || device == NULL) 255 if (vendor == NULL || device == NULL)
254 return PCIBIOS_DEVICE_NOT_FOUND; 256 return PCIBIOS_DEVICE_NOT_FOUND;
255 257
@@ -689,20 +691,21 @@ static void __init fixup_nec_usb2(void)
689 691
690 for (nec = NULL; (nec = of_find_node_by_name(nec, "usb")) != NULL;) { 692 for (nec = NULL; (nec = of_find_node_by_name(nec, "usb")) != NULL;) {
691 struct pci_controller *hose; 693 struct pci_controller *hose;
692 u32 data, *prop; 694 u32 data;
695 const u32 *prop;
693 u8 bus, devfn; 696 u8 bus, devfn;
694 697
695 prop = (u32 *)get_property(nec, "vendor-id", NULL); 698 prop = get_property(nec, "vendor-id", NULL);
696 if (prop == NULL) 699 if (prop == NULL)
697 continue; 700 continue;
698 if (0x1033 != *prop) 701 if (0x1033 != *prop)
699 continue; 702 continue;
700 prop = (u32 *)get_property(nec, "device-id", NULL); 703 prop = get_property(nec, "device-id", NULL);
701 if (prop == NULL) 704 if (prop == NULL)
702 continue; 705 continue;
703 if (0x0035 != *prop) 706 if (0x0035 != *prop)
704 continue; 707 continue;
705 prop = (u32 *)get_property(nec, "reg", NULL); 708 prop = get_property(nec, "reg", NULL);
706 if (prop == NULL) 709 if (prop == NULL)
707 continue; 710 continue;
708 devfn = (prop[0] >> 8) & 0xff; 711 devfn = (prop[0] >> 8) & 0xff;
@@ -901,7 +904,7 @@ static int __init add_bridge(struct device_node *dev)
901 struct pci_controller *hose; 904 struct pci_controller *hose;
902 struct resource rsrc; 905 struct resource rsrc;
903 char *disp_name; 906 char *disp_name;
904 int *bus_range; 907 const int *bus_range;
905 int primary = 1, has_address = 0; 908 int primary = 1, has_address = 0;
906 909
907 DBG("Adding PCI host bridge %s\n", dev->full_name); 910 DBG("Adding PCI host bridge %s\n", dev->full_name);
@@ -910,7 +913,7 @@ static int __init add_bridge(struct device_node *dev)
910 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); 913 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
911 914
912 /* Get bus range if any */ 915 /* Get bus range if any */
913 bus_range = (int *) get_property(dev, "bus-range", &len); 916 bus_range = get_property(dev, "bus-range", &len);
914 if (bus_range == NULL || len < 2 * sizeof(int)) { 917 if (bus_range == NULL || len < 2 * sizeof(int)) {
915 printk(KERN_WARNING "Can't get bus-range for %s, assume" 918 printk(KERN_WARNING "Can't get bus-range for %s, assume"
916 " bus 0\n", dev->full_name); 919 " bus 0\n", dev->full_name);