提交 c2dea655 编写于 作者: J Jesper Juhl 提交者: Greg Kroah-Hartman

[PATCH] PCI: Reduce nr of ptr derefs in drivers/pci/hotplug/pciehprm_acpi.c

Here's a small patch to reduce the nr. of pointer dereferences in
drivers/pci/hotplug/pciehprm_acpi.c

Benefits:
 - micro speed optimization due to fewer pointer derefs
 - generated code is slightly smaller
 - better readability
Signed-off-by: NJesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 f5c99dfc
...@@ -174,7 +174,9 @@ int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev) ...@@ -174,7 +174,9 @@ int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev)
acpi_status status; acpi_status status;
acpi_handle chandle, handle = DEVICE_ACPI_HANDLE(&(dev->dev)); acpi_handle chandle, handle = DEVICE_ACPI_HANDLE(&(dev->dev));
struct pci_dev *pdev = dev; struct pci_dev *pdev = dev;
struct pci_bus *parent;
u8 *path_name; u8 *path_name;
/* /*
* Per PCI firmware specification, we should run the ACPI _OSC * Per PCI firmware specification, we should run the ACPI _OSC
* method to get control of hotplug hardware before using it. * method to get control of hotplug hardware before using it.
...@@ -190,17 +192,18 @@ int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev) ...@@ -190,17 +192,18 @@ int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev)
*/ */
if (!pdev || !pdev->bus->parent) if (!pdev || !pdev->bus->parent)
break; break;
parent = pdev->bus->parent;
dbg("Could not find %s in acpi namespace, trying parent\n", dbg("Could not find %s in acpi namespace, trying parent\n",
pci_name(pdev)); pci_name(pdev));
if (!pdev->bus->parent->self) if (!parent->self)
/* Parent must be a host bridge */ /* Parent must be a host bridge */
handle = acpi_get_pci_rootbridge_handle( handle = acpi_get_pci_rootbridge_handle(
pci_domain_nr(pdev->bus->parent), pci_domain_nr(parent),
pdev->bus->parent->number); parent->number);
else else
handle = DEVICE_ACPI_HANDLE( handle = DEVICE_ACPI_HANDLE(
&(pdev->bus->parent->self->dev)); &(parent->self->dev));
pdev = pdev->bus->parent->self; pdev = parent->self;
} }
while (handle) { while (handle) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册