aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorYuji Shimada <shimada-yxb@necst.nec.co.jp>2009-04-03 03:41:46 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-04-06 14:25:06 -0400
commit296ccb086dfb89b5b8d73ef08c795ffdff12a597 (patch)
tree8c4ef0f0271e448b6843811a1bcded8c47c005a1 /drivers/pci/pci.c
parent7eb93b175d4de9438a4b0af3a94a112cb5266944 (diff)
PCI: Setup disabled bridges even if buses are added
This patch sets up disabled bridges even if buses have already been added. pci_assign_unassigned_resources is called after buses are added. pci_assign_unassigned_resources calls pci_bus_assign_resources. pci_bus_assign_resources calls pci_setup_bridge to configure BARs of bridges. Currently pci_setup_bridge returns immediately if the bus have already been added. So pci_assign_unassigned_resources can't configure BARs of bridges that were added in a disabled state; this patch fixes the issue. On logical hot-add, we need to prevent the kernel from re-initializing bridges that have already been initialized. To achieve this, pci_setup_bridge returns immediately if the bridge have already been enabled. We don't need to check whether the specified bus is a root bus or not. pci_setup_bridge is not called on a root bus, because a root bus does not have a bridge. The patch adds a new helper function, pci_is_enabled. I made the function name similar to pci_is_managed. The codes which use enable_cnt directly are changed to use pci_is_enabled. Acked-by: Alex Chiang <achiang@hp.com> Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 445fb6f7ea3f..16fd0d4c3166 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -844,7 +844,7 @@ static int do_pci_enable_device(struct pci_dev *dev, int bars)
844 */ 844 */
845int pci_reenable_device(struct pci_dev *dev) 845int pci_reenable_device(struct pci_dev *dev)
846{ 846{
847 if (atomic_read(&dev->enable_cnt)) 847 if (pci_is_enabled(dev))
848 return do_pci_enable_device(dev, (1 << PCI_NUM_RESOURCES) - 1); 848 return do_pci_enable_device(dev, (1 << PCI_NUM_RESOURCES) - 1);
849 return 0; 849 return 0;
850} 850}
@@ -1042,7 +1042,7 @@ static void do_pci_disable_device(struct pci_dev *dev)
1042 */ 1042 */
1043void pci_disable_enabled_device(struct pci_dev *dev) 1043void pci_disable_enabled_device(struct pci_dev *dev)
1044{ 1044{
1045 if (atomic_read(&dev->enable_cnt)) 1045 if (pci_is_enabled(dev))
1046 do_pci_disable_device(dev); 1046 do_pci_disable_device(dev);
1047} 1047}
1048 1048