From patchwork Wed Aug 1 22:27:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Sharp X-Patchwork-Id: 174617 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 2FE092C0091 for ; Thu, 2 Aug 2012 08:55:10 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 70BAD28093; Thu, 2 Aug 2012 00:55:08 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5YylPlsR8xcq; Thu, 2 Aug 2012 00:55:08 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7DC8728094; Thu, 2 Aug 2012 00:55:06 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B12B628094 for ; Thu, 2 Aug 2012 00:55:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0fdjTjuZa7Th for ; Thu, 2 Aug 2012 00:55:04 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-yx0-f172.google.com (mail-yx0-f172.google.com [209.85.213.172]) by theia.denx.de (Postfix) with ESMTPS id 0630628093 for ; Thu, 2 Aug 2012 00:55:02 +0200 (CEST) Received: by yenq13 with SMTP id q13so7868924yen.3 for ; Wed, 01 Aug 2012 15:55:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references:to; bh=dpLeD+aBv+X+vIuv/et7qP1XtWkrYwh07HV1GZvHAEA=; b=DyXeCCT1MSrlOFHsTF3/5VaEz4wYh1IZ09E/BIh2D4e4we0DXvYSAEobrKcIz3cE1n H2mNoFYDF64IZbra35aQ1UlxkjbBdFrWvgjW9WZoWSAGk6Kne/zHMF8BWL2p9GIHd+8B QYoVI9Vh0E2j5HVDskGFWWEYWf1rjcjjDyPv7yx0u9rqCRit/Av2Rjp/s0qc+1jLQmzK L2OD/qsOPLusRYOoHJwe5BhrvB9HDvgcEG+NEpsYDlaXSzzI9+aP4S1viJlazWEVk1qT 7AUXoirOjV6h/vH6D1pUrKSvPnK19Lrfi7aj7wzBuWnPNhuXI+bjGffRgh8zpHEec3n2 A7Pg== Received: by 10.68.130.67 with SMTP id oc3mr55514872pbb.18.1343860048831; Wed, 01 Aug 2012 15:27:28 -0700 (PDT) Received: from localhost.localdomain ([132.237.245.15]) by mx.google.com with ESMTPS id tv6sm3392326pbc.24.2012.08.01.15.27.27 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Aug 2012 15:27:28 -0700 (PDT) From: Andrew Sharp To: Date: Wed, 1 Aug 2012 15:27:18 -0700 Message-Id: <1343860040-30941-4-git-send-email-andywyse6@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1343860040-30941-1-git-send-email-andywyse6@gmail.com> References: <1343860040-30941-1-git-send-email-andywyse6@gmail.com> To: Subject: [U-Boot] [PATCH 3/5] pci: minor cleanup of CONFIG_PCI_PNP usage X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@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--;