sparclinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] PCI: Simplify bus range parsing
@ 2025-01-13 23:15 Bjorn Helgaas
  2025-01-13 23:15 ` [PATCH v2 1/4] PCI: Unexport of_pci_parse_bus_range() Bjorn Helgaas
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2025-01-13 23:15 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 the "No bus range found" message since host bridges typically lead to
[bus 00-ff], and we already default to that if there is no "bus-range" DT
property, so there's no point in requiring it in DT or complaining if it's
not there.

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 (4):
  PCI: Unexport of_pci_parse_bus_range()
  PCI: of: Drop 'No bus range found' message
  PCI: of: Simplify devm_of_pci_get_host_bridge_resources() interface
  sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources()

 arch/sparc/kernel/pci_common.c |  2 +-
 drivers/pci/of.c               | 22 ++++++++++------------
 drivers/pci/pci.h              |  7 -------
 3 files changed, 11 insertions(+), 20 deletions(-)

Changes since v1
(https://lore.kernel.org/r/20250103213129.5182-1-helgaas@kernel.org):
  - Fix compile error
  - Drop 'No bus range found' message
  - Add Ack from Andreas for the sparc/PCI comment update
  - Add Reviewed-by from Rob for the unexport patch

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 1/4] PCI: Unexport of_pci_parse_bus_range()
  2025-01-13 23:15 [PATCH v2 0/4] PCI: Simplify bus range parsing Bjorn Helgaas
@ 2025-01-13 23:15 ` Bjorn Helgaas
  2025-01-15  0:31   ` Sathyanarayanan Kuppuswamy
  2025-01-13 23:15 ` [PATCH v2 2/4] PCI: of: Drop 'No bus range found' message Bjorn Helgaas
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Bjorn Helgaas @ 2025-01-13 23:15 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>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
---
 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 v2 2/4] PCI: of: Drop 'No bus range found' message
  2025-01-13 23:15 [PATCH v2 0/4] PCI: Simplify bus range parsing Bjorn Helgaas
  2025-01-13 23:15 ` [PATCH v2 1/4] PCI: Unexport of_pci_parse_bus_range() Bjorn Helgaas
@ 2025-01-13 23:15 ` Bjorn Helgaas
  2025-01-15  0:31   ` Sathyanarayanan Kuppuswamy
  2025-01-13 23:15 ` [PATCH v2 3/4] PCI: of: Simplify devm_of_pci_get_host_bridge_resources() interface Bjorn Helgaas
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Bjorn Helgaas @ 2025-01-13 23:15 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>

The typical bus range for a host bridge is [bus 00-ff], and
devm_of_pci_get_host_bridge_resources() defaults to that unless DT contains
a "bus-range" property.

devm_of_pci_get_host_bridge_resources() previously emitted a message when
there was no "bus-range" property, but that seems unnecessary for this
common situation.  Remove the message.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/of.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index 2f579b691f8e..48b9274b846e 100644
--- a/drivers/pci/of.c
+++ b/drivers/pci/of.c
@@ -346,8 +346,6 @@ static int devm_of_pci_get_host_bridge_resources(struct device *dev,
 		bus_range->start = busno;
 		bus_range->end = bus_max;
 		bus_range->flags = IORESOURCE_BUS;
-		dev_info(dev, "  No bus range found for %pOF, using %pR\n",
-			 dev_node, bus_range);
 	} else {
 		if (bus_range->end > bus_range->start + bus_max)
 			bus_range->end = bus_range->start + bus_max;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 3/4] PCI: of: Simplify devm_of_pci_get_host_bridge_resources() interface
  2025-01-13 23:15 [PATCH v2 0/4] PCI: Simplify bus range parsing Bjorn Helgaas
  2025-01-13 23:15 ` [PATCH v2 1/4] PCI: Unexport of_pci_parse_bus_range() Bjorn Helgaas
  2025-01-13 23:15 ` [PATCH v2 2/4] PCI: of: Drop 'No bus range found' message Bjorn Helgaas
