* [PATCH 0/3] PCI: Simplify bus range parsing
@ 2025-01-03 21:31 Bjorn Helgaas
2025-01-03 21:31 ` [PATCH 1/3] PCI: Unexport of_pci_parse_bus_range() Bjorn Helgaas
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2025-01-03 21:31 UTC (permalink / raw)
To: Rob Herring
Cc: David S . Miller, Andreas Larsson, sparclinux, linux-kernel,
linux-pci, Bjorn Helgaas
From: Bjorn Helgaas <bhelgaas@google.com>
Unexport of_pci_parse_bus_range() since it's only used in drivers/pci/of.c.
Drop bus range parameters from devm_of_pci_get_host_bridge_resources()
since they're always the same values.
Update a sparc comment that referred to of_pci_get_host_bridge_resources(),
which no longer exists.
Bjorn Helgaas (3):
PCI: Unexport of_pci_parse_bus_range()
PCI: of: Simplify bus range parsing
sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources()
arch/sparc/kernel/pci_common.c | 2 +-
drivers/pci/of.c | 13 +++++--------
drivers/pci/pci.h | 7 -------
3 files changed, 6 insertions(+), 16 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/3] PCI: Unexport of_pci_parse_bus_range()
2025-01-03 21:31 [PATCH 0/3] PCI: Simplify bus range parsing Bjorn Helgaas
@ 2025-01-03 21:31 ` Bjorn Helgaas
2025-01-07 14:52 ` Rob Herring
2025-01-03 21:31 ` [PATCH 2/3] PCI: of: Simplify bus range parsing Bjorn Helgaas
2025-01-03 21:31 ` [PATCH 3/3] sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources() Bjorn Helgaas
2 siblings, 1 reply; 11+ messages in thread
From: Bjorn Helgaas @ 2025-01-03 21:31 UTC (permalink / raw)
To: Rob Herring
Cc: David S . Miller, Andreas Larsson, sparclinux, linux-kernel,
linux-pci, Bjorn Helgaas
From: Bjorn Helgaas <bhelgaas@google.com>
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 <bhelgaas@google.com>
---
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)
{
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/3] PCI: of: Simplify bus range parsing
2025-01-03 21:31 [PATCH 0/3] PCI: Simplify bus range parsing Bjorn Helgaas
2025-01-03 21:31 ` [PATCH 1/3] PCI: Unexport of_pci_parse_bus_range() Bjorn Helgaas
@ 2025-01-03 21:31 ` Bjorn Helgaas
2025-01-03 21:36 ` Bjorn Helgaas
` (3 more replies)
2025-01-03 21:31 ` [PATCH 3/3] sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources() Bjorn Helgaas
2 siblings, 4 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2025-01-03 21:31 UTC (permalink / raw)
To: Rob Herring
Cc: David S . Miller, Andreas Larsson, sparclinux, linux-kernel,
linux-pci, Bjorn Helgaas
From: Bjorn Helgaas <bhelgaas@google.com>
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 <bhelgaas@google.com>
---
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;
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/3] sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources()
2025-01-03 21:31 [PATCH 0/3] PCI: Simplify bus range parsing Bjorn Helgaas
2025-01-03 21:31 ` [PATCH 1/3] PCI: Unexport of_pci_parse_bus_range() Bjorn Helgaas
2025-01-03 21:31 ` [PATCH 2/3] PCI: of: Simplify bus range parsing Bjorn Helgaas
@ 2025-01-03 21:31 ` Bjorn Helgaas
2025-01-07 13:03 ` Andreas Larsson
2 siblings, 1 reply; 11+ messages in thread
From: Bjorn Helgaas @ 2025-01-03 21:31 UTC (permalink / raw)
To: Rob Herring
Cc: David S . Miller, Andreas Larsson, sparclinux, linux-kernel,
linux-pci, Bjorn Helgaas
From: Bjorn Helgaas <bhelgaas@google.com>
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 <bhelgaas@google.com>
---
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);
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] PCI: of: Simplify bus range parsing
2025-01-03 21:31 ` [PATCH 2/3] PCI: of: Simplify bus range parsing Bjorn Helgaas
@ 2025-01-03 21:36 ` Bjorn Helgaas
2025-01-03 21:38 ` Bjorn Helgaas
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2025-01-03 21:36 UTC (permalink / raw)
To: Rob Herring
Cc: David S . Miller, Andreas Larsson, sparclinux, linux-kernel,
linux-pci, Bjorn Helgaas
On Fri, Jan 03, 2025 at 03:31:28PM -0600, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> 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.
> @@ -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);
Hmm, would have been better if I'd compiled this first to notice the
build error, sorry about that:
drivers/pci/of.c: In function ‘devm_of_pci_get_host_bridge_resources’:
drivers/pci/of.c:349:57: error: ‘bus_max’ undeclared (first use in this function)
349 | if (bus_range->end > bus_range->start + bus_max)
| ^~~~~~~
Will fix.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] PCI: of: Simplify bus range parsing
2025-01-03 21:31 ` [PATCH 2/3] PCI: of: Simplify bus range parsing Bjorn Helgaas
2025-01-03 21:36 ` Bjorn Helgaas
@ 2025-01-03 21:38 ` Bjorn Helgaas
2025-01-07 14:46 ` Rob Herring
2025-01-04 7:23 ` kernel test robot
2025-01-04 8:39 ` kernel test robot
3 siblings, 1 reply; 11+ messages in thread
From: Bjorn Helgaas @ 2025-01-03 21:38 UTC (permalink / raw)
To: Rob Herring
Cc: David S . Miller, Andreas Larsson, sparclinux, linux-kernel,
linux-pci, Bjorn Helgaas
On Fri, Jan 03, 2025 at 03:31:28PM -0600, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> 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().
Since we default this if the DT lacks "bus-range", is there any point
in repeating "bus-range = <0x00 0xff>;" in all the host bridge
descriptions?
> @@ -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);
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] PCI: of: Simplify bus range parsing
2025-01-03 21:31 ` [PATCH 2/3] PCI: of: Simplify bus range parsing Bjorn Helgaas
2025-01-03 21:36 ` Bjorn Helgaas
2025-01-03 21:38 ` Bjorn Helgaas
@ 2025-01-04 7:23 ` kernel test robot
2025-01-04 8:39 ` kernel test robot
3 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2025-01-04 7:23 UTC (permalink / raw)
To: Bjorn Helgaas, Rob Herring
Cc: llvm, oe-kbuild-all, David S . Miller, Andreas Larsson,
sparclinux, linux-kernel, linux-pci, Bjorn Helgaas
Hi Bjorn,
kernel test robot noticed the following build errors:
[auto build test ERROR on pci/next]
[also build test ERROR on pci/for-linus robh/for-next linus/master v6.13-rc5 next-20241220]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Bjorn-Helgaas/PCI-Unexport-of_pci_parse_bus_range/20250104-053408
base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link: https://lore.kernel.org/r/20250103213129.5182-3-helgaas%40kernel.org
patch subject: [PATCH 2/3] PCI: of: Simplify bus range parsing
config: i386-buildonly-randconfig-001-20250104 (https://download.01.org/0day-ci/archive/20250104/202501041529.CV5Doc8D-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250104/202501041529.CV5Doc8D-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501041529.CV5Doc8D-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from drivers/pci/of.c:12:
In file included from include/linux/pci.h:1645:
In file included from include/linux/dmapool.h:14:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:2223:
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> drivers/pci/of.c:349:43: error: use of undeclared identifier 'bus_max'; did you mean 'pid_max'?
349 | if (bus_range->end > bus_range->start + bus_max)
| ^~~~~~~
| pid_max
include/linux/pid.h:109:12: note: 'pid_max' declared here
109 | extern int pid_max;
| ^
drivers/pci/of.c:350:40: error: use of undeclared identifier 'bus_max'; did you mean 'pid_max'?
350 | bus_range->end = bus_range->start + bus_max;
| ^~~~~~~
| pid_max
include/linux/pid.h:109:12: note: 'pid_max' declared here
109 | extern int pid_max;
| ^
1 warning and 2 errors generated.
vim +349 drivers/pci/of.c
4670d610d59233 Rob Herring 2018-01-17 300
4670d610d59233 Rob Herring 2018-01-17 301 /**
5bd51b35c7cbbc Jan Kiszka 2018-05-15 302 * devm_of_pci_get_host_bridge_resources() - Resource-managed parsing of PCI
5bd51b35c7cbbc Jan Kiszka 2018-05-15 303 * host bridge resources from DT
055f87a2a33640 Jan Kiszka 2018-05-15 304 * @dev: host bridge device
4670d610d59233 Rob Herring 2018-01-17 305 * @resources: list where the range of resources will be added after DT parsing
9b41d19aff4090 Krzysztof Kozlowski 2020-07-29 306 * @ib_resources: list where the range of inbound resources (with addresses
9b41d19aff4090 Krzysztof Kozlowski 2020-07-29 307 * from 'dma-ranges') will be added after DT parsing
4670d610d59233 Rob Herring 2018-01-17 308 * @io_base: pointer to a variable that will contain on return the physical
4670d610d59233 Rob Herring 2018-01-17 309 * address for the start of the I/O range. Can be NULL if the caller doesn't
4670d610d59233 Rob Herring 2018-01-17 310 * expect I/O ranges to be present in the device tree.
4670d610d59233 Rob Herring 2018-01-17 311 *
4670d610d59233 Rob Herring 2018-01-17 312 * This function will parse the "ranges" property of a PCI host bridge device
4670d610d59233 Rob Herring 2018-01-17 313 * node and setup the resource mapping based on its content. It is expected
4670d610d59233 Rob Herring 2018-01-17 314 * that the property conforms with the Power ePAPR document.
4670d610d59233 Rob Herring 2018-01-17 315 *
4670d610d59233 Rob Herring 2018-01-17 316 * It returns zero if the range parsing has been successful or a standard error
4670d610d59233 Rob Herring 2018-01-17 317 * value if it failed.
4670d610d59233 Rob Herring 2018-01-17 318 */
3b55809cf91f54 Rob Herring 2019-10-28 319 static int devm_of_pci_get_host_bridge_resources(struct device *dev,
331f63457165a3 Rob Herring 2019-10-30 320 struct list_head *resources,
331f63457165a3 Rob Herring 2019-10-30 321 struct list_head *ib_resources,
331f63457165a3 Rob Herring 2019-10-30 322 resource_size_t *io_base)
4670d610d59233 Rob Herring 2018-01-17 323 {
055f87a2a33640 Jan Kiszka 2018-05-15 324 struct device_node *dev_node = dev->of_node;
93c9a7f8793175 Jan Kiszka 2018-06-19 325 struct resource *res, tmp_res;
4670d610d59233 Rob Herring 2018-01-17 326 struct resource *bus_range;
4670d610d59233 Rob Herring 2018-01-17 327 struct of_pci_range range;
4670d610d59233 Rob Herring 2018-01-17 328 struct of_pci_range_parser parser;
331f63457165a3 Rob Herring 2019-10-30 329 const char *range_type;
4670d610d59233 Rob Herring 2018-01-17 330 int err;
4670d610d59233 Rob Herring 2018-01-17 331
4670d610d59233 Rob Herring 2018-01-17 332 if (io_base)
4670d610d59233 Rob Herring 2018-01-17 333 *io_base = (resource_size_t)OF_BAD_ADDR;
4670d610d59233 Rob Herring 2018-01-17 334
5bd51b35c7cbbc Jan Kiszka 2018-05-15 335 bus_range = devm_kzalloc(dev, sizeof(*bus_range), GFP_KERNEL);
4670d610d59233 Rob Herring 2018-01-17 336 if (!bus_range)
4670d610d59233 Rob Herring 2018-01-17 337 return -ENOMEM;
4670d610d59233 Rob Herring 2018-01-17 338
d9c5d5ac287caa Jan Kiszka 2018-05-15 339 dev_info(dev, "host bridge %pOF ranges:\n", dev_node);
4670d610d59233 Rob Herring 2018-01-17 340
126b7de6bfd84b Jan Kiszka 2018-05-15 341 err = of_pci_parse_bus_range(dev_node, bus_range);
4670d610d59233 Rob Herring 2018-01-17 342 if (err) {
5ad20c289cd7a4 Bjorn Helgaas 2025-01-03 343 bus_range->start = 0;
5ad20c289cd7a4 Bjorn Helgaas 2025-01-03 344 bus_range->end = 0xff;
4670d610d59233 Rob Herring 2018-01-17 345 bus_range->flags = IORESOURCE_BUS;
d9c5d5ac287caa Jan Kiszka 2018-05-15 346 dev_info(dev, " No bus range found for %pOF, using %pR\n",
126b7de6bfd84b Jan Kiszka 2018-05-15 347 dev_node, bus_range);
4670d610d59233 Rob Herring 2018-01-17 348 } else {
4670d610d59233 Rob Herring 2018-01-17 @349 if (bus_range->end > bus_range->start + bus_max)
4670d610d59233 Rob Herring 2018-01-17 350 bus_range->end = bus_range->start + bus_max;
4670d610d59233 Rob Herring 2018-01-17 351 }
4670d610d59233 Rob Herring 2018-01-17 352 pci_add_resource(resources, bus_range);
4670d610d59233 Rob Herring 2018-01-17 353
4670d610d59233 Rob Herring 2018-01-17 354 /* Check for ranges property */
126b7de6bfd84b Jan Kiszka 2018-05-15 355 err = of_pci_range_parser_init(&parser, dev_node);
4670d610d59233 Rob Herring 2018-01-17 356 if (err)
d277f6e88c8872 Rob Herring 2021-08-03 357 return 0;
4670d610d59233 Rob Herring 2018-01-17 358
d9c5d5ac287caa Jan Kiszka 2018-05-15 359 dev_dbg(dev, "Parsing ranges property...\n");
4670d610d59233 Rob Herring 2018-01-17 360 for_each_of_pci_range(&parser, &range) {
4670d610d59233 Rob Herring 2018-01-17 361 /* Read next ranges element */
4670d610d59233 Rob Herring 2018-01-17 362 if ((range.flags & IORESOURCE_TYPE_BITS) == IORESOURCE_IO)
331f63457165a3 Rob Herring 2019-10-30 363 range_type = "IO";
4670d610d59233 Rob Herring 2018-01-17 364 else if ((range.flags & IORESOURCE_TYPE_BITS) == IORESOURCE_MEM)
331f63457165a3 Rob Herring 2019-10-30 365 range_type = "MEM";
4670d610d59233 Rob Herring 2018-01-17 366 else
331f63457165a3 Rob Herring 2019-10-30 367 range_type = "err";
331f63457165a3 Rob Herring 2019-10-30 368 dev_info(dev, " %6s %#012llx..%#012llx -> %#012llx\n",
d9c5d5ac287caa Jan Kiszka 2018-05-15 369 range_type, range.cpu_addr,
d9c5d5ac287caa Jan Kiszka 2018-05-15 370 range.cpu_addr + range.size - 1, range.pci_addr);
4670d610d59233 Rob Herring 2018-01-17 371
4670d610d59233 Rob Herring 2018-01-17 372 /*
4670d610d59233 Rob Herring 2018-01-17 373 * If we failed translation or got a zero-sized region
4670d610d59233 Rob Herring 2018-01-17 374 * then skip this range
4670d610d59233 Rob Herring 2018-01-17 375 */
4670d610d59233 Rob Herring 2018-01-17 376 if (range.cpu_addr == OF_BAD_ADDR || range.size == 0)
4670d610d59233 Rob Herring 2018-01-17 377 continue;
4670d610d59233 Rob Herring 2018-01-17 378
93c9a7f8793175 Jan Kiszka 2018-06-19 379 err = of_pci_range_to_resource(&range, dev_node, &tmp_res);
93c9a7f8793175 Jan Kiszka 2018-06-19 380 if (err)
93c9a7f8793175 Jan Kiszka 2018-06-19 381 continue;
93c9a7f8793175 Jan Kiszka 2018-06-19 382
93c9a7f8793175 Jan Kiszka 2018-06-19 383 res = devm_kmemdup(dev, &tmp_res, sizeof(tmp_res), GFP_KERNEL);
4670d610d59233 Rob Herring 2018-01-17 384 if (!res) {
4670d610d59233 Rob Herring 2018-01-17 385 err = -ENOMEM;
5bd51b35c7cbbc Jan Kiszka 2018-05-15 386 goto failed;
4670d610d59233 Rob Herring 2018-01-17 387 }
4670d610d59233 Rob Herring 2018-01-17 388
4670d610d59233 Rob Herring 2018-01-17 389 if (resource_type(res) == IORESOURCE_IO) {
4670d610d59233 Rob Herring 2018-01-17 390 if (!io_base) {
d9c5d5ac287caa Jan Kiszka 2018-05-15 391 dev_err(dev, "I/O range found for %pOF. Please provide an io_base pointer to save CPU base address\n",
126b7de6bfd84b Jan Kiszka 2018-05-15 392 dev_node);
4670d610d59233 Rob Herring 2018-01-17 393 err = -EINVAL;
5bd51b35c7cbbc Jan Kiszka 2018-05-15 394 goto failed;
4670d610d59233 Rob Herring 2018-01-17 395 }
4670d610d59233 Rob Herring 2018-01-17 396 if (*io_base != (resource_size_t)OF_BAD_ADDR)
d9c5d5ac287caa Jan Kiszka 2018-05-15 397 dev_warn(dev, "More than one I/O resource converted for %pOF. CPU base address for old range lost!\n",
126b7de6bfd84b Jan Kiszka 2018-05-15 398 dev_node);
4670d610d59233 Rob Herring 2018-01-17 399 *io_base = range.cpu_addr;
3bd6b8271ee660 Punit Agrawal 2021-06-15 400 } else if (resource_type(res) == IORESOURCE_MEM) {
3bd6b8271ee660 Punit Agrawal 2021-06-15 401 res->flags &= ~IORESOURCE_MEM_64;
4670d610d59233 Rob Herring 2018-01-17 402 }
4670d610d59233 Rob Herring 2018-01-17 403
4670d610d59233 Rob Herring 2018-01-17 404 pci_add_resource_offset(resources, res, res->start - range.pci_addr);
4670d610d59233 Rob Herring 2018-01-17 405 }
4670d610d59233 Rob Herring 2018-01-17 406
331f63457165a3 Rob Herring 2019-10-30 407 /* Check for dma-ranges property */
331f63457165a3 Rob Herring 2019-10-30 408 if (!ib_resources)
331f63457165a3 Rob Herring 2019-10-30 409 return 0;
331f63457165a3 Rob Herring 2019-10-30 410 err = of_pci_dma_range_parser_init(&parser, dev_node);
331f63457165a3 Rob Herring 2019-10-30 411 if (err)
331f63457165a3 Rob Herring 2019-10-30 412 return 0;
331f63457165a3 Rob Herring 2019-10-30 413
331f63457165a3 Rob Herring 2019-10-30 414 dev_dbg(dev, "Parsing dma-ranges property...\n");
331f63457165a3 Rob Herring 2019-10-30 415 for_each_of_pci_range(&parser, &range) {
331f63457165a3 Rob Herring 2019-10-30 416 /*
331f63457165a3 Rob Herring 2019-10-30 417 * If we failed translation or got a zero-sized region
331f63457165a3 Rob Herring 2019-10-30 418 * then skip this range
331f63457165a3 Rob Herring 2019-10-30 419 */
331f63457165a3 Rob Herring 2019-10-30 420 if (((range.flags & IORESOURCE_TYPE_BITS) != IORESOURCE_MEM) ||
331f63457165a3 Rob Herring 2019-10-30 421 range.cpu_addr == OF_BAD_ADDR || range.size == 0)
331f63457165a3 Rob Herring 2019-10-30 422 continue;
331f63457165a3 Rob Herring 2019-10-30 423
331f63457165a3 Rob Herring 2019-10-30 424 dev_info(dev, " %6s %#012llx..%#012llx -> %#012llx\n",
331f63457165a3 Rob Herring 2019-10-30 425 "IB MEM", range.cpu_addr,
331f63457165a3 Rob Herring 2019-10-30 426 range.cpu_addr + range.size - 1, range.pci_addr);
331f63457165a3 Rob Herring 2019-10-30 427
331f63457165a3 Rob Herring 2019-10-30 428
331f63457165a3 Rob Herring 2019-10-30 429 err = of_pci_range_to_resource(&range, dev_node, &tmp_res);
331f63457165a3 Rob Herring 2019-10-30 430 if (err)
331f63457165a3 Rob Herring 2019-10-30 431 continue;
331f63457165a3 Rob Herring 2019-10-30 432
331f63457165a3 Rob Herring 2019-10-30 433 res = devm_kmemdup(dev, &tmp_res, sizeof(tmp_res), GFP_KERNEL);
331f63457165a3 Rob Herring 2019-10-30 434 if (!res) {
331f63457165a3 Rob Herring 2019-10-30 435 err = -ENOMEM;
331f63457165a3 Rob Herring 2019-10-30 436 goto failed;
331f63457165a3 Rob Herring 2019-10-30 437 }
331f63457165a3 Rob Herring 2019-10-30 438
b8397a8f4ebc0b Robin Murphy 2022-05-09 439 pci_add_resource_offset(ib_resources, res,
331f63457165a3 Rob Herring 2019-10-30 440 res->start - range.pci_addr);
331f63457165a3 Rob Herring 2019-10-30 441 }
331f63457165a3 Rob Herring 2019-10-30 442
4670d610d59233 Rob Herring 2018-01-17 443 return 0;
4670d610d59233 Rob Herring 2018-01-17 444
5bd51b35c7cbbc Jan Kiszka 2018-05-15 445 failed:
4670d610d59233 Rob Herring 2018-01-17 446 pci_free_resource_list(resources);
4670d610d59233 Rob Herring 2018-01-17 447 return err;
4670d610d59233 Rob Herring 2018-01-17 448 }
4670d610d59233 Rob Herring 2018-01-17 449
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] PCI: of: Simplify bus range parsing
2025-01-03 21:31 ` [PATCH 2/3] PCI: of: Simplify bus range parsing Bjorn Helgaas
` (2 preceding siblings ...)
2025-01-04 7:23 ` kernel test robot
@ 2025-01-04 8:39 ` kernel test robot
3 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2025-01-04 8:39 UTC (permalink / raw)
To: Bjorn Helgaas, Rob Herring
Cc: oe-kbuild-all, David S . Miller, Andreas Larsson, sparclinux,
linux-kernel, linux-pci, Bjorn Helgaas
Hi Bjorn,
kernel test robot noticed the following build errors:
[auto build test ERROR on pci/next]
[also build test ERROR on pci/for-linus robh/for-next linus/master v6.13-rc5 next-20241220]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Bjorn-Helgaas/PCI-Unexport-of_pci_parse_bus_range/20250104-053408
base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link: https://lore.kernel.org/r/20250103213129.5182-3-helgaas%40kernel.org
patch subject: [PATCH 2/3] PCI: of: Simplify bus range parsing
config: i386-buildonly-randconfig-006-20250104 (https://download.01.org/0day-ci/archive/20250104/202501041649.cjMwvH2B-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250104/202501041649.cjMwvH2B-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501041649.cjMwvH2B-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/pci/of.c: In function 'devm_of_pci_get_host_bridge_resources':
>> drivers/pci/of.c:349:57: error: 'bus_max' undeclared (first use in this function)
349 | if (bus_range->end > bus_range->start + bus_max)
| ^~~~~~~
drivers/pci/of.c:349:57: note: each undeclared identifier is reported only once for each function it appears in
vim +/bus_max +349 drivers/pci/of.c
4670d610d59233 Rob Herring 2018-01-17 300
4670d610d59233 Rob Herring 2018-01-17 301 /**
5bd51b35c7cbbc Jan Kiszka 2018-05-15 302 * devm_of_pci_get_host_bridge_resources() - Resource-managed parsing of PCI
5bd51b35c7cbbc Jan Kiszka 2018-05-15 303 * host bridge resources from DT
055f87a2a33640 Jan Kiszka 2018-05-15 304 * @dev: host bridge device
4670d610d59233 Rob Herring 2018-01-17 305 * @resources: list where the range of resources will be added after DT parsing
9b41d19aff4090 Krzysztof Kozlowski 2020-07-29 306 * @ib_resources: list where the range of inbound resources (with addresses
9b41d19aff4090 Krzysztof Kozlowski 2020-07-29 307 * from 'dma-ranges') will be added after DT parsing
4670d610d59233 Rob Herring 2018-01-17 308 * @io_base: pointer to a variable that will contain on return the physical
4670d610d59233 Rob Herring 2018-01-17 309 * address for the start of the I/O range. Can be NULL if the caller doesn't
4670d610d59233 Rob Herring 2018-01-17 310 * expect I/O ranges to be present in the device tree.
4670d610d59233 Rob Herring 2018-01-17 311 *
4670d610d59233 Rob Herring 2018-01-17 312 * This function will parse the "ranges" property of a PCI host bridge device
4670d610d59233 Rob Herring 2018-01-17 313 * node and setup the resource mapping based on its content. It is expected
4670d610d59233 Rob Herring 2018-01-17 314 * that the property conforms with the Power ePAPR document.
4670d610d59233 Rob Herring 2018-01-17 315 *
4670d610d59233 Rob Herring 2018-01-17 316 * It returns zero if the range parsing has been successful or a standard error
4670d610d59233 Rob Herring 2018-01-17 317 * value if it failed.
4670d610d59233 Rob Herring 2018-01-17 318 */
3b55809cf91f54 Rob Herring 2019-10-28 319 static int devm_of_pci_get_host_bridge_resources(struct device *dev,
331f63457165a3 Rob Herring 2019-10-30 320 struct list_head *resources,
331f63457165a3 Rob Herring 2019-10-30 321 struct list_head *ib_resources,
331f63457165a3 Rob Herring 2019-10-30 322 resource_size_t *io_base)
4670d610d59233 Rob Herring 2018-01-17 323 {
055f87a2a33640 Jan Kiszka 2018-05-15 324 struct device_node *dev_node = dev->of_node;
93c9a7f8793175 Jan Kiszka 2018-06-19 325 struct resource *res, tmp_res;
4670d610d59233 Rob Herring 2018-01-17 326 struct resource *bus_range;
4670d610d59233 Rob Herring 2018-01-17 327 struct of_pci_range range;
4670d610d59233 Rob Herring 2018-01-17 328 struct of_pci_range_parser parser;
331f63457165a3 Rob Herring 2019-10-30 329 const char *range_type;
4670d610d59233 Rob Herring 2018-01-17 330 int err;
4670d610d59233 Rob Herring 2018-01-17 331
4670d610d59233 Rob Herring 2018-01-17 332 if (io_base)
4670d610d59233 Rob Herring 2018-01-17 333 *io_base = (resource_size_t)OF_BAD_ADDR;
4670d610d59233 Rob Herring 2018-01-17 334
5bd51b35c7cbbc Jan Kiszka 2018-05-15 335 bus_range = devm_kzalloc(dev, sizeof(*bus_range), GFP_KERNEL);
4670d610d59233 Rob Herring 2018-01-17 336 if (!bus_range)
4670d610d59233 Rob Herring 2018-01-17 337 return -ENOMEM;
4670d610d59233 Rob Herring 2018-01-17 338
d9c5d5ac287caa Jan Kiszka 2018-05-15 339 dev_info(dev, "host bridge %pOF ranges:\n", dev_node);
4670d610d59233 Rob Herring 2018-01-17 340
126b7de6bfd84b Jan Kiszka 2018-05-15 341 err = of_pci_parse_bus_range(dev_node, bus_range);
4670d610d59233 Rob Herring 2018-01-17 342 if (err) {
5ad20c289cd7a4 Bjorn Helgaas 2025-01-03 343 bus_range->start = 0;
5ad20c289cd7a4 Bjorn Helgaas 2025-01-03 344 bus_range->end = 0xff;
4670d610d59233 Rob Herring 2018-01-17 345 bus_range->flags = IORESOURCE_BUS;
d9c5d5ac287caa Jan Kiszka 2018-05-15 346 dev_info(dev, " No bus range found for %pOF, using %pR\n",
126b7de6bfd84b Jan Kiszka 2018-05-15 347 dev_node, bus_range);
4670d610d59233 Rob Herring 2018-01-17 348 } else {
4670d610d59233 Rob Herring 2018-01-17 @349 if (bus_range->end > bus_range->start + bus_max)
4670d610d59233 Rob Herring 2018-01-17 350 bus_range->end = bus_range->start + bus_max;
4670d610d59233 Rob Herring 2018-01-17 351 }
4670d610d59233 Rob Herring 2018-01-17 352 pci_add_resource(resources, bus_range);
4670d610d59233 Rob Herring 2018-01-17 353
4670d610d59233 Rob Herring 2018-01-17 354 /* Check for ranges property */
126b7de6bfd84b Jan Kiszka 2018-05-15 355 err = of_pci_range_parser_init(&parser, dev_node);
4670d610d59233 Rob Herring 2018-01-17 356 if (err)
d277f6e88c8872 Rob Herring 2021-08-03 357 return 0;
4670d610d59233 Rob Herring 2018-01-17 358
d9c5d5ac287caa Jan Kiszka 2018-05-15 359 dev_dbg(dev, "Parsing ranges property...\n");
4670d610d59233 Rob Herring 2018-01-17 360 for_each_of_pci_range(&parser, &range) {
4670d610d59233 Rob Herring 2018-01-17 361 /* Read next ranges element */
4670d610d59233 Rob Herring 2018-01-17 362 if ((range.flags & IORESOURCE_TYPE_BITS) == IORESOURCE_IO)
331f63457165a3 Rob Herring 2019-10-30 363 range_type = "IO";
4670d610d59233 Rob Herring 2018-01-17 364 else if ((range.flags & IORESOURCE_TYPE_BITS) == IORESOURCE_MEM)
331f63457165a3 Rob Herring 2019-10-30 365 range_type = "MEM";
4670d610d59233 Rob Herring 2018-01-17 366 else
331f63457165a3 Rob Herring 2019-10-30 367 range_type = "err";
331f63457165a3 Rob Herring 2019-10-30 368 dev_info(dev, " %6s %#012llx..%#012llx -> %#012llx\n",
d9c5d5ac287caa Jan Kiszka 2018-05-15 369 range_type, range.cpu_addr,
d9c5d5ac287caa Jan Kiszka 2018-05-15 370 range.cpu_addr + range.size - 1, range.pci_addr);
4670d610d59233 Rob Herring 2018-01-17 371
4670d610d59233 Rob Herring 2018-01-17 372 /*
4670d610d59233 Rob Herring 2018-01-17 373 * If we failed translation or got a zero-sized region
4670d610d59233 Rob Herring 2018-01-17 374 * then skip this range
4670d610d59233 Rob Herring 2018-01-17 375 */
4670d610d59233 Rob Herring 2018-01-17 376 if (range.cpu_addr == OF_BAD_ADDR || range.size == 0)
4670d610d59233 Rob Herring 2018-01-17 377 continue;
4670d610d59233 Rob Herring 2018-01-17 378
93c9a7f8793175 Jan Kiszka 2018-06-19 379 err = of_pci_range_to_resource(&range, dev_node, &tmp_res);
93c9a7f8793175 Jan Kiszka 2018-06-19 380 if (err)
93c9a7f8793175 Jan Kiszka 2018-06-19 381 continue;
93c9a7f8793175 Jan Kiszka 2018-06-19 382
93c9a7f8793175 Jan Kiszka 2018-06-19 383 res = devm_kmemdup(dev, &tmp_res, sizeof(tmp_res), GFP_KERNEL);
4670d610d59233 Rob Herring 2018-01-17 384 if (!res) {
4670d610d59233 Rob Herring 2018-01-17 385 err = -ENOMEM;
5bd51b35c7cbbc Jan Kiszka 2018-05-15 386 goto failed;
4670d610d59233 Rob Herring 2018-01-17 387 }
4670d610d59233 Rob Herring 2018-01-17 388
4670d610d59233 Rob Herring 2018-01-17 389 if (resource_type(res) == IORESOURCE_IO) {
4670d610d59233 Rob Herring 2018-01-17 390 if (!io_base) {
d9c5d5ac287caa Jan Kiszka 2018-05-15 391 dev_err(dev, "I/O range found for %pOF. Please provide an io_base pointer to save CPU base address\n",
126b7de6bfd84b Jan Kiszka 2018-05-15 392 dev_node);
4670d610d59233 Rob Herring 2018-01-17 393 err = -EINVAL;
5bd51b35c7cbbc Jan Kiszka 2018-05-15 394 goto failed;
4670d610d59233 Rob Herring 2018-01-17 395 }
4670d610d59233 Rob Herring 2018-01-17 396 if (*io_base != (resource_size_t)OF_BAD_ADDR)
d9c5d5ac287caa Jan Kiszka 2018-05-15 397 dev_warn(dev, "More than one I/O resource converted for %pOF. CPU base address for old range lost!\n",
126b7de6bfd84b Jan Kiszka 2018-05-15 398 dev_node);
4670d610d59233 Rob Herring 2018-01-17 399 *io_base = range.cpu_addr;
3bd6b8271ee660 Punit Agrawal 2021-06-15 400 } else if (resource_type(res) == IORESOURCE_MEM) {
3bd6b8271ee660 Punit Agrawal 2021-06-15 401 res->flags &= ~IORESOURCE_MEM_64;
4670d610d59233 Rob Herring 2018-01-17 402 }
4670d610d59233 Rob Herring 2018-01-17 403
4670d610d59233 Rob Herring 2018-01-17 404 pci_add_resource_offset(resources, res, res->start - range.pci_addr);
4670d610d59233 Rob Herring 2018-01-17 405 }
4670d610d59233 Rob Herring 2018-01-17 406
331f63457165a3 Rob Herring 2019-10-30 407 /* Check for dma-ranges property */
331f63457165a3 Rob Herring 2019-10-30 408 if (!ib_resources)
331f63457165a3 Rob Herring 2019-10-30 409 return 0;
331f63457165a3 Rob Herring 2019-10-30 410 err = of_pci_dma_range_parser_init(&parser, dev_node);
331f63457165a3 Rob Herring 2019-10-30 411 if (err)
331f63457165a3 Rob Herring 2019-10-30 412 return 0;
331f63457165a3 Rob Herring 2019-10-30 413
331f63457165a3 Rob Herring 2019-10-30 414 dev_dbg(dev, "Parsing dma-ranges property...\n");
331f63457165a3 Rob Herring 2019-10-30 415 for_each_of_pci_range(&parser, &range) {
331f63457165a3 Rob Herring 2019-10-30 416 /*
331f63457165a3 Rob Herring 2019-10-30 417 * If we failed translation or got a zero-sized region
331f63457165a3 Rob Herring 2019-10-30 418 * then skip this range
331f63457165a3 Rob Herring 2019-10-30 419 */
331f63457165a3 Rob Herring 2019-10-30 420 if (((range.flags & IORESOURCE_TYPE_BITS) != IORESOURCE_MEM) ||
331f63457165a3 Rob Herring 2019-10-30 421 range.cpu_addr == OF_BAD_ADDR || range.size == 0)
331f63457165a3 Rob Herring 2019-10-30 422 continue;
331f63457165a3 Rob Herring 2019-10-30 423
331f63457165a3 Rob Herring 2019-10-30 424 dev_info(dev, " %6s %#012llx..%#012llx -> %#012llx\n",
331f63457165a3 Rob Herring 2019-10-30 425 "IB MEM", range.cpu_addr,
331f63457165a3 Rob Herring 2019-10-30 426 range.cpu_addr + range.size - 1, range.pci_addr);
331f63457165a3 Rob Herring 2019-10-30 427
331f63457165a3 Rob Herring 2019-10-30 428
331f63457165a3 Rob Herring 2019-10-30 429 err = of_pci_range_to_resource(&range, dev_node, &tmp_res);
331f63457165a3 Rob Herring 2019-10-30 430 if (err)
331f63457165a3 Rob Herring 2019-10-30 431 continue;
331f63457165a3 Rob Herring 2019-10-30 432
331f63457165a3 Rob Herring 2019-10-30 433 res = devm_kmemdup(dev, &tmp_res, sizeof(tmp_res), GFP_KERNEL);
331f63457165a3 Rob Herring 2019-10-30 434 if (!res) {
331f63457165a3 Rob Herring 2019-10-30 435 err = -ENOMEM;
331f63457165a3 Rob Herring 2019-10-30 436 goto failed;
331f63457165a3 Rob Herring 2019-10-30 437 }
331f63457165a3 Rob Herring 2019-10-30 438
b8397a8f4ebc0b Robin Murphy 2022-05-09 439 pci_add_resource_offset(ib_resources, res,
331f63457165a3 Rob Herring 2019-10-30 440 res->start - range.pci_addr);
331f63457165a3 Rob Herring 2019-10-30 441 }
331f63457165a3 Rob Herring 2019-10-30 442
4670d610d59233 Rob Herring 2018-01-17 443 return 0;
4670d610d59233 Rob Herring 2018-01-17 444
5bd51b35c7cbbc Jan Kiszka 2018-05-15 445 failed:
4670d610d59233 Rob Herring 2018-01-17 446 pci_free_resource_list(resources);
4670d610d59233 Rob Herring 2018-01-17 447 return err;
4670d610d59233 Rob Herring 2018-01-17 448 }
4670d610d59233 Rob Herring 2018-01-17 449
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3] sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources()
2025-01-03 21:31 ` [PATCH 3/3] sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources() Bjorn Helgaas
@ 2025-01-07 13:03 ` Andreas Larsson
0 siblings, 0 replies; 11+ messages in thread
From: Andreas Larsson @ 2025-01-07 13:03 UTC (permalink / raw)
To: Bjorn Helgaas, Rob Herring
Cc: David S . Miller, sparclinux, linux-kernel, linux-pci,
Bjorn Helgaas
On 2025-01-03 22:31, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> 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 <bhelgaas@google.com>
> ---
> 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);
Acked-by: Andreas Larsson <andreas@gaisler.com>
Thanks,
Andreas
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] PCI: of: Simplify bus range parsing
2025-01-03 21:38 ` Bjorn Helgaas
@ 2025-01-07 14:46 ` Rob Herring
0 siblings, 0 replies; 11+ messages in thread
From: Rob Herring @ 2025-01-07 14:46 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: David S . Miller, Andreas Larsson, sparclinux, linux-kernel,
linux-pci, Bjorn Helgaas
On Fri, Jan 3, 2025 at 3:38 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> On Fri, Jan 03, 2025 at 03:31:28PM -0600, Bjorn Helgaas wrote:
> > From: Bjorn Helgaas <bhelgaas@google.com>
> >
> > 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().
>
> Since we default this if the DT lacks "bus-range", is there any point
> in repeating "bus-range = <0x00 0xff>;" in all the host bridge
> descriptions?
No. And I tell people to drop it if that's what they have.
Rob
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] PCI: Unexport of_pci_parse_bus_range()
2025-01-03 21:31 ` [PATCH 1/3] PCI: Unexport of_pci_parse_bus_range() Bjorn Helgaas
@ 2025-01-07 14:52 ` Rob Herring
0 siblings, 0 replies; 11+ messages in thread
From: Rob Herring @ 2025-01-07 14:52 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: David S . Miller, Andreas Larsson, sparclinux, linux-kernel,
linux-pci, Bjorn Helgaas
On Fri, Jan 3, 2025 at 3:31 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> 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 <bhelgaas@google.com>
> ---
> drivers/pci/of.c | 4 ++--
> drivers/pci/pci.h | 7 -------
> 2 files changed, 2 insertions(+), 9 deletions(-)
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-01-07 14:52 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-03 21:31 [PATCH 0/3] PCI: Simplify bus range parsing Bjorn Helgaas
2025-01-03 21:31 ` [PATCH 1/3] PCI: Unexport of_pci_parse_bus_range() Bjorn Helgaas
2025-01-07 14:52 ` Rob Herring
2025-01-03 21:31 ` [PATCH 2/3] PCI: of: Simplify bus range parsing Bjorn Helgaas
2025-01-03 21:36 ` Bjorn Helgaas
2025-01-03 21:38 ` Bjorn Helgaas
2025-01-07 14:46 ` Rob Herring
2025-01-04 7:23 ` kernel test robot
2025-01-04 8:39 ` kernel test robot
2025-01-03 21:31 ` [PATCH 3/3] sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources() Bjorn Helgaas
2025-01-07 13:03 ` Andreas Larsson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).