aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/probe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r--drivers/pci/probe.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 2fe1d690eb13..e48fcf089621 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -364,7 +364,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
364 } 364 }
365} 365}
366 366
367static struct pci_bus * __devinit pci_alloc_bus(void) 367static struct pci_bus * pci_alloc_bus(void)
368{ 368{
369 struct pci_bus *b; 369 struct pci_bus *b;
370 370
@@ -432,7 +432,7 @@ error_register:
432 return NULL; 432 return NULL;
433} 433}
434 434
435struct pci_bus * __devinit pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr) 435struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr)
436{ 436{
437 struct pci_bus *child; 437 struct pci_bus *child;
438 438
@@ -461,7 +461,7 @@ static void pci_enable_crs(struct pci_dev *dev)
461 pci_write_config_word(dev, rpcap + PCI_EXP_RTCTL, rpctl); 461 pci_write_config_word(dev, rpcap + PCI_EXP_RTCTL, rpctl);
462} 462}
463 463
464static void __devinit pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max) 464static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max)
465{ 465{
466 struct pci_bus *parent = child->parent; 466 struct pci_bus *parent = child->parent;
467 467
@@ -477,7 +477,7 @@ static void __devinit pci_fixup_parent_subordinate_busnr(struct pci_bus *child,
477 } 477 }
478} 478}
479 479
480unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus); 480unsigned int pci_scan_child_bus(struct pci_bus *bus);
481 481
482/* 482/*
483 * If it's a bridge, configure it and scan the bus behind it. 483 * If it's a bridge, configure it and scan the bus behind it.
@@ -489,7 +489,7 @@ unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus);
489 * them, we proceed to assigning numbers to the remaining buses in 489 * them, we proceed to assigning numbers to the remaining buses in
490 * order to avoid overlaps between old and new bus numbers. 490 * order to avoid overlaps between old and new bus numbers.
491 */ 491 */
492int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass) 492int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass)
493{ 493{
494 struct pci_bus *child; 494 struct pci_bus *child;
495 int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS); 495 int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS);
@@ -846,6 +846,23 @@ static void pci_release_bus_bridge_dev(struct device *dev)
846 kfree(dev); 846 kfree(dev);
847} 847}
848 848
849struct pci_dev *alloc_pci_dev(void)
850{
851 struct pci_dev *dev;
852
853 dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL);
854 if (!dev)
855 return NULL;
856
857 INIT_LIST_HEAD(&dev->global_list);
858 INIT_LIST_HEAD(&dev->bus_list);
859
860 pci_msi_init_pci_dev(dev);
861
862 return dev;
863}
864EXPORT_SYMBOL(alloc_pci_dev);
865
849/* 866/*
850 * Read the config data for a PCI device, sanity-check it 867 * Read the config data for a PCI device, sanity-check it
851 * and fill in the dev structure... 868 * and fill in the dev structure...
@@ -885,7 +902,7 @@ pci_scan_device(struct pci_bus *bus, int devfn)
885 if (pci_bus_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type)) 902 if (pci_bus_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type))
886 return NULL; 903 return NULL;
887 904
888 dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL); 905 dev = alloc_pci_dev();
889 if (!dev) 906 if (!dev)
890 return NULL; 907 return NULL;
891 908
@@ -912,7 +929,7 @@ pci_scan_device(struct pci_bus *bus, int devfn)
912 return dev; 929 return dev;
913} 930}
914 931
915void __devinit pci_device_add(struct pci_dev *dev, struct pci_bus *bus) 932void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
916{ 933{
917 device_initialize(&dev->dev); 934 device_initialize(&dev->dev);
918 dev->dev.release = pci_release_dev; 935 dev->dev.release = pci_release_dev;
@@ -935,8 +952,7 @@ void __devinit pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
935 up_write(&pci_bus_sem); 952 up_write(&pci_bus_sem);
936} 953}
937 954
938struct pci_dev * __devinit 955struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn)
939pci_scan_single_device(struct pci_bus *bus, int devfn)
940{ 956{
941 struct pci_dev *dev; 957 struct pci_dev *dev;
942 958
@@ -958,7 +974,7 @@ pci_scan_single_device(struct pci_bus *bus, int devfn)
958 * discovered devices to the @bus->devices list. New devices 974 * discovered devices to the @bus->devices list. New devices
959 * will have an empty dev->global_list head. 975 * will have an empty dev->global_list head.
960 */ 976 */
961int __devinit pci_scan_slot(struct pci_bus *bus, int devfn) 977int pci_scan_slot(struct pci_bus *bus, int devfn)
962{ 978{
963 int func, nr = 0; 979 int func, nr = 0;
964 int scan_all_fns; 980 int scan_all_fns;
@@ -991,7 +1007,7 @@ int __devinit pci_scan_slot(struct pci_bus *bus, int devfn)
991 return nr; 1007 return nr;
992} 1008}
993 1009
994unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus) 1010unsigned int pci_scan_child_bus(struct pci_bus *bus)
995{ 1011{
996 unsigned int devfn, pass, max = bus->secondary; 1012 unsigned int devfn, pass, max = bus->secondary;
997 struct pci_dev *dev; 1013 struct pci_dev *dev;
@@ -1041,7 +1057,7 @@ unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus)
1041 return max; 1057 return max;
1042} 1058}
1043 1059
1044struct pci_bus * __devinit pci_create_bus(struct device *parent, 1060struct pci_bus * pci_create_bus(struct device *parent,
1045 int bus, struct pci_ops *ops, void *sysdata) 1061 int bus, struct pci_ops *ops, void *sysdata)
1046{ 1062{
1047 int error; 1063 int error;
@@ -1119,7 +1135,7 @@ err_out:
1119} 1135}
1120EXPORT_SYMBOL_GPL(pci_create_bus); 1136EXPORT_SYMBOL_GPL(pci_create_bus);
1121 1137
1122struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, 1138struct pci_bus *pci_scan_bus_parented(struct device *parent,
1123 int bus, struct pci_ops *ops, void *sysdata) 1139 int bus, struct pci_ops *ops, void *sysdata)
1124{ 1140{
1125 struct pci_bus *b; 1141 struct pci_bus *b;