From: Andrew Sharp Date: Wed, 1 Aug 2012 15:27:18 -0700 Subject: [U-Boot] [PATCH 3/5] pci: minor cleanup of CONFIG_PCI_PNP usage In-Reply-To: <1343860040-30941-1-git-send-email-andywyse6@gmail.com> References: <1343860040-30941-1-git-send-email-andywyse6@gmail.com> Message-ID: <1343860040-30941-4-git-send-email-andywyse6@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Refactor the common PCI code just a tiny bit surrounding the PCI_PNP (pciauto) stuff. Makes the code a tiny bit easier to read, and also makes it more obvious that almost no platform needs to setup or use the pci_config_table stuff. Signed-off-by: Andrew Sharp --- drivers/pci/pci.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index f18d49e..1f5b8d7 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -622,8 +622,10 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus) unsigned int sub_bus, found_multi = 0; unsigned short vendor, device, class; unsigned char header_type; - struct pci_config_table *cfg; pci_dev_t dev; +#ifndef CONFIG_PCI_PNP + struct pci_config_table *cfg; +#endif #ifdef CONFIG_PCI_SCAN_SHOW static int indent = 0; #endif @@ -669,18 +671,16 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus) } #endif +#ifdef CONFIG_PCI_PNP + sub_bus = max(pciauto_config_device(hose, dev), sub_bus); +#else cfg = pci_find_config(hose, class, vendor, device, PCI_BUS(dev), PCI_DEV(dev), PCI_FUNC(dev)); if (cfg) { cfg->config_device(hose, dev, cfg); sub_bus = max(sub_bus, hose->current_busno); -#ifdef CONFIG_PCI_PNP - } else { - int n = pciauto_config_device(hose, dev); - - sub_bus = max(sub_bus, n); -#endif } +#endif #ifdef CONFIG_PCI_SCAN_SHOW indent--; -- 1.7.1