提交 be07c00e 编写于 作者: Z Zhang Rui 提交者: Rafael J. Wysocki

pci-acpi: convert acpi_get_handle() to acpi_has_method()

acpi_has_method() is a new ACPI API introduced to check
the existence of an ACPI control method.

It can be used to replace acpi_get_handle() in the case that
1. the calling function doesn't need the ACPI handle of the control method.
and
2. the calling function doesn't care the reason why the method is unavailable.

Convert acpi_get_handle() to acpi_has_method()
in drivers/pci/pci-acpi.c in this patch.
Signed-off-by: NZhang Rui <rui.zhang@intel.com>
CC: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 2fd6f9c3
...@@ -181,7 +181,6 @@ static bool acpi_pci_power_manageable(struct pci_dev *dev) ...@@ -181,7 +181,6 @@ static bool acpi_pci_power_manageable(struct pci_dev *dev)
static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
{ {
acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev);
acpi_handle tmp;
static const u8 state_conv[] = { static const u8 state_conv[] = {
[PCI_D0] = ACPI_STATE_D0, [PCI_D0] = ACPI_STATE_D0,
[PCI_D1] = ACPI_STATE_D1, [PCI_D1] = ACPI_STATE_D1,
...@@ -192,7 +191,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) ...@@ -192,7 +191,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
int error = -EINVAL; int error = -EINVAL;
/* If the ACPI device has _EJ0, ignore the device */ /* If the ACPI device has _EJ0, ignore the device */
if (!handle || ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp))) if (!handle || acpi_has_method(handle, "_EJ0"))
return -ENODEV; return -ENODEV;
switch (state) { switch (state) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册