Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1419696 > unrolled thread

[PATCH V9 06/11] PCI: Refactor generic bus domain assignment

Started byTomasz Nowicki <tn@semihalf.com>
First post2016-06-10 22:00 +0200
Last post2016-06-10 23:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH V9 06/11] PCI: Refactor generic bus domain assignment Tomasz Nowicki <tn@semihalf.com> - 2016-06-10 22:00 +0200
    Re: [PATCH V9 06/11] PCI: Refactor generic bus domain assignment Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-06-10 23:00 +0200

#1419696 — [PATCH V9 06/11] PCI: Refactor generic bus domain assignment

FromTomasz Nowicki <tn@semihalf.com>
Date2016-06-10 22:00 +0200
Subject[PATCH V9 06/11] PCI: Refactor generic bus domain assignment
Message-ID<rIAL0-Mx-41@gated-at.bofh.it>
Change the way PCI bus domain number is assigned and improve function
name to reflect what function does. No functional changes.

Instead of assigning bus domain number inside of pci_bus_assign_domain_nr()
simply return domain number and let pci_create_root_bus() do assignment.
This way pci_create_root_bus() setups bus structure data in the consistent
way. Since pci_bus_assign_domain_nr() now does not assign but retrieves
domain number instead, rename it to pci_bus_find_domain_nr().

Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
---
 drivers/pci/pci.c   | 4 ++--
 drivers/pci/probe.c | 4 +++-
 include/linux/pci.h | 7 +------
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index eb431b5..b9a7833 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4941,7 +4941,7 @@ int pci_get_new_domain_nr(void)
 }
 
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
-void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
+int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent)
 {
 	static int use_dt_domains = -1;
 	int domain = -1;
@@ -4985,7 +4985,7 @@ void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
 		domain = -1;
 	}
 
-	bus->domain_nr = domain;
+	return domain;
 }
 #endif
 #endif
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 8e3ef72..380d46d 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2127,7 +2127,9 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	b->sysdata = sysdata;
 	b->ops = ops;
 	b->number = b->busn_res.start = bus;
-	pci_bus_assign_domain_nr(b, parent);
+#ifdef CONFIG_PCI_DOMAINS_GENERIC
+	b->domain_nr = pci_bus_find_domain_nr(b, parent);
+#endif
 	b2 = pci_find_bus(pci_domain_nr(b), bus);
 	if (b2) {
 		/* If we already got to this bus through a different bridge, ignore it */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index ce03d65..48839e8 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1390,12 +1390,7 @@ static inline int pci_domain_nr(struct pci_bus *bus)
 {
 	return bus->domain_nr;
 }
-void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent);
-#else
-static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
-					struct device *parent)
-{
-}
+int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent);
 #endif
 
 /* some architectures require additional setup to direct VGA traffic */
-- 
1.9.1

[toc] | [next] | [standalone]


#1419720

FromLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Date2016-06-10 23:00 +0200
Message-ID<rIBH4-1wC-19@gated-at.bofh.it>
In reply to#1419696
On Fri, Jun 10, 2016 at 09:55:14PM +0200, Tomasz Nowicki wrote:
> Change the way PCI bus domain number is assigned and improve function
> name to reflect what function does. No functional changes.
> 
> Instead of assigning bus domain number inside of pci_bus_assign_domain_nr()
> simply return domain number and let pci_create_root_bus() do assignment.
> This way pci_create_root_bus() setups bus structure data in the consistent
> way. Since pci_bus_assign_domain_nr() now does not assign but retrieves
> domain number instead, rename it to pci_bus_find_domain_nr().
> 
> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>

Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

> ---
>  drivers/pci/pci.c   | 4 ++--
>  drivers/pci/probe.c | 4 +++-
>  include/linux/pci.h | 7 +------
>  3 files changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index eb431b5..b9a7833 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -4941,7 +4941,7 @@ int pci_get_new_domain_nr(void)
>  }
>  
>  #ifdef CONFIG_PCI_DOMAINS_GENERIC
> -void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
> +int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent)
>  {
>  	static int use_dt_domains = -1;
>  	int domain = -1;
> @@ -4985,7 +4985,7 @@ void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
>  		domain = -1;
>  	}
>  
> -	bus->domain_nr = domain;
> +	return domain;
>  }
>  #endif
>  #endif
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 8e3ef72..380d46d 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -2127,7 +2127,9 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
>  	b->sysdata = sysdata;
>  	b->ops = ops;
>  	b->number = b->busn_res.start = bus;
> -	pci_bus_assign_domain_nr(b, parent);
> +#ifdef CONFIG_PCI_DOMAINS_GENERIC
> +	b->domain_nr = pci_bus_find_domain_nr(b, parent);
> +#endif
>  	b2 = pci_find_bus(pci_domain_nr(b), bus);
>  	if (b2) {
>  		/* If we already got to this bus through a different bridge, ignore it */
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index ce03d65..48839e8 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1390,12 +1390,7 @@ static inline int pci_domain_nr(struct pci_bus *bus)
>  {
>  	return bus->domain_nr;
>  }
> -void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent);
> -#else
> -static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
> -					struct device *parent)
> -{
> -}
> +int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent);
>  #endif
>  
>  /* some architectures require additional setup to direct VGA traffic */
> -- 
> 1.9.1
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web