aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhao, Yu <yu.zhao@intel.com>2008-10-13 07:49:55 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-10-20 13:54:31 -0400
commit201de56eb22f1ff3f36804bc70cbff220b50f067 (patch)
tree3613a9485bee233ab62bc9d747b40aa3b11eeec7
parent280c73d3691fb182fa55b0160737c2c0feb79471 (diff)
PCI: centralize the capabilities code in probe.c
This patch centralizes the initialization and release functions of various PCI capabilities in probe.c, which makes the introduction of new capability support functions cleaner in the future. Signed-off-by: Yu Zhao <yu.zhao@intel.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
-rw-r--r--drivers/pci/probe.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 49599ac49bda..8c158b9abd41 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -842,6 +842,11 @@ static int pci_setup_device(struct pci_dev * dev)
842 return 0; 842 return 0;
843} 843}
844 844
845static void pci_release_capabilities(struct pci_dev *dev)
846{
847 pci_vpd_release(dev);
848}
849
845/** 850/**
846 * pci_release_dev - free a pci device structure when all users of it are finished. 851 * pci_release_dev - free a pci device structure when all users of it are finished.
847 * @dev: device that's been disconnected 852 * @dev: device that's been disconnected
@@ -854,7 +859,7 @@ static void pci_release_dev(struct device *dev)
854 struct pci_dev *pci_dev; 859 struct pci_dev *pci_dev;
855 860
856 pci_dev = to_pci_dev(dev); 861 pci_dev = to_pci_dev(dev);
857 pci_vpd_release(pci_dev); 862 pci_release_capabilities(pci_dev);
858 kfree(pci_dev); 863 kfree(pci_dev);
859} 864}
860 865
@@ -935,8 +940,6 @@ struct pci_dev *alloc_pci_dev(void)
935 940
936 INIT_LIST_HEAD(&dev->bus_list); 941 INIT_LIST_HEAD(&dev->bus_list);
937 942
938 pci_msi_init_pci_dev(dev);
939
940 return dev; 943 return dev;
941} 944}
942EXPORT_SYMBOL(alloc_pci_dev); 945EXPORT_SYMBOL(alloc_pci_dev);
@@ -1009,11 +1012,21 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
1009 return NULL; 1012 return NULL;
1010 } 1013 }
1011 1014
1012 pci_vpd_pci22_init(dev);
1013
1014 return dev; 1015 return dev;
1015} 1016}
1016 1017
1018static void pci_init_capabilities(struct pci_dev *dev)
1019{
1020 /* MSI/MSI-X list */
1021 pci_msi_init_pci_dev(dev);
1022
1023 /* Power Management */
1024 pci_pm_init(dev);
1025
1026 /* Vital Product Data */
1027 pci_vpd_pci22_init(dev);
1028}
1029
1017void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) 1030void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
1018{ 1031{
1019 device_initialize(&dev->dev); 1032 device_initialize(&dev->dev);
@@ -1030,8 +1043,8 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
1030 /* Fix up broken headers */ 1043 /* Fix up broken headers */
1031 pci_fixup_device(pci_fixup_header, dev); 1044 pci_fixup_device(pci_fixup_header, dev);
1032 1045
1033 /* Initialize power management of the device */ 1046 /* Initialize various capabilities */
1034 pci_pm_init(dev); 1047 pci_init_capabilities(dev);
1035 1048
1036 /* 1049 /*
1037 * Add the device to our list of discovered devices 1050 * Add the device to our list of discovered devices