devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-kernel@lists.infradead.org
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	Rob Herring <robh+dt@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [RFC PATCH] drivers: of: move PCI domain assignment to generic OF code
Date: Mon, 10 Nov 2014 13:51:19 +0100	[thread overview]
Message-ID: <1459907.RIyEjnM4cg@wuerfel> (raw)
In-Reply-To: <1415622368-14612-1-git-send-email-lorenzo.pieralisi@arm.com>

On Monday 10 November 2014 12:26:08 Lorenzo Pieralisi wrote:
> ---
>  arch/arm64/kernel/pci.c | 14 +++--------
>  drivers/of/of_pci.c     | 66 +++++++++++++++++++++++++++++++++++++++++++++++--
>  include/linux/of_pci.h  |  7 +++---
>  3 files changed, 71 insertions(+), 16 deletions(-)
> 
> diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
> index ce5836c..5e21c1c 100644
> --- a/arch/arm64/kernel/pci.c
> +++ b/arch/arm64/kernel/pci.c
> @@ -49,20 +49,14 @@ int pcibios_add_device(struct pci_dev *dev)
>  
>  
>  #ifdef CONFIG_PCI_DOMAINS_GENERIC
> -static bool dt_domain_found = false;
>  
>  void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
>  {
> -	int domain = of_get_pci_domain_nr(parent->of_node);
> +	int domain = of_assign_pci_domain_nr(parent->of_node);
>  
> -	if (domain >= 0) {
> -		dt_domain_found = true;
> -	} else if (dt_domain_found == true) {
> -		dev_err(parent, "Node %s is missing \"linux,pci-domain\" property in DT\n",
> -			parent->of_node->full_name);
> -		return;
> -	} else {
> -		domain = pci_get_new_domain_nr();
> +	if (domain < 0) {
> +		dev_err(parent, "PCI domain assignment failed\n");
> +		domain = -1;
>  	}
>  
>  	bus->domain_nr = domain;

Is there a need to still keep this in architecture specific code? Why
not move it to drivers/pci and let other firmware infrastructure
hook in there directly.

>  {
> @@ -45,10 +45,9 @@ 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)
> +static inline int of_assign_pci_domain_nr(struct device_node *node)
>  {
> -	return -1;
> +	return pci_get_new_domain_nr();
>  }
>  #endif

This gets a bit tricky otherwise once we add ACPI in the mix, with all
combinations of OF and ACPI at compile time and at runtime.

	Arnd

  reply	other threads:[~2014-11-10 12:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-10 12:26 [RFC PATCH] drivers: of: move PCI domain assignment to generic OF code Lorenzo Pieralisi
2014-11-10 12:51 ` Arnd Bergmann [this message]
2014-11-10 13:52   ` Lorenzo Pieralisi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459907.RIyEjnM4cg@wuerfel \
    --to=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).