diff options
Diffstat (limited to 'drivers/pci/hotplug/acpi_pcihp.c')
-rw-r--r-- | drivers/pci/hotplug/acpi_pcihp.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c index 64cb30d7fc9a..9395fec73423 100644 --- a/drivers/pci/hotplug/acpi_pcihp.c +++ b/drivers/pci/hotplug/acpi_pcihp.c | |||
@@ -145,14 +145,27 @@ EXPORT_SYMBOL_GPL(acpi_run_oshp); | |||
145 | 145 | ||
146 | /* acpi_get_hp_params_from_firmware | 146 | /* acpi_get_hp_params_from_firmware |
147 | * | 147 | * |
148 | * @dev - the pci_dev of the newly added device | 148 | * @bus - the pci_bus of the bus on which the device is newly added |
149 | * @hpp - allocated by the caller | 149 | * @hpp - allocated by the caller |
150 | */ | 150 | */ |
151 | acpi_status acpi_get_hp_params_from_firmware(struct pci_dev *dev, | 151 | acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, |
152 | struct hotplug_params *hpp) | 152 | struct hotplug_params *hpp) |
153 | { | 153 | { |
154 | acpi_status status = AE_NOT_FOUND; | 154 | acpi_status status = AE_NOT_FOUND; |
155 | struct pci_dev *pdev = dev; | 155 | acpi_handle handle, phandle; |
156 | struct pci_bus *pbus = bus; | ||
157 | struct pci_dev *pdev; | ||
158 | |||
159 | do { | ||
160 | pdev = pbus->self; | ||
161 | if (!pdev) { | ||
162 | handle = acpi_get_pci_rootbridge_handle( | ||
163 | pci_domain_nr(pbus), pbus->number); | ||
164 | break; | ||
165 | } | ||
166 | handle = DEVICE_ACPI_HANDLE(&(pdev->dev)); | ||
167 | pbus = pbus->parent; | ||
168 | } while (!handle); | ||
156 | 169 | ||
157 | /* | 170 | /* |
158 | * _HPP settings apply to all child buses, until another _HPP is | 171 | * _HPP settings apply to all child buses, until another _HPP is |
@@ -160,15 +173,16 @@ acpi_status acpi_get_hp_params_from_firmware(struct pci_dev *dev, | |||
160 | * look for it in the parent device scope since that would apply to | 173 | * look for it in the parent device scope since that would apply to |
161 | * this pci dev. If we don't find any _HPP, use hardcoded defaults | 174 | * this pci dev. If we don't find any _HPP, use hardcoded defaults |
162 | */ | 175 | */ |
163 | while (pdev && (ACPI_FAILURE(status))) { | 176 | while (handle) { |
164 | acpi_handle handle = DEVICE_ACPI_HANDLE(&(pdev->dev)); | ||
165 | if (!handle) | ||
166 | break; | ||
167 | status = acpi_run_hpp(handle, hpp); | 177 | status = acpi_run_hpp(handle, hpp); |
168 | if (!(pdev->bus->parent)) | 178 | if (ACPI_SUCCESS(status)) |
179 | break; | ||
180 | if (acpi_root_bridge(handle)) | ||
181 | break; | ||
182 | status = acpi_get_parent(handle, &phandle); | ||
183 | if (ACPI_FAILURE(status)) | ||
169 | break; | 184 | break; |
170 | /* Check if a parent object supports _HPP */ | 185 | handle = phandle; |
171 | pdev = pdev->bus->parent->self; | ||
172 | } | 186 | } |
173 | return status; | 187 | return status; |
174 | } | 188 | } |