diff options
-rw-r--r-- | drivers/pci/pci.h | 1 | ||||
-rw-r--r-- | drivers/pci/probe.c | 50 | ||||
-rw-r--r-- | include/linux/pci.h | 3 |
3 files changed, 36 insertions, 18 deletions
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index d00168b1f662..d3f3dd42240d 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -29,7 +29,6 @@ static inline int pci_proc_detach_bus(struct pci_bus *bus) { return 0; } | |||
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | /* Functions for PCI Hotplug drivers to use */ | 31 | /* Functions for PCI Hotplug drivers to use */ |
32 | extern struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr); | ||
33 | extern unsigned int pci_do_scan_bus(struct pci_bus *bus); | 32 | extern unsigned int pci_do_scan_bus(struct pci_bus *bus); |
34 | extern int pci_remove_device_safe(struct pci_dev *dev); | 33 | extern int pci_remove_device_safe(struct pci_dev *dev); |
35 | extern unsigned char pci_max_busnr(void); | 34 | extern unsigned char pci_max_busnr(void); |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index b9c9b03919d4..35caec13023a 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -753,27 +753,19 @@ pci_scan_device(struct pci_bus *bus, int devfn) | |||
753 | kfree(dev); | 753 | kfree(dev); |
754 | return NULL; | 754 | return NULL; |
755 | } | 755 | } |
756 | device_initialize(&dev->dev); | ||
757 | dev->dev.release = pci_release_dev; | ||
758 | pci_dev_get(dev); | ||
759 | |||
760 | dev->dev.dma_mask = &dev->dma_mask; | ||
761 | dev->dev.coherent_dma_mask = 0xffffffffull; | ||
762 | 756 | ||
763 | return dev; | 757 | return dev; |
764 | } | 758 | } |
765 | 759 | ||
766 | struct pci_dev * __devinit | 760 | void __devinit pci_device_add(struct pci_dev *dev, struct pci_bus *bus) |
767 | pci_scan_single_device(struct pci_bus *bus, int devfn) | ||
768 | { | 761 | { |
769 | struct pci_dev *dev; | 762 | device_initialize(&dev->dev); |
763 | dev->dev.release = pci_release_dev; | ||
764 | pci_dev_get(dev); | ||
770 | 765 | ||
771 | dev = pci_scan_device(bus, devfn); | 766 | dev->dev.dma_mask = &dev->dma_mask; |
772 | pci_scan_msi_device(dev); | 767 | dev->dev.coherent_dma_mask = 0xffffffffull; |
773 | 768 | ||
774 | if (!dev) | ||
775 | return NULL; | ||
776 | |||
777 | /* Fix up broken headers */ | 769 | /* Fix up broken headers */ |
778 | pci_fixup_device(pci_fixup_header, dev); | 770 | pci_fixup_device(pci_fixup_header, dev); |
779 | 771 | ||
@@ -785,6 +777,19 @@ pci_scan_single_device(struct pci_bus *bus, int devfn) | |||
785 | spin_lock(&pci_bus_lock); | 777 | spin_lock(&pci_bus_lock); |
786 | list_add_tail(&dev->bus_list, &bus->devices); | 778 | list_add_tail(&dev->bus_list, &bus->devices); |
787 | spin_unlock(&pci_bus_lock); | 779 | spin_unlock(&pci_bus_lock); |
780 | } | ||
781 | |||
782 | struct pci_dev * __devinit | ||
783 | pci_scan_single_device(struct pci_bus *bus, int devfn) | ||
784 | { | ||
785 | struct pci_dev *dev; | ||
786 | |||
787 | dev = pci_scan_device(bus, devfn); | ||
788 | if (!dev) | ||
789 | return NULL; | ||
790 | |||
791 | pci_device_add(dev, bus); | ||
792 | pci_scan_msi_device(dev); | ||
788 | 793 | ||
789 | return dev; | 794 | return dev; |
790 | } | 795 | } |
@@ -881,7 +886,8 @@ unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus) | |||
881 | return max; | 886 | return max; |
882 | } | 887 | } |
883 | 888 | ||
884 | struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata) | 889 | struct pci_bus * __devinit pci_create_bus(struct device *parent, |
890 | int bus, struct pci_ops *ops, void *sysdata) | ||
885 | { | 891 | { |
886 | int error; | 892 | int error; |
887 | struct pci_bus *b; | 893 | struct pci_bus *b; |
@@ -938,8 +944,6 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus, | |||
938 | b->resource[0] = &ioport_resource; | 944 | b->resource[0] = &ioport_resource; |
939 | b->resource[1] = &iomem_resource; | 945 | b->resource[1] = &iomem_resource; |
940 | 946 | ||
941 | b->subordinate = pci_scan_child_bus(b); | ||
942 | |||
943 | return b; | 947 | return b; |
944 | 948 | ||
945 | sys_create_link_err: | 949 | sys_create_link_err: |
@@ -957,6 +961,18 @@ err_out: | |||
957 | kfree(b); | 961 | kfree(b); |
958 | return NULL; | 962 | return NULL; |
959 | } | 963 | } |
964 | EXPORT_SYMBOL_GPL(pci_create_bus); | ||
965 | |||
966 | struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, | ||
967 | int bus, struct pci_ops *ops, void *sysdata) | ||
968 | { | ||
969 | struct pci_bus *b; | ||
970 | |||
971 | b = pci_create_bus(parent, bus, ops, sysdata); | ||
972 | if (b) | ||
973 | b->subordinate = pci_scan_child_bus(b); | ||
974 | return b; | ||
975 | } | ||
960 | EXPORT_SYMBOL(pci_scan_bus_parented); | 976 | EXPORT_SYMBOL(pci_scan_bus_parented); |
961 | 977 | ||
962 | #ifdef CONFIG_HOTPLUG | 978 | #ifdef CONFIG_HOTPLUG |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 609499356e07..9c7aecf0c599 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -315,8 +315,11 @@ static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *s | |||
315 | pci_bus_add_devices(root_bus); | 315 | pci_bus_add_devices(root_bus); |
316 | return root_bus; | 316 | return root_bus; |
317 | } | 317 | } |
318 | struct pci_bus *pci_create_bus(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); | ||
319 | struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr); | ||
318 | int pci_scan_slot(struct pci_bus *bus, int devfn); | 320 | int pci_scan_slot(struct pci_bus *bus, int devfn); |
319 | struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); | 321 | struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); |
322 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); | ||
320 | unsigned int pci_scan_child_bus(struct pci_bus *bus); | 323 | unsigned int pci_scan_child_bus(struct pci_bus *bus); |
321 | void pci_bus_add_device(struct pci_dev *dev); | 324 | void pci_bus_add_device(struct pci_dev *dev); |
322 | void pci_read_bridge_bases(struct pci_bus *child); | 325 | void pci_read_bridge_bases(struct pci_bus *child); |