@ 2025-01-13 23:15 ` Bjorn Helgaas
  2025-01-15  0:21   ` Sathyanarayanan Kuppuswamy
  2025-01-13 23:15 ` [PATCH v2 4/4] sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources() Bjorn Helgaas
  2025-01-15 21:29 ` [PATCH v2 0/4] PCI: Simplify bus range parsing Bjorn Helgaas
  4 siblings, 1 reply; 11+ messages in thread
From: Bjorn Helgaas @ 2025-01-13 23:15 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>

Previously pci_parse_request_of_pci_ranges() supplied the default bus range
to devm_of_pci_get_host_bridge_resources(), but that function 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 | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index 48b9274b846e..a2acfc52caf4 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,12 +340,15 @@ 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;
 	} else {
-		if (bus_range->end > bus_range->start + bus_max)
-			bus_range->end = bus_range->start + bus_max;
+		if (bus_range->end > 0xff) {
+			dev_info(dev, "  Invalid end bus number in %pR, defaulting to 0xff\n",
+				 bus_range);
+			bus_range->end = 0xff;
+		}
 	}
 	pci_add_resource(resources, bus_range);
 
@@ -595,7 +595,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 v2 4/4] sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources()
  2025-01-13 23:15 [PATCH v2 0/4] PCI: Simplify bus range parsing Bjorn Helgaas
                   ` (2 preceding siblings ...)
  2025-01-13 23:15 ` [PATCH v2 3/4] PCI: of: Simplify devm_of_pci_get_host_bridge_resources() interface Bjorn Helgaas
@ 2025-01-13 23:15 ` Bjorn Helgaas
  2025-01-15  0:34   ` Sathyanarayanan Kuppuswamy
  2025-01-15 21:29 ` [PATCH v2 0/4] PCI: Simplify bus range parsing Bjorn Helgaas
  4 siblings, 1 reply; 11+ messages in thread
From: Bjorn Helgaas @ 2025-01-13 23:15 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>
Acked-by: Andreas Larsson <andreas@gaisler.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 v2 3/4] PCI: of: Simplify devm_of_pci_get_host_bridge_resources() interface
  2025-01-13 23:15 ` [PATCH v2 3/4] PCI: of: Simplify devm_of_pci_get_host_bridge_resources() interface Bjorn Helgaas
@ 2025-01-15  0:21   ` Sathyanarayanan Kuppuswamy
  2025-01-15 21:28     ` Bjorn Helgaas
  0 siblings, 1 reply; 11+ messages in thread
From: Sathyanarayanan Kuppuswamy @ 2025-01-15  0:21 UTC (permalink / raw)
  To: Bjorn Helgaas, Rob Herring
  Cc: David S . Miller, Andreas Larsson, sparclinux, linux-kernel,
	linux-pci, Bjorn Helgaas

Hi Bjorn,

On 1/13/25 3:15 PM, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> Previously pci_parse_request_of_pci_ranges() supplied the default bus range
> to devm_of_pci_get_host_bridge_resources(), but that function 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 | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/pci/of.c b/drivers/pci/of.c
> index 48b9274b846e..a2acfc52caf4 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,12 +340,15 @@ 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;
>   	} else {
> -		if (bus_range->end > bus_range->start + bus_max)
> -			bus_range->end = bus_range->start + bus_max;
> +		if (bus_range->end > 0xff) {
> +			dev_info(dev, "  Invalid end bus number in %pR, defaulting to 0xff\n",
> +				 bus_range);

Use dev_warn() ? I noticed that dev_info() is used in place of 
warning/errors in this file.
Probably it needs to be cleaned?

> +			bus_range->end = 0xff;
> +		}
>   	}
>   	pci_add_resource(resources, bus_range);
>   
> @@ -595,7 +595,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;

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/4] PCI: Unexport of_pci_parse_bus_range()
  2025-01-13 23:15 ` [PATCH v2 1/4] PCI: Unexport of_pci_parse_bus_range() Bjorn Helgaas
@ 2025-01-15  0:31   ` Sathyanarayanan Kuppuswamy
  0 siblings, 0 replies; 11+ messages in thread
