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: 9170371 X-Patchwork-Delegate: bhelgaas@google.com 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 6DC3E6048F for ; Fri, 10 Jun 2016 19:57:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FA68282F9 for ; Fri, 10 Jun 2016 19:57:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 540DF2835E; Fri, 10 Jun 2016 19:57:50 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04B20282F9 for ; Fri, 10 Jun 2016 19:57:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932420AbcFJT5f (ORCPT ); Fri, 10 Jun 2016 15:57:35 -0400 Received: from mail-lf0-f45.google.com ([209.85.215.45]:33059 "EHLO mail-lf0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932130AbcFJTz5 (ORCPT ); Fri, 10 Jun 2016 15:55:57 -0400 Received: by mail-lf0-f45.google.com with SMTP id f6so31372855lfg.0 for ; Fri, 10 Jun 2016 12:55:56 -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=DvP1sEPE4YF72Sz3+zsxlMjYwlgP8wDmMY9KQib8D4F2VLl2OEi9uesBmd/lmTmVzU 4cgG4YD693gWtE5I4ISI8u+SAq8YU/zkYiwrggrM3VXAa29H32l7LfjhGVkH6qf9j88w guFEPLJfdJwDJVIShOS1Rqg2FFnaq91wrtnTsGJDtHi3ucOo3vcAiufLrn9jbuxH+v+w 2huUTxF9aBwrUCi4yz8NgBpFWE9wHXRSD6TnoB18LjMvmjtKj2ZWh05xXPrXzn8ZRD40 jBn2Xy2GA7eFVgldOGDl8eueXOwjX81+NfaZ+qZoxc78lqfahC3snc8UqJtvDa3H+Mlm Y4Vw== X-Gm-Message-State: ALyK8tLFaTtsCVfY1cty6wF3za0Ky+VTv6vgOr9yy+b321Jh7oMpNmR2EV8LSafn489R5Q== 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 Cc: robert.richter@caviumnetworks.com, mw@semihalf.com, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com, wangyijing@huawei.com, Suravee.Suthikulpanit@amd.com, msalter@redhat.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, jcm@redhat.com, andrea.gallo@linaro.org, dhdang@apm.com, jeremy.linton@arm.com, liudongdong3@huawei.com, cov@codeaurora.org, Tomasz Nowicki 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> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.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 */