diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2006-07-12 01:35:54 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-07-31 01:55:04 -0400 |
commit | a7f67bdf2c9f24509b8e81e0f35573b611987c80 (patch) | |
tree | 201662dd6504418ef3c84cfe1f280153a4d8cb29 /arch/powerpc/kernel/pci_32.c | |
parent | 4288b92b9644fdb4c6168273873fe08f32090d7a (diff) |
[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: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/pci_32.c')
-rw-r--r-- | arch/powerpc/kernel/pci_32.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c index 898dae8ab6d9..3f6bd36e9e14 100644 --- a/arch/powerpc/kernel/pci_32.c +++ b/arch/powerpc/kernel/pci_32.c | |||
@@ -633,12 +633,12 @@ pcibios_alloc_controller(void) | |||
633 | static void | 633 | static void |
634 | make_one_node_map(struct device_node* node, u8 pci_bus) | 634 | make_one_node_map(struct device_node* node, u8 pci_bus) |
635 | { | 635 | { |
636 | int *bus_range; | 636 | const int *bus_range; |
637 | int len; | 637 | int len; |
638 | 638 | ||
639 | if (pci_bus >= pci_bus_count) | 639 | if (pci_bus >= pci_bus_count) |
640 | return; | 640 | return; |
641 | bus_range = (int *) get_property(node, "bus-range", &len); | 641 | bus_range = get_property(node, "bus-range", &len); |
642 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 642 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
643 | printk(KERN_WARNING "Can't get bus-range for %s, " | 643 | printk(KERN_WARNING "Can't get bus-range for %s, " |
644 | "assuming it starts at 0\n", node->full_name); | 644 | "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 | 648 | ||
649 | for (node=node->child; node != 0;node = node->sibling) { | 649 | for (node=node->child; node != 0;node = node->sibling) { |
650 | struct pci_dev* dev; | 650 | struct pci_dev* dev; |
651 | unsigned int *class_code, *reg; | 651 | const unsigned int *class_code, *reg; |
652 | 652 | ||
653 | class_code = (unsigned int *) get_property(node, "class-code", NULL); | 653 | class_code = get_property(node, "class-code", NULL); |
654 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && | 654 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && |
655 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) | 655 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) |
656 | continue; | 656 | continue; |
657 | reg = (unsigned int *)get_property(node, "reg", NULL); | 657 | reg = get_property(node, "reg", NULL); |
658 | if (!reg) | 658 | if (!reg) |
659 | continue; | 659 | continue; |
660 | dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff)); | 660 | dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff)); |
@@ -669,7 +669,7 @@ pcibios_make_OF_bus_map(void) | |||
669 | { | 669 | { |
670 | int i; | 670 | int i; |
671 | struct pci_controller* hose; | 671 | struct pci_controller* hose; |
672 | u8* of_prop_map; | 672 | struct property *map_prop; |
673 | 673 | ||
674 | pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL); | 674 | pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL); |
675 | if (!pci_to_OF_bus_map) { | 675 | if (!pci_to_OF_bus_map) { |
@@ -691,9 +691,12 @@ pcibios_make_OF_bus_map(void) | |||
691 | continue; | 691 | continue; |
692 | make_one_node_map(node, hose->first_busno); | 692 | make_one_node_map(node, hose->first_busno); |
693 | } | 693 | } |
694 | of_prop_map = get_property(find_path_device("/"), "pci-OF-bus-map", NULL); | 694 | map_prop = of_find_property(find_path_device("/"), |
695 | if (of_prop_map) | 695 | "pci-OF-bus-map", NULL); |
696 | memcpy(of_prop_map, pci_to_OF_bus_map, pci_bus_count); | 696 | if (map_prop) { |
697 | BUG_ON(pci_bus_count > map_prop->length); | ||
698 | memcpy(map_prop->value, pci_to_OF_bus_map, pci_bus_count); | ||
699 | } | ||
697 | #ifdef DEBUG | 700 | #ifdef DEBUG |
698 | printk("PCI->OF bus map:\n"); | 701 | printk("PCI->OF bus map:\n"); |
699 | for (i=0; i<pci_bus_count; i++) { | 702 | 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 | struct device_node* sub_node; | 715 | struct device_node* sub_node; |
713 | 716 | ||
714 | for (; node != 0;node = node->sibling) { | 717 | for (; node != 0;node = node->sibling) { |
715 | unsigned int *class_code; | 718 | const unsigned int *class_code; |
716 | 719 | ||
717 | if (filter(node, data)) | 720 | if (filter(node, data)) |
718 | return node; | 721 | return node; |
@@ -722,7 +725,7 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* | |||
722 | * a fake root for all functions of a multi-function device, | 725 | * a fake root for all functions of a multi-function device, |
723 | * we go down them as well. | 726 | * we go down them as well. |
724 | */ | 727 | */ |
725 | class_code = (unsigned int *) get_property(node, "class-code", NULL); | 728 | class_code = get_property(node, "class-code", NULL); |
726 | if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && | 729 | if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && |
727 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) && | 730 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) && |
728 | strcmp(node->name, "multifunc-device")) | 731 | strcmp(node->name, "multifunc-device")) |
@@ -737,10 +740,10 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* | |||
737 | static int | 740 | static int |
738 | scan_OF_pci_childs_iterator(struct device_node* node, void* data) | 741 | scan_OF_pci_childs_iterator(struct device_node* node, void* data) |
739 | { | 742 | { |
740 | unsigned int *reg; | 743 | const unsigned int *reg; |
741 | u8* fdata = (u8*)data; | 744 | u8* fdata = (u8*)data; |
742 | 745 | ||
743 | reg = (unsigned int *) get_property(node, "reg", NULL); | 746 | reg = get_property(node, "reg", NULL); |
744 | if (reg && ((reg[0] >> 8) & 0xff) == fdata[1] | 747 | if (reg && ((reg[0] >> 8) & 0xff) == fdata[1] |
745 | && ((reg[0] >> 16) & 0xff) == fdata[0]) | 748 | && ((reg[0] >> 16) & 0xff) == fdata[0]) |
746 | return 1; | 749 | return 1; |
@@ -841,7 +844,7 @@ find_OF_pci_device_filter(struct device_node* node, void* data) | |||
841 | int | 844 | int |
842 | pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn) | 845 | pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn) |
843 | { | 846 | { |
844 | unsigned int *reg; | 847 | const unsigned int *reg; |
845 | struct pci_controller* hose; | 848 | struct pci_controller* hose; |
846 | struct pci_dev* dev = NULL; | 849 | struct pci_dev* dev = NULL; |
847 | 850 | ||
@@ -854,7 +857,7 @@ pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn) | |||
854 | if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child, | 857 | if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child, |
855 | find_OF_pci_device_filter, (void *)node)) | 858 | find_OF_pci_device_filter, (void *)node)) |
856 | return -ENODEV; | 859 | return -ENODEV; |
857 | reg = (unsigned int *) get_property(node, "reg", NULL); | 860 | reg = get_property(node, "reg", NULL); |
858 | if (!reg) | 861 | if (!reg) |
859 | return -ENODEV; | 862 | return -ENODEV; |
860 | *bus = (reg[0] >> 16) & 0xff; | 863 | *bus = (reg[0] >> 16) & 0xff; |
@@ -885,8 +888,8 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose, | |||
885 | struct device_node *dev, int primary) | 888 | struct device_node *dev, int primary) |
886 | { | 889 | { |
887 | static unsigned int static_lc_ranges[256] __initdata; | 890 | static unsigned int static_lc_ranges[256] __initdata; |
888 | unsigned int *dt_ranges, *lc_ranges, *ranges, *prev; | 891 | const unsigned int *dt_ranges; |
889 | unsigned int size; | 892 | unsigned int *lc_ranges, *ranges, *prev, size; |
890 | int rlen = 0, orig_rlen; | 893 | int rlen = 0, orig_rlen; |
891 | int memno = 0; | 894 | int memno = 0; |
892 | struct resource *res; | 895 | struct resource *res; |
@@ -897,7 +900,7 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose, | |||
897 | * that can have more than 3 ranges, fortunately using contiguous | 900 | * that can have more than 3 ranges, fortunately using contiguous |
898 | * addresses -- BenH | 901 | * addresses -- BenH |
899 | */ | 902 | */ |
900 | dt_ranges = (unsigned int *) get_property(dev, "ranges", &rlen); | 903 | dt_ranges = get_property(dev, "ranges", &rlen); |
901 | if (!dt_ranges) | 904 | if (!dt_ranges) |
902 | return; | 905 | return; |
903 | /* Sanity check, though hopefully that never happens */ | 906 | /* Sanity check, though hopefully that never happens */ |