aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-09-14 18:35:15 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-09-14 20:38:26 -0400
commit6a29172ba90e49c046245610caff9848307bfd6a (patch)
tree41911e0b90cb6bec026f9eb2d4cc5e0f914afa75 /drivers/pci
parentfca6825ad7382ae9df8ecda9068ac13ee9e343f4 (diff)
PCI hotplug: clean up acpi_get_hp_params_from_firmware() interface
This patch makes acpi_get_hp_params_from_firmware() take a pci_dev rather than a pci_bus and makes it return a standard int errno rather than acpi_status. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/hotplug/acpi_pcihp.c14
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c7
-rw-r--r--drivers/pci/hotplug/pciehp.h4
-rw-r--r--drivers/pci/hotplug/shpchp.h4
4 files changed, 12 insertions, 17 deletions
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c
index ec3c039b7ebd..14d2d8a01f68 100644
--- a/drivers/pci/hotplug/acpi_pcihp.c
+++ b/drivers/pci/hotplug/acpi_pcihp.c
@@ -324,18 +324,18 @@ static acpi_status acpi_run_oshp(acpi_handle handle)
324 324
325/* acpi_get_hp_params_from_firmware 325/* acpi_get_hp_params_from_firmware
326 * 326 *
327 * @bus - the pci_bus of the bus on which the device is newly added 327 * @dev - the pci_dev for which we want parameters
328 * @hpp - allocated by the caller 328 * @hpp - allocated by the caller
329 */ 329 */
330acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, 330int acpi_get_hp_params_from_firmware(struct pci_dev *dev,
331 struct hotplug_params *hpp) 331 struct hotplug_params *hpp)
332{ 332{
333 acpi_status status = AE_NOT_FOUND; 333 acpi_status status;
334 acpi_handle handle, phandle; 334 acpi_handle handle, phandle;
335 struct pci_bus *pbus; 335 struct pci_bus *pbus;
336 336
337 handle = NULL; 337 handle = NULL;
338 for (pbus = bus; pbus; pbus = pbus->parent) { 338 for (pbus = dev->bus; pbus; pbus = pbus->parent) {
339 handle = acpi_pci_get_bridge_handle(pbus); 339 handle = acpi_pci_get_bridge_handle(pbus);
340 if (handle) 340 if (handle)
341 break; 341 break;
@@ -350,10 +350,10 @@ acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,
350 while (handle) { 350 while (handle) {
351 status = acpi_run_hpx(handle, hpp); 351 status = acpi_run_hpx(handle, hpp);
352 if (ACPI_SUCCESS(status)) 352 if (ACPI_SUCCESS(status))
353 break; 353 return 0;
354 status = acpi_run_hpp(handle, hpp); 354 status = acpi_run_hpp(handle, hpp);
355 if (ACPI_SUCCESS(status)) 355 if (ACPI_SUCCESS(status))
356 break; 356 return 0;
357 if (acpi_is_root_bridge(handle)) 357 if (acpi_is_root_bridge(handle))
358 break; 358 break;
359 status = acpi_get_parent(handle, &phandle); 359 status = acpi_get_parent(handle, &phandle);
@@ -361,7 +361,7 @@ acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,
361 break; 361 break;
362 handle = phandle; 362 handle = phandle;
363 } 363 }
364 return status; 364 return -ENODEV;
365} 365}
366EXPORT_SYMBOL_GPL(acpi_get_hp_params_from_firmware); 366EXPORT_SYMBOL_GPL(acpi_get_hp_params_from_firmware);
367 367
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index db81c08de8d5..14e6f1a17f28 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -275,11 +275,10 @@ static int detect_ejectable_slots(acpi_handle handle)
275/* decode ACPI 2.0 _HPP hot plug parameters */ 275/* decode ACPI 2.0 _HPP hot plug parameters */
276static void decode_hpp(struct pci_dev *dev, struct hotplug_params *hpp) 276static void decode_hpp(struct pci_dev *dev, struct hotplug_params *hpp)
277{ 277{
278 acpi_status status; 278 int ret;
279 279
280 status = acpi_get_hp_params_from_firmware(dev->bus, hpp); 280 ret = acpi_get_hp_params_from_firmware(dev, hpp);
281 if (ACPI_FAILURE(status) || 281 if (ret || !hpp->t0 || (hpp->t0->revision > 1)) {
282 !hpp->t0 || (hpp->t0->revision > 1)) {
283 /* use default numbers */ 282 /* use default numbers */
284 printk(KERN_WARNING 283 printk(KERN_WARNING
285 "%s: Could not get hotplug parameters. Use defaults\n", 284 "%s: Could not get hotplug parameters. Use defaults\n",
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index e6cf096498be..86cdfd71ed27 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -241,9 +241,7 @@ static inline int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev)
241static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev, 241static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev,
242 struct hotplug_params *hpp) 242 struct hotplug_params *hpp)
243{ 243{
244 if (ACPI_FAILURE(acpi_get_hp_params_from_firmware(dev->bus, hpp))) 244 return acpi_get_hp_params_from_firmware(dev, hpp);
245 return -ENODEV;
246 return 0;
247} 245}
248#else 246#else
249#define pciehp_firmware_init() do {} while (0) 247#define pciehp_firmware_init() do {} while (0)
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
index 974e924ca96d..ad6a255cf0a5 100644
--- a/drivers/pci/hotplug/shpchp.h
+++ b/drivers/pci/hotplug/shpchp.h
@@ -191,9 +191,7 @@ static inline const char *slot_name(struct slot *slot)
191static inline int get_hp_params_from_firmware(struct pci_dev *dev, 191static inline int get_hp_params_from_firmware(struct pci_dev *dev,
192 struct hotplug_params *hpp) 192 struct hotplug_params *hpp)
193{ 193{
194 if (ACPI_FAILURE(acpi_get_hp_params_from_firmware(dev->bus, hpp))) 194 return acpi_get_hp_params_from_firmware(dev, hpp);
195 return -ENODEV;
196 return 0;
197} 195}
198 196
199static inline int get_hp_hw_control_from_firmware(struct pci_dev *dev) 197static inline int get_hp_hw_control_from_firmware(struct pci_dev *dev)