From patchwork Thu Dec 17 04:12:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 558042 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 99CA71401DA for ; Thu, 17 Dec 2015 15:13:09 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=SdOuuuPX; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 42328A7524; Thu, 17 Dec 2015 05:13:05 +0100 (CET) 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 clvQ2nV1T7cc; Thu, 17 Dec 2015 05:13:05 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 09A55A7525; Thu, 17 Dec 2015 05:12:56 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 764AE4BD83 for ; Thu, 17 Dec 2015 05:12:47 +0100 (CET) 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 nY_e3W5YUHMI for ; Thu, 17 Dec 2015 05:12:47 +0100 (CET) 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-oi0-f41.google.com (mail-oi0-f41.google.com [209.85.218.41]) by theia.denx.de (Postfix) with ESMTPS id 0B2964BD86 for ; Thu, 17 Dec 2015 05:12:42 +0100 (CET) Received: by mail-oi0-f41.google.com with SMTP id o62so31675254oif.3 for ; Wed, 16 Dec 2015 20:12:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=W3JtNgX9mTB1K3LP1UZ6Rp0N0ldCebEtIkiLdFbSwpA=; b=SdOuuuPX14lCGN7AJXfKBcL2Iind22QOqTdcTdAmSvY//gX1ZphOfF+1nLW+8sfvuo Bw7wQ5kA+yZVsGAvNDvYWE4RBOEMWG40/g2iIXwohAi/N3l1hAdI5wSg8eblmtuqmWCt CC2iyDycQcGqKF7vGx/o5+FP+I6N7GqodQ6dO/mjo7vEThg+F9IMk4TWf69T5urLrUkU 4y0FVYmzu92pEud4jJeySCPbDiMDxaiDl1KEBgKFMWSRQrzYJilx4XuYpcBSsodwiven QjW4Tv+BGjcibCN++o495hW0zfZwLTmsFUHOH1Bx/6XSFHAa6mv097RC/GEnSLOYhCRG OvmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=W3JtNgX9mTB1K3LP1UZ6Rp0N0ldCebEtIkiLdFbSwpA=; b=a34/MaBLQ62rAm/L00HOg1LV0aEf8tTWj2DkHEosGSZEOAxI6/zY0DcH02wPlxKVdn X/hMspzrd4zeFyGQirlz2DlsWYM9aIjrzPE7OKx/VQUy9lwEhuKB0JAStcurV4Pkgz5Z wtIezM3OvGuCafszVP4gKQ6YUM7ys0mNoegjKs9bwk+n94WLki3G7ov5+XeQ3MLygOEw xQMqzOiJR9qy+YNrHUAOHPJX3BoxiaffSC3ky9cJNyBdf3YiOCVRyOmWyT1bw/0fWpnO 7B92EuQNOFhLOmwfsNi9JkMOPqAzHGVupeEeNtFlLOp009MLYc6Bp5ne3NNiocIH7IRo N9yA== X-Gm-Message-State: ALoCoQnn2HU/guSroEal+aniyfATxigtCAgxGi4ru5/0uX2ZkLdDAkjKwoVh3ofh6463feQeQBTIwHWpX0X8BNKIA5Ni/e4tmQ== X-Received: by 10.202.207.2 with SMTP id f2mr28126184oig.101.1450325561532; Wed, 16 Dec 2015 20:12:41 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by smtp.gmail.com with ESMTPSA id qv1sm2719488oeb.2.2015.12.16.20.12.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Dec 2015 20:12:40 -0800 (PST) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 11D042210EE; Wed, 16 Dec 2015 21:12:38 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 Dec 2015 21:12:32 -0700 Message-Id: <1450325556-12403-4-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 In-Reply-To: <1450325556-12403-1-git-send-email-sjg@chromium.org> References: <1450325556-12403-1-git-send-email-sjg@chromium.org> Subject: [U-Boot] [PATCH v2 3/7] dm: pci: Avoid using pci_bus_to_hose() in the uclass X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This function is only available for compatibility with old code. Avoid using it in the uclass. Signed-off-by: Simon Glass Reviewed-by: Bin Meng Tested-by: Bin Meng --- Changes in v2: None drivers/pci/pci_auto.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c index 842eafc..c5638e9 100644 --- a/drivers/pci/pci_auto.c +++ b/drivers/pci/pci_auto.c @@ -9,6 +9,7 @@ */ #include +#include #include #include @@ -167,8 +168,8 @@ void dm_pciauto_prescan_setup_bridge(struct udevice *dev, int sub_bus) struct pci_region *pci_prefetch; struct pci_region *pci_io; u16 cmdstat, prefechable_64; - /* The root controller has the region information */ - struct pci_controller *ctlr_hose = pci_bus_to_hose(0); + struct udevice *ctlr = pci_get_controller(dev); + struct pci_controller *ctlr_hose = dev_get_uclass_priv(ctlr); pci_mem = ctlr_hose->pci_mem; pci_prefetch = ctlr_hose->pci_prefetch; @@ -248,9 +249,8 @@ void dm_pciauto_postscan_setup_bridge(struct udevice *dev, int sub_bus) struct pci_region *pci_mem; struct pci_region *pci_prefetch; struct pci_region *pci_io; - - /* The root controller has the region information */ - struct pci_controller *ctlr_hose = pci_bus_to_hose(0); + struct udevice *ctlr = pci_get_controller(dev); + struct pci_controller *ctlr_hose = dev_get_uclass_priv(ctlr); pci_mem = ctlr_hose->pci_mem; pci_prefetch = ctlr_hose->pci_prefetch; @@ -311,13 +311,13 @@ int dm_pciauto_config_device(struct udevice *dev) unsigned int sub_bus = PCI_BUS(dm_pci_get_bdf(dev)); unsigned short class; bool enum_only = false; + struct udevice *ctlr = pci_get_controller(dev); + struct pci_controller *ctlr_hose = dev_get_uclass_priv(ctlr); int n; #ifdef CONFIG_PCI_ENUM_ONLY enum_only = true; #endif - /* The root controller has the region information */ - struct pci_controller *ctlr_hose = pci_bus_to_hose(0); pci_mem = ctlr_hose->pci_mem; pci_prefetch = ctlr_hose->pci_prefetch;