aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/pciehp_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/pciehp_pci.c')
-rw-r--r--drivers/pci/hotplug/pciehp_pci.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c
index 02e24d63b3ee..21733108adde 100644
--- a/drivers/pci/hotplug/pciehp_pci.c
+++ b/drivers/pci/hotplug/pciehp_pci.c
@@ -63,27 +63,27 @@ static int __ref pciehp_add_bridge(struct pci_dev *dev)
63int pciehp_configure_device(struct slot *p_slot) 63int pciehp_configure_device(struct slot *p_slot)
64{ 64{
65 struct pci_dev *dev; 65 struct pci_dev *dev;
66 struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; 66 struct pci_bus *parent = p_slot->ctrl->pcie->port->subordinate;
67 int num, fn; 67 int num, fn;
68 struct controller *ctrl = p_slot->ctrl; 68 struct controller *ctrl = p_slot->ctrl;
69 69
70 dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); 70 dev = pci_get_slot(parent, PCI_DEVFN(0, 0));
71 if (dev) { 71 if (dev) {
72 ctrl_err(ctrl, "Device %s already exists " 72 ctrl_err(ctrl, "Device %s already exists "
73 "at %04x:%02x:%02x, cannot hot-add\n", pci_name(dev), 73 "at %04x:%02x:00, cannot hot-add\n", pci_name(dev),
74 pci_domain_nr(parent), p_slot->bus, p_slot->device); 74 pci_domain_nr(parent), parent->number);
75 pci_dev_put(dev); 75 pci_dev_put(dev);
76 return -EINVAL; 76 return -EINVAL;
77 } 77 }
78 78
79 num = pci_scan_slot(parent, PCI_DEVFN(p_slot->device, 0)); 79 num = pci_scan_slot(parent, PCI_DEVFN(0, 0));
80 if (num == 0) { 80 if (num == 0) {
81 ctrl_err(ctrl, "No new device found\n"); 81 ctrl_err(ctrl, "No new device found\n");
82 return -ENODEV; 82 return -ENODEV;
83 } 83 }
84 84
85 for (fn = 0; fn < 8; fn++) { 85 for (fn = 0; fn < 8; fn++) {
86 dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, fn)); 86 dev = pci_get_slot(parent, PCI_DEVFN(0, fn));
87 if (!dev) 87 if (!dev)
88 continue; 88 continue;
89 if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { 89 if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
@@ -111,19 +111,18 @@ int pciehp_unconfigure_device(struct slot *p_slot)
111 int j; 111 int j;
112 u8 bctl = 0; 112 u8 bctl = 0;
113 u8 presence = 0; 113 u8 presence = 0;
114 struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; 114 struct pci_bus *parent = p_slot->ctrl->pcie->port->subordinate;
115 u16 command; 115 u16 command;
116 struct controller *ctrl = p_slot->ctrl; 116 struct controller *ctrl = p_slot->ctrl;
117 117
118 ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:%02x\n", 118 ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:00\n",
119 __func__, pci_domain_nr(parent), p_slot->bus, p_slot->device); 119 __func__, pci_domain_nr(parent), parent->number);
120 ret = p_slot->hpc_ops->get_adapter_status(p_slot, &presence); 120 ret = pciehp_get_adapter_status(p_slot, &presence);
121 if (ret) 121 if (ret)
122 presence = 0; 122 presence = 0;
123 123
124 for (j = 0; j < 8; j++) { 124 for (j = 0; j < 8; j++) {
125 struct pci_dev* temp = pci_get_slot(parent, 125 struct pci_dev* temp = pci_get_slot(parent, PCI_DEVFN(0, j));
126 (p_slot->device << 3) | j);
127 if (!temp) 126 if (!temp)
128 continue; 127 continue;
129 if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { 128 if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) {