From patchwork Fri Jun 10 19:55:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9170395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AFEBC6048F for ; Fri, 10 Jun 2016 19:58:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A10A526E5D for ; Fri, 10 Jun 2016 19:58:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9596E28319; Fri, 10 Jun 2016 19:58:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 55BB426E5D for ; Fri, 10 Jun 2016 19:58:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bBSYN-0001sl-Kn; Fri, 10 Jun 2016 19:57:15 +0000 Received: from mail-lf0-x22f.google.com ([2a00:1450:4010:c07::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bBSXR-00012N-Ks for linux-arm-kernel@lists.infradead.org; Fri, 10 Jun 2016 19:56:19 +0000 Received: by mail-lf0-x22f.google.com with SMTP id q132so14581293lfe.3 for ; Fri, 10 Jun 2016 12:55:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gb7kq1g3ZXC2qkT2FRNEGle+647/VBHWNLzxts6ejbw=; b=hrdGG16bm0KzuN+piQIMf8XRicVK72tLWrD7ERk2DbGMqhJwwrOwOEyhoKU8z8/WXS 9XC9wUb/eSWjPTTZe2YgBACLwEZJnTgA8GwzVAroUAOP4ixLvk3UnkzvxxmaiobiR+0h T/OJoAISyQJdBOQ4X+bBPuPV0rW7J0/aZ0ci8MlTnrZIIYJ97Z3QzbCymZn2CzqYdEQP UBp+74CIwR9g35P1t12DRvlXwk8RwUaElhijgmMZ7R8HA1ayeTv8g2jloVUzYwREgU16 TeFzCFBIzPcDfMvDa717LiB1m8PcAf0JMGRIo84ORl1ytn5dqAIy8DbsfW/0GZWgRiyv Gcbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gb7kq1g3ZXC2qkT2FRNEGle+647/VBHWNLzxts6ejbw=; b=ZoUUzcwY7gQPWzq231y7pXOuJ3Vrk7WiTiQkx5xSj3VRlM0wGT/RV1A/k4hVja8QC8 hr+JqHNKbNsKXHEIy99KDPfgegZFRAS9mt//jYcUJ7Vy4Gj57AXKD9HsX3dREBGsQ0nn IdbSBdygdXw8kZ3xTOKNQk1skqp47ZHMKOUi6b2wfDTOOA9CG3r9Md7L0p8caCrGpodS QtyORKbaz7R7iEBUCYF/KiRTI/hvOqNdKiLe1PRoIELWkHzJ27b8JShRY7DLEIfzUp+s 5IFv4vK3VGCf2RYe/MSg49JqgR09nk2Wn0yCFIF0EBlfn1fN+UG4F41kqwBD/lB3sSv5 v5tQ== X-Gm-Message-State: ALyK8tKaf+c+TjLu7tY1+YCYzD4OJpIDlRoIG17c2fXlkE0QXCk/wjKXaF3Bl5+ByNMdVg== X-Received: by 10.25.136.11 with SMTP id k11mr928941lfd.134.1465588555842; Fri, 10 Jun 2016 12:55:55 -0700 (PDT) Received: from tn-HP-4.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id a190sm1377175lfe.21.2016.06.10.12.55.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Jun 2016 12:55:55 -0700 (PDT) From: Tomasz Nowicki To: helgaas@kernel.org, arnd@arndb.de, will.deacon@arm.com, catalin.marinas@arm.com, rafael@kernel.org, hanjun.guo@linaro.org, Lorenzo.Pieralisi@arm.com, okaya@codeaurora.org, jchandra@broadcom.com Subject: [PATCH V9 06/11] PCI: Refactor generic bus domain assignment Date: Fri, 10 Jun 2016 21:55:14 +0200 Message-Id: <1465588519-11334-7-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465588519-11334-1-git-send-email-tn@semihalf.com> References: <1465588519-11334-1-git-send-email-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160610_125618_067095_67DE48A3 X-CRM114-Status: GOOD ( 13.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jcm@redhat.com, linaro-acpi@lists.linaro.org, linux-pci@vger.kernel.org, dhdang@apm.com, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com, jeremy.linton@arm.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, robert.richter@caviumnetworks.com, cov@codeaurora.org, Suravee.Suthikulpanit@amd.com, msalter@redhat.com, wangyijing@huawei.com, Tomasz Nowicki , mw@semihalf.com, andrea.gallo@linaro.org, linux-arm-kernel@lists.infradead.org, liudongdong3@huawei.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Change the way PCI bus domain number is assigned and improve function name to reflect what function does. No functional changes. Instead of assigning bus domain number inside of pci_bus_assign_domain_nr() simply return domain number and let pci_create_root_bus() do assignment. This way pci_create_root_bus() setups bus structure data in the consistent way. Since pci_bus_assign_domain_nr() now does not assign but retrieves domain number instead, rename it to pci_bus_find_domain_nr(). Signed-off-by: Tomasz Nowicki Reviewed-by: Lorenzo Pieralisi --- drivers/pci/pci.c | 4 ++-- drivers/pci/probe.c | 4 +++- include/linux/pci.h | 7 +------ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index eb431b5..b9a7833 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4941,7 +4941,7 @@ int pci_get_new_domain_nr(void) } #ifdef CONFIG_PCI_DOMAINS_GENERIC -void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent) +int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent) { static int use_dt_domains = -1; int domain = -1; @@ -4985,7 +4985,7 @@ void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent) domain = -1; } - bus->domain_nr = domain; + return domain; } #endif #endif diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 8e3ef72..380d46d 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2127,7 +2127,9 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, b->sysdata = sysdata; b->ops = ops; b->number = b->busn_res.start = bus; - pci_bus_assign_domain_nr(b, parent); +#ifdef CONFIG_PCI_DOMAINS_GENERIC + b->domain_nr = pci_bus_find_domain_nr(b, parent); +#endif b2 = pci_find_bus(pci_domain_nr(b), bus); if (b2) { /* If we already got to this bus through a different bridge, ignore it */ diff --git a/include/linux/pci.h b/include/linux/pci.h index ce03d65..48839e8 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1390,12 +1390,7 @@ static inline int pci_domain_nr(struct pci_bus *bus) { return bus->domain_nr; } -void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent); -#else -static inline void pci_bus_assign_domain_nr(struct pci_bus *bus, - struct device *parent) -{ -} +int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent); #endif /* some architectures require additional setup to direct VGA traffic */