From: Sathyanarayanan Kuppuswamy @ 2025-01-15  0:31 UTC (permalink / raw)
  To: Bjorn Helgaas, Rob Herring
  Cc: David S . Miller, Andreas Larsson, sparclinux, linux-kernel,
	linux-pci, Bjorn Helgaas

Hi,

On 1/13/25 3:15 PM, Bjorn Helgaas 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>
> Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
> ---
Looks good

Reviewed-by: Kuppuswamy Sathyanarayanan 
<sathyanarayanan.kuppuswamy@linux.intel.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)
>   {

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 2/4] PCI: of: Drop 'No bus range found' message
  2025-01-13 23:15 ` [PATCH v2 2/4] PCI: of: Drop 'No bus range found' message Bjorn Helgaas
@ 2025-01-15  0:31   ` Sathyanarayanan Kuppuswamy
  0 siblings, 0 replies; 11+ messages in thread
From: Sathyanarayanan Kuppuswamy @ 2025-01-15  0:31 UTC (permalink / raw)
  To: Bjorn Helgaas, Rob Herring
  Cc: David S . Miller, Andreas Larsson, sparclinux, linux-kernel,
	linux-pci, Bjorn Helgaas


On 1/13/25 3:15 PM, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> The typical bus range for a host bridge is [bus 00-ff], and
> devm_of_pci_get_host_bridge_resources() defaults to that unless DT contains
> a "bus-range" property.
>
> devm_of_pci_get_host_bridge_resources() previously emitted a message when
> there was no "bus-range" property, but that seems unnecessary for this
> common situation.  Remove the message.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---

Reviewed-by: Kuppuswamy Sathyanarayanan 
<sathyanarayanan.kuppuswamy@linux.intel.com>

>   drivers/pci/of.c | 2 --
>   1 file changed, 2 deletions(-)
>
> diff --git a/drivers/pci/of.c b/drivers/pci/of.c
> index 2f579b691f8e..48b9274b846e 100644
> --- a/drivers/pci/of.c
> +++ b/drivers/pci/of.c
> @@ -346,8 +346,6 @@ static int devm_of_pci_get_host_bridge_resources(struct device *dev,
>   		bus_range->start = busno;
>   		bus_range->end = bus_max;
>   		bus_range->flags = IORESOURCE_BUS;
> -		dev_info(dev, "  No bus range found for %pOF, using %pR\n",
> -			 dev_node, bus_range);
>   	} else {
>   		if (bus_range->end > bus_range->start + bus_max)
>   			bus_range->end = bus_range->start + bus_max;

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 4/4] sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources()
  2025-01-13 23:15 ` [PATCH v2 4/4] sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources() Bjorn Helgaas
@ 2025-01-15  0:34   ` Sathyanarayanan Kuppuswamy
  0 siblings, 0 replies; 11+ messages in thread
From: Sathyanarayanan Kuppuswamy @ 2025-01-15  0:34 UTC (permalink / raw)
  To: Bjorn Helgaas, Rob Herring
  Cc: David S . Miller, Andreas Larsson, sparclinux, linux-kernel,
	linux-pci, Bjorn Helgaas


On 1/13/25 3:15 PM, 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>
> Acked-by: Andreas Larsson <andreas@gaisler.com>
> ---

Reviewed-by: Kuppuswamy Sathyanarayanan 
<sathyanarayanan.kuppuswamy@linux.intel.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);

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/4] PCI: of: Simplify devm_of_pci_get_host_bridge_resources() interface
  2025-01-15  0:21   ` Sathyanarayanan Kuppuswamy
@ 2025-01-15 21:28     ` Bjorn Helgaas
  0 siblings, 0 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2025-01-15 21:28 UTC (permalink / raw)
  To: Sathyanarayanan Kuppuswamy
  Cc: Rob Herring, David S . Miller, Andreas Larsson, sparclinux,
	linux-kernel, linux-pci, Bjorn Helgaas

