[RFC PATCH] drivers: of: move PCI domain assignment to generic OF code
Arnd Bergmann
arnd at arndb.de
Mon Nov 10 04:51:19 PST 2014
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
More information about the linux-arm-kernel
mailing list