diff options
Diffstat (limited to 'drivers/pci/probe.c')
| -rw-r--r-- | drivers/pci/probe.c | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index b9c9b03919d4..26a55d08b506 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
| @@ -72,11 +72,13 @@ void pci_remove_legacy_files(struct pci_bus *bus) { return; } | |||
| 72 | /* | 72 | /* |
| 73 | * PCI Bus Class Devices | 73 | * PCI Bus Class Devices |
| 74 | */ | 74 | */ |
| 75 | static ssize_t pci_bus_show_cpuaffinity(struct class_device *class_dev, char *buf) | 75 | static ssize_t pci_bus_show_cpuaffinity(struct class_device *class_dev, |
| 76 | char *buf) | ||
| 76 | { | 77 | { |
| 77 | cpumask_t cpumask = pcibus_to_cpumask(to_pci_bus(class_dev)); | ||
| 78 | int ret; | 78 | int ret; |
| 79 | cpumask_t cpumask; | ||
| 79 | 80 | ||
| 81 | cpumask = pcibus_to_cpumask(to_pci_bus(class_dev)); | ||
| 80 | ret = cpumask_scnprintf(buf, PAGE_SIZE, cpumask); | 82 | ret = cpumask_scnprintf(buf, PAGE_SIZE, cpumask); |
| 81 | if (ret < PAGE_SIZE) | 83 | if (ret < PAGE_SIZE) |
| 82 | buf[ret++] = '\n'; | 84 | buf[ret++] = '\n'; |
| @@ -753,27 +755,19 @@ pci_scan_device(struct pci_bus *bus, int devfn) | |||
| 753 | kfree(dev); | 755 | kfree(dev); |
| 754 | return NULL; | 756 | return NULL; |
| 755 | } | 757 | } |
| 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 | 758 | ||
| 763 | return dev; | 759 | return dev; |
| 764 | } | 760 | } |
| 765 | 761 | ||
| 766 | struct pci_dev * __devinit | 762 | 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 | { | 763 | { |
| 769 | struct pci_dev *dev; | 764 | device_initialize(&dev->dev); |
| 765 | dev->dev.release = pci_release_dev; | ||
| 766 | pci_dev_get(dev); | ||
| 770 | 767 | ||
| 771 | dev = pci_scan_device(bus, devfn); | 768 | dev->dev.dma_mask = &dev->dma_mask; |
| 772 | pci_scan_msi_device(dev); | 769 | dev->dev.coherent_dma_mask = 0xffffffffull; |
| 773 | 770 | ||
| 774 | if (!dev) | ||
| 775 | return NULL; | ||
| 776 | |||
| 777 | /* Fix up broken headers */ | 771 | /* Fix up broken headers */ |
| 778 | pci_fixup_device(pci_fixup_header, dev); | 772 | pci_fixup_device(pci_fixup_header, dev); |
| 779 | 773 | ||
| @@ -785,6 +779,19 @@ pci_scan_single_device(struct pci_bus *bus, int devfn) | |||
| 785 | spin_lock(&pci_bus_lock); | 779 | spin_lock(&pci_bus_lock); |
| 786 | list_add_tail(&dev->bus_list, &bus->devices); | 780 | list_add_tail(&dev->bus_list, &bus->devices); |
| 787 | spin_unlock(&pci_bus_lock); | 781 | spin_unlock(&pci_bus_lock); |
| 782 | } | ||
| 783 | |||
| 784 | struct pci_dev * __devinit | ||
| 785 | pci_scan_single_device(struct pci_bus *bus, int devfn) | ||
| 786 | { | ||
| 787 | struct pci_dev *dev; | ||
| 788 | |||
| 789 | dev = pci_scan_device(bus, devfn); | ||
| 790 | if (!dev) | ||
| 791 | return NULL; | ||
| 792 | |||
| 793 | pci_device_add(dev, bus); | ||
| 794 | pci_scan_msi_device(dev); | ||
| 788 | 795 | ||
| 789 | return dev; | 796 | return dev; |
| 790 | } | 797 | } |
| @@ -881,7 +888,8 @@ unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus) | |||
| 881 | return max; | 888 | return max; |
| 882 | } | 889 | } |
| 883 | 890 | ||
| 884 | struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata) | 891 | struct pci_bus * __devinit pci_create_bus(struct device *parent, |
| 892 | int bus, struct pci_ops *ops, void *sysdata) | ||
| 885 | { | 893 | { |
| 886 | int error; | 894 | int error; |
| 887 | struct pci_bus *b; | 895 | struct pci_bus *b; |
| @@ -938,8 +946,6 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus, | |||
| 938 | b->resource[0] = &ioport_resource; | 946 | b->resource[0] = &ioport_resource; |
| 939 | b->resource[1] = &iomem_resource; | 947 | b->resource[1] = &iomem_resource; |
| 940 | 948 | ||
| 941 | b->subordinate = pci_scan_child_bus(b); | ||
| 942 | |||
| 943 | return b; | 949 | return b; |
| 944 | 950 | ||
| 945 | sys_create_link_err: | 951 | sys_create_link_err: |
| @@ -957,6 +963,18 @@ err_out: | |||
| 957 | kfree(b); | 963 | kfree(b); |
| 958 | return NULL; | 964 | return NULL; |
| 959 | } | 965 | } |
| 966 | EXPORT_SYMBOL_GPL(pci_create_bus); | ||
| 967 | |||
| 968 | struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, | ||
| 969 | int bus, struct pci_ops *ops, void *sysdata) | ||
| 970 | { | ||
| 971 | struct pci_bus *b; | ||
| 972 | |||
| 973 | b = pci_create_bus(parent, bus, ops, sysdata); | ||
| 974 | if (b) | ||
| 975 | b->subordinate = pci_scan_child_bus(b); | ||
| 976 | return b; | ||
| 977 | } | ||
| 960 | EXPORT_SYMBOL(pci_scan_bus_parented); | 978 | EXPORT_SYMBOL(pci_scan_bus_parented); |
| 961 | 979 | ||
| 962 | #ifdef CONFIG_HOTPLUG | 980 | #ifdef CONFIG_HOTPLUG |