On Tue, Jan 14, 2025 at 04:21:15PM -0800, Sathyanarayanan Kuppuswamy wrote:
> On 1/13/25 3:15 PM, Bjorn Helgaas wrote:
> > From: Bjorn Helgaas <bhelgaas@google.com>
> > 
> > Previously pci_parse_request_of_pci_ranges() supplied the default bus range
> > to devm_of_pci_get_host_bridge_resources(), but that function 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().

> >   	} else {
> > -		if (bus_range->end > bus_range->start + bus_max)
> > -			bus_range->end = bus_range->start + bus_max;
> > +		if (bus_range->end > 0xff) {
> > +			dev_info(dev, "  Invalid end bus number in %pR, defaulting to 0xff\n",
> > +				 bus_range);
> 
> Use dev_warn() ? I noticed that dev_info() is used in place of
> warning/errors in this file.

Good point, changed.

> Probably it needs to be cleaned?
> 
> > +			bus_range->end = 0xff;

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/4] PCI: Simplify bus range parsing
  2025-01-13 23:15 [PATCH v2 0/4] PCI: Simplify bus range parsing Bjorn Helgaas
                   ` (3 preceding siblings ...)
  2025-01-13 23:15 ` [PATCH v2 4/4] sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources() Bjorn Helgaas
@ 2025-01-15 21:29 ` Bjorn Helgaas
  4 siblings, 0 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2025-01-15 21:29 UTC (permalink / raw)
  To: Rob Herring
  Cc: David S . Miller, Andreas Larsson, sparclinux, linux-kernel,
	linux-pci, Bjorn Helgaas

On Mon, Jan 13, 2025 at 05:15:53PM -0600, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> Unexport of_pci_parse_bus_range() since it's only used in drivers/pci/of.c.
> 
> Drop the "No bus range found" message since host bridges typically lead to
> [bus 00-ff], and we already default to that if there is no "bus-range" DT
> property, so there's no point in requiring it in DT or complaining if it's
> not there.
> 
> 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 (4):
>   PCI: Unexport of_pci_parse_bus_range()
>   PCI: of: Drop 'No bus range found' message
>   PCI: of: Simplify devm_of_pci_get_host_bridge_resources() interface
>   sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources()
> 
>  arch/sparc/kernel/pci_common.c |  2 +-
>  drivers/pci/of.c               | 22 ++++++++++------------
>  drivers/pci/pci.h              |  7 -------
>  3 files changed, 11 insertions(+), 20 deletions(-)

Applied to pci/of for v6.14.

> Changes since v1
> (https://lore.kernel.org/r/20250103213129.5182-1-helgaas@kernel.org):
>   - Fix compile error
>   - Drop 'No bus range found' message
>   - Add Ack from Andreas for the sparc/PCI comment update
>   - Add Reviewed-by from Rob for the unexport patch

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-01-15 21:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-13 23:15 [PATCH v2 0/4] PCI: Simplify bus range parsing Bjorn Helgaas
2025-01-13 23:15 ` [PATCH v2 1/4] PCI: Unexport of_pci_parse_bus_range() Bjorn Helgaas
2025-01-15  0:31   ` Sathyanarayanan Kuppuswamy
2025-01-13 23:15 ` [PATCH v2 2/4] PCI: of: Drop 'No bus range found' message Bjorn Helgaas
2025-01-15  0:31   ` Sathyanarayanan Kuppuswamy
2025-01-13 23:15 ` [PATCH v2 3/4] PCI: of: Simplify devm_of_pci_get_host_bridge_resources() interface Bjorn Helgaas
2025-01-15  0:21   ` Sathyanarayanan Kuppuswamy
2025-01-15 21:28     ` Bjorn Helgaas
2025-01-13 23:15 ` [PATCH v2 4/4] sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources() Bjorn Helgaas
2025-01-15  0:34   ` Sathyanarayanan Kuppuswamy
2025-01-15 21:29 ` [PATCH v2 0/4] PCI: Simplify bus range parsing Bjorn Helgaas

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).