diff options
author | Jesper Juhl <jesper.juhl@gmail.com> | 2005-12-11 00:43:09 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-09 15:13:20 -0500 |
commit | c2dea6553090a3fd06ffa9ba512a09fdac4d1b6e (patch) | |
tree | 25a5cfe0db7c2a5d457cdea3a818725a14f6c3c5 /drivers | |
parent | f5c99dfc11dce8f26c1ceedb6595fa0eac335ea3 (diff) |
[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: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pci/hotplug/pciehprm_acpi.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/pci/hotplug/pciehprm_acpi.c b/drivers/pci/hotplug/pciehprm_acpi.c index ae244e218620..2bdb30f68bf8 100644 --- a/drivers/pci/hotplug/pciehprm_acpi.c +++ b/drivers/pci/hotplug/pciehprm_acpi.c | |||
@@ -174,7 +174,9 @@ int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev) | |||
174 | acpi_status status; | 174 | acpi_status status; |
175 | acpi_handle chandle, handle = DEVICE_ACPI_HANDLE(&(dev->dev)); | 175 | acpi_handle chandle, handle = DEVICE_ACPI_HANDLE(&(dev->dev)); |
176 | struct pci_dev *pdev = dev; | 176 | struct pci_dev *pdev = dev; |
177 | struct pci_bus *parent; | ||
177 | u8 *path_name; | 178 | u8 *path_name; |
179 | |||
178 | /* | 180 | /* |
179 | * Per PCI firmware specification, we should run the ACPI _OSC | 181 | * Per PCI firmware specification, we should run the ACPI _OSC |
180 | * method to get control of hotplug hardware before using it. | 182 | * 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 | */ | 192 | */ |
191 | if (!pdev || !pdev->bus->parent) | 193 | if (!pdev || !pdev->bus->parent) |
192 | break; | 194 | break; |
195 | parent = pdev->bus->parent; | ||
193 | dbg("Could not find %s in acpi namespace, trying parent\n", | 196 | dbg("Could not find %s in acpi namespace, trying parent\n", |
194 | pci_name(pdev)); | 197 | pci_name(pdev)); |
195 | if (!pdev->bus->parent->self) | 198 | if (!parent->self) |
196 | /* Parent must be a host bridge */ | 199 | /* Parent must be a host bridge */ |
197 | handle = acpi_get_pci_rootbridge_handle( | 200 | handle = acpi_get_pci_rootbridge_handle( |
198 | pci_domain_nr(pdev->bus->parent), | 201 | pci_domain_nr(parent), |
199 | pdev->bus->parent->number); | 202 | parent->number); |
200 | else | 203 | else |
201 | handle = DEVICE_ACPI_HANDLE( | 204 | handle = DEVICE_ACPI_HANDLE( |
202 | &(pdev->bus->parent->self->dev)); | 205 | &(parent->self->dev)); |
203 | pdev = pdev->bus->parent->self; | 206 | pdev = parent->self; |
204 | } | 207 | } |
205 | 208 | ||
206 | while (handle) { | 209 | while (handle) { |