From patchwork Fri Jan 3 21:31:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 13925954 X-Patchwork-Delegate: bhelgaas@google.com Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B15B31BD9FF; Fri, 3 Jan 2025 21:31:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735939898; cv=none; b=FOFjAlh67+UdwSfugjsEbwKVB/vytiVvVYPg9fO9xU8+Dr2mHtkn2wGnDyP0JOhfzsmqACKo76anOdi91nx6WcccooEEfVK8fXL9RcgxHD1pDHks8MFZ3HhgIhPYgcZfHM8ir9Ci1Y2qhlzcV/2UJwa1MQYZy83bP14jivGfd70= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735939898; c=relaxed/simple; bh=T3K7Xt/laFZc/LMwoH4OYILNY7Em+VlSsCcVbeg4c9o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nbWUp+MR6fYc/uxZIwdy2IaCcG6Jfv0a8bp/wboWIeGi/DQc524BnV3yeSL61mgdxZPVk7IIID21N3iVYiTjdX/nN90TQ4LUzYmCLqLzet5zCb4UIR14fsu0cQ1VBQLKJah/S0Gx4jQxShdigvAPpvRX/MOnhWy85FGyVYUzefA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pdM7sGO2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pdM7sGO2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30B0DC4CEE0; Fri, 3 Jan 2025 21:31:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735939898; bh=T3K7Xt/laFZc/LMwoH4OYILNY7Em+VlSsCcVbeg4c9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pdM7sGO2qaXMPTZjUtOSF5JeRh5l/trqXU8vci4JYvyyWmEj5sM9/fWlsW2sldZvM 0pWQZJRsWz5ufXJuiFjys0BKsBJpKFcK5JnHVWdmwZR0rESPAw0gSkN6j6eiR9b0jJ cKqBgHPERwm0c4dw35iCls+kUqU9TjXiuwuNxDanXZ67aJKx2WdZEtHAYAsrKw+s0X 6VTCyn+j/it9Sz7RzRYCd85XlzQfhK2cyE0ArT3vi2PNUV8+qu+huHPm8/EGqeTAs8 pLJLFNbmmAswSwx7Eh7/WTabVR3Fbfu/krWWxaNB28SNHp4sFpMklkVF8teETConbL G41rVORmPcVjg== From: Bjorn Helgaas To: Rob Herring Cc: "David S . Miller" , Andreas Larsson , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 1/3] PCI: Unexport of_pci_parse_bus_range() Date: Fri, 3 Jan 2025 15:31:27 -0600 Message-Id: <20250103213129.5182-2-helgaas@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250103213129.5182-1-helgaas@kernel.org> References: <20250103213129.5182-1-helgaas@kernel.org> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bjorn Helgaas of_pci_parse_bus_range() is only used in drivers/pci/of.c, so make it static and unexport it. Signed-off-by: Bjorn Helgaas Reviewed-by: Rob Herring (Arm) --- drivers/pci/of.c | 4 ++-- drivers/pci/pci.h | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 52f770bcc481..2f579b691f8e 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -190,7 +190,8 @@ EXPORT_SYMBOL_GPL(of_pci_get_devfn); * * Returns 0 on success or a negative error-code on failure. */ -int of_pci_parse_bus_range(struct device_node *node, struct resource *res) +static int of_pci_parse_bus_range(struct device_node *node, + struct resource *res) { u32 bus_range[2]; int error; @@ -207,7 +208,6 @@ int of_pci_parse_bus_range(struct device_node *node, struct resource *res) return 0; } -EXPORT_SYMBOL_GPL(of_pci_parse_bus_range); /** * of_get_pci_domain_nr - Find the host bridge domain number diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 2e40fc63ba31..35faf4770a14 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -797,7 +797,6 @@ static inline u64 pci_rebar_size_to_bytes(int size) struct device_node; #ifdef CONFIG_OF -int of_pci_parse_bus_range(struct device_node *node, struct resource *res); int of_get_pci_domain_nr(struct device_node *node); int of_pci_get_max_link_speed(struct device_node *node); u32 of_pci_get_slot_power_limit(struct device_node *node, @@ -813,12 +812,6 @@ int devm_of_pci_bridge_init(struct device *dev, struct pci_host_bridge *bridge); bool of_pci_supply_present(struct device_node *np); #else -static inline int -of_pci_parse_bus_range(struct device_node *node, struct resource *res) -{ - return -EINVAL; -} - static inline int of_get_pci_domain_nr(struct device_node *node) { From patchwork Fri Jan 3 21:31:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 13925955 X-Patchwork-Delegate: bhelgaas@google.com Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 826291C3BF7; Fri, 3 Jan 2025 21:31:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735939900; cv=none; b=ew7thKR4OjgJKbvVsGe1okcnon6ovs0ahQuFzDH0Fkxmz+sMg1Ise4rsHpJVvyH4F9rnRfdySMqntYvbPgLNpwE4OLbg3tCdKpsq9168Sgj7w13Bh0PLeD7KFTLtMn1ERkpOPB/T8ARVBApjN3mKzhLglsIZVzqx0tb+t5rFnSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735939900; c=relaxed/simple; bh=ztOb7Bjbdt8/rOh3nZBMwe5FXbP3NIWGLtLshH98ct8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BLlm2r+SM0JLcZrIC/tCCbaY5JqXSmzkCh+a/XAV6l89okLvH7aqaGGw+MC6tTmAkHc0MBsHL5CPYXH+WtOkCBW1JkCQHwQ/xsR2UBy6eWy0cg18/Oo6+iA6H2jQor+z3FmzufEFwTf84yEhl7HgBZcIjzIU70886FQG5JgH4nU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MKXdZqoO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MKXdZqoO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFC2DC4CED7; Fri, 3 Jan 2025 21:31:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735939900; bh=ztOb7Bjbdt8/rOh3nZBMwe5FXbP3NIWGLtLshH98ct8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MKXdZqoOf6LEH5y3eWn5fPO0k1j+4ekhPXyt/ieCCAaz8YT9GR4Kavz8CxrxW5R+K tpkQIxXqFBuydnalmcYKGfISPQKeUpyk/ttzWqgfxFx2nYgn9fqSZT5vZ0FPpOuako DJ4aFwJrhlPYuuJBO7flSU7arTKY8IB9XsreLo5tu+GC/UptTzPSUByTMo720kqTeA hFt7kN7T8UABoqEk5DsZ1mZR+VpHF9MrORM8EceNI9RDTqG+EHysIG4puDJDvQ4tw8 sAAmqyGVP3DfhzUYheIhaM5iEj/jJdRVo2J7VjujYgfpAvkysOyheeBEg7odAuFHRL oMTcj+p3RLOhw== From: Bjorn Helgaas To: Rob Herring Cc: "David S . Miller" , Andreas Larsson , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 2/3] PCI: of: Simplify bus range parsing Date: Fri, 3 Jan 2025 15:31:28 -0600 Message-Id: <20250103213129.5182-3-helgaas@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250103213129.5182-1-helgaas@kernel.org> References: <20250103213129.5182-1-helgaas@kernel.org> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bjorn Helgaas of_pci_parse_bus_range() looks for a DT "bus-range" property. If none exists, devm_of_pci_get_host_bridge_resources() defaults to the [bus 00-ff] range supplied by its caller, pci_parse_request_of_pci_ranges(). devm_of_pci_get_host_bridge_resources() is static and has no other callers, so there's no reason to complicate its interface by passing the default bus range. Drop the busno and bus_max parameters and use 0x0 and 0xff directly in devm_of_pci_get_host_bridge_resources(). Signed-off-by: Bjorn Helgaas --- drivers/pci/of.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 2f579b691f8e..02cba51e4ca4 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -302,8 +302,6 @@ EXPORT_SYMBOL_GPL(of_pci_check_probe_only); * devm_of_pci_get_host_bridge_resources() - Resource-managed parsing of PCI * host bridge resources from DT * @dev: host bridge device - * @busno: bus number associated with the bridge root bus - * @bus_max: maximum number of buses for this bridge * @resources: list where the range of resources will be added after DT parsing * @ib_resources: list where the range of inbound resources (with addresses * from 'dma-ranges') will be added after DT parsing @@ -319,7 +317,6 @@ EXPORT_SYMBOL_GPL(of_pci_check_probe_only); * value if it failed. */ static int devm_of_pci_get_host_bridge_resources(struct device *dev, - unsigned char busno, unsigned char bus_max, struct list_head *resources, struct list_head *ib_resources, resource_size_t *io_base) @@ -343,8 +340,8 @@ static int devm_of_pci_get_host_bridge_resources(struct device *dev, err = of_pci_parse_bus_range(dev_node, bus_range); if (err) { - bus_range->start = busno; - bus_range->end = bus_max; + bus_range->start = 0; + bus_range->end = 0xff; bus_range->flags = IORESOURCE_BUS; dev_info(dev, " No bus range found for %pOF, using %pR\n", dev_node, bus_range); @@ -597,7 +594,7 @@ static int pci_parse_request_of_pci_ranges(struct device *dev, INIT_LIST_HEAD(&bridge->windows); INIT_LIST_HEAD(&bridge->dma_ranges); - err = devm_of_pci_get_host_bridge_resources(dev, 0, 0xff, &bridge->windows, + err = devm_of_pci_get_host_bridge_resources(dev, &bridge->windows, &bridge->dma_ranges, &iobase); if (err) return err; From patchwork Fri Jan 3 21:31:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 13925956 X-Patchwork-Delegate: bhelgaas@google.com Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30EC21BD9FF; Fri, 3 Jan 2025 21:31:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735939902; cv=none; b=QoXUhaJ3oB7knaHH/3uMoTxljce7Zfjh/qGU71eIOBJDTBDFghnDMNXSQLSWNAcWEC0jEffnSnmQVVDjicsNyW8dOgK1LZpTKCn/mNYNIGQzN7mgU4cmaEupHWpo1mzJgrZafRt2nWdNVpcYM1rh8aqkYS7dVoDjU9xMyIQyCyk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735939902; c=relaxed/simple; bh=EuCGkIFQhILIwI/BmPvzsrziE7WAnUsgkmw9+dkwRlY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=a69qsVYB6sOWFayv3+O1hxtFZ9ywfeELl73klfjZsSN1RI5tv0LoOqShIGDcvEFuA/AAvCBgF0fR7QVjZbqCoX42xJp4lK+/I7R1nHpRVwLYJJ5Vl/XuREO2yTGapKct773L1aESS4rLTQ6ogQL52l+41lFzmfe+ImwwHE74pmI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lhAspUKF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lhAspUKF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89680C4CECE; Fri, 3 Jan 2025 21:31:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735939901; bh=EuCGkIFQhILIwI/BmPvzsrziE7WAnUsgkmw9+dkwRlY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lhAspUKFtF39lRlM18VayT1QP+099ZCaZZ4nEhX+lax4q812ogmxjpOcMki7XHF7Z 1aA1DlJPoyRNkiaWY+ftbCTDFfKbWeZ9Kp36E4qLPdFAqxKNrCa5S8dX2h1gJx+zVB QFkPMgGtfQIGamvs5U1epM4jE04jSOJyLG6qVxbGXo/CgQx4YSaQGuUHwaMVX7HgM+ uLlxCcCDP3MACJdapylvZdyeadGbYBm36pMWDXN54imLO55f4OICkaZjKy+iUp/pfv e0HCmHGqhXG7xSYSgGo02Ej7AJlhZhwvD40+lotXybtfkMEx0CmxKj7NT/sSO+8Eml dHnkHNK378XSQ== From: Bjorn Helgaas To: Rob Herring Cc: "David S . Miller" , Andreas Larsson , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 3/3] sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources() Date: Fri, 3 Jan 2025 15:31:29 -0600 Message-Id: <20250103213129.5182-4-helgaas@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250103213129.5182-1-helgaas@kernel.org> References: <20250103213129.5182-1-helgaas@kernel.org> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bjorn Helgaas 5bd51b35c7cb ("PCI: Rework of_pci_get_host_bridge_resources() to devm_of_pci_get_host_bridge_resources()") converted and renamed of_pci_get_host_bridge_resources(). Update the comment reference to match. Signed-off-by: Bjorn Helgaas Acked-by: Andreas Larsson --- arch/sparc/kernel/pci_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sparc/kernel/pci_common.c b/arch/sparc/kernel/pci_common.c index 5eeec9ad6845..2576f4f31309 100644 --- a/arch/sparc/kernel/pci_common.c +++ b/arch/sparc/kernel/pci_common.c @@ -361,7 +361,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm) int i, saw_mem, saw_io; int num_pbm_ranges; - /* Corresponding generic code in of_pci_get_host_bridge_resources() */ + /* Corresponds to generic devm_of_pci_get_host_bridge_resources() */ saw_mem = saw_io = 0; pbm_ranges = of_get_property(pbm->op->dev.of_node, "ranges", &i);