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>
This commit is contained in:
parent
fca6825ad7
commit
6a29172ba9
|
@ -324,18 +324,18 @@ static acpi_status acpi_run_oshp(acpi_handle handle)
|
||||||
|
|
||||||
/* acpi_get_hp_params_from_firmware
|
/* acpi_get_hp_params_from_firmware
|
||||||
*
|
*
|
||||||
* @bus - the pci_bus of the bus on which the device is newly added
|
* @dev - the pci_dev for which we want parameters
|
||||||
* @hpp - allocated by the caller
|
* @hpp - allocated by the caller
|
||||||
*/
|
*/
|
||||||
acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,
|
int acpi_get_hp_params_from_firmware(struct pci_dev *dev,
|
||||||
struct hotplug_params *hpp)
|
struct hotplug_params *hpp)
|
||||||
{
|
{
|
||||||
acpi_status status = AE_NOT_FOUND;
|
acpi_status status;
|
||||||
acpi_handle handle, phandle;
|
acpi_handle handle, phandle;
|
||||||
struct pci_bus *pbus;
|
struct pci_bus *pbus;
|
||||||
|
|
||||||
handle = NULL;
|
handle = NULL;
|
||||||
for (pbus = bus; pbus; pbus = pbus->parent) {
|
for (pbus = dev->bus; pbus; pbus = pbus->parent) {
|
||||||
handle = acpi_pci_get_bridge_handle(pbus);
|
handle = acpi_pci_get_bridge_handle(pbus);
|
||||||
if (handle)
|
if (handle)
|
||||||
break;
|
break;
|
||||||
|
@ -350,10 +350,10 @@ acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,
|
||||||
while (handle) {
|
while (handle) {
|
||||||
status = acpi_run_hpx(handle, hpp);
|
status = acpi_run_hpx(handle, hpp);
|
||||||
if (ACPI_SUCCESS(status))
|
if (ACPI_SUCCESS(status))
|
||||||
break;
|
return 0;
|
||||||
status = acpi_run_hpp(handle, hpp);
|
status = acpi_run_hpp(handle, hpp);
|
||||||
if (ACPI_SUCCESS(status))
|
if (ACPI_SUCCESS(status))
|
||||||
break;
|
return 0;
|
||||||
if (acpi_is_root_bridge(handle))
|
if (acpi_is_root_bridge(handle))
|
||||||
break;
|
break;
|
||||||
status = acpi_get_parent(handle, &phandle);
|
status = acpi_get_parent(handle, &phandle);
|
||||||
|
@ -361,7 +361,7 @@ acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,
|
||||||
break;
|
break;
|
||||||
handle = phandle;
|
handle = phandle;
|
||||||
}
|
}
|
||||||
return status;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(acpi_get_hp_params_from_firmware);
|
EXPORT_SYMBOL_GPL(acpi_get_hp_params_from_firmware);
|
||||||
|
|
||||||
|
|
|
@ -275,11 +275,10 @@ static int detect_ejectable_slots(acpi_handle handle)
|
||||||
/* decode ACPI 2.0 _HPP hot plug parameters */
|
/* decode ACPI 2.0 _HPP hot plug parameters */
|
||||||
static void decode_hpp(struct pci_dev *dev, struct hotplug_params *hpp)
|
static void decode_hpp(struct pci_dev *dev, struct hotplug_params *hpp)
|
||||||
{
|
{
|
||||||
acpi_status status;
|
int ret;
|
||||||
|
|
||||||
status = acpi_get_hp_params_from_firmware(dev->bus, hpp);
|
ret = acpi_get_hp_params_from_firmware(dev, hpp);
|
||||||
if (ACPI_FAILURE(status) ||
|
if (ret || !hpp->t0 || (hpp->t0->revision > 1)) {
|
||||||
!hpp->t0 || (hpp->t0->revision > 1)) {
|
|
||||||
/* use default numbers */
|
/* use default numbers */
|
||||||
printk(KERN_WARNING
|
printk(KERN_WARNING
|
||||||
"%s: Could not get hotplug parameters. Use defaults\n",
|
"%s: Could not get hotplug parameters. Use defaults\n",
|
||||||
|
|
|
@ -241,9 +241,7 @@ static inline int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev)
|
||||||
static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev,
|
static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev,
|
||||||
struct hotplug_params *hpp)
|
struct hotplug_params *hpp)
|
||||||
{
|
{
|
||||||
if (ACPI_FAILURE(acpi_get_hp_params_from_firmware(dev->bus, hpp)))
|
return acpi_get_hp_params_from_firmware(dev, hpp);
|
||||||
return -ENODEV;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define pciehp_firmware_init() do {} while (0)
|
#define pciehp_firmware_init() do {} while (0)
|
||||||
|
|
|
@ -191,9 +191,7 @@ static inline const char *slot_name(struct slot *slot)
|
||||||
static inline int get_hp_params_from_firmware(struct pci_dev *dev,
|
static inline int get_hp_params_from_firmware(struct pci_dev *dev,
|
||||||
struct hotplug_params *hpp)
|
struct hotplug_params *hpp)
|
||||||
{
|
{
|
||||||
if (ACPI_FAILURE(acpi_get_hp_params_from_firmware(dev->bus, hpp)))
|
return acpi_get_hp_params_from_firmware(dev, hpp);
|
||||||
return -ENODEV;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int get_hp_hw_control_from_firmware(struct pci_dev *dev)
|
static inline int get_hp_hw_control_from_firmware(struct pci_dev *dev)
|
||||||
|
|
|
@ -227,7 +227,7 @@ struct hotplug_params {
|
||||||
#ifdef CONFIG_ACPI
|
#ifdef CONFIG_ACPI
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acpi_bus.h>
|
#include <acpi/acpi_bus.h>
|
||||||
extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,
|
int acpi_get_hp_params_from_firmware(struct pci_dev *dev,
|
||||||
struct hotplug_params *hpp);
|
struct hotplug_params *hpp);
|
||||||
int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags);
|
int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags);
|
||||||
int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle);
|
int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle);
|
||||||
|
|
Loading…
Reference in New Issue