All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/28] Refine PCI scan interfaces and make generic pci host bridge
@ 2015-01-16  1:43 ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:43 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

This series is based on Bjorn's pci-next branch.

Patch 1-4 ripped out pci_bus_add_devices() from pci scan interfaces
for better pci scan flow.

Patch 5-11 make a generic pci_host_bridge to hold pci_host_bridge
related informations, and introduce a pci_host_bridge_ops to 
support platform host drivers provide its own pci_host_bridge 
related operations to setup pci_host_bridge during pci enumeration.

Patch 12-28 apply the new pci scan interfaces to platform pci host
bridge drivers.

Now in kernel, we scan pci bus use the following ways:
1. pci_scan_bus. 
   parent = NULL, default io/mem/bus resources
   call pci_bus_add_devices()

2. pci_scan_bus_parented() + pci_bus_add_devices()
   default io/mem/bus resources, only used by xen

3. pci_scan_root_bus() + pci_bus_add_devices()

4. pci_create_root_bus() + pci_scan_child_bus() + pci_bus_add_devices()

5. pci_create_root_bus() + xx_of_scan_bus()  +  pci_bus_add_devices()

And we have a lot of arch specific pci_domain_nr() and other platform
specific weak function like pcibios_root_bridge_prepare().

After applied this series, we have following scan interfaces:

1. pci_scan_bus_legacy() 
   parent = NULL, default io/mem/bus resources.
   for legacy pci scan

2. pci_scan_root_bus()
   for callers provide its own parent and io/mem/bus resources
   but no platform specific pci_host_bridge operations

3. pci_scan_root_bridge()
   for callers provide its own parent and io/mem/bus resources
   and pci_host_bridge_ops.

Besides, above pci scan interfaces all need addtionally call pci_bus_add_devices()
to set match_driver true and try to attach drivers.

Also we could eliminate all arch specific pci_domain_nr() after applied this series.

I tested this series on x86 (with or without ACPI).
Comments and tests are warmly welcome!

Arnd Bergmann (1):
  xen/PCI: Don't use deprecated function pci_scan_bus_parented()

Yijing Wang (27):
  PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
  PCI: Rip out pci_bus_add_devices() from pci_scan_root_bus()
  PCI: Remove deprecated pci_scan_bus_parented()
  PCI: Rename pci_scan_bus() to pci_scan_bus_legacy()
  PCI: Combine PCI domain and bus number in u32 arg
  PCI: Pass PCI domain number combined with root bus number
  PCI: Introduce pci_host_assign_domain_nr() to assign domain
  PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
  PCI: Save sysdata in pci_host_bridge drvdata
  PCI: Introduce pci_host_bridge_ops to setup host bridge
  PCI: Introduce new scan function pci_scan_root_bridge()
  PCI/x86: Refine pci_acpi_scan_root() with generic pci_host_bridge
  PCI/IA64: Refine pci_acpi_scan_root() with generic pci_host_bridge
  PCI/powerpc: Rename pcibios_root_bridge_prepare() for better
    readability
  PCI/powerpc: Use pci_scan_root_bridge() for simplicity
  PCI: Remove weak pcibios_root_bridge_prepare()
  PCI/sparc: Use pci_scan_root_bridge() for simplicity
  PCI: Introduce pci_bus_child_max_busnr()
  PCI/Parisc: Use pci_scan_root_bus() for simplicity
  PCI/mvebu: Use pci_common_init_dev() to simplify code
  PCI/tegra: Remove redundant tegra_pcie_scan_bus()
  PCI/designware: Use pci_scan_root_bus() for simplicity
  PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
  PCI: Rename __pci_create_root_bus() to pci_create_root_bus()
  PCI: Export find_pci_host_bridge()
  PCI: Remove platform specific pci_domain_nr()
  PCI: Remove pci_bus_assign_domain_nr()

 arch/alpha/include/asm/pci.h             |    2 -
 arch/alpha/kernel/pci.c                  |    7 +-
 arch/alpha/kernel/sys_nautilus.c         |    4 +-
 arch/frv/mb93090-mb00/pci-vdk.c          |    6 +-
 arch/ia64/include/asm/pci.h              |    1 -
 arch/ia64/pci/pci.c                      |   34 +++---
 arch/ia64/sn/kernel/io_init.c            |    6 +-
 arch/m68k/coldfire/pci.c                 |    3 +-
 arch/microblaze/pci/pci-common.c         |   17 +--
 arch/mips/include/asm/pci.h              |    2 -
 arch/mips/pci/pci.c                      |    5 +-
 arch/mn10300/unit-asb2305/pci.c          |    5 +-
 arch/powerpc/include/asm/machdep.h       |    2 +-
 arch/powerpc/kernel/pci-common.c         |   73 ++++++-----
 arch/powerpc/platforms/pseries/pci.c     |    2 +-
 arch/powerpc/platforms/pseries/pseries.h |    2 +-
 arch/powerpc/platforms/pseries/setup.c   |    2 +-
 arch/s390/pci/pci.c                      |   13 +--
 arch/sh/drivers/pci/pci.c                |    6 +-
 arch/sh/include/asm/pci.h                |    2 -
 arch/sparc/kernel/leon_pci.c             |    1 +
 arch/sparc/kernel/pci.c                  |   48 ++++----
 arch/sparc/kernel/pcic.c                 |    4 +-
 arch/tile/include/asm/pci.h              |    2 -
 arch/tile/kernel/pci.c                   |    6 +-
 arch/tile/kernel/pci_gx.c                |    7 +-
 arch/unicore32/kernel/pci.c              |   13 +--
 arch/x86/include/asm/pci.h               |    6 -
 arch/x86/pci/acpi.c                      |   38 +++---
 arch/x86/pci/common.c                    |    4 +-
 arch/xtensa/kernel/pci.c                 |    2 +
 drivers/parisc/dino.c                    |   11 +--
 drivers/parisc/lba_pci.c                 |    6 +-
 drivers/pci/host-bridge.c                |   90 +++++++++++++-
 drivers/pci/host/pci-mvebu.c             |   18 +---
 drivers/pci/host/pci-tegra.c             |   15 ---
 drivers/pci/host/pci-xgene.c             |    3 +-
 drivers/pci/host/pcie-designware.c       |    4 +-
 drivers/pci/hotplug/acpiphp_glue.c       |   29 +----
 drivers/pci/hotplug/ibmphp_core.c        |    6 +-
 drivers/pci/pci.c                        |   40 ++++++-
 drivers/pci/probe.c                      |  198 ++++++++++++------------------
 drivers/pci/xen-pcifront.c               |   11 ++-
 include/linux/pci.h                      |   51 +++++---
 include/uapi/linux/pci.h                 |    3 +
 45 files changed, 425 insertions(+), 385 deletions(-)


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

* [PATCH 00/28] Refine PCI scan interfaces and make generic pci host bridge
@ 2015-01-16  1:43 ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:43 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

This series is based on Bjorn's pci-next branch.

Patch 1-4 ripped out pci_bus_add_devices() from pci scan interfaces
for better pci scan flow.

Patch 5-11 make a generic pci_host_bridge to hold pci_host_bridge
related informations, and introduce a pci_host_bridge_ops to 
support platform host drivers provide its own pci_host_bridge 
related operations to setup pci_host_bridge during pci enumeration.

Patch 12-28 apply the new pci scan interfaces to platform pci host
bridge drivers.

Now in kernel, we scan pci bus use the following ways:
1. pci_scan_bus. 
   parent = NULL, default io/mem/bus resources
   call pci_bus_add_devices()

2. pci_scan_bus_parented() + pci_bus_add_devices()
   default io/mem/bus resources, only used by xen

3. pci_scan_root_bus() + pci_bus_add_devices()

4. pci_create_root_bus() + pci_scan_child_bus() + pci_bus_add_devices()

5. pci_create_root_bus() + xx_of_scan_bus()  +  pci_bus_add_devices()

And we have a lot of arch specific pci_domain_nr() and other platform
specific weak function like pcibios_root_bridge_prepare().

After applied this series, we have following scan interfaces:

1. pci_scan_bus_legacy() 
   parent = NULL, default io/mem/bus resources.
   for legacy pci scan

2. pci_scan_root_bus()
   for callers provide its own parent and io/mem/bus resources
   but no platform specific pci_host_bridge operations

3. pci_scan_root_bridge()
   for callers provide its own parent and io/mem/bus resources
   and pci_host_bridge_ops.

Besides, above pci scan interfaces all need addtionally call pci_bus_add_devices()
to set match_driver true and try to attach drivers.

Also we could eliminate all arch specific pci_domain_nr() after applied this series.

I tested this series on x86 (with or without ACPI).
Comments and tests are warmly welcome!

Arnd Bergmann (1):
  xen/PCI: Don't use deprecated function pci_scan_bus_parented()

Yijing Wang (27):
  PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
  PCI: Rip out pci_bus_add_devices() from pci_scan_root_bus()
  PCI: Remove deprecated pci_scan_bus_parented()
  PCI: Rename pci_scan_bus() to pci_scan_bus_legacy()
  PCI: Combine PCI domain and bus number in u32 arg
  PCI: Pass PCI domain number combined with root bus number
  PCI: Introduce pci_host_assign_domain_nr() to assign domain
  PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
  PCI: Save sysdata in pci_host_bridge drvdata
  PCI: Introduce pci_host_bridge_ops to setup host bridge
  PCI: Introduce new scan function pci_scan_root_bridge()
  PCI/x86: Refine pci_acpi_scan_root() with generic pci_host_bridge
  PCI/IA64: Refine pci_acpi_scan_root() with generic pci_host_bridge
  PCI/powerpc: Rename pcibios_root_bridge_prepare() for better
    readability
  PCI/powerpc: Use pci_scan_root_bridge() for simplicity
  PCI: Remove weak pcibios_root_bridge_prepare()
  PCI/sparc: Use pci_scan_root_bridge() for simplicity
  PCI: Introduce pci_bus_child_max_busnr()
  PCI/Parisc: Use pci_scan_root_bus() for simplicity
  PCI/mvebu: Use pci_common_init_dev() to simplify code
  PCI/tegra: Remove redundant tegra_pcie_scan_bus()
  PCI/designware: Use pci_scan_root_bus() for simplicity
  PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
  PCI: Rename __pci_create_root_bus() to pci_create_root_bus()
  PCI: Export find_pci_host_bridge()
  PCI: Remove platform specific pci_domain_nr()
  PCI: Remove pci_bus_assign_domain_nr()

 arch/alpha/include/asm/pci.h             |    2 -
 arch/alpha/kernel/pci.c                  |    7 +-
 arch/alpha/kernel/sys_nautilus.c         |    4 +-
 arch/frv/mb93090-mb00/pci-vdk.c          |    6 +-
 arch/ia64/include/asm/pci.h              |    1 -
 arch/ia64/pci/pci.c                      |   34 +++---
 arch/ia64/sn/kernel/io_init.c            |    6 +-
 arch/m68k/coldfire/pci.c                 |    3 +-
 arch/microblaze/pci/pci-common.c         |   17 +--
 arch/mips/include/asm/pci.h              |    2 -
 arch/mips/pci/pci.c                      |    5 +-
 arch/mn10300/unit-asb2305/pci.c          |    5 +-
 arch/powerpc/include/asm/machdep.h       |    2 +-
 arch/powerpc/kernel/pci-common.c         |   73 ++++++-----
 arch/powerpc/platforms/pseries/pci.c     |    2 +-
 arch/powerpc/platforms/pseries/pseries.h |    2 +-
 arch/powerpc/platforms/pseries/setup.c   |    2 +-
 arch/s390/pci/pci.c                      |   13 +--
 arch/sh/drivers/pci/pci.c                |    6 +-
 arch/sh/include/asm/pci.h                |    2 -
 arch/sparc/kernel/leon_pci.c             |    1 +
 arch/sparc/kernel/pci.c                  |   48 ++++----
 arch/sparc/kernel/pcic.c                 |    4 +-
 arch/tile/include/asm/pci.h              |    2 -
 arch/tile/kernel/pci.c                   |    6 +-
 arch/tile/kernel/pci_gx.c                |    7 +-
 arch/unicore32/kernel/pci.c              |   13 +--
 arch/x86/include/asm/pci.h               |    6 -
 arch/x86/pci/acpi.c                      |   38 +++---
 arch/x86/pci/common.c                    |    4 +-
 arch/xtensa/kernel/pci.c                 |    2 +
 drivers/parisc/dino.c                    |   11 +--
 drivers/parisc/lba_pci.c                 |    6 +-
 drivers/pci/host-bridge.c                |   90 +++++++++++++-
 drivers/pci/host/pci-mvebu.c             |   18 +---
 drivers/pci/host/pci-tegra.c             |   15 ---
 drivers/pci/host/pci-xgene.c             |    3 +-
 drivers/pci/host/pcie-designware.c       |    4 +-
 drivers/pci/hotplug/acpiphp_glue.c       |   29 +----
 drivers/pci/hotplug/ibmphp_core.c        |    6 +-
 drivers/pci/pci.c                        |   40 ++++++-
 drivers/pci/probe.c                      |  198 ++++++++++++------------------
 drivers/pci/xen-pcifront.c               |   11 ++-
 include/linux/pci.h                      |   51 +++++---
 include/uapi/linux/pci.h                 |    3 +
 45 files changed, 425 insertions(+), 385 deletions(-)


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

* [PATCH 00/28] Refine PCI scan interfaces and make generic pci host bridge
@ 2015-01-16  1:43 ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:43 UTC (permalink / raw)
  To: linux-arm-kernel

This series is based on Bjorn's pci-next branch.

Patch 1-4 ripped out pci_bus_add_devices() from pci scan interfaces
for better pci scan flow.

Patch 5-11 make a generic pci_host_bridge to hold pci_host_bridge
related informations, and introduce a pci_host_bridge_ops to 
support platform host drivers provide its own pci_host_bridge 
related operations to setup pci_host_bridge during pci enumeration.

Patch 12-28 apply the new pci scan interfaces to platform pci host
bridge drivers.

Now in kernel, we scan pci bus use the following ways:
1. pci_scan_bus. 
   parent = NULL, default io/mem/bus resources
   call pci_bus_add_devices()

2. pci_scan_bus_parented() + pci_bus_add_devices()
   default io/mem/bus resources, only used by xen

3. pci_scan_root_bus() + pci_bus_add_devices()

4. pci_create_root_bus() + pci_scan_child_bus() + pci_bus_add_devices()

5. pci_create_root_bus() + xx_of_scan_bus()  +  pci_bus_add_devices()

And we have a lot of arch specific pci_domain_nr() and other platform
specific weak function like pcibios_root_bridge_prepare().

After applied this series, we have following scan interfaces:

1. pci_scan_bus_legacy() 
   parent = NULL, default io/mem/bus resources.
   for legacy pci scan

2. pci_scan_root_bus()
   for callers provide its own parent and io/mem/bus resources
   but no platform specific pci_host_bridge operations

3. pci_scan_root_bridge()
   for callers provide its own parent and io/mem/bus resources
   and pci_host_bridge_ops.

Besides, above pci scan interfaces all need addtionally call pci_bus_add_devices()
to set match_driver true and try to attach drivers.

Also we could eliminate all arch specific pci_domain_nr() after applied this series.

I tested this series on x86 (with or without ACPI).
Comments and tests are warmly welcome!

Arnd Bergmann (1):
  xen/PCI: Don't use deprecated function pci_scan_bus_parented()

Yijing Wang (27):
  PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
  PCI: Rip out pci_bus_add_devices() from pci_scan_root_bus()
  PCI: Remove deprecated pci_scan_bus_parented()
  PCI: Rename pci_scan_bus() to pci_scan_bus_legacy()
  PCI: Combine PCI domain and bus number in u32 arg
  PCI: Pass PCI domain number combined with root bus number
  PCI: Introduce pci_host_assign_domain_nr() to assign domain
  PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
  PCI: Save sysdata in pci_host_bridge drvdata
  PCI: Introduce pci_host_bridge_ops to setup host bridge
  PCI: Introduce new scan function pci_scan_root_bridge()
  PCI/x86: Refine pci_acpi_scan_root() with generic pci_host_bridge
  PCI/IA64: Refine pci_acpi_scan_root() with generic pci_host_bridge
  PCI/powerpc: Rename pcibios_root_bridge_prepare() for better
    readability
  PCI/powerpc: Use pci_scan_root_bridge() for simplicity
  PCI: Remove weak pcibios_root_bridge_prepare()
  PCI/sparc: Use pci_scan_root_bridge() for simplicity
  PCI: Introduce pci_bus_child_max_busnr()
  PCI/Parisc: Use pci_scan_root_bus() for simplicity
  PCI/mvebu: Use pci_common_init_dev() to simplify code
  PCI/tegra: Remove redundant tegra_pcie_scan_bus()
  PCI/designware: Use pci_scan_root_bus() for simplicity
  PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
  PCI: Rename __pci_create_root_bus() to pci_create_root_bus()
  PCI: Export find_pci_host_bridge()
  PCI: Remove platform specific pci_domain_nr()
  PCI: Remove pci_bus_assign_domain_nr()

 arch/alpha/include/asm/pci.h             |    2 -
 arch/alpha/kernel/pci.c                  |    7 +-
 arch/alpha/kernel/sys_nautilus.c         |    4 +-
 arch/frv/mb93090-mb00/pci-vdk.c          |    6 +-
 arch/ia64/include/asm/pci.h              |    1 -
 arch/ia64/pci/pci.c                      |   34 +++---
 arch/ia64/sn/kernel/io_init.c            |    6 +-
 arch/m68k/coldfire/pci.c                 |    3 +-
 arch/microblaze/pci/pci-common.c         |   17 +--
 arch/mips/include/asm/pci.h              |    2 -
 arch/mips/pci/pci.c                      |    5 +-
 arch/mn10300/unit-asb2305/pci.c          |    5 +-
 arch/powerpc/include/asm/machdep.h       |    2 +-
 arch/powerpc/kernel/pci-common.c         |   73 ++++++-----
 arch/powerpc/platforms/pseries/pci.c     |    2 +-
 arch/powerpc/platforms/pseries/pseries.h |    2 +-
 arch/powerpc/platforms/pseries/setup.c   |    2 +-
 arch/s390/pci/pci.c                      |   13 +--
 arch/sh/drivers/pci/pci.c                |    6 +-
 arch/sh/include/asm/pci.h                |    2 -
 arch/sparc/kernel/leon_pci.c             |    1 +
 arch/sparc/kernel/pci.c                  |   48 ++++----
 arch/sparc/kernel/pcic.c                 |    4 +-
 arch/tile/include/asm/pci.h              |    2 -
 arch/tile/kernel/pci.c                   |    6 +-
 arch/tile/kernel/pci_gx.c                |    7 +-
 arch/unicore32/kernel/pci.c              |   13 +--
 arch/x86/include/asm/pci.h               |    6 -
 arch/x86/pci/acpi.c                      |   38 +++---
 arch/x86/pci/common.c                    |    4 +-
 arch/xtensa/kernel/pci.c                 |    2 +
 drivers/parisc/dino.c                    |   11 +--
 drivers/parisc/lba_pci.c                 |    6 +-
 drivers/pci/host-bridge.c                |   90 +++++++++++++-
 drivers/pci/host/pci-mvebu.c             |   18 +---
 drivers/pci/host/pci-tegra.c             |   15 ---
 drivers/pci/host/pci-xgene.c             |    3 +-
 drivers/pci/host/pcie-designware.c       |    4 +-
 drivers/pci/hotplug/acpiphp_glue.c       |   29 +----
 drivers/pci/hotplug/ibmphp_core.c        |    6 +-
 drivers/pci/pci.c                        |   40 ++++++-
 drivers/pci/probe.c                      |  198 ++++++++++++------------------
 drivers/pci/xen-pcifront.c               |   11 ++-
 include/linux/pci.h                      |   51 +++++---
 include/uapi/linux/pci.h                 |    3 +
 45 files changed, 425 insertions(+), 385 deletions(-)

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

* [PATCH 00/28] Refine PCI scan interfaces and make generic pci host bridge
@ 2015-01-16  1:43 ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:43 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

This series is based on Bjorn's pci-next branch.

Patch 1-4 ripped out pci_bus_add_devices() from pci scan interfaces
for better pci scan flow.

Patch 5-11 make a generic pci_host_bridge to hold pci_host_bridge
related informations, and introduce a pci_host_bridge_ops to 
support platform host drivers provide its own pci_host_bridge 
related operations to setup pci_host_bridge during pci enumeration.

Patch 12-28 apply the new pci scan interfaces to platform pci host
bridge drivers.

Now in kernel, we scan pci bus use the following ways:
1. pci_scan_bus. 
   parent = NULL, default io/mem/bus resources
   call pci_bus_add_devices()

2. pci_scan_bus_parented() + pci_bus_add_devices()
   default io/mem/bus resources, only used by xen

3. pci_scan_root_bus() + pci_bus_add_devices()

4. pci_create_root_bus() + pci_scan_child_bus() + pci_bus_add_devices()

5. pci_create_root_bus() + xx_of_scan_bus()  +  pci_bus_add_devices()

And we have a lot of arch specific pci_domain_nr() and other platform
specific weak function like pcibios_root_bridge_prepare().

After applied this series, we have following scan interfaces:

1. pci_scan_bus_legacy() 
   parent = NULL, default io/mem/bus resources.
   for legacy pci scan

2. pci_scan_root_bus()
   for callers provide its own parent and io/mem/bus resources
   but no platform specific pci_host_bridge operations

3. pci_scan_root_bridge()
   for callers provide its own parent and io/mem/bus resources
   and pci_host_bridge_ops.

Besides, above pci scan interfaces all need addtionally call pci_bus_add_devices()
to set match_driver true and try to attach drivers.

Also we could eliminate all arch specific pci_domain_nr() after applied this series.

I tested this series on x86 (with or without ACPI).
Comments and tests are warmly welcome!

Arnd Bergmann (1):
  xen/PCI: Don't use deprecated function pci_scan_bus_parented()

Yijing Wang (27):
  PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
  PCI: Rip out pci_bus_add_devices() from pci_scan_root_bus()
  PCI: Remove deprecated pci_scan_bus_parented()
  PCI: Rename pci_scan_bus() to pci_scan_bus_legacy()
  PCI: Combine PCI domain and bus number in u32 arg
  PCI: Pass PCI domain number combined with root bus number
  PCI: Introduce pci_host_assign_domain_nr() to assign domain
  PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
  PCI: Save sysdata in pci_host_bridge drvdata
  PCI: Introduce pci_host_bridge_ops to setup host bridge
  PCI: Introduce new scan function pci_scan_root_bridge()
  PCI/x86: Refine pci_acpi_scan_root() with generic pci_host_bridge
  PCI/IA64: Refine pci_acpi_scan_root() with generic pci_host_bridge
  PCI/powerpc: Rename pcibios_root_bridge_prepare() for better
    readability
  PCI/powerpc: Use pci_scan_root_bridge() for simplicity
  PCI: Remove weak pcibios_root_bridge_prepare()
  PCI/sparc: Use pci_scan_root_bridge() for simplicity
  PCI: Introduce pci_bus_child_max_busnr()
  PCI/Parisc: Use pci_scan_root_bus() for simplicity
  PCI/mvebu: Use pci_common_init_dev() to simplify code
  PCI/tegra: Remove redundant tegra_pcie_scan_bus()
  PCI/designware: Use pci_scan_root_bus() for simplicity
  PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
  PCI: Rename __pci_create_root_bus() to pci_create_root_bus()
  PCI: Export find_pci_host_bridge()
  PCI: Remove platform specific pci_domain_nr()
  PCI: Remove pci_bus_assign_domain_nr()

 arch/alpha/include/asm/pci.h             |    2 -
 arch/alpha/kernel/pci.c                  |    7 +-
 arch/alpha/kernel/sys_nautilus.c         |    4 +-
 arch/frv/mb93090-mb00/pci-vdk.c          |    6 +-
 arch/ia64/include/asm/pci.h              |    1 -
 arch/ia64/pci/pci.c                      |   34 +++---
 arch/ia64/sn/kernel/io_init.c            |    6 +-
 arch/m68k/coldfire/pci.c                 |    3 +-
 arch/microblaze/pci/pci-common.c         |   17 +--
 arch/mips/include/asm/pci.h              |    2 -
 arch/mips/pci/pci.c                      |    5 +-
 arch/mn10300/unit-asb2305/pci.c          |    5 +-
 arch/powerpc/include/asm/machdep.h       |    2 +-
 arch/powerpc/kernel/pci-common.c         |   73 ++++++-----
 arch/powerpc/platforms/pseries/pci.c     |    2 +-
 arch/powerpc/platforms/pseries/pseries.h |    2 +-
 arch/powerpc/platforms/pseries/setup.c   |    2 +-
 arch/s390/pci/pci.c                      |   13 +--
 arch/sh/drivers/pci/pci.c                |    6 +-
 arch/sh/include/asm/pci.h                |    2 -
 arch/sparc/kernel/leon_pci.c             |    1 +
 arch/sparc/kernel/pci.c                  |   48 ++++----
 arch/sparc/kernel/pcic.c                 |    4 +-
 arch/tile/include/asm/pci.h              |    2 -
 arch/tile/kernel/pci.c                   |    6 +-
 arch/tile/kernel/pci_gx.c                |    7 +-
 arch/unicore32/kernel/pci.c              |   13 +--
 arch/x86/include/asm/pci.h               |    6 -
 arch/x86/pci/acpi.c                      |   38 +++---
 arch/x86/pci/common.c                    |    4 +-
 arch/xtensa/kernel/pci.c                 |    2 +
 drivers/parisc/dino.c                    |   11 +--
 drivers/parisc/lba_pci.c                 |    6 +-
 drivers/pci/host-bridge.c                |   90 +++++++++++++-
 drivers/pci/host/pci-mvebu.c             |   18 +---
 drivers/pci/host/pci-tegra.c             |   15 ---
 drivers/pci/host/pci-xgene.c             |    3 +-
 drivers/pci/host/pcie-designware.c       |    4 +-
 drivers/pci/hotplug/acpiphp_glue.c       |   29 +----
 drivers/pci/hotplug/ibmphp_core.c        |    6 +-
 drivers/pci/pci.c                        |   40 ++++++-
 drivers/pci/probe.c                      |  198 ++++++++++++------------------
 drivers/pci/xen-pcifront.c               |   11 ++-
 include/linux/pci.h                      |   51 +++++---
 include/uapi/linux/pci.h                 |    3 +
 45 files changed, 425 insertions(+), 385 deletions(-)


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

* [PATCH 00/28] Refine PCI scan interfaces and make generic pci host bridge
@ 2015-01-16  1:43 ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:43 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

This series is based on Bjorn's pci-next branch.

Patch 1-4 ripped out pci_bus_add_devices() from pci scan interfaces
for better pci scan flow.

Patch 5-11 make a generic pci_host_bridge to hold pci_host_bridge
related informations, and introduce a pci_host_bridge_ops to 
support platform host drivers provide its own pci_host_bridge 
related operations to setup pci_host_bridge during pci enumeration.

Patch 12-28 apply the new pci scan interfaces to platform pci host
bridge drivers.

Now in kernel, we scan pci bus use the following ways:
1. pci_scan_bus. 
   parent = NULL, default io/mem/bus resources
   call pci_bus_add_devices()

2. pci_scan_bus_parented() + pci_bus_add_devices()
   default io/mem/bus resources, only used by xen

3. pci_scan_root_bus() + pci_bus_add_devices()

4. pci_create_root_bus() + pci_scan_child_bus() + pci_bus_add_devices()

5. pci_create_root_bus() + xx_of_scan_bus()  +  pci_bus_add_devices()

And we have a lot of arch specific pci_domain_nr() and other platform
specific weak function like pcibios_root_bridge_prepare().

After applied this series, we have following scan interfaces:

1. pci_scan_bus_legacy() 
   parent = NULL, default io/mem/bus resources.
   for legacy pci scan

2. pci_scan_root_bus()
   for callers provide its own parent and io/mem/bus resources
   but no platform specific pci_host_bridge operations

3. pci_scan_root_bridge()
   for callers provide its own parent and io/mem/bus resources
   and pci_host_bridge_ops.

Besides, above pci scan interfaces all need addtionally call pci_bus_add_devices()
to set match_driver true and try to attach drivers.

Also we could eliminate all arch specific pci_domain_nr() after applied this series.

I tested this series on x86 (with or without ACPI).
Comments and tests are warmly welcome!

Arnd Bergmann (1):
  xen/PCI: Don't use deprecated function pci_scan_bus_parented()

Yijing Wang (27):
  PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
  PCI: Rip out pci_bus_add_devices() from pci_scan_root_bus()
  PCI: Remove deprecated pci_scan_bus_parented()
  PCI: Rename pci_scan_bus() to pci_scan_bus_legacy()
  PCI: Combine PCI domain and bus number in u32 arg
  PCI: Pass PCI domain number combined with root bus number
  PCI: Introduce pci_host_assign_domain_nr() to assign domain
  PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
  PCI: Save sysdata in pci_host_bridge drvdata
  PCI: Introduce pci_host_bridge_ops to setup host bridge
  PCI: Introduce new scan function pci_scan_root_bridge()
  PCI/x86: Refine pci_acpi_scan_root() with generic pci_host_bridge
  PCI/IA64: Refine pci_acpi_scan_root() with generic pci_host_bridge
  PCI/powerpc: Rename pcibios_root_bridge_prepare() for better
    readability
  PCI/powerpc: Use pci_scan_root_bridge() for simplicity
  PCI: Remove weak pcibios_root_bridge_prepare()
  PCI/sparc: Use pci_scan_root_bridge() for simplicity
  PCI: Introduce pci_bus_child_max_busnr()
  PCI/Parisc: Use pci_scan_root_bus() for simplicity
  PCI/mvebu: Use pci_common_init_dev() to simplify code
  PCI/tegra: Remove redundant tegra_pcie_scan_bus()
  PCI/designware: Use pci_scan_root_bus() for simplicity
  PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
  PCI: Rename __pci_create_root_bus() to pci_create_root_bus()
  PCI: Export find_pci_host_bridge()
  PCI: Remove platform specific pci_domain_nr()
  PCI: Remove pci_bus_assign_domain_nr()

 arch/alpha/include/asm/pci.h             |    2 -
 arch/alpha/kernel/pci.c                  |    7 +-
 arch/alpha/kernel/sys_nautilus.c         |    4 +-
 arch/frv/mb93090-mb00/pci-vdk.c          |    6 +-
 arch/ia64/include/asm/pci.h              |    1 -
 arch/ia64/pci/pci.c                      |   34 +++---
 arch/ia64/sn/kernel/io_init.c            |    6 +-
 arch/m68k/coldfire/pci.c                 |    3 +-
 arch/microblaze/pci/pci-common.c         |   17 +--
 arch/mips/include/asm/pci.h              |    2 -
 arch/mips/pci/pci.c                      |    5 +-
 arch/mn10300/unit-asb2305/pci.c          |    5 +-
 arch/powerpc/include/asm/machdep.h       |    2 +-
 arch/powerpc/kernel/pci-common.c         |   73 ++++++-----
 arch/powerpc/platforms/pseries/pci.c     |    2 +-
 arch/powerpc/platforms/pseries/pseries.h |    2 +-
 arch/powerpc/platforms/pseries/setup.c   |    2 +-
 arch/s390/pci/pci.c                      |   13 +--
 arch/sh/drivers/pci/pci.c                |    6 +-
 arch/sh/include/asm/pci.h                |    2 -
 arch/sparc/kernel/leon_pci.c             |    1 +
 arch/sparc/kernel/pci.c                  |   48 ++++----
 arch/sparc/kernel/pcic.c                 |    4 +-
 arch/tile/include/asm/pci.h              |    2 -
 arch/tile/kernel/pci.c                   |    6 +-
 arch/tile/kernel/pci_gx.c                |    7 +-
 arch/unicore32/kernel/pci.c              |   13 +--
 arch/x86/include/asm/pci.h               |    6 -
 arch/x86/pci/acpi.c                      |   38 +++---
 arch/x86/pci/common.c                    |    4 +-
 arch/xtensa/kernel/pci.c                 |    2 +
 drivers/parisc/dino.c                    |   11 +--
 drivers/parisc/lba_pci.c                 |    6 +-
 drivers/pci/host-bridge.c                |   90 +++++++++++++-
 drivers/pci/host/pci-mvebu.c             |   18 +---
 drivers/pci/host/pci-tegra.c             |   15 ---
 drivers/pci/host/pci-xgene.c             |    3 +-
 drivers/pci/host/pcie-designware.c       |    4 +-
 drivers/pci/hotplug/acpiphp_glue.c       |   29 +----
 drivers/pci/hotplug/ibmphp_core.c        |    6 +-
 drivers/pci/pci.c                        |   40 ++++++-
 drivers/pci/probe.c                      |  198 ++++++++++++------------------
 drivers/pci/xen-pcifront.c               |   11 ++-
 include/linux/pci.h                      |   51 +++++---
 include/uapi/linux/pci.h                 |    3 +
 45 files changed, 425 insertions(+), 385 deletions(-)

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

* [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
  2015-01-16  1:43 ` Yijing Wang
                     ` (3 preceding siblings ...)
  (?)
@ 2015-01-16  1:43   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:43 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, sparclinux

Pci_bus_add_devices() should not be placed in pci_scan_bus().
Now pci device will be added to driver core once its
creation. All things left in pci_bus_add_devices() are
driver attachment and other trivial sysfs things.
Pci_scan_bus() should be the function responsible for
scanning PCI devices, not including driver attachment.
Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
will call pci_bus_size_bridges() and pci_bus_assign_resources()
after pci_scan_bus().

E.g.
In m68k
mcf_pci_init()
	pci_scan_bus()
		...
		pci_bus_add_devices() --- try to attach driver
	pci_fixup_irqs()
	pci_bus_size_bridges()
	pci_bus_assign_resources()

It is not correct, resources should be assigned correctly
before attaching driver.
So we should rip out pci_bus_add_devices() for better
code design. After applied this patch, pci_scan_bus()
should be used in flow like:

pci_scan_bus() (mandatory)
pci_fixup_irqs() (optional)
pci_bus_size_bridges() (optional)
pci_pci_bus_assign_resources() (optional)
pci_bus_add_devices() (mandatory)

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Geert Uytterhoeven <geert@linux-m68k.org>
CC: Guan Xuetao <gxt@mprc.pku.edu.cn>
CC: linux-alpha@vger.kernel.org
CC: linux-m68k@lists.linux-m68k.org
CC: sparclinux@vger.kernel.org
---
 arch/alpha/kernel/sys_nautilus.c  |    1 +
 arch/m68k/coldfire/pci.c          |    1 +
 arch/sparc/kernel/pcic.c          |    2 ++
 arch/unicore32/kernel/pci.c       |   11 +++--------
 drivers/pci/hotplug/ibmphp_core.c |    6 ++++--
 drivers/pci/probe.c               |    1 -
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 837c0fa..4ae4a40 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -253,6 +253,7 @@ nautilus_init_pci(void)
 	   for the root bus, so just clear it. */
 	bus->self = NULL;
 	pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq);
+	pci_bus_add_devices(bus);
 }
 
 /*
diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index df96792..d45f087 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -319,6 +319,7 @@ static int __init mcf_pci_init(void)
 	pci_fixup_irqs(pci_common_swizzle, mcf_pci_map_irq);
 	pci_bus_size_bridges(rootbus);
 	pci_bus_assign_resources(rootbus);
+	pci_bus_add_devices(rootbus);
 	return 0;
 }
 
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 6cc78c2..7a82fe2 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -391,6 +391,8 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic)
 	struct linux_pbm_info *pbm = &pcic->pbm;
 
 	pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, &pcic_ops, pbm);
+	if (pbm->pci_bus)
+		pci_bus_add_devices(pbm->pci_bus);
 #if 0 /* deadwood transplanted from sparc64 */
 	pci_fill_in_pbm_cookies(pbm->pci_bus, pbm, pbm->prom_node);
 	pci_record_assignments(pbm, pbm->pci_bus);
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 374a055..3d82024 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -266,17 +266,12 @@ static int __init pci_common_init(void)
 	pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq);
 
 	if (!pci_has_flag(PCI_PROBE_ONLY)) {
-		/*
-		 * Size the bridge windows.
-		 */
+		/* Size the bridge windows. */
 		pci_bus_size_bridges(puv3_bus);
-
-		/*
-		 * Assign resources.
-		 */
+		/* Assign resources. */
 		pci_bus_assign_resources(puv3_bus);
 	}
-
+	pci_bus_add_devices(puv3_bus);
 	return 0;
 }
 subsys_initcall(pci_common_init);
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 96c5c72..86e3bfd 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -738,7 +738,7 @@ static void ibm_unconfigure_device(struct pci_func *func)
  */
 static u8 bus_structure_fixup(u8 busno)
 {
-	struct pci_bus *bus;
+	struct pci_bus *bus, *b;
 	struct pci_dev *dev;
 	u16 l;
 
@@ -765,7 +765,9 @@ static u8 bus_structure_fixup(u8 busno)
 					(l != 0x0000) && (l != 0xffff)) {
 			debug("%s - Inside bus_structure_fixup()\n",
 							__func__);
-			pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			b = pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			if (b)
+				pci_bus_add_devices(b);
 			break;
 		}
 	}
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 23212f8..053c0f4 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2123,7 +2123,6 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 	b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);
 	if (b) {
 		pci_scan_child_bus(b);
-		pci_bus_add_devices(b);
 	} else {
 		pci_free_resource_list(&resources);
 	}
-- 
1.7.1


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

* [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
  2015-01-16  1:43 ` Yijing Wang
                   ` (3 preceding siblings ...)
  (?)
@ 2015-01-16  1:43 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:43 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, sparclinux

Pci_bus_add_devices() should not be placed in pci_scan_bus().
Now pci device will be added to driver core once its
creation. All things left in pci_bus_add_devices() are
driver attachment and other trivial sysfs things.
Pci_scan_bus() should be the function responsible for
scanning PCI devices, not including driver attachment.
Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
will call pci_bus_size_bridges() and pci_bus_assign_resources()
after pci_scan_bus().

E.g.
In m68k
mcf_pci_init()
	pci_scan_bus()
		...
		pci_bus_add_devices() --- try to attach driver
	pci_fixup_irqs()
	pci_bus_size_bridges()
	pci_bus_assign_resources()

It is not correct, resources should be assigned correctly
before attaching driver.
So we should rip out pci_bus_add_devices() for better
code design. After applied this patch, pci_scan_bus()
should be used in flow like:

pci_scan_bus() (mandatory)
pci_fixup_irqs() (optional)
pci_bus_size_bridges() (optional)
pci_pci_bus_assign_resources() (optional)
pci_bus_add_devices() (mandatory)

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Geert Uytterhoeven <geert@linux-m68k.org>
CC: Guan Xuetao <gxt@mprc.pku.edu.cn>
CC: linux-alpha@vger.kernel.org
CC: linux-m68k@lists.linux-m68k.org
CC: sparclinux@vger.kernel.org
---
 arch/alpha/kernel/sys_nautilus.c  |    1 +
 arch/m68k/coldfire/pci.c          |    1 +
 arch/sparc/kernel/pcic.c          |    2 ++
 arch/unicore32/kernel/pci.c       |   11 +++--------
 drivers/pci/hotplug/ibmphp_core.c |    6 ++++--
 drivers/pci/probe.c               |    1 -
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 837c0fa..4ae4a40 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -253,6 +253,7 @@ nautilus_init_pci(void)
 	   for the root bus, so just clear it. */
 	bus->self = NULL;
 	pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq);
+	pci_bus_add_devices(bus);
 }
 
 /*
diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index df96792..d45f087 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -319,6 +319,7 @@ static int __init mcf_pci_init(void)
 	pci_fixup_irqs(pci_common_swizzle, mcf_pci_map_irq);
 	pci_bus_size_bridges(rootbus);
 	pci_bus_assign_resources(rootbus);
+	pci_bus_add_devices(rootbus);
 	return 0;
 }
 
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 6cc78c2..7a82fe2 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -391,6 +391,8 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic)
 	struct linux_pbm_info *pbm = &pcic->pbm;
 
 	pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, &pcic_ops, pbm);
+	if (pbm->pci_bus)
+		pci_bus_add_devices(pbm->pci_bus);
 #if 0 /* deadwood transplanted from sparc64 */
 	pci_fill_in_pbm_cookies(pbm->pci_bus, pbm, pbm->prom_node);
 	pci_record_assignments(pbm, pbm->pci_bus);
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 374a055..3d82024 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -266,17 +266,12 @@ static int __init pci_common_init(void)
 	pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq);
 
 	if (!pci_has_flag(PCI_PROBE_ONLY)) {
-		/*
-		 * Size the bridge windows.
-		 */
+		/* Size the bridge windows. */
 		pci_bus_size_bridges(puv3_bus);
-
-		/*
-		 * Assign resources.
-		 */
+		/* Assign resources. */
 		pci_bus_assign_resources(puv3_bus);
 	}
-
+	pci_bus_add_devices(puv3_bus);
 	return 0;
 }
 subsys_initcall(pci_common_init);
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 96c5c72..86e3bfd 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -738,7 +738,7 @@ static void ibm_unconfigure_device(struct pci_func *func)
  */
 static u8 bus_structure_fixup(u8 busno)
 {
-	struct pci_bus *bus;
+	struct pci_bus *bus, *b;
 	struct pci_dev *dev;
 	u16 l;
 
@@ -765,7 +765,9 @@ static u8 bus_structure_fixup(u8 busno)
 					(l != 0x0000) && (l != 0xffff)) {
 			debug("%s - Inside bus_structure_fixup()\n",
 							__func__);
-			pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			b = pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			if (b)
+				pci_bus_add_devices(b);
 			break;
 		}
 	}
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 23212f8..053c0f4 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2123,7 +2123,6 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 	b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);
 	if (b) {
 		pci_scan_child_bus(b);
-		pci_bus_add_devices(b);
 	} else {
 		pci_free_resource_list(&resources);
 	}
-- 
1.7.1

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

* [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-16  1:43   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:43 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, sparclinux

Pci_bus_add_devices() should not be placed in pci_scan_bus().
Now pci device will be added to driver core once its
creation. All things left in pci_bus_add_devices() are
driver attachment and other trivial sysfs things.
Pci_scan_bus() should be the function responsible for
scanning PCI devices, not including driver attachment.
Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
will call pci_bus_size_bridges() and pci_bus_assign_resources()
after pci_scan_bus().

E.g.
In m68k
mcf_pci_init()
	pci_scan_bus()
		...
		pci_bus_add_devices() --- try to attach driver
	pci_fixup_irqs()
	pci_bus_size_bridges()
	pci_bus_assign_resources()

It is not correct, resources should be assigned correctly
before attaching driver.
So we should rip out pci_bus_add_devices() for better
code design. After applied this patch, pci_scan_bus()
should be used in flow like:

pci_scan_bus() (mandatory)
pci_fixup_irqs() (optional)
pci_bus_size_bridges() (optional)
pci_pci_bus_assign_resources() (optional)
pci_bus_add_devices() (mandatory)

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Geert Uytterhoeven <geert@linux-m68k.org>
CC: Guan Xuetao <gxt@mprc.pku.edu.cn>
CC: linux-alpha@vger.kernel.org
CC: linux-m68k@lists.linux-m68k.org
CC: sparclinux@vger.kernel.org
---
 arch/alpha/kernel/sys_nautilus.c  |    1 +
 arch/m68k/coldfire/pci.c          |    1 +
 arch/sparc/kernel/pcic.c          |    2 ++
 arch/unicore32/kernel/pci.c       |   11 +++--------
 drivers/pci/hotplug/ibmphp_core.c |    6 ++++--
 drivers/pci/probe.c               |    1 -
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 837c0fa..4ae4a40 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -253,6 +253,7 @@ nautilus_init_pci(void)
 	   for the root bus, so just clear it. */
 	bus->self = NULL;
 	pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq);
+	pci_bus_add_devices(bus);
 }
 
 /*
diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index df96792..d45f087 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -319,6 +319,7 @@ static int __init mcf_pci_init(void)
 	pci_fixup_irqs(pci_common_swizzle, mcf_pci_map_irq);
 	pci_bus_size_bridges(rootbus);
 	pci_bus_assign_resources(rootbus);
+	pci_bus_add_devices(rootbus);
 	return 0;
 }
 
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 6cc78c2..7a82fe2 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -391,6 +391,8 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic)
 	struct linux_pbm_info *pbm = &pcic->pbm;
 
 	pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, &pcic_ops, pbm);
+	if (pbm->pci_bus)
+		pci_bus_add_devices(pbm->pci_bus);
 #if 0 /* deadwood transplanted from sparc64 */
 	pci_fill_in_pbm_cookies(pbm->pci_bus, pbm, pbm->prom_node);
 	pci_record_assignments(pbm, pbm->pci_bus);
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 374a055..3d82024 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -266,17 +266,12 @@ static int __init pci_common_init(void)
 	pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq);
 
 	if (!pci_has_flag(PCI_PROBE_ONLY)) {
-		/*
-		 * Size the bridge windows.
-		 */
+		/* Size the bridge windows. */
 		pci_bus_size_bridges(puv3_bus);
-
-		/*
-		 * Assign resources.
-		 */
+		/* Assign resources. */
 		pci_bus_assign_resources(puv3_bus);
 	}
-
+	pci_bus_add_devices(puv3_bus);
 	return 0;
 }
 subsys_initcall(pci_common_init);
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 96c5c72..86e3bfd 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -738,7 +738,7 @@ static void ibm_unconfigure_device(struct pci_func *func)
  */
 static u8 bus_structure_fixup(u8 busno)
 {
-	struct pci_bus *bus;
+	struct pci_bus *bus, *b;
 	struct pci_dev *dev;
 	u16 l;
 
@@ -765,7 +765,9 @@ static u8 bus_structure_fixup(u8 busno)
 					(l != 0x0000) && (l != 0xffff)) {
 			debug("%s - Inside bus_structure_fixup()\n",
 							__func__);
-			pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			b = pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			if (b)
+				pci_bus_add_devices(b);
 			break;
 		}
 	}
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 23212f8..053c0f4 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2123,7 +2123,6 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 	b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);
 	if (b) {
 		pci_scan_child_bus(b);
-		pci_bus_add_devices(b);
 	} else {
 		pci_free_resource_list(&resources);
 	}
-- 
1.7.1


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

* [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-16  1:43   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:43 UTC (permalink / raw)
  To: linux-arm-kernel

Pci_bus_add_devices() should not be placed in pci_scan_bus().
Now pci device will be added to driver core once its
creation. All things left in pci_bus_add_devices() are
driver attachment and other trivial sysfs things.
Pci_scan_bus() should be the function responsible for
scanning PCI devices, not including driver attachment.
Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
will call pci_bus_size_bridges() and pci_bus_assign_resources()
after pci_scan_bus().

E.g.
In m68k
mcf_pci_init()
	pci_scan_bus()
		...
		pci_bus_add_devices() --- try to attach driver
	pci_fixup_irqs()
	pci_bus_size_bridges()
	pci_bus_assign_resources()

It is not correct, resources should be assigned correctly
before attaching driver.
So we should rip out pci_bus_add_devices() for better
code design. After applied this patch, pci_scan_bus()
should be used in flow like:

pci_scan_bus() (mandatory)
pci_fixup_irqs() (optional)
pci_bus_size_bridges() (optional)
pci_pci_bus_assign_resources() (optional)
pci_bus_add_devices() (mandatory)

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Geert Uytterhoeven <geert@linux-m68k.org>
CC: Guan Xuetao <gxt@mprc.pku.edu.cn>
CC: linux-alpha@vger.kernel.org
CC: linux-m68k@lists.linux-m68k.org
CC: sparclinux@vger.kernel.org
---
 arch/alpha/kernel/sys_nautilus.c  |    1 +
 arch/m68k/coldfire/pci.c          |    1 +
 arch/sparc/kernel/pcic.c          |    2 ++
 arch/unicore32/kernel/pci.c       |   11 +++--------
 drivers/pci/hotplug/ibmphp_core.c |    6 ++++--
 drivers/pci/probe.c               |    1 -
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 837c0fa..4ae4a40 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -253,6 +253,7 @@ nautilus_init_pci(void)
 	   for the root bus, so just clear it. */
 	bus->self = NULL;
 	pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq);
+	pci_bus_add_devices(bus);
 }
 
 /*
diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index df96792..d45f087 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -319,6 +319,7 @@ static int __init mcf_pci_init(void)
 	pci_fixup_irqs(pci_common_swizzle, mcf_pci_map_irq);
 	pci_bus_size_bridges(rootbus);
 	pci_bus_assign_resources(rootbus);
+	pci_bus_add_devices(rootbus);
 	return 0;
 }
 
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 6cc78c2..7a82fe2 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -391,6 +391,8 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic)
 	struct linux_pbm_info *pbm = &pcic->pbm;
 
 	pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, &pcic_ops, pbm);
+	if (pbm->pci_bus)
+		pci_bus_add_devices(pbm->pci_bus);
 #if 0 /* deadwood transplanted from sparc64 */
 	pci_fill_in_pbm_cookies(pbm->pci_bus, pbm, pbm->prom_node);
 	pci_record_assignments(pbm, pbm->pci_bus);
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 374a055..3d82024 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -266,17 +266,12 @@ static int __init pci_common_init(void)
 	pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq);
 
 	if (!pci_has_flag(PCI_PROBE_ONLY)) {
-		/*
-		 * Size the bridge windows.
-		 */
+		/* Size the bridge windows. */
 		pci_bus_size_bridges(puv3_bus);
-
-		/*
-		 * Assign resources.
-		 */
+		/* Assign resources. */
 		pci_bus_assign_resources(puv3_bus);
 	}
-
+	pci_bus_add_devices(puv3_bus);
 	return 0;
 }
 subsys_initcall(pci_common_init);
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 96c5c72..86e3bfd 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -738,7 +738,7 @@ static void ibm_unconfigure_device(struct pci_func *func)
  */
 static u8 bus_structure_fixup(u8 busno)
 {
-	struct pci_bus *bus;
+	struct pci_bus *bus, *b;
 	struct pci_dev *dev;
 	u16 l;
 
@@ -765,7 +765,9 @@ static u8 bus_structure_fixup(u8 busno)
 					(l != 0x0000) && (l != 0xffff)) {
 			debug("%s - Inside bus_structure_fixup()\n",
 							__func__);
-			pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			b = pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			if (b)
+				pci_bus_add_devices(b);
 			break;
 		}
 	}
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 23212f8..053c0f4 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2123,7 +2123,6 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 	b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);
 	if (b) {
 		pci_scan_child_bus(b);
-		pci_bus_add_devices(b);
 	} else {
 		pci_free_resource_list(&resources);
 	}
-- 
1.7.1


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

* [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-16  1:43   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:43 UTC (permalink / raw)
  To: linux-arm-kernel

Pci_bus_add_devices() should not be placed in pci_scan_bus().
Now pci device will be added to driver core once its
creation. All things left in pci_bus_add_devices() are
driver attachment and other trivial sysfs things.
Pci_scan_bus() should be the function responsible for
scanning PCI devices, not including driver attachment.
Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
will call pci_bus_size_bridges() and pci_bus_assign_resources()
after pci_scan_bus().

E.g.
In m68k
mcf_pci_init()
	pci_scan_bus()
		...
		pci_bus_add_devices() --- try to attach driver
	pci_fixup_irqs()
	pci_bus_size_bridges()
	pci_bus_assign_resources()

It is not correct, resources should be assigned correctly
before attaching driver.
So we should rip out pci_bus_add_devices() for better
code design. After applied this patch, pci_scan_bus()
should be used in flow like:

pci_scan_bus() (mandatory)
pci_fixup_irqs() (optional)
pci_bus_size_bridges() (optional)
pci_pci_bus_assign_resources() (optional)
pci_bus_add_devices() (mandatory)

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Geert Uytterhoeven <geert@linux-m68k.org>
CC: Guan Xuetao <gxt@mprc.pku.edu.cn>
CC: linux-alpha at vger.kernel.org
CC: linux-m68k at lists.linux-m68k.org
CC: sparclinux at vger.kernel.org
---
 arch/alpha/kernel/sys_nautilus.c  |    1 +
 arch/m68k/coldfire/pci.c          |    1 +
 arch/sparc/kernel/pcic.c          |    2 ++
 arch/unicore32/kernel/pci.c       |   11 +++--------
 drivers/pci/hotplug/ibmphp_core.c |    6 ++++--
 drivers/pci/probe.c               |    1 -
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 837c0fa..4ae4a40 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -253,6 +253,7 @@ nautilus_init_pci(void)
 	   for the root bus, so just clear it. */
 	bus->self = NULL;
 	pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq);
+	pci_bus_add_devices(bus);
 }
 
 /*
diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index df96792..d45f087 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -319,6 +319,7 @@ static int __init mcf_pci_init(void)
 	pci_fixup_irqs(pci_common_swizzle, mcf_pci_map_irq);
 	pci_bus_size_bridges(rootbus);
 	pci_bus_assign_resources(rootbus);
+	pci_bus_add_devices(rootbus);
 	return 0;
 }
 
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 6cc78c2..7a82fe2 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -391,6 +391,8 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic)
 	struct linux_pbm_info *pbm = &pcic->pbm;
 
 	pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, &pcic_ops, pbm);
+	if (pbm->pci_bus)
+		pci_bus_add_devices(pbm->pci_bus);
 #if 0 /* deadwood transplanted from sparc64 */
 	pci_fill_in_pbm_cookies(pbm->pci_bus, pbm, pbm->prom_node);
 	pci_record_assignments(pbm, pbm->pci_bus);
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 374a055..3d82024 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -266,17 +266,12 @@ static int __init pci_common_init(void)
 	pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq);
 
 	if (!pci_has_flag(PCI_PROBE_ONLY)) {
-		/*
-		 * Size the bridge windows.
-		 */
+		/* Size the bridge windows. */
 		pci_bus_size_bridges(puv3_bus);
-
-		/*
-		 * Assign resources.
-		 */
+		/* Assign resources. */
 		pci_bus_assign_resources(puv3_bus);
 	}
-
+	pci_bus_add_devices(puv3_bus);
 	return 0;
 }
 subsys_initcall(pci_common_init);
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 96c5c72..86e3bfd 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -738,7 +738,7 @@ static void ibm_unconfigure_device(struct pci_func *func)
  */
 static u8 bus_structure_fixup(u8 busno)
 {
-	struct pci_bus *bus;
+	struct pci_bus *bus, *b;
 	struct pci_dev *dev;
 	u16 l;
 
@@ -765,7 +765,9 @@ static u8 bus_structure_fixup(u8 busno)
 					(l != 0x0000) && (l != 0xffff)) {
 			debug("%s - Inside bus_structure_fixup()\n",
 							__func__);
-			pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			b = pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			if (b)
+				pci_bus_add_devices(b);
 			break;
 		}
 	}
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 23212f8..053c0f4 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2123,7 +2123,6 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 	b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);
 	if (b) {
 		pci_scan_child_bus(b);
-		pci_bus_add_devices(b);
 	} else {
 		pci_free_resource_list(&resources);
 	}
-- 
1.7.1

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

* [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-16  1:43   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:43 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, sparclinux

Pci_bus_add_devices() should not be placed in pci_scan_bus().
Now pci device will be added to driver core once its
creation. All things left in pci_bus_add_devices() are
driver attachment and other trivial sysfs things.
Pci_scan_bus() should be the function responsible for
scanning PCI devices, not including driver attachment.
Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
will call pci_bus_size_bridges() and pci_bus_assign_resources()
after pci_scan_bus().

E.g.
In m68k
mcf_pci_init()
	pci_scan_bus()
		...
		pci_bus_add_devices() --- try to attach driver
	pci_fixup_irqs()
	pci_bus_size_bridges()
	pci_bus_assign_resources()

It is not correct, resources should be assigned correctly
before attaching driver.
So we should rip out pci_bus_add_devices() for better
code design. After applied this patch, pci_scan_bus()
should be used in flow like:

pci_scan_bus() (mandatory)
pci_fixup_irqs() (optional)
pci_bus_size_bridges() (optional)
pci_pci_bus_assign_resources() (optional)
pci_bus_add_devices() (mandatory)

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Geert Uytterhoeven <geert@linux-m68k.org>
CC: Guan Xuetao <gxt@mprc.pku.edu.cn>
CC: linux-alpha@vger.kernel.org
CC: linux-m68k@lists.linux-m68k.org
CC: sparclinux@vger.kernel.org
---
 arch/alpha/kernel/sys_nautilus.c  |    1 +
 arch/m68k/coldfire/pci.c          |    1 +
 arch/sparc/kernel/pcic.c          |    2 ++
 arch/unicore32/kernel/pci.c       |   11 +++--------
 drivers/pci/hotplug/ibmphp_core.c |    6 ++++--
 drivers/pci/probe.c               |    1 -
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 837c0fa..4ae4a40 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -253,6 +253,7 @@ nautilus_init_pci(void)
 	   for the root bus, so just clear it. */
 	bus->self = NULL;
 	pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq);
+	pci_bus_add_devices(bus);
 }
 
 /*
diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index df96792..d45f087 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -319,6 +319,7 @@ static int __init mcf_pci_init(void)
 	pci_fixup_irqs(pci_common_swizzle, mcf_pci_map_irq);
 	pci_bus_size_bridges(rootbus);
 	pci_bus_assign_resources(rootbus);
+	pci_bus_add_devices(rootbus);
 	return 0;
 }
 
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 6cc78c2..7a82fe2 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -391,6 +391,8 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic)
 	struct linux_pbm_info *pbm = &pcic->pbm;
 
 	pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, &pcic_ops, pbm);
+	if (pbm->pci_bus)
+		pci_bus_add_devices(pbm->pci_bus);
 #if 0 /* deadwood transplanted from sparc64 */
 	pci_fill_in_pbm_cookies(pbm->pci_bus, pbm, pbm->prom_node);
 	pci_record_assignments(pbm, pbm->pci_bus);
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 374a055..3d82024 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -266,17 +266,12 @@ static int __init pci_common_init(void)
 	pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq);
 
 	if (!pci_has_flag(PCI_PROBE_ONLY)) {
-		/*
-		 * Size the bridge windows.
-		 */
+		/* Size the bridge windows. */
 		pci_bus_size_bridges(puv3_bus);
-
-		/*
-		 * Assign resources.
-		 */
+		/* Assign resources. */
 		pci_bus_assign_resources(puv3_bus);
 	}
-
+	pci_bus_add_devices(puv3_bus);
 	return 0;
 }
 subsys_initcall(pci_common_init);
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 96c5c72..86e3bfd 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -738,7 +738,7 @@ static void ibm_unconfigure_device(struct pci_func *func)
  */
 static u8 bus_structure_fixup(u8 busno)
 {
-	struct pci_bus *bus;
+	struct pci_bus *bus, *b;
 	struct pci_dev *dev;
 	u16 l;
 
@@ -765,7 +765,9 @@ static u8 bus_structure_fixup(u8 busno)
 					(l != 0x0000) && (l != 0xffff)) {
 			debug("%s - Inside bus_structure_fixup()\n",
 							__func__);
-			pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			b = pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			if (b)
+				pci_bus_add_devices(b);
 			break;
 		}
 	}
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 23212f8..053c0f4 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2123,7 +2123,6 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 	b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);
 	if (b) {
 		pci_scan_child_bus(b);
-		pci_bus_add_devices(b);
 	} else {
 		pci_free_resource_list(&resources);
 	}
-- 
1.7.1


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

* [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-16  1:43   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:43 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Liviu Dudau, Tony Luck, Russell King, Arnd Bergmann,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	sparclinux, linux-m68k, Geert Uytterhoeven, linux-alpha,
	Yijing Wang, linux-ia64, Thomas Gleixner, Guan Xuetao,
	Yinghai Lu, Jiang Liu, linux-arm-kernel

Pci_bus_add_devices() should not be placed in pci_scan_bus().
Now pci device will be added to driver core once its
creation. All things left in pci_bus_add_devices() are
driver attachment and other trivial sysfs things.
Pci_scan_bus() should be the function responsible for
scanning PCI devices, not including driver attachment.
Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
will call pci_bus_size_bridges() and pci_bus_assign_resources()
after pci_scan_bus().

E.g.
In m68k
mcf_pci_init()
	pci_scan_bus()
		...
		pci_bus_add_devices() --- try to attach driver
	pci_fixup_irqs()
	pci_bus_size_bridges()
	pci_bus_assign_resources()

It is not correct, resources should be assigned correctly
before attaching driver.
So we should rip out pci_bus_add_devices() for better
code design. After applied this patch, pci_scan_bus()
should be used in flow like:

pci_scan_bus() (mandatory)
pci_fixup_irqs() (optional)
pci_bus_size_bridges() (optional)
pci_pci_bus_assign_resources() (optional)
pci_bus_add_devices() (mandatory)

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Geert Uytterhoeven <geert@linux-m68k.org>
CC: Guan Xuetao <gxt@mprc.pku.edu.cn>
CC: linux-alpha@vger.kernel.org
CC: linux-m68k@lists.linux-m68k.org
CC: sparclinux@vger.kernel.org
---
 arch/alpha/kernel/sys_nautilus.c  |    1 +
 arch/m68k/coldfire/pci.c          |    1 +
 arch/sparc/kernel/pcic.c          |    2 ++
 arch/unicore32/kernel/pci.c       |   11 +++--------
 drivers/pci/hotplug/ibmphp_core.c |    6 ++++--
 drivers/pci/probe.c               |    1 -
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 837c0fa..4ae4a40 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -253,6 +253,7 @@ nautilus_init_pci(void)
 	   for the root bus, so just clear it. */
 	bus->self = NULL;
 	pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq);
+	pci_bus_add_devices(bus);
 }
 
 /*
diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index df96792..d45f087 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -319,6 +319,7 @@ static int __init mcf_pci_init(void)
 	pci_fixup_irqs(pci_common_swizzle, mcf_pci_map_irq);
 	pci_bus_size_bridges(rootbus);
 	pci_bus_assign_resources(rootbus);
+	pci_bus_add_devices(rootbus);
 	return 0;
 }
 
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 6cc78c2..7a82fe2 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -391,6 +391,8 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic)
 	struct linux_pbm_info *pbm = &pcic->pbm;
 
 	pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, &pcic_ops, pbm);
+	if (pbm->pci_bus)
+		pci_bus_add_devices(pbm->pci_bus);
 #if 0 /* deadwood transplanted from sparc64 */
 	pci_fill_in_pbm_cookies(pbm->pci_bus, pbm, pbm->prom_node);
 	pci_record_assignments(pbm, pbm->pci_bus);
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 374a055..3d82024 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -266,17 +266,12 @@ static int __init pci_common_init(void)
 	pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq);
 
 	if (!pci_has_flag(PCI_PROBE_ONLY)) {
-		/*
-		 * Size the bridge windows.
-		 */
+		/* Size the bridge windows. */
 		pci_bus_size_bridges(puv3_bus);
-
-		/*
-		 * Assign resources.
-		 */
+		/* Assign resources. */
 		pci_bus_assign_resources(puv3_bus);
 	}
-
+	pci_bus_add_devices(puv3_bus);
 	return 0;
 }
 subsys_initcall(pci_common_init);
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 96c5c72..86e3bfd 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -738,7 +738,7 @@ static void ibm_unconfigure_device(struct pci_func *func)
  */
 static u8 bus_structure_fixup(u8 busno)
 {
-	struct pci_bus *bus;
+	struct pci_bus *bus, *b;
 	struct pci_dev *dev;
 	u16 l;
 
@@ -765,7 +765,9 @@ static u8 bus_structure_fixup(u8 busno)
 					(l != 0x0000) && (l != 0xffff)) {
 			debug("%s - Inside bus_structure_fixup()\n",
 							__func__);
-			pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			b = pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			if (b)
+				pci_bus_add_devices(b);
 			break;
 		}
 	}
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 23212f8..053c0f4 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2123,7 +2123,6 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 	b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);
 	if (b) {
 		pci_scan_child_bus(b);
-		pci_bus_add_devices(b);
 	} else {
 		pci_free_resource_list(&resources);
 	}
-- 
1.7.1

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

* [PATCH 02/28] PCI: Rip out pci_bus_add_devices() from pci_scan_root_bus()
  2015-01-16  1:43 ` Yijing Wang
                     ` (3 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Just like pci_scan_bus(), we also should rip out
pci_bus_add_devices() from pci_scan_root_bus().
Lots platforms first call pci_scan_root_bus(), but
after that, they call pci_bus_size_bridges() and
pci_bus_assign_resources(). Place pci_bus_add_devices()
in pci_scan_root_bus() hurts PCI scan logic.
For arm hw_pci->scan() functions which call
pci_scan_root_bus(), it's no need to change anything,
because pci_bus_add_devices() will be called later
in pci_common_init_dev().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: David Howells <dhowells@redhat.com>
CC: Tony Luck <tony.luck@intel.com>
CC: Michal Simek <monstr@monstr.eu>
CC: Ralf Baechle <ralf@linux-mips.org>
CC: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
CC: Sebastian Ott <sebott@linux.vnet.ibm.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Chris Metcalf <cmetcalf@ezchip.com>
CC: Chris Zankel <chris@zankel.net>
CC: linux-alpha@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: linux-mips@linux-mips.org
CC: linux-am33-list@redhat.com
CC: linux-s390@vger.kernel.org
CC: linux-sh@vger.kernel.org
CC: sparclinux@vger.kernel.org
CC: linux-pci@vger.kernel.org
CC: linux-xtensa@linux-xtensa.org
---
 arch/alpha/kernel/pci.c          |    2 ++
 arch/frv/mb93090-mb00/pci-vdk.c  |    6 ++++--
 arch/ia64/sn/kernel/io_init.c    |    1 +
 arch/microblaze/pci/pci-common.c |    1 +
 arch/mips/pci/pci.c              |    1 +
 arch/mn10300/unit-asb2305/pci.c  |    5 ++++-
 arch/s390/pci/pci.c              |    2 +-
 arch/sh/drivers/pci/pci.c        |    1 +
 arch/sparc/kernel/leon_pci.c     |    1 +
 arch/tile/kernel/pci.c           |    2 ++
 arch/tile/kernel/pci_gx.c        |    2 ++
 arch/x86/pci/common.c            |    1 +
 arch/xtensa/kernel/pci.c         |    2 ++
 drivers/pci/probe.c              |    1 -
 14 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 076c35c..97f9730 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -334,6 +334,8 @@ common_init_pci(void)
 
 		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
 					hose, &resources);
+		if (bus)
+			pci_bus_add_devices(bus);
 		hose->bus = bus;
 		hose->need_domain_info = need_domain_info;
 		next_busno = bus->busn_res.end + 1;
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index efa5d65..2b36044 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -316,6 +316,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
 
 int __init pcibios_init(void)
 {
+	struct pci_bus *bus;
 	struct pci_ops *dir = NULL;
 	LIST_HEAD(resources);
 
@@ -383,12 +384,13 @@ int __init pcibios_init(void)
 	printk("PCI: Probing PCI hardware\n");
 	pci_add_resource(&resources, &pci_ioport_resource);
 	pci_add_resource(&resources, &pci_iomem_resource);
-	pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources);
+	bus = pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources);
 
 	pcibios_irq_init();
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
-
+	if (bus)
+		pci_bus_add_devices(bus);
 	return 0;
 }
 
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 0b5ce82..63b43a6 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -272,6 +272,7 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
 		kfree(res);
 		kfree(controller);
 	}
+	pci_bus_add_devices(bus);
 }
 
 /*
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index b30e41c..009b271 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1351,6 +1351,7 @@ static void pcibios_scan_phb(struct pci_controller *hose)
 	hose->bus = bus;
 
 	hose->last_busno = bus->busn_res.end;
+	pci_bus_add_devices(bus);
 }
 
 static int __init pcibios_init(void)
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 1bf60b1..9eb54b5 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -114,6 +114,7 @@ static void pcibios_scanbus(struct pci_controller *hose)
 			pci_bus_size_bridges(bus);
 			pci_bus_assign_resources(bus);
 		}
+		pci_bus_add_devices(bus);
 	}
 }
 
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index 6b4339f..860aa35 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -345,6 +345,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
  */
 static int __init pcibios_init(void)
 {
+	struct pci_bus *bus;
 	resource_size_t io_offset, mem_offset;
 	LIST_HEAD(resources);
 
@@ -376,11 +377,13 @@ static int __init pcibios_init(void)
 
 	pci_add_resource_offset(&resources, &pci_ioport_resource, io_offset);
 	pci_add_resource_offset(&resources, &pci_iomem_resource, mem_offset);
-	pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources);
+	bus = pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources);
 
 	pcibios_irq_init();
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
+	if (bus)
+		pci_bus_add_devices(bus);
 	return 0;
 }
 
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 3290f11..0b32769 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -756,7 +756,7 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
 		zpci_cleanup_bus_resources(zdev);
 		return -EIO;
 	}
-
+	pci_bus_add_devices(zdev->bus);
 	zdev->bus->max_bus_speed = zdev->max_bus_speed;
 	return 0;
 }
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 1bc09ee..efc1051 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -69,6 +69,7 @@ static void pcibios_scanbus(struct pci_channel *hose)
 
 		pci_bus_size_bridges(bus);
 		pci_bus_assign_resources(bus);
+		pci_bus_add_devices(bus);
 	} else {
 		pci_free_resource_list(&resources);
 	}
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index 899b720..2971076 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -40,6 +40,7 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info)
 
 		/* Assign devices with resources */
 		pci_assign_unassigned_resources();
+		pci_bus_add_devices(root_bus);
 	} else {
 		pci_free_resource_list(&resources);
 	}
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index f70c789..83d3e30 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -339,6 +339,8 @@ int __init pcibios_init(void)
 			struct pci_bus *next_bus;
 			struct pci_dev *dev;
 
+			pci_bus_add_devices(root_bus);
+
 			list_for_each_entry(dev, &root_bus->devices, bus_list) {
 				/*
 				 * Find the PCI host controller, ie. the 1st
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index 2c95f37..d7a0729 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -916,6 +916,8 @@ int __init pcibios_init(void)
 		/* Configure the max_payload_size values for this domain. */
 		fixup_read_and_payload_sizes(controller);
 
+		pci_bus_add_devices(root_bus);
+
 		/* Alloc a PIO region for PCI memory access for each RC port. */
 		ret = gxio_trio_alloc_pio_regions(trio_context, 1, 0, 0);
 		if (ret < 0) {
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 7b20bcc..300d39e 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -475,6 +475,7 @@ void pcibios_scan_root(int busnum)
 		pci_free_resource_list(&resources);
 		kfree(sd);
 	}
+	pci_bus_add_devices(bus);
 }
 
 void __init pcibios_set_cache_line_size(void)
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c
index 5b34033..f2ae64e 100644
--- a/arch/xtensa/kernel/pci.c
+++ b/arch/xtensa/kernel/pci.c
@@ -185,6 +185,8 @@ static int __init pcibios_init(void)
 		pci_controller_apertures(pci_ctrl, &resources);
 		bus = pci_scan_root_bus(NULL, pci_ctrl->first_busno,
 					pci_ctrl->ops, pci_ctrl, &resources);
+		if (bus)
+			pci_bus_add_devices(bus);
 		pci_ctrl->bus = bus;
 		pci_ctrl->last_busno = bus->busn_res.end;
 		if (next_busno <= pci_ctrl->last_busno)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 053c0f4..7cf577f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2087,7 +2087,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 	if (!found)
 		pci_bus_update_busn_res_end(b, max);
 
-	pci_bus_add_devices(b);
 	return b;
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
-- 
1.7.1


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

* [PATCH 02/28] PCI: Rip out pci_bus_add_devices() from pci_scan_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, David Howells, Michal Simek, Ralf Baechle,
	Koichi Yasutake, Sebastian Ott, Chris Metcalf, Chris Zankel,
	linux-mips, linux-am33-list, linux-s390, linux-sh, sparclinux,
	linux-xtensa

Just like pci_scan_bus(), we also should rip out
pci_bus_add_devices() from pci_scan_root_bus().
Lots platforms first call pci_scan_root_bus(), but
after that, they call pci_bus_size_bridges() and
pci_bus_assign_resources(). Place pci_bus_add_devices()
in pci_scan_root_bus() hurts PCI scan logic.
For arm hw_pci->scan() functions which call
pci_scan_root_bus(), it's no need to change anything,
because pci_bus_add_devices() will be called later
in pci_common_init_dev().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: David Howells <dhowells@redhat.com>
CC: Tony Luck <tony.luck@intel.com>
CC: Michal Simek <monstr@monstr.eu>
CC: Ralf Baechle <ralf@linux-mips.org>
CC: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
CC: Sebastian Ott <sebott@linux.vnet.ibm.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Chris Metcalf <cmetcalf@ezchip.com>
CC: Chris Zankel <chris@zankel.net>
CC: linux-alpha@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: linux-mips@linux-mips.org
CC: linux-am33-list@redhat.com
CC: linux-s390@vger.kernel.org
CC: linux-sh@vger.kernel.org
CC: sparclinux@vger.kernel.org
CC: linux-pci@vger.kernel.org
CC: linux-xtensa@linux-xtensa.org
---
 arch/alpha/kernel/pci.c          |    2 ++
 arch/frv/mb93090-mb00/pci-vdk.c  |    6 ++++--
 arch/ia64/sn/kernel/io_init.c    |    1 +
 arch/microblaze/pci/pci-common.c |    1 +
 arch/mips/pci/pci.c              |    1 +
 arch/mn10300/unit-asb2305/pci.c  |    5 ++++-
 arch/s390/pci/pci.c              |    2 +-
 arch/sh/drivers/pci/pci.c        |    1 +
 arch/sparc/kernel/leon_pci.c     |    1 +
 arch/tile/kernel/pci.c           |    2 ++
 arch/tile/kernel/pci_gx.c        |    2 ++
 arch/x86/pci/common.c            |    1 +
 arch/xtensa/kernel/pci.c         |    2 ++
 drivers/pci/probe.c              |    1 -
 14 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 076c35c..97f9730 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -334,6 +334,8 @@ common_init_pci(void)
 
 		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
 					hose, &resources);
+		if (bus)
+			pci_bus_add_devices(bus);
 		hose->bus = bus;
 		hose->need_domain_info = need_domain_info;
 		next_busno = bus->busn_res.end + 1;
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index efa5d65..2b36044 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -316,6 +316,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
 
 int __init pcibios_init(void)
 {
+	struct pci_bus *bus;
 	struct pci_ops *dir = NULL;
 	LIST_HEAD(resources);
 
@@ -383,12 +384,13 @@ int __init pcibios_init(void)
 	printk("PCI: Probing PCI hardware\n");
 	pci_add_resource(&resources, &pci_ioport_resource);
 	pci_add_resource(&resources, &pci_iomem_resource);
-	pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources);
+	bus = pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources);
 
 	pcibios_irq_init();
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
-
+	if (bus)
+		pci_bus_add_devices(bus);
 	return 0;
 }
 
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 0b5ce82..63b43a6 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -272,6 +272,7 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
 		kfree(res);
 		kfree(controller);
 	}
+	pci_bus_add_devices(bus);
 }
 
 /*
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index b30e41c..009b271 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1351,6 +1351,7 @@ static void pcibios_scan_phb(struct pci_controller *hose)
 	hose->bus = bus;
 
 	hose->last_busno = bus->busn_res.end;
+	pci_bus_add_devices(bus);
 }
 
 static int __init pcibios_init(void)
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 1bf60b1..9eb54b5 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -114,6 +114,7 @@ static void pcibios_scanbus(struct pci_controller *hose)
 			pci_bus_size_bridges(bus);
 			pci_bus_assign_resources(bus);
 		}
+		pci_bus_add_devices(bus);
 	}
 }
 
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index 6b4339f..860aa35 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -345,6 +345,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
  */
 static int __init pcibios_init(void)
 {
+	struct pci_bus *bus;
 	resource_size_t io_offset, mem_offset;
 	LIST_HEAD(resources);
 
@@ -376,11 +377,13 @@ static int __init pcibios_init(void)
 
 	pci_add_resource_offset(&resources, &pci_ioport_resource, io_offset);
 	pci_add_resource_offset(&resources, &pci_iomem_resource, mem_offset);
-	pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources);
+	bus = pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources);
 
 	pcibios_irq_init();
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
+	if (bus)
+		pci_bus_add_devices(bus);
 	return 0;
 }
 
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 3290f11..0b32769 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -756,7 +756,7 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
 		zpci_cleanup_bus_resources(zdev);
 		return -EIO;
 	}
-
+	pci_bus_add_devices(zdev->bus);
 	zdev->bus->max_bus_speed = zdev->max_bus_speed;
 	return 0;
 }
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 1bc09ee..efc1051 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -69,6 +69,7 @@ static void pcibios_scanbus(struct pci_channel *hose)
 
 		pci_bus_size_bridges(bus);
 		pci_bus_assign_resources(bus);
+		pci_bus_add_devices(bus);
 	} else {
 		pci_free_resource_list(&resources);
 	}
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index 899b720..2971076 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -40,6 +40,7 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info)
 
 		/* Assign devices with resources */
 		pci_assign_unassigned_resources();
+		pci_bus_add_devices(root_bus);
 	} else {
 		pci_free_resource_list(&resources);
 	}
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index f70c789..83d3e30 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -339,6 +339,8 @@ int __init pcibios_init(void)
 			struct pci_bus *next_bus;
 			struct pci_dev *dev;
 
+			pci_bus_add_devices(root_bus);
+
 			list_for_each_entry(dev, &root_bus->devices, bus_list) {
 				/*
 				 * Find the PCI host controller, ie. the 1st
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index 2c95f37..d7a0729 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -916,6 +916,8 @@ int __init pcibios_init(void)
 		/* Configure the max_payload_size values for this domain. */
 		fixup_read_and_payload_sizes(controller);
 
+		pci_bus_add_devices(root_bus);
+
 		/* Alloc a PIO region for PCI memory access for each RC port. */
 		ret = gxio_trio_alloc_pio_regions(trio_context, 1, 0, 0);
 		if (ret < 0) {
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 7b20bcc..300d39e 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -475,6 +475,7 @@ void pcibios_scan_root(int busnum)
 		pci_free_resource_list(&resources);
 		kfree(sd);
 	}
+	pci_bus_add_devices(bus);
 }
 
 void __init pcibios_set_cache_line_size(void)
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c
index 5b34033..f2ae64e 100644
--- a/arch/xtensa/kernel/pci.c
+++ b/arch/xtensa/kernel/pci.c
@@ -185,6 +185,8 @@ static int __init pcibios_init(void)
 		pci_controller_apertures(pci_ctrl, &resources);
 		bus = pci_scan_root_bus(NULL, pci_ctrl->first_busno,
 					pci_ctrl->ops, pci_ctrl, &resources);
+		if (bus)
+			pci_bus_add_devices(bus);
 		pci_ctrl->bus = bus;
 		pci_ctrl->last_busno = bus->busn_res.end;
 		if (next_busno <= pci_ctrl->last_busno)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 053c0f4..7cf577f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2087,7 +2087,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 	if (!found)
 		pci_bus_update_busn_res_end(b, max);
 
-	pci_bus_add_devices(b);
 	return b;
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
-- 
1.7.1


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

* [PATCH 02/28] PCI: Rip out pci_bus_add_devices() from pci_scan_root_bus()
  2015-01-16  1:43 ` Yijing Wang
                   ` (5 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, David Howells, Michal Simek, Ralf Baechle,
	Koichi Yasutake, Sebastian Ott, Chris

Just like pci_scan_bus(), we also should rip out
pci_bus_add_devices() from pci_scan_root_bus().
Lots platforms first call pci_scan_root_bus(), but
after that, they call pci_bus_size_bridges() and
pci_bus_assign_resources(). Place pci_bus_add_devices()
in pci_scan_root_bus() hurts PCI scan logic.
For arm hw_pci->scan() functions which call
pci_scan_root_bus(), it's no need to change anything,
because pci_bus_add_devices() will be called later
in pci_common_init_dev().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: David Howells <dhowells@redhat.com>
CC: Tony Luck <tony.luck@intel.com>
CC: Michal Simek <monstr@monstr.eu>
CC: Ralf Baechle <ralf@linux-mips.org>
CC: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
CC: Sebastian Ott <sebott@linux.vnet.ibm.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Chris Metcalf <cmetcalf@ezchip.com>
CC: Chris Zankel <chris@zankel.net>
CC: linux-alpha@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: linux-mips@linux-mips.org
CC: linux-am33-list@redhat.com
CC: linux-s390@vger.kernel.org
CC: linux-sh@vger.kernel.org
CC: sparclinux@vger.kernel.org
CC: linux-pci@vger.kernel.org
CC: linux-xtensa@linux-xtensa.org
---
 arch/alpha/kernel/pci.c          |    2 ++
 arch/frv/mb93090-mb00/pci-vdk.c  |    6 ++++--
 arch/ia64/sn/kernel/io_init.c    |    1 +
 arch/microblaze/pci/pci-common.c |    1 +
 arch/mips/pci/pci.c              |    1 +
 arch/mn10300/unit-asb2305/pci.c  |    5 ++++-
 arch/s390/pci/pci.c              |    2 +-
 arch/sh/drivers/pci/pci.c        |    1 +
 arch/sparc/kernel/leon_pci.c     |    1 +
 arch/tile/kernel/pci.c           |    2 ++
 arch/tile/kernel/pci_gx.c        |    2 ++
 arch/x86/pci/common.c            |    1 +
 arch/xtensa/kernel/pci.c         |    2 ++
 drivers/pci/probe.c              |    1 -
 14 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 076c35c..97f9730 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -334,6 +334,8 @@ common_init_pci(void)
 
 		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
 					hose, &resources);
+		if (bus)
+			pci_bus_add_devices(bus);
 		hose->bus = bus;
 		hose->need_domain_info = need_domain_info;
 		next_busno = bus->busn_res.end + 1;
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index efa5d65..2b36044 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -316,6 +316,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
 
 int __init pcibios_init(void)
 {
+	struct pci_bus *bus;
 	struct pci_ops *dir = NULL;
 	LIST_HEAD(resources);
 
@@ -383,12 +384,13 @@ int __init pcibios_init(void)
 	printk("PCI: Probing PCI hardware\n");
 	pci_add_resource(&resources, &pci_ioport_resource);
 	pci_add_resource(&resources, &pci_iomem_resource);
-	pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources);
+	bus = pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources);
 
 	pcibios_irq_init();
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
-
+	if (bus)
+		pci_bus_add_devices(bus);
 	return 0;
 }
 
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 0b5ce82..63b43a6 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -272,6 +272,7 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
 		kfree(res);
 		kfree(controller);
 	}
+	pci_bus_add_devices(bus);
 }
 
 /*
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index b30e41c..009b271 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1351,6 +1351,7 @@ static void pcibios_scan_phb(struct pci_controller *hose)
 	hose->bus = bus;
 
 	hose->last_busno = bus->busn_res.end;
+	pci_bus_add_devices(bus);
 }
 
 static int __init pcibios_init(void)
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 1bf60b1..9eb54b5 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -114,6 +114,7 @@ static void pcibios_scanbus(struct pci_controller *hose)
 			pci_bus_size_bridges(bus);
 			pci_bus_assign_resources(bus);
 		}
+		pci_bus_add_devices(bus);
 	}
 }
 
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index 6b4339f..860aa35 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -345,6 +345,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
  */
 static int __init pcibios_init(void)
 {
+	struct pci_bus *bus;
 	resource_size_t io_offset, mem_offset;
 	LIST_HEAD(resources);
 
@@ -376,11 +377,13 @@ static int __init pcibios_init(void)
 
 	pci_add_resource_offset(&resources, &pci_ioport_resource, io_offset);
 	pci_add_resource_offset(&resources, &pci_iomem_resource, mem_offset);
-	pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources);
+	bus = pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources);
 
 	pcibios_irq_init();
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
+	if (bus)
+		pci_bus_add_devices(bus);
 	return 0;
 }
 
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 3290f11..0b32769 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -756,7 +756,7 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
 		zpci_cleanup_bus_resources(zdev);
 		return -EIO;
 	}
-
+	pci_bus_add_devices(zdev->bus);
 	zdev->bus->max_bus_speed = zdev->max_bus_speed;
 	return 0;
 }
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 1bc09ee..efc1051 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -69,6 +69,7 @@ static void pcibios_scanbus(struct pci_channel *hose)
 
 		pci_bus_size_bridges(bus);
 		pci_bus_assign_resources(bus);
+		pci_bus_add_devices(bus);
 	} else {
 		pci_free_resource_list(&resources);
 	}
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index 899b720..2971076 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -40,6 +40,7 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info)
 
 		/* Assign devices with resources */
 		pci_assign_unassigned_resources();
+		pci_bus_add_devices(root_bus);
 	} else {
 		pci_free_resource_list(&resources);
 	}
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index f70c789..83d3e30 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -339,6 +339,8 @@ int __init pcibios_init(void)
 			struct pci_bus *next_bus;
 			struct pci_dev *dev;
 
+			pci_bus_add_devices(root_bus);
+
 			list_for_each_entry(dev, &root_bus->devices, bus_list) {
 				/*
 				 * Find the PCI host controller, ie. the 1st
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index 2c95f37..d7a0729 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -916,6 +916,8 @@ int __init pcibios_init(void)
 		/* Configure the max_payload_size values for this domain. */
 		fixup_read_and_payload_sizes(controller);
 
+		pci_bus_add_devices(root_bus);
+
 		/* Alloc a PIO region for PCI memory access for each RC port. */
 		ret = gxio_trio_alloc_pio_regions(trio_context, 1, 0, 0);
 		if (ret < 0) {
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 7b20bcc..300d39e 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -475,6 +475,7 @@ void pcibios_scan_root(int busnum)
 		pci_free_resource_list(&resources);
 		kfree(sd);
 	}
+	pci_bus_add_devices(bus);
 }
 
 void __init pcibios_set_cache_line_size(void)
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c
index 5b34033..f2ae64e 100644
--- a/arch/xtensa/kernel/pci.c
+++ b/arch/xtensa/kernel/pci.c
@@ -185,6 +185,8 @@ static int __init pcibios_init(void)
 		pci_controller_apertures(pci_ctrl, &resources);
 		bus = pci_scan_root_bus(NULL, pci_ctrl->first_busno,
 					pci_ctrl->ops, pci_ctrl, &resources);
+		if (bus)
+			pci_bus_add_devices(bus);
 		pci_ctrl->bus = bus;
 		pci_ctrl->last_busno = bus->busn_res.end;
 		if (next_busno <= pci_ctrl->last_busno)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 053c0f4..7cf577f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2087,7 +2087,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 	if (!found)
 		pci_bus_update_busn_res_end(b, max);
 
-	pci_bus_add_devices(b);
 	return b;
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
-- 
1.7.1

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

* [PATCH 02/28] PCI: Rip out pci_bus_add_devices() from pci_scan_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, David Howells, Michal Simek, Ralf Baechle,
	Koichi Yasutake, Sebastian Ott, Chris Metcalf, Chris Zankel,
	linux-mips, linux-am33-list, linux-s390, linux-sh, sparclinux,
	linux-xtensa

Just like pci_scan_bus(), we also should rip out
pci_bus_add_devices() from pci_scan_root_bus().
Lots platforms first call pci_scan_root_bus(), but
after that, they call pci_bus_size_bridges() and
pci_bus_assign_resources(). Place pci_bus_add_devices()
in pci_scan_root_bus() hurts PCI scan logic.
For arm hw_pci->scan() functions which call
pci_scan_root_bus(), it's no need to change anything,
because pci_bus_add_devices() will be called later
in pci_common_init_dev().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: David Howells <dhowells@redhat.com>
CC: Tony Luck <tony.luck@intel.com>
CC: Michal Simek <monstr@monstr.eu>
CC: Ralf Baechle <ralf@linux-mips.org>
CC: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
CC: Sebastian Ott <sebott@linux.vnet.ibm.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Chris Metcalf <cmetcalf@ezchip.com>
CC: Chris Zankel <chris@zankel.net>
CC: linux-alpha@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: linux-mips@linux-mips.org
CC: linux-am33-list@redhat.com
CC: linux-s390@vger.kernel.org
CC: linux-sh@vger.kernel.org
CC: sparclinux@vger.kernel.org
CC: linux-pci@vger.kernel.org
CC: linux-xtensa@linux-xtensa.org
---
 arch/alpha/kernel/pci.c          |    2 ++
 arch/frv/mb93090-mb00/pci-vdk.c  |    6 ++++--
 arch/ia64/sn/kernel/io_init.c    |    1 +
 arch/microblaze/pci/pci-common.c |    1 +
 arch/mips/pci/pci.c              |    1 +
 arch/mn10300/unit-asb2305/pci.c  |    5 ++++-
 arch/s390/pci/pci.c              |    2 +-
 arch/sh/drivers/pci/pci.c        |    1 +
 arch/sparc/kernel/leon_pci.c     |    1 +
 arch/tile/kernel/pci.c           |    2 ++
 arch/tile/kernel/pci_gx.c        |    2 ++
 arch/x86/pci/common.c            |    1 +
 arch/xtensa/kernel/pci.c         |    2 ++
 drivers/pci/probe.c              |    1 -
 14 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 076c35c..97f9730 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -334,6 +334,8 @@ common_init_pci(void)
 
 		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
 					hose, &resources);
+		if (bus)
+			pci_bus_add_devices(bus);
 		hose->bus = bus;
 		hose->need_domain_info = need_domain_info;
 		next_busno = bus->busn_res.end + 1;
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index efa5d65..2b36044 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -316,6 +316,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
 
 int __init pcibios_init(void)
 {
+	struct pci_bus *bus;
 	struct pci_ops *dir = NULL;
 	LIST_HEAD(resources);
 
@@ -383,12 +384,13 @@ int __init pcibios_init(void)
 	printk("PCI: Probing PCI hardware\n");
 	pci_add_resource(&resources, &pci_ioport_resource);
 	pci_add_resource(&resources, &pci_iomem_resource);
-	pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources);
+	bus = pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources);
 
 	pcibios_irq_init();
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
-
+	if (bus)
+		pci_bus_add_devices(bus);
 	return 0;
 }
 
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 0b5ce82..63b43a6 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -272,6 +272,7 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
 		kfree(res);
 		kfree(controller);
 	}
+	pci_bus_add_devices(bus);
 }
 
 /*
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index b30e41c..009b271 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1351,6 +1351,7 @@ static void pcibios_scan_phb(struct pci_controller *hose)
 	hose->bus = bus;
 
 	hose->last_busno = bus->busn_res.end;
+	pci_bus_add_devices(bus);
 }
 
 static int __init pcibios_init(void)
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 1bf60b1..9eb54b5 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -114,6 +114,7 @@ static void pcibios_scanbus(struct pci_controller *hose)
 			pci_bus_size_bridges(bus);
 			pci_bus_assign_resources(bus);
 		}
+		pci_bus_add_devices(bus);
 	}
 }
 
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index 6b4339f..860aa35 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -345,6 +345,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
  */
 static int __init pcibios_init(void)
 {
+	struct pci_bus *bus;
 	resource_size_t io_offset, mem_offset;
 	LIST_HEAD(resources);
 
@@ -376,11 +377,13 @@ static int __init pcibios_init(void)
 
 	pci_add_resource_offset(&resources, &pci_ioport_resource, io_offset);
 	pci_add_resource_offset(&resources, &pci_iomem_resource, mem_offset);
-	pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources);
+	bus = pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources);
 
 	pcibios_irq_init();
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
+	if (bus)
+		pci_bus_add_devices(bus);
 	return 0;
 }
 
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 3290f11..0b32769 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -756,7 +756,7 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
 		zpci_cleanup_bus_resources(zdev);
 		return -EIO;
 	}
-
+	pci_bus_add_devices(zdev->bus);
 	zdev->bus->max_bus_speed = zdev->max_bus_speed;
 	return 0;
 }
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 1bc09ee..efc1051 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -69,6 +69,7 @@ static void pcibios_scanbus(struct pci_channel *hose)
 
 		pci_bus_size_bridges(bus);
 		pci_bus_assign_resources(bus);
+		pci_bus_add_devices(bus);
 	} else {
 		pci_free_resource_list(&resources);
 	}
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index 899b720..2971076 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -40,6 +40,7 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info)
 
 		/* Assign devices with resources */
 		pci_assign_unassigned_resources();
+		pci_bus_add_devices(root_bus);
 	} else {
 		pci_free_resource_list(&resources);
 	}
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index f70c789..83d3e30 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -339,6 +339,8 @@ int __init pcibios_init(void)
 			struct pci_bus *next_bus;
 			struct pci_dev *dev;
 
+			pci_bus_add_devices(root_bus);
+
 			list_for_each_entry(dev, &root_bus->devices, bus_list) {
 				/*
 				 * Find the PCI host controller, ie. the 1st
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index 2c95f37..d7a0729 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -916,6 +916,8 @@ int __init pcibios_init(void)
 		/* Configure the max_payload_size values for this domain. */
 		fixup_read_and_payload_sizes(controller);
 
+		pci_bus_add_devices(root_bus);
+
 		/* Alloc a PIO region for PCI memory access for each RC port. */
 		ret = gxio_trio_alloc_pio_regions(trio_context, 1, 0, 0);
 		if (ret < 0) {
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 7b20bcc..300d39e 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -475,6 +475,7 @@ void pcibios_scan_root(int busnum)
 		pci_free_resource_list(&resources);
 		kfree(sd);
 	}
+	pci_bus_add_devices(bus);
 }
 
 void __init pcibios_set_cache_line_size(void)
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c
index 5b34033..f2ae64e 100644
--- a/arch/xtensa/kernel/pci.c
+++ b/arch/xtensa/kernel/pci.c
@@ -185,6 +185,8 @@ static int __init pcibios_init(void)
 		pci_controller_apertures(pci_ctrl, &resources);
 		bus = pci_scan_root_bus(NULL, pci_ctrl->first_busno,
 					pci_ctrl->ops, pci_ctrl, &resources);
+		if (bus)
+			pci_bus_add_devices(bus);
 		pci_ctrl->bus = bus;
 		pci_ctrl->last_busno = bus->busn_res.end;
 		if (next_busno <= pci_ctrl->last_busno)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 053c0f4..7cf577f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2087,7 +2087,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 	if (!found)
 		pci_bus_update_busn_res_end(b, max);
 
-	pci_bus_add_devices(b);
 	return b;
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
-- 
1.7.1


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

* [PATCH 02/28] PCI: Rip out pci_bus_add_devices() from pci_scan_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, David Howells, Michal Simek, Ralf Baechle,
	Koichi Yasutake, Sebastian Ott, Chris Metcalf, Chris Zankel,
	linux-mips, linux-am33-list, linux-s390, linux-sh, sparclinux,
	linux-xtensa

Just like pci_scan_bus(), we also should rip out
pci_bus_add_devices() from pci_scan_root_bus().
Lots platforms first call pci_scan_root_bus(), but
after that, they call pci_bus_size_bridges() and
pci_bus_assign_resources(). Place pci_bus_add_devices()
in pci_scan_root_bus() hurts PCI scan logic.
For arm hw_pci->scan() functions which call
pci_scan_root_bus(), it's no need to change anything,
because pci_bus_add_devices() will be called later
in pci_common_init_dev().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: David Howells <dhowells@redhat.com>
CC: Tony Luck <tony.luck@intel.com>
CC: Michal Simek <monstr@monstr.eu>
CC: Ralf Baechle <ralf@linux-mips.org>
CC: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
CC: Sebastian Ott <sebott@linux.vnet.ibm.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Chris Metcalf <cmetcalf@ezchip.com>
CC: Chris Zankel <chris@zankel.net>
CC: linux-alpha@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: linux-mips@linux-mips.org
CC: linux-am33-list@redhat.com
CC: linux-s390@vger.kernel.org
CC: linux-sh@vger.kernel.org
CC: sparclinux@vger.kernel.org
CC: linux-pci@vger.kernel.org
CC: linux-xtensa@linux-xtensa.org
---
 arch/alpha/kernel/pci.c          |    2 ++
 arch/frv/mb93090-mb00/pci-vdk.c  |    6 ++++--
 arch/ia64/sn/kernel/io_init.c    |    1 +
 arch/microblaze/pci/pci-common.c |    1 +
 arch/mips/pci/pci.c              |    1 +
 arch/mn10300/unit-asb2305/pci.c  |    5 ++++-
 arch/s390/pci/pci.c              |    2 +-
 arch/sh/drivers/pci/pci.c        |    1 +
 arch/sparc/kernel/leon_pci.c     |    1 +
 arch/tile/kernel/pci.c           |    2 ++
 arch/tile/kernel/pci_gx.c        |    2 ++
 arch/x86/pci/common.c            |    1 +
 arch/xtensa/kernel/pci.c         |    2 ++
 drivers/pci/probe.c              |    1 -
 14 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 076c35c..97f9730 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -334,6 +334,8 @@ common_init_pci(void)
 
 		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
 					hose, &resources);
+		if (bus)
+			pci_bus_add_devices(bus);
 		hose->bus = bus;
 		hose->need_domain_info = need_domain_info;
 		next_busno = bus->busn_res.end + 1;
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index efa5d65..2b36044 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -316,6 +316,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
 
 int __init pcibios_init(void)
 {
+	struct pci_bus *bus;
 	struct pci_ops *dir = NULL;
 	LIST_HEAD(resources);
 
@@ -383,12 +384,13 @@ int __init pcibios_init(void)
 	printk("PCI: Probing PCI hardware\n");
 	pci_add_resource(&resources, &pci_ioport_resource);
 	pci_add_resource(&resources, &pci_iomem_resource);
-	pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources);
+	bus = pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources);
 
 	pcibios_irq_init();
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
-
+	if (bus)
+		pci_bus_add_devices(bus);
 	return 0;
 }
 
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 0b5ce82..63b43a6 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -272,6 +272,7 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
 		kfree(res);
 		kfree(controller);
 	}
+	pci_bus_add_devices(bus);
 }
 
 /*
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index b30e41c..009b271 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1351,6 +1351,7 @@ static void pcibios_scan_phb(struct pci_controller *hose)
 	hose->bus = bus;
 
 	hose->last_busno = bus->busn_res.end;
+	pci_bus_add_devices(bus);
 }
 
 static int __init pcibios_init(void)
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 1bf60b1..9eb54b5 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -114,6 +114,7 @@ static void pcibios_scanbus(struct pci_controller *hose)
 			pci_bus_size_bridges(bus);
 			pci_bus_assign_resources(bus);
 		}
+		pci_bus_add_devices(bus);
 	}
 }
 
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index 6b4339f..860aa35 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -345,6 +345,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
  */
 static int __init pcibios_init(void)
 {
+	struct pci_bus *bus;
 	resource_size_t io_offset, mem_offset;
 	LIST_HEAD(resources);
 
@@ -376,11 +377,13 @@ static int __init pcibios_init(void)
 
 	pci_add_resource_offset(&resources, &pci_ioport_resource, io_offset);
 	pci_add_resource_offset(&resources, &pci_iomem_resource, mem_offset);
-	pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources);
+	bus = pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources);
 
 	pcibios_irq_init();
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
+	if (bus)
+		pci_bus_add_devices(bus);
 	return 0;
 }
 
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 3290f11..0b32769 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -756,7 +756,7 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
 		zpci_cleanup_bus_resources(zdev);
 		return -EIO;
 	}
-
+	pci_bus_add_devices(zdev->bus);
 	zdev->bus->max_bus_speed = zdev->max_bus_speed;
 	return 0;
 }
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 1bc09ee..efc1051 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -69,6 +69,7 @@ static void pcibios_scanbus(struct pci_channel *hose)
 
 		pci_bus_size_bridges(bus);
 		pci_bus_assign_resources(bus);
+		pci_bus_add_devices(bus);
 	} else {
 		pci_free_resource_list(&resources);
 	}
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index 899b720..2971076 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -40,6 +40,7 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info)
 
 		/* Assign devices with resources */
 		pci_assign_unassigned_resources();
+		pci_bus_add_devices(root_bus);
 	} else {
 		pci_free_resource_list(&resources);
 	}
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index f70c789..83d3e30 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -339,6 +339,8 @@ int __init pcibios_init(void)
 			struct pci_bus *next_bus;
 			struct pci_dev *dev;
 
+			pci_bus_add_devices(root_bus);
+
 			list_for_each_entry(dev, &root_bus->devices, bus_list) {
 				/*
 				 * Find the PCI host controller, ie. the 1st
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index 2c95f37..d7a0729 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -916,6 +916,8 @@ int __init pcibios_init(void)
 		/* Configure the max_payload_size values for this domain. */
 		fixup_read_and_payload_sizes(controller);
 
+		pci_bus_add_devices(root_bus);
+
 		/* Alloc a PIO region for PCI memory access for each RC port. */
 		ret = gxio_trio_alloc_pio_regions(trio_context, 1, 0, 0);
 		if (ret < 0) {
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 7b20bcc..300d39e 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -475,6 +475,7 @@ void pcibios_scan_root(int busnum)
 		pci_free_resource_list(&resources);
 		kfree(sd);
 	}
+	pci_bus_add_devices(bus);
 }
 
 void __init pcibios_set_cache_line_size(void)
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c
index 5b34033..f2ae64e 100644
--- a/arch/xtensa/kernel/pci.c
+++ b/arch/xtensa/kernel/pci.c
@@ -185,6 +185,8 @@ static int __init pcibios_init(void)
 		pci_controller_apertures(pci_ctrl, &resources);
 		bus = pci_scan_root_bus(NULL, pci_ctrl->first_busno,
 					pci_ctrl->ops, pci_ctrl, &resources);
+		if (bus)
+			pci_bus_add_devices(bus);
 		pci_ctrl->bus = bus;
 		pci_ctrl->last_busno = bus->busn_res.end;
 		if (next_busno <= pci_ctrl->last_busno)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 053c0f4..7cf577f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2087,7 +2087,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 	if (!found)
 		pci_bus_update_busn_res_end(b, max);
 
-	pci_bus_add_devices(b);
 	return b;
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
-- 
1.7.1

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

* [PATCH 02/28] PCI: Rip out pci_bus_add_devices() from pci_scan_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Just like pci_scan_bus(), we also should rip out
pci_bus_add_devices() from pci_scan_root_bus().
Lots platforms first call pci_scan_root_bus(), but
after that, they call pci_bus_size_bridges() and
pci_bus_assign_resources(). Place pci_bus_add_devices()
in pci_scan_root_bus() hurts PCI scan logic.
For arm hw_pci->scan() functions which call
pci_scan_root_bus(), it's no need to change anything,
because pci_bus_add_devices() will be called later
in pci_common_init_dev().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: David Howells <dhowells@redhat.com>
CC: Tony Luck <tony.luck@intel.com>
CC: Michal Simek <monstr@monstr.eu>
CC: Ralf Baechle <ralf@linux-mips.org>
CC: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
CC: Sebastian Ott <sebott@linux.vnet.ibm.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Chris Metcalf <cmetcalf@ezchip.com>
CC: Chris Zankel <chris@zankel.net>
CC: linux-alpha at vger.kernel.org
CC: linux-kernel at vger.kernel.org
CC: linux-mips at linux-mips.org
CC: linux-am33-list at redhat.com
CC: linux-s390 at vger.kernel.org
CC: linux-sh at vger.kernel.org
CC: sparclinux at vger.kernel.org
CC: linux-pci at vger.kernel.org
CC: linux-xtensa at linux-xtensa.org
---
 arch/alpha/kernel/pci.c          |    2 ++
 arch/frv/mb93090-mb00/pci-vdk.c  |    6 ++++--
 arch/ia64/sn/kernel/io_init.c    |    1 +
 arch/microblaze/pci/pci-common.c |    1 +
 arch/mips/pci/pci.c              |    1 +
 arch/mn10300/unit-asb2305/pci.c  |    5 ++++-
 arch/s390/pci/pci.c              |    2 +-
 arch/sh/drivers/pci/pci.c        |    1 +
 arch/sparc/kernel/leon_pci.c     |    1 +
 arch/tile/kernel/pci.c           |    2 ++
 arch/tile/kernel/pci_gx.c        |    2 ++
 arch/x86/pci/common.c            |    1 +
 arch/xtensa/kernel/pci.c         |    2 ++
 drivers/pci/probe.c              |    1 -
 14 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 076c35c..97f9730 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -334,6 +334,8 @@ common_init_pci(void)
 
 		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
 					hose, &resources);
+		if (bus)
+			pci_bus_add_devices(bus);
 		hose->bus = bus;
 		hose->need_domain_info = need_domain_info;
 		next_busno = bus->busn_res.end + 1;
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index efa5d65..2b36044 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -316,6 +316,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
 
 int __init pcibios_init(void)
 {
+	struct pci_bus *bus;
 	struct pci_ops *dir = NULL;
 	LIST_HEAD(resources);
 
@@ -383,12 +384,13 @@ int __init pcibios_init(void)
 	printk("PCI: Probing PCI hardware\n");
 	pci_add_resource(&resources, &pci_ioport_resource);
 	pci_add_resource(&resources, &pci_iomem_resource);
-	pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources);
+	bus = pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources);
 
 	pcibios_irq_init();
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
-
+	if (bus)
+		pci_bus_add_devices(bus);
 	return 0;
 }
 
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 0b5ce82..63b43a6 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -272,6 +272,7 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
 		kfree(res);
 		kfree(controller);
 	}
+	pci_bus_add_devices(bus);
 }
 
 /*
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index b30e41c..009b271 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1351,6 +1351,7 @@ static void pcibios_scan_phb(struct pci_controller *hose)
 	hose->bus = bus;
 
 	hose->last_busno = bus->busn_res.end;
+	pci_bus_add_devices(bus);
 }
 
 static int __init pcibios_init(void)
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 1bf60b1..9eb54b5 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -114,6 +114,7 @@ static void pcibios_scanbus(struct pci_controller *hose)
 			pci_bus_size_bridges(bus);
 			pci_bus_assign_resources(bus);
 		}
+		pci_bus_add_devices(bus);
 	}
 }
 
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index 6b4339f..860aa35 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -345,6 +345,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
  */
 static int __init pcibios_init(void)
 {
+	struct pci_bus *bus;
 	resource_size_t io_offset, mem_offset;
 	LIST_HEAD(resources);
 
@@ -376,11 +377,13 @@ static int __init pcibios_init(void)
 
 	pci_add_resource_offset(&resources, &pci_ioport_resource, io_offset);
 	pci_add_resource_offset(&resources, &pci_iomem_resource, mem_offset);
-	pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources);
+	bus = pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources);
 
 	pcibios_irq_init();
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
+	if (bus)
+		pci_bus_add_devices(bus);
 	return 0;
 }
 
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 3290f11..0b32769 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -756,7 +756,7 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
 		zpci_cleanup_bus_resources(zdev);
 		return -EIO;
 	}
-
+	pci_bus_add_devices(zdev->bus);
 	zdev->bus->max_bus_speed = zdev->max_bus_speed;
 	return 0;
 }
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 1bc09ee..efc1051 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -69,6 +69,7 @@ static void pcibios_scanbus(struct pci_channel *hose)
 
 		pci_bus_size_bridges(bus);
 		pci_bus_assign_resources(bus);
+		pci_bus_add_devices(bus);
 	} else {
 		pci_free_resource_list(&resources);
 	}
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index 899b720..2971076 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -40,6 +40,7 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info)
 
 		/* Assign devices with resources */
 		pci_assign_unassigned_resources();
+		pci_bus_add_devices(root_bus);
 	} else {
 		pci_free_resource_list(&resources);
 	}
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index f70c789..83d3e30 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -339,6 +339,8 @@ int __init pcibios_init(void)
 			struct pci_bus *next_bus;
 			struct pci_dev *dev;
 
+			pci_bus_add_devices(root_bus);
+
 			list_for_each_entry(dev, &root_bus->devices, bus_list) {
 				/*
 				 * Find the PCI host controller, ie. the 1st
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index 2c95f37..d7a0729 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -916,6 +916,8 @@ int __init pcibios_init(void)
 		/* Configure the max_payload_size values for this domain. */
 		fixup_read_and_payload_sizes(controller);
 
+		pci_bus_add_devices(root_bus);
+
 		/* Alloc a PIO region for PCI memory access for each RC port. */
 		ret = gxio_trio_alloc_pio_regions(trio_context, 1, 0, 0);
 		if (ret < 0) {
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 7b20bcc..300d39e 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -475,6 +475,7 @@ void pcibios_scan_root(int busnum)
 		pci_free_resource_list(&resources);
 		kfree(sd);
 	}
+	pci_bus_add_devices(bus);
 }
 
 void __init pcibios_set_cache_line_size(void)
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c
index 5b34033..f2ae64e 100644
--- a/arch/xtensa/kernel/pci.c
+++ b/arch/xtensa/kernel/pci.c
@@ -185,6 +185,8 @@ static int __init pcibios_init(void)
 		pci_controller_apertures(pci_ctrl, &resources);
 		bus = pci_scan_root_bus(NULL, pci_ctrl->first_busno,
 					pci_ctrl->ops, pci_ctrl, &resources);
+		if (bus)
+			pci_bus_add_devices(bus);
 		pci_ctrl->bus = bus;
 		pci_ctrl->last_busno = bus->busn_res.end;
 		if (next_busno <= pci_ctrl->last_busno)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 053c0f4..7cf577f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2087,7 +2087,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 	if (!found)
 		pci_bus_update_busn_res_end(b, max);
 
-	pci_bus_add_devices(b);
 	return b;
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
-- 
1.7.1

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

* [PATCH 02/28] PCI: Rip out pci_bus_add_devices() from pci_scan_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, David Howells, Michal Simek, Ralf Baechle

Just like pci_scan_bus(), we also should rip out
pci_bus_add_devices() from pci_scan_root_bus().
Lots platforms first call pci_scan_root_bus(), but
after that, they call pci_bus_size_bridges() and
pci_bus_assign_resources(). Place pci_bus_add_devices()
in pci_scan_root_bus() hurts PCI scan logic.
For arm hw_pci->scan() functions which call
pci_scan_root_bus(), it's no need to change anything,
because pci_bus_add_devices() will be called later
in pci_common_init_dev().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: David Howells <dhowells@redhat.com>
CC: Tony Luck <tony.luck@intel.com>
CC: Michal Simek <monstr@monstr.eu>
CC: Ralf Baechle <ralf@linux-mips.org>
CC: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
CC: Sebastian Ott <sebott@linux.vnet.ibm.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Chris Metcalf <cmetcalf@ezchip.com>
CC: Chris Zankel <chris@zankel.net>
CC: linux-alpha@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: linux-mips@linux-mips.org
CC: linux-am33-list@redhat.com
CC: linux-s390@vger.kernel.org
CC: linux-sh@vger.kernel.org
CC: sparclinux@vger.kernel.org
CC: linux-pci@vger.kernel.org
CC: linux-xtensa@linux-xtensa.org
---
 arch/alpha/kernel/pci.c          |    2 ++
 arch/frv/mb93090-mb00/pci-vdk.c  |    6 ++++--
 arch/ia64/sn/kernel/io_init.c    |    1 +
 arch/microblaze/pci/pci-common.c |    1 +
 arch/mips/pci/pci.c              |    1 +
 arch/mn10300/unit-asb2305/pci.c  |    5 ++++-
 arch/s390/pci/pci.c              |    2 +-
 arch/sh/drivers/pci/pci.c        |    1 +
 arch/sparc/kernel/leon_pci.c     |    1 +
 arch/tile/kernel/pci.c           |    2 ++
 arch/tile/kernel/pci_gx.c        |    2 ++
 arch/x86/pci/common.c            |    1 +
 arch/xtensa/kernel/pci.c         |    2 ++
 drivers/pci/probe.c              |    1 -
 14 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 076c35c..97f9730 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -334,6 +334,8 @@ common_init_pci(void)
 
 		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
 					hose, &resources);
+		if (bus)
+			pci_bus_add_devices(bus);
 		hose->bus = bus;
 		hose->need_domain_info = need_domain_info;
 		next_busno = bus->busn_res.end + 1;
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index efa5d65..2b36044 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -316,6 +316,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
 
 int __init pcibios_init(void)
 {
+	struct pci_bus *bus;
 	struct pci_ops *dir = NULL;
 	LIST_HEAD(resources);
 
@@ -383,12 +384,13 @@ int __init pcibios_init(void)
 	printk("PCI: Probing PCI hardware\n");
 	pci_add_resource(&resources, &pci_ioport_resource);
 	pci_add_resource(&resources, &pci_iomem_resource);
-	pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources);
+	bus = pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources);
 
 	pcibios_irq_init();
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
-
+	if (bus)
+		pci_bus_add_devices(bus);
 	return 0;
 }
 
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 0b5ce82..63b43a6 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -272,6 +272,7 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
 		kfree(res);
 		kfree(controller);
 	}
+	pci_bus_add_devices(bus);
 }
 
 /*
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index b30e41c..009b271 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1351,6 +1351,7 @@ static void pcibios_scan_phb(struct pci_controller *hose)
 	hose->bus = bus;
 
 	hose->last_busno = bus->busn_res.end;
+	pci_bus_add_devices(bus);
 }
 
 static int __init pcibios_init(void)
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 1bf60b1..9eb54b5 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -114,6 +114,7 @@ static void pcibios_scanbus(struct pci_controller *hose)
 			pci_bus_size_bridges(bus);
 			pci_bus_assign_resources(bus);
 		}
+		pci_bus_add_devices(bus);
 	}
 }
 
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index 6b4339f..860aa35 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -345,6 +345,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
  */
 static int __init pcibios_init(void)
 {
+	struct pci_bus *bus;
 	resource_size_t io_offset, mem_offset;
 	LIST_HEAD(resources);
 
@@ -376,11 +377,13 @@ static int __init pcibios_init(void)
 
 	pci_add_resource_offset(&resources, &pci_ioport_resource, io_offset);
 	pci_add_resource_offset(&resources, &pci_iomem_resource, mem_offset);
-	pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources);
+	bus = pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources);
 
 	pcibios_irq_init();
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
+	if (bus)
+		pci_bus_add_devices(bus);
 	return 0;
 }
 
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 3290f11..0b32769 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -756,7 +756,7 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
 		zpci_cleanup_bus_resources(zdev);
 		return -EIO;
 	}
-
+	pci_bus_add_devices(zdev->bus);
 	zdev->bus->max_bus_speed = zdev->max_bus_speed;
 	return 0;
 }
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 1bc09ee..efc1051 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -69,6 +69,7 @@ static void pcibios_scanbus(struct pci_channel *hose)
 
 		pci_bus_size_bridges(bus);
 		pci_bus_assign_resources(bus);
+		pci_bus_add_devices(bus);
 	} else {
 		pci_free_resource_list(&resources);
 	}
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index 899b720..2971076 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -40,6 +40,7 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info)
 
 		/* Assign devices with resources */
 		pci_assign_unassigned_resources();
+		pci_bus_add_devices(root_bus);
 	} else {
 		pci_free_resource_list(&resources);
 	}
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index f70c789..83d3e30 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -339,6 +339,8 @@ int __init pcibios_init(void)
 			struct pci_bus *next_bus;
 			struct pci_dev *dev;
 
+			pci_bus_add_devices(root_bus);
+
 			list_for_each_entry(dev, &root_bus->devices, bus_list) {
 				/*
 				 * Find the PCI host controller, ie. the 1st
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index 2c95f37..d7a0729 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -916,6 +916,8 @@ int __init pcibios_init(void)
 		/* Configure the max_payload_size values for this domain. */
 		fixup_read_and_payload_sizes(controller);
 
+		pci_bus_add_devices(root_bus);
+
 		/* Alloc a PIO region for PCI memory access for each RC port. */
 		ret = gxio_trio_alloc_pio_regions(trio_context, 1, 0, 0);
 		if (ret < 0) {
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 7b20bcc..300d39e 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -475,6 +475,7 @@ void pcibios_scan_root(int busnum)
 		pci_free_resource_list(&resources);
 		kfree(sd);
 	}
+	pci_bus_add_devices(bus);
 }
 
 void __init pcibios_set_cache_line_size(void)
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c
index 5b34033..f2ae64e 100644
--- a/arch/xtensa/kernel/pci.c
+++ b/arch/xtensa/kernel/pci.c
@@ -185,6 +185,8 @@ static int __init pcibios_init(void)
 		pci_controller_apertures(pci_ctrl, &resources);
 		bus = pci_scan_root_bus(NULL, pci_ctrl->first_busno,
 					pci_ctrl->ops, pci_ctrl, &resources);
+		if (bus)
+			pci_bus_add_devices(bus);
 		pci_ctrl->bus = bus;
 		pci_ctrl->last_busno = bus->busn_res.end;
 		if (next_busno <= pci_ctrl->last_busno)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 053c0f4..7cf577f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2087,7 +2087,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 	if (!found)
 		pci_bus_update_busn_res_end(b, max);
 
-	pci_bus_add_devices(b);
 	return b;
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
-- 
1.7.1



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

* [PATCH 03/28] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, Konrad Rzeszutek Wilk, xen-devel

From: Arnd Bergmann <arnd@arndb.de>

Use pci_scan_root_bus() instead of deprecated function
pci_scan_bus_parented().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: xen-devel@lists.xenproject.org
---
 drivers/pci/xen-pcifront.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index b1ffebe..240ddbc 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -446,6 +446,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 				 unsigned int domain, unsigned int bus)
 {
 	struct pci_bus *b;
+	LIST_HEAD(resources);
 	struct pcifront_sd *sd = NULL;
 	struct pci_bus_entry *bus_entry = NULL;
 	int err = 0;
@@ -470,17 +471,20 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 		err = -ENOMEM;
 		goto err_out;
 	}
+	pci_add_resource(&resources, &ioport_resource);
+	pci_add_resource(&resources, &iomem_resource);
 	pcifront_init_sd(sd, domain, bus, pdev);
 
 	pci_lock_rescan_remove();
 
-	b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
-				  &pcifront_bus_ops, sd);
+	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
+				  &pcifront_bus_ops, sd, &resources);
 	if (!b) {
 		dev_err(&pdev->xdev->dev,
 			"Error creating PCI Frontend Bus!\n");
 		err = -ENOMEM;
 		pci_unlock_rescan_remove();
+		pci_free_resource_list(&resources);
 		goto err_out;
 	}
 
@@ -488,7 +492,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 
 	list_add(&bus_entry->list, &pdev->root_buses);
 
-	/* pci_scan_bus_parented skips devices which do not have a have
+	/* pci_scan_root_bus skips devices which do not have a have
 	* devfn==0. The pcifront_scan_bus enumerates all devfn. */
 	err = pcifront_scan_bus(pdev, domain, bus, b);
 
-- 
1.7.1


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

* [PATCH 03/28] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
  2015-01-16  1:43 ` Yijing Wang
                   ` (8 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, Konrad Rzeszutek Wilk, xen-devel

From: Arnd Bergmann <arnd@arndb.de>

Use pci_scan_root_bus() instead of deprecated function
pci_scan_bus_parented().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: xen-devel@lists.xenproject.org
---
 drivers/pci/xen-pcifront.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index b1ffebe..240ddbc 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -446,6 +446,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 				 unsigned int domain, unsigned int bus)
 {
 	struct pci_bus *b;
+	LIST_HEAD(resources);
 	struct pcifront_sd *sd = NULL;
 	struct pci_bus_entry *bus_entry = NULL;
 	int err = 0;
@@ -470,17 +471,20 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 		err = -ENOMEM;
 		goto err_out;
 	}
+	pci_add_resource(&resources, &ioport_resource);
+	pci_add_resource(&resources, &iomem_resource);
 	pcifront_init_sd(sd, domain, bus, pdev);
 
 	pci_lock_rescan_remove();
 
-	b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
-				  &pcifront_bus_ops, sd);
+	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
+				  &pcifront_bus_ops, sd, &resources);
 	if (!b) {
 		dev_err(&pdev->xdev->dev,
 			"Error creating PCI Frontend Bus!\n");
 		err = -ENOMEM;
 		pci_unlock_rescan_remove();
+		pci_free_resource_list(&resources);
 		goto err_out;
 	}
 
@@ -488,7 +492,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 
 	list_add(&bus_entry->list, &pdev->root_buses);
 
-	/* pci_scan_bus_parented skips devices which do not have a have
+	/* pci_scan_root_bus skips devices which do not have a have
 	* devfn==0. The pcifront_scan_bus enumerates all devfn. */
 	err = pcifront_scan_bus(pdev, domain, bus, b);
 
-- 
1.7.1

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

* [PATCH 03/28] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, Konrad Rzeszutek Wilk, xen-devel

From: Arnd Bergmann <arnd@arndb.de>

Use pci_scan_root_bus() instead of deprecated function
pci_scan_bus_parented().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: xen-devel@lists.xenproject.org
---
 drivers/pci/xen-pcifront.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index b1ffebe..240ddbc 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -446,6 +446,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 				 unsigned int domain, unsigned int bus)
 {
 	struct pci_bus *b;
+	LIST_HEAD(resources);
 	struct pcifront_sd *sd = NULL;
 	struct pci_bus_entry *bus_entry = NULL;
 	int err = 0;
@@ -470,17 +471,20 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 		err = -ENOMEM;
 		goto err_out;
 	}
+	pci_add_resource(&resources, &ioport_resource);
+	pci_add_resource(&resources, &iomem_resource);
 	pcifront_init_sd(sd, domain, bus, pdev);
 
 	pci_lock_rescan_remove();
 
-	b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
-				  &pcifront_bus_ops, sd);
+	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
+				  &pcifront_bus_ops, sd, &resources);
 	if (!b) {
 		dev_err(&pdev->xdev->dev,
 			"Error creating PCI Frontend Bus!\n");
 		err = -ENOMEM;
 		pci_unlock_rescan_remove();
+		pci_free_resource_list(&resources);
 		goto err_out;
 	}
 
@@ -488,7 +492,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 
 	list_add(&bus_entry->list, &pdev->root_buses);
 
-	/* pci_scan_bus_parented skips devices which do not have a have
+	/* pci_scan_root_bus skips devices which do not have a have
 	* devfn==0. The pcifront_scan_bus enumerates all devfn. */
 	err = pcifront_scan_bus(pdev, domain, bus, b);
 
-- 
1.7.1


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

* [PATCH 03/28] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

From: Arnd Bergmann <arnd@arndb.de>

Use pci_scan_root_bus() instead of deprecated function
pci_scan_bus_parented().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: xen-devel at lists.xenproject.org
---
 drivers/pci/xen-pcifront.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index b1ffebe..240ddbc 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -446,6 +446,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 				 unsigned int domain, unsigned int bus)
 {
 	struct pci_bus *b;
+	LIST_HEAD(resources);
 	struct pcifront_sd *sd = NULL;
 	struct pci_bus_entry *bus_entry = NULL;
 	int err = 0;
@@ -470,17 +471,20 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 		err = -ENOMEM;
 		goto err_out;
 	}
+	pci_add_resource(&resources, &ioport_resource);
+	pci_add_resource(&resources, &iomem_resource);
 	pcifront_init_sd(sd, domain, bus, pdev);
 
 	pci_lock_rescan_remove();
 
-	b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
-				  &pcifront_bus_ops, sd);
+	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
+				  &pcifront_bus_ops, sd, &resources);
 	if (!b) {
 		dev_err(&pdev->xdev->dev,
 			"Error creating PCI Frontend Bus!\n");
 		err = -ENOMEM;
 		pci_unlock_rescan_remove();
+		pci_free_resource_list(&resources);
 		goto err_out;
 	}
 
@@ -488,7 +492,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 
 	list_add(&bus_entry->list, &pdev->root_buses);
 
-	/* pci_scan_bus_parented skips devices which do not have a have
+	/* pci_scan_root_bus skips devices which do not have a have
 	* devfn==0. The pcifront_scan_bus enumerates all devfn. */
 	err = pcifront_scan_bus(pdev, domain, bus, b);
 
-- 
1.7.1

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

* [PATCH 03/28] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Liviu Dudau, Tony Luck, Russell King, xen-devel, Arnd Bergmann,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, Yijing Wang,
	linux-ia64, Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	linux-arm-kernel

From: Arnd Bergmann <arnd@arndb.de>

Use pci_scan_root_bus() instead of deprecated function
pci_scan_bus_parented().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: xen-devel@lists.xenproject.org
---
 drivers/pci/xen-pcifront.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index b1ffebe..240ddbc 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -446,6 +446,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 				 unsigned int domain, unsigned int bus)
 {
 	struct pci_bus *b;
+	LIST_HEAD(resources);
 	struct pcifront_sd *sd = NULL;
 	struct pci_bus_entry *bus_entry = NULL;
 	int err = 0;
@@ -470,17 +471,20 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 		err = -ENOMEM;
 		goto err_out;
 	}
+	pci_add_resource(&resources, &ioport_resource);
+	pci_add_resource(&resources, &iomem_resource);
 	pcifront_init_sd(sd, domain, bus, pdev);
 
 	pci_lock_rescan_remove();
 
-	b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
-				  &pcifront_bus_ops, sd);
+	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
+				  &pcifront_bus_ops, sd, &resources);
 	if (!b) {
 		dev_err(&pdev->xdev->dev,
 			"Error creating PCI Frontend Bus!\n");
 		err = -ENOMEM;
 		pci_unlock_rescan_remove();
+		pci_free_resource_list(&resources);
 		goto err_out;
 	}
 
@@ -488,7 +492,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 
 	list_add(&bus_entry->list, &pdev->root_buses);
 
-	/* pci_scan_bus_parented skips devices which do not have a have
+	/* pci_scan_root_bus skips devices which do not have a have
 	* devfn==0. The pcifront_scan_bus enumerates all devfn. */
 	err = pcifront_scan_bus(pdev, domain, bus, b);
 
-- 
1.7.1

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

* [PATCH 03/28] xen/PCI: Don't use deprecated function pci_scan_bus_parented()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, Konrad Rzeszutek Wilk, xen-devel

From: Arnd Bergmann <arnd@arndb.de>

Use pci_scan_root_bus() instead of deprecated function
pci_scan_bus_parented().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: xen-devel@lists.xenproject.org
---
 drivers/pci/xen-pcifront.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index b1ffebe..240ddbc 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -446,6 +446,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 				 unsigned int domain, unsigned int bus)
 {
 	struct pci_bus *b;
+	LIST_HEAD(resources);
 	struct pcifront_sd *sd = NULL;
 	struct pci_bus_entry *bus_entry = NULL;
 	int err = 0;
@@ -470,17 +471,20 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 		err = -ENOMEM;
 		goto err_out;
 	}
+	pci_add_resource(&resources, &ioport_resource);
+	pci_add_resource(&resources, &iomem_resource);
 	pcifront_init_sd(sd, domain, bus, pdev);
 
 	pci_lock_rescan_remove();
 
-	b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
-				  &pcifront_bus_ops, sd);
+	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
+				  &pcifront_bus_ops, sd, &resources);
 	if (!b) {
 		dev_err(&pdev->xdev->dev,
 			"Error creating PCI Frontend Bus!\n");
 		err = -ENOMEM;
 		pci_unlock_rescan_remove();
+		pci_free_resource_list(&resources);
 		goto err_out;
 	}
 
@@ -488,7 +492,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 
 	list_add(&bus_entry->list, &pdev->root_buses);
 
-	/* pci_scan_bus_parented skips devices which do not have a have
+	/* pci_scan_root_bus skips devices which do not have a have
 	* devfn=0. The pcifront_scan_bus enumerates all devfn. */
 	err = pcifront_scan_bus(pdev, domain, bus, b);
 
-- 
1.7.1


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

* [PATCH 04/28] PCI: Remove deprecated pci_scan_bus_parented()
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

No one uses pci_scan_bus_parented() any more,
remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   19 -------------------
 include/linux/pci.h |    2 --
 2 files changed, 0 insertions(+), 21 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 7cf577f..e44de73 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2091,25 +2091,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-/* Deprecated; use pci_scan_root_bus() instead */
-struct pci_bus *pci_scan_bus_parented(struct device *parent,
-		int bus, struct pci_ops *ops, void *sysdata)
-{
-	LIST_HEAD(resources);
-	struct pci_bus *b;
-
-	pci_add_resource(&resources, &ioport_resource);
-	pci_add_resource(&resources, &iomem_resource);
-	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(parent, bus, ops, sysdata, &resources);
-	if (b)
-		pci_scan_child_bus(b);
-	else
-		pci_free_resource_list(&resources);
-	return b;
-}
-EXPORT_SYMBOL(pci_scan_bus_parented);
-
 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 					void *sysdata)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 360a966..55b2c81 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -769,8 +769,6 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
-				      struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 				    struct pci_ops *ops, void *sysdata,
-- 
1.7.1


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

* [PATCH 04/28] PCI: Remove deprecated pci_scan_bus_parented()
  2015-01-16  1:43 ` Yijing Wang
                   ` (10 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

No one uses pci_scan_bus_parented() any more,
remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   19 -------------------
 include/linux/pci.h |    2 --
 2 files changed, 0 insertions(+), 21 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 7cf577f..e44de73 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2091,25 +2091,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-/* Deprecated; use pci_scan_root_bus() instead */
-struct pci_bus *pci_scan_bus_parented(struct device *parent,
-		int bus, struct pci_ops *ops, void *sysdata)
-{
-	LIST_HEAD(resources);
-	struct pci_bus *b;
-
-	pci_add_resource(&resources, &ioport_resource);
-	pci_add_resource(&resources, &iomem_resource);
-	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(parent, bus, ops, sysdata, &resources);
-	if (b)
-		pci_scan_child_bus(b);
-	else
-		pci_free_resource_list(&resources);
-	return b;
-}
-EXPORT_SYMBOL(pci_scan_bus_parented);
-
 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 					void *sysdata)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 360a966..55b2c81 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -769,8 +769,6 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
-				      struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 				    struct pci_ops *ops, void *sysdata,
-- 
1.7.1

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

* [PATCH 04/28] PCI: Remove deprecated pci_scan_bus_parented()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

No one uses pci_scan_bus_parented() any more,
remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   19 -------------------
 include/linux/pci.h |    2 --
 2 files changed, 0 insertions(+), 21 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 7cf577f..e44de73 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2091,25 +2091,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-/* Deprecated; use pci_scan_root_bus() instead */
-struct pci_bus *pci_scan_bus_parented(struct device *parent,
-		int bus, struct pci_ops *ops, void *sysdata)
-{
-	LIST_HEAD(resources);
-	struct pci_bus *b;
-
-	pci_add_resource(&resources, &ioport_resource);
-	pci_add_resource(&resources, &iomem_resource);
-	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(parent, bus, ops, sysdata, &resources);
-	if (b)
-		pci_scan_child_bus(b);
-	else
-		pci_free_resource_list(&resources);
-	return b;
-}
-EXPORT_SYMBOL(pci_scan_bus_parented);
-
 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 					void *sysdata)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 360a966..55b2c81 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -769,8 +769,6 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
-				      struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 				    struct pci_ops *ops, void *sysdata,
-- 
1.7.1


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

* [PATCH 04/28] PCI: Remove deprecated pci_scan_bus_parented()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

No one uses pci_scan_bus_parented() any more,
remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   19 -------------------
 include/linux/pci.h |    2 --
 2 files changed, 0 insertions(+), 21 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 7cf577f..e44de73 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2091,25 +2091,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-/* Deprecated; use pci_scan_root_bus() instead */
-struct pci_bus *pci_scan_bus_parented(struct device *parent,
-		int bus, struct pci_ops *ops, void *sysdata)
-{
-	LIST_HEAD(resources);
-	struct pci_bus *b;
-
-	pci_add_resource(&resources, &ioport_resource);
-	pci_add_resource(&resources, &iomem_resource);
-	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(parent, bus, ops, sysdata, &resources);
-	if (b)
-		pci_scan_child_bus(b);
-	else
-		pci_free_resource_list(&resources);
-	return b;
-}
-EXPORT_SYMBOL(pci_scan_bus_parented);
-
 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 					void *sysdata)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 360a966..55b2c81 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -769,8 +769,6 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
-				      struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 				    struct pci_ops *ops, void *sysdata,
-- 
1.7.1

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

* [PATCH 04/28] PCI: Remove deprecated pci_scan_bus_parented()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

No one uses pci_scan_bus_parented() any more,
remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   19 -------------------
 include/linux/pci.h |    2 --
 2 files changed, 0 insertions(+), 21 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 7cf577f..e44de73 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2091,25 +2091,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-/* Deprecated; use pci_scan_root_bus() instead */
-struct pci_bus *pci_scan_bus_parented(struct device *parent,
-		int bus, struct pci_ops *ops, void *sysdata)
-{
-	LIST_HEAD(resources);
-	struct pci_bus *b;
-
-	pci_add_resource(&resources, &ioport_resource);
-	pci_add_resource(&resources, &iomem_resource);
-	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(parent, bus, ops, sysdata, &resources);
-	if (b)
-		pci_scan_child_bus(b);
-	else
-		pci_free_resource_list(&resources);
-	return b;
-}
-EXPORT_SYMBOL(pci_scan_bus_parented);
-
 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 					void *sysdata)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 360a966..55b2c81 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -769,8 +769,6 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
-				      struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 				    struct pci_ops *ops, void *sysdata,
-- 
1.7.1


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

* [PATCH 04/28] PCI: Remove deprecated pci_scan_bus_parented()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

No one uses pci_scan_bus_parented() any more,
remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   19 -------------------
 include/linux/pci.h |    2 --
 2 files changed, 0 insertions(+), 21 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 7cf577f..e44de73 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2091,25 +2091,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-/* Deprecated; use pci_scan_root_bus() instead */
-struct pci_bus *pci_scan_bus_parented(struct device *parent,
-		int bus, struct pci_ops *ops, void *sysdata)
-{
-	LIST_HEAD(resources);
-	struct pci_bus *b;
-
-	pci_add_resource(&resources, &ioport_resource);
-	pci_add_resource(&resources, &iomem_resource);
-	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(parent, bus, ops, sysdata, &resources);
-	if (b)
-		pci_scan_child_bus(b);
-	else
-		pci_free_resource_list(&resources);
-	return b;
-}
-EXPORT_SYMBOL(pci_scan_bus_parented);
-
 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 					void *sysdata)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 360a966..55b2c81 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -769,8 +769,6 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
-				      struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 				    struct pci_ops *ops, void *sysdata,
-- 
1.7.1


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

* [PATCH 05/28] PCI: Rename pci_scan_bus() to pci_scan_bus_legacy()
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Pci_scan_bus() is called by legacy pci host drivers,
the legacy host drivers mean they use NUll as parent
device, use all IO/MEM as default resources. Rename
pci_scan_bus() to pci_scan_bus_legacy() for better
readability.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/kernel/sys_nautilus.c  |    2 +-
 arch/m68k/coldfire/pci.c          |    2 +-
 arch/sparc/kernel/pcic.c          |    2 +-
 arch/unicore32/kernel/pci.c       |    2 +-
 drivers/pci/hotplug/ibmphp_core.c |    2 +-
 drivers/pci/probe.c               |    4 ++--
 include/linux/pci.h               |    2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 4ae4a40..2c864bb 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -206,7 +206,7 @@ nautilus_init_pci(void)
 	unsigned long memtop = max_low_pfn << PAGE_SHIFT;
 
 	/* Scan our single hose.  */
-	bus = pci_scan_bus(0, alpha_mv.pci_ops, hose);
+	bus = pci_scan_bus_legacy(0, alpha_mv.pci_ops, hose);
 	hose->bus = bus;
 	pcibios_claim_one_bus(bus);
 
diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index d45f087..0ef4dd4 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -312,7 +312,7 @@ static int __init mcf_pci_init(void)
 	set_current_state(TASK_UNINTERRUPTIBLE);
 	schedule_timeout(msecs_to_jiffies(200));
 
-	rootbus = pci_scan_bus(0, &mcf_pci_ops, NULL);
+	rootbus = pci_scan_bus_legacy(0, &mcf_pci_ops, NULL);
 	rootbus->resource[0] = &mcf_pci_io;
 	rootbus->resource[1] = &mcf_pci_mem;
 
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 7a82fe2..f7edc97 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -390,7 +390,7 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic)
 {
 	struct linux_pbm_info *pbm = &pcic->pbm;
 
-	pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, &pcic_ops, pbm);
+	pbm->pci_bus = pci_scan_bus_legacy(pbm->pci_first_busno, &pcic_ops, pbm);
 	if (pbm->pci_bus)
 		pci_bus_add_devices(pbm->pci_bus);
 #if 0 /* deadwood transplanted from sparc64 */
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 3d82024..2e238b4 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -258,7 +258,7 @@ static int __init pci_common_init(void)
 
 	pci_puv3_preinit();
 
-	puv3_bus = pci_scan_bus(0, &pci_puv3_ops, NULL);
+	puv3_bus = pci_scan_bus_legacy(0, &pci_puv3_ops, NULL);
 
 	if (!puv3_bus)
 		panic("PCI: unable to scan bus!");
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 86e3bfd..4ade1b4 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -765,7 +765,7 @@ static u8 bus_structure_fixup(u8 busno)
 					(l != 0x0000) && (l != 0xffff)) {
 			debug("%s - Inside bus_structure_fixup()\n",
 							__func__);
-			b = pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			b = pci_scan_bus_legacy(busno, ibmphp_pci_bus->ops, NULL);
 			if (b)
 				pci_bus_add_devices(b);
 			break;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index e44de73..ed894cb 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2091,7 +2091,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
+struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
@@ -2108,7 +2108,7 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 	}
 	return b;
 }
-EXPORT_SYMBOL(pci_scan_bus);
+EXPORT_SYMBOL(pci_scan_bus_legacy);
 
 /**
  * pci_rescan_bus_bridge_resize - scan a PCI bus for devices.
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 55b2c81..a6fa2f1 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -769,7 +769,7 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
+struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
-- 
1.7.1


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

* [PATCH 05/28] PCI: Rename pci_scan_bus() to pci_scan_bus_legacy()
  2015-01-16  1:43 ` Yijing Wang
                   ` (11 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Pci_scan_bus() is called by legacy pci host drivers,
the legacy host drivers mean they use NUll as parent
device, use all IO/MEM as default resources. Rename
pci_scan_bus() to pci_scan_bus_legacy() for better
readability.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/kernel/sys_nautilus.c  |    2 +-
 arch/m68k/coldfire/pci.c          |    2 +-
 arch/sparc/kernel/pcic.c          |    2 +-
 arch/unicore32/kernel/pci.c       |    2 +-
 drivers/pci/hotplug/ibmphp_core.c |    2 +-
 drivers/pci/probe.c               |    4 ++--
 include/linux/pci.h               |    2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 4ae4a40..2c864bb 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -206,7 +206,7 @@ nautilus_init_pci(void)
 	unsigned long memtop = max_low_pfn << PAGE_SHIFT;
 
 	/* Scan our single hose.  */
-	bus = pci_scan_bus(0, alpha_mv.pci_ops, hose);
+	bus = pci_scan_bus_legacy(0, alpha_mv.pci_ops, hose);
 	hose->bus = bus;
 	pcibios_claim_one_bus(bus);
 
diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index d45f087..0ef4dd4 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -312,7 +312,7 @@ static int __init mcf_pci_init(void)
 	set_current_state(TASK_UNINTERRUPTIBLE);
 	schedule_timeout(msecs_to_jiffies(200));
 
-	rootbus = pci_scan_bus(0, &mcf_pci_ops, NULL);
+	rootbus = pci_scan_bus_legacy(0, &mcf_pci_ops, NULL);
 	rootbus->resource[0] = &mcf_pci_io;
 	rootbus->resource[1] = &mcf_pci_mem;
 
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 7a82fe2..f7edc97 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -390,7 +390,7 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic)
 {
 	struct linux_pbm_info *pbm = &pcic->pbm;
 
-	pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, &pcic_ops, pbm);
+	pbm->pci_bus = pci_scan_bus_legacy(pbm->pci_first_busno, &pcic_ops, pbm);
 	if (pbm->pci_bus)
 		pci_bus_add_devices(pbm->pci_bus);
 #if 0 /* deadwood transplanted from sparc64 */
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 3d82024..2e238b4 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -258,7 +258,7 @@ static int __init pci_common_init(void)
 
 	pci_puv3_preinit();
 
-	puv3_bus = pci_scan_bus(0, &pci_puv3_ops, NULL);
+	puv3_bus = pci_scan_bus_legacy(0, &pci_puv3_ops, NULL);
 
 	if (!puv3_bus)
 		panic("PCI: unable to scan bus!");
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 86e3bfd..4ade1b4 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -765,7 +765,7 @@ static u8 bus_structure_fixup(u8 busno)
 					(l != 0x0000) && (l != 0xffff)) {
 			debug("%s - Inside bus_structure_fixup()\n",
 							__func__);
-			b = pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			b = pci_scan_bus_legacy(busno, ibmphp_pci_bus->ops, NULL);
 			if (b)
 				pci_bus_add_devices(b);
 			break;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index e44de73..ed894cb 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2091,7 +2091,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
+struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
@@ -2108,7 +2108,7 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 	}
 	return b;
 }
-EXPORT_SYMBOL(pci_scan_bus);
+EXPORT_SYMBOL(pci_scan_bus_legacy);
 
 /**
  * pci_rescan_bus_bridge_resize - scan a PCI bus for devices.
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 55b2c81..a6fa2f1 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -769,7 +769,7 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
+struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
-- 
1.7.1

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

* [PATCH 05/28] PCI: Rename pci_scan_bus() to pci_scan_bus_legacy()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Pci_scan_bus() is called by legacy pci host drivers,
the legacy host drivers mean they use NUll as parent
device, use all IO/MEM as default resources. Rename
pci_scan_bus() to pci_scan_bus_legacy() for better
readability.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/kernel/sys_nautilus.c  |    2 +-
 arch/m68k/coldfire/pci.c          |    2 +-
 arch/sparc/kernel/pcic.c          |    2 +-
 arch/unicore32/kernel/pci.c       |    2 +-
 drivers/pci/hotplug/ibmphp_core.c |    2 +-
 drivers/pci/probe.c               |    4 ++--
 include/linux/pci.h               |    2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 4ae4a40..2c864bb 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -206,7 +206,7 @@ nautilus_init_pci(void)
 	unsigned long memtop = max_low_pfn << PAGE_SHIFT;
 
 	/* Scan our single hose.  */
-	bus = pci_scan_bus(0, alpha_mv.pci_ops, hose);
+	bus = pci_scan_bus_legacy(0, alpha_mv.pci_ops, hose);
 	hose->bus = bus;
 	pcibios_claim_one_bus(bus);
 
diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index d45f087..0ef4dd4 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -312,7 +312,7 @@ static int __init mcf_pci_init(void)
 	set_current_state(TASK_UNINTERRUPTIBLE);
 	schedule_timeout(msecs_to_jiffies(200));
 
-	rootbus = pci_scan_bus(0, &mcf_pci_ops, NULL);
+	rootbus = pci_scan_bus_legacy(0, &mcf_pci_ops, NULL);
 	rootbus->resource[0] = &mcf_pci_io;
 	rootbus->resource[1] = &mcf_pci_mem;
 
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 7a82fe2..f7edc97 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -390,7 +390,7 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic)
 {
 	struct linux_pbm_info *pbm = &pcic->pbm;
 
-	pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, &pcic_ops, pbm);
+	pbm->pci_bus = pci_scan_bus_legacy(pbm->pci_first_busno, &pcic_ops, pbm);
 	if (pbm->pci_bus)
 		pci_bus_add_devices(pbm->pci_bus);
 #if 0 /* deadwood transplanted from sparc64 */
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 3d82024..2e238b4 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -258,7 +258,7 @@ static int __init pci_common_init(void)
 
 	pci_puv3_preinit();
 
-	puv3_bus = pci_scan_bus(0, &pci_puv3_ops, NULL);
+	puv3_bus = pci_scan_bus_legacy(0, &pci_puv3_ops, NULL);
 
 	if (!puv3_bus)
 		panic("PCI: unable to scan bus!");
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 86e3bfd..4ade1b4 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -765,7 +765,7 @@ static u8 bus_structure_fixup(u8 busno)
 					(l != 0x0000) && (l != 0xffff)) {
 			debug("%s - Inside bus_structure_fixup()\n",
 							__func__);
-			b = pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			b = pci_scan_bus_legacy(busno, ibmphp_pci_bus->ops, NULL);
 			if (b)
 				pci_bus_add_devices(b);
 			break;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index e44de73..ed894cb 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2091,7 +2091,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
+struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
@@ -2108,7 +2108,7 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 	}
 	return b;
 }
-EXPORT_SYMBOL(pci_scan_bus);
+EXPORT_SYMBOL(pci_scan_bus_legacy);
 
 /**
  * pci_rescan_bus_bridge_resize - scan a PCI bus for devices.
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 55b2c81..a6fa2f1 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -769,7 +769,7 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
+struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
-- 
1.7.1


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

* [PATCH 05/28] PCI: Rename pci_scan_bus() to pci_scan_bus_legacy()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Pci_scan_bus() is called by legacy pci host drivers,
the legacy host drivers mean they use NUll as parent
device, use all IO/MEM as default resources. Rename
pci_scan_bus() to pci_scan_bus_legacy() for better
readability.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/kernel/sys_nautilus.c  |    2 +-
 arch/m68k/coldfire/pci.c          |    2 +-
 arch/sparc/kernel/pcic.c          |    2 +-
 arch/unicore32/kernel/pci.c       |    2 +-
 drivers/pci/hotplug/ibmphp_core.c |    2 +-
 drivers/pci/probe.c               |    4 ++--
 include/linux/pci.h               |    2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 4ae4a40..2c864bb 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -206,7 +206,7 @@ nautilus_init_pci(void)
 	unsigned long memtop = max_low_pfn << PAGE_SHIFT;
 
 	/* Scan our single hose.  */
-	bus = pci_scan_bus(0, alpha_mv.pci_ops, hose);
+	bus = pci_scan_bus_legacy(0, alpha_mv.pci_ops, hose);
 	hose->bus = bus;
 	pcibios_claim_one_bus(bus);
 
diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index d45f087..0ef4dd4 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -312,7 +312,7 @@ static int __init mcf_pci_init(void)
 	set_current_state(TASK_UNINTERRUPTIBLE);
 	schedule_timeout(msecs_to_jiffies(200));
 
-	rootbus = pci_scan_bus(0, &mcf_pci_ops, NULL);
+	rootbus = pci_scan_bus_legacy(0, &mcf_pci_ops, NULL);
 	rootbus->resource[0] = &mcf_pci_io;
 	rootbus->resource[1] = &mcf_pci_mem;
 
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 7a82fe2..f7edc97 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -390,7 +390,7 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic)
 {
 	struct linux_pbm_info *pbm = &pcic->pbm;
 
-	pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, &pcic_ops, pbm);
+	pbm->pci_bus = pci_scan_bus_legacy(pbm->pci_first_busno, &pcic_ops, pbm);
 	if (pbm->pci_bus)
 		pci_bus_add_devices(pbm->pci_bus);
 #if 0 /* deadwood transplanted from sparc64 */
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 3d82024..2e238b4 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -258,7 +258,7 @@ static int __init pci_common_init(void)
 
 	pci_puv3_preinit();
 
-	puv3_bus = pci_scan_bus(0, &pci_puv3_ops, NULL);
+	puv3_bus = pci_scan_bus_legacy(0, &pci_puv3_ops, NULL);
 
 	if (!puv3_bus)
 		panic("PCI: unable to scan bus!");
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 86e3bfd..4ade1b4 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -765,7 +765,7 @@ static u8 bus_structure_fixup(u8 busno)
 					(l != 0x0000) && (l != 0xffff)) {
 			debug("%s - Inside bus_structure_fixup()\n",
 							__func__);
-			b = pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			b = pci_scan_bus_legacy(busno, ibmphp_pci_bus->ops, NULL);
 			if (b)
 				pci_bus_add_devices(b);
 			break;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index e44de73..ed894cb 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2091,7 +2091,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
+struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
@@ -2108,7 +2108,7 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 	}
 	return b;
 }
-EXPORT_SYMBOL(pci_scan_bus);
+EXPORT_SYMBOL(pci_scan_bus_legacy);
 
 /**
  * pci_rescan_bus_bridge_resize - scan a PCI bus for devices.
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 55b2c81..a6fa2f1 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -769,7 +769,7 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
+struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
-- 
1.7.1

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

* [PATCH 05/28] PCI: Rename pci_scan_bus() to pci_scan_bus_legacy()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Pci_scan_bus() is called by legacy pci host drivers,
the legacy host drivers mean they use NUll as parent
device, use all IO/MEM as default resources. Rename
pci_scan_bus() to pci_scan_bus_legacy() for better
readability.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/kernel/sys_nautilus.c  |    2 +-
 arch/m68k/coldfire/pci.c          |    2 +-
 arch/sparc/kernel/pcic.c          |    2 +-
 arch/unicore32/kernel/pci.c       |    2 +-
 drivers/pci/hotplug/ibmphp_core.c |    2 +-
 drivers/pci/probe.c               |    4 ++--
 include/linux/pci.h               |    2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 4ae4a40..2c864bb 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -206,7 +206,7 @@ nautilus_init_pci(void)
 	unsigned long memtop = max_low_pfn << PAGE_SHIFT;
 
 	/* Scan our single hose.  */
-	bus = pci_scan_bus(0, alpha_mv.pci_ops, hose);
+	bus = pci_scan_bus_legacy(0, alpha_mv.pci_ops, hose);
 	hose->bus = bus;
 	pcibios_claim_one_bus(bus);
 
diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index d45f087..0ef4dd4 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -312,7 +312,7 @@ static int __init mcf_pci_init(void)
 	set_current_state(TASK_UNINTERRUPTIBLE);
 	schedule_timeout(msecs_to_jiffies(200));
 
-	rootbus = pci_scan_bus(0, &mcf_pci_ops, NULL);
+	rootbus = pci_scan_bus_legacy(0, &mcf_pci_ops, NULL);
 	rootbus->resource[0] = &mcf_pci_io;
 	rootbus->resource[1] = &mcf_pci_mem;
 
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 7a82fe2..f7edc97 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -390,7 +390,7 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic)
 {
 	struct linux_pbm_info *pbm = &pcic->pbm;
 
-	pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, &pcic_ops, pbm);
+	pbm->pci_bus = pci_scan_bus_legacy(pbm->pci_first_busno, &pcic_ops, pbm);
 	if (pbm->pci_bus)
 		pci_bus_add_devices(pbm->pci_bus);
 #if 0 /* deadwood transplanted from sparc64 */
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 3d82024..2e238b4 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -258,7 +258,7 @@ static int __init pci_common_init(void)
 
 	pci_puv3_preinit();
 
-	puv3_bus = pci_scan_bus(0, &pci_puv3_ops, NULL);
+	puv3_bus = pci_scan_bus_legacy(0, &pci_puv3_ops, NULL);
 
 	if (!puv3_bus)
 		panic("PCI: unable to scan bus!");
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 86e3bfd..4ade1b4 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -765,7 +765,7 @@ static u8 bus_structure_fixup(u8 busno)
 					(l != 0x0000) && (l != 0xffff)) {
 			debug("%s - Inside bus_structure_fixup()\n",
 							__func__);
-			b = pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			b = pci_scan_bus_legacy(busno, ibmphp_pci_bus->ops, NULL);
 			if (b)
 				pci_bus_add_devices(b);
 			break;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index e44de73..ed894cb 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2091,7 +2091,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
+struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
@@ -2108,7 +2108,7 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 	}
 	return b;
 }
-EXPORT_SYMBOL(pci_scan_bus);
+EXPORT_SYMBOL(pci_scan_bus_legacy);
 
 /**
  * pci_rescan_bus_bridge_resize - scan a PCI bus for devices.
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 55b2c81..a6fa2f1 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -769,7 +769,7 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
+struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
-- 
1.7.1


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

* [PATCH 05/28] PCI: Rename pci_scan_bus() to pci_scan_bus_legacy()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Pci_scan_bus() is called by legacy pci host drivers,
the legacy host drivers mean they use NUll as parent
device, use all IO/MEM as default resources. Rename
pci_scan_bus() to pci_scan_bus_legacy() for better
readability.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/kernel/sys_nautilus.c  |    2 +-
 arch/m68k/coldfire/pci.c          |    2 +-
 arch/sparc/kernel/pcic.c          |    2 +-
 arch/unicore32/kernel/pci.c       |    2 +-
 drivers/pci/hotplug/ibmphp_core.c |    2 +-
 drivers/pci/probe.c               |    4 ++--
 include/linux/pci.h               |    2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 4ae4a40..2c864bb 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -206,7 +206,7 @@ nautilus_init_pci(void)
 	unsigned long memtop = max_low_pfn << PAGE_SHIFT;
 
 	/* Scan our single hose.  */
-	bus = pci_scan_bus(0, alpha_mv.pci_ops, hose);
+	bus = pci_scan_bus_legacy(0, alpha_mv.pci_ops, hose);
 	hose->bus = bus;
 	pcibios_claim_one_bus(bus);
 
diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index d45f087..0ef4dd4 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -312,7 +312,7 @@ static int __init mcf_pci_init(void)
 	set_current_state(TASK_UNINTERRUPTIBLE);
 	schedule_timeout(msecs_to_jiffies(200));
 
-	rootbus = pci_scan_bus(0, &mcf_pci_ops, NULL);
+	rootbus = pci_scan_bus_legacy(0, &mcf_pci_ops, NULL);
 	rootbus->resource[0] = &mcf_pci_io;
 	rootbus->resource[1] = &mcf_pci_mem;
 
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 7a82fe2..f7edc97 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -390,7 +390,7 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic)
 {
 	struct linux_pbm_info *pbm = &pcic->pbm;
 
-	pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, &pcic_ops, pbm);
+	pbm->pci_bus = pci_scan_bus_legacy(pbm->pci_first_busno, &pcic_ops, pbm);
 	if (pbm->pci_bus)
 		pci_bus_add_devices(pbm->pci_bus);
 #if 0 /* deadwood transplanted from sparc64 */
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 3d82024..2e238b4 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -258,7 +258,7 @@ static int __init pci_common_init(void)
 
 	pci_puv3_preinit();
 
-	puv3_bus = pci_scan_bus(0, &pci_puv3_ops, NULL);
+	puv3_bus = pci_scan_bus_legacy(0, &pci_puv3_ops, NULL);
 
 	if (!puv3_bus)
 		panic("PCI: unable to scan bus!");
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 86e3bfd..4ade1b4 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -765,7 +765,7 @@ static u8 bus_structure_fixup(u8 busno)
 					(l != 0x0000) && (l != 0xffff)) {
 			debug("%s - Inside bus_structure_fixup()\n",
 							__func__);
-			b = pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
+			b = pci_scan_bus_legacy(busno, ibmphp_pci_bus->ops, NULL);
 			if (b)
 				pci_bus_add_devices(b);
 			break;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index e44de73..ed894cb 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2091,7 +2091,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
+struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
@@ -2108,7 +2108,7 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
 	}
 	return b;
 }
-EXPORT_SYMBOL(pci_scan_bus);
+EXPORT_SYMBOL(pci_scan_bus_legacy);
 
 /**
  * pci_rescan_bus_bridge_resize - scan a PCI bus for devices.
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 55b2c81..a6fa2f1 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -769,7 +769,7 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
+struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
-- 
1.7.1

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

* [PATCH 06/28] PCI: Combine PCI domain and bus number in u32 arg
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Currently, we use int type for bus number in
pci_create_root_bus(), pci_scan_root_bus() and
pci_scan_bus_legacy. Because PCI bus number
always <= 255, so we could change the bus number
argument type to u32, and combine PCI domain and
bus number in one. Also add a domain member in
pci_host_bridge to save domain number. Finally,
we could eliminate lots of the platform specific
pci_domain_nr() in the last of the series.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c      |   16 +++++++++-------
 include/linux/pci.h      |    7 ++++---
 include/uapi/linux/pci.h |    3 +++
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ed894cb..50f58b3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1889,7 +1889,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
 	int error;
@@ -1900,6 +1900,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	resource_size_t offset;
 	char bus_addr[64];
 	char *fmt;
+	u8	bus = PCI_BUSNUM(db);
 
 	b = pci_alloc_bus(NULL);
 	if (!b)
@@ -1920,6 +1921,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	if (!bridge)
 		goto err_out;
 
+	bridge->domain = PCI_DOMAIN(db);
 	bridge->dev.parent = parent;
 	bridge->dev.release = pci_release_host_bridge_dev;
 	dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus);
@@ -2057,7 +2059,7 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 			res, ret ? "can not be" : "is");
 }
 
-struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
 	struct pci_host_bridge_window *window;
@@ -2071,15 +2073,15 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 			break;
 		}
 
-	b = pci_create_root_bus(parent, bus, ops, sysdata, resources);
+	b = pci_create_root_bus(parent, db, ops, sysdata, resources);
 	if (!b)
 		return NULL;
 
 	if (!found) {
 		dev_info(&b->dev,
 		 "No busn resource found for root bus, will use [bus %02x-ff]\n",
-			bus);
-		pci_bus_insert_busn_res(b, bus, 255);
+			PCI_BUSNUM(db));
+		pci_bus_insert_busn_res(b, PCI_BUSNUM(db), 255);
 	}
 
 	max = pci_scan_child_bus(b);
@@ -2091,7 +2093,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
+struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
@@ -2100,7 +2102,7 @@ struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
 	pci_add_resource(&resources, &ioport_resource);
 	pci_add_resource(&resources, &iomem_resource);
 	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);
+	b = pci_create_root_bus(NULL, db, ops, sysdata, &resources);
 	if (b) {
 		pci_scan_child_bus(b);
 	} else {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a6fa2f1..c771508 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -402,6 +402,7 @@ struct pci_host_bridge_window {
 };
 
 struct pci_host_bridge {
+	u16	domain;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
 	struct list_head windows;	/* pci_host_bridge_windows */
@@ -769,14 +770,14 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops, void *sysdata);
-struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysdata);
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
 void pci_bus_release_busn_res(struct pci_bus *b);
-struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 dombus,
 					     struct pci_ops *ops, void *sysdata,
 					     struct list_head *resources);
 struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
diff --git a/include/uapi/linux/pci.h b/include/uapi/linux/pci.h
index 3c292bc..89c6f15 100644
--- a/include/uapi/linux/pci.h
+++ b/include/uapi/linux/pci.h
@@ -30,6 +30,9 @@
 #define PCI_DEVFN(slot, func)	((((slot) & 0x1f) << 3) | ((func) & 0x07))
 #define PCI_SLOT(devfn)		(((devfn) >> 3) & 0x1f)
 #define PCI_FUNC(devfn)		((devfn) & 0x07)
+#define PCI_DOMAIN(db)		((db) >> 16)
+#define PCI_BUSNUM(db)		((db) & 0xffff)
+#define PCI_DOMBUS(domain, bus)		(((domain) << 16) | (bus))
 
 /* Ioctls for /proc/bus/pci/X/Y nodes. */
 #define PCIIOC_BASE		('P' << 24 | 'C' << 16 | 'I' << 8)
-- 
1.7.1


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

* [PATCH 06/28] PCI: Combine PCI domain and bus number in u32 arg
  2015-01-16  1:43 ` Yijing Wang
                   ` (14 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Currently, we use int type for bus number in
pci_create_root_bus(), pci_scan_root_bus() and
pci_scan_bus_legacy. Because PCI bus number
always <= 255, so we could change the bus number
argument type to u32, and combine PCI domain and
bus number in one. Also add a domain member in
pci_host_bridge to save domain number. Finally,
we could eliminate lots of the platform specific
pci_domain_nr() in the last of the series.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c      |   16 +++++++++-------
 include/linux/pci.h      |    7 ++++---
 include/uapi/linux/pci.h |    3 +++
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ed894cb..50f58b3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1889,7 +1889,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
 	int error;
@@ -1900,6 +1900,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	resource_size_t offset;
 	char bus_addr[64];
 	char *fmt;
+	u8	bus = PCI_BUSNUM(db);
 
 	b = pci_alloc_bus(NULL);
 	if (!b)
@@ -1920,6 +1921,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	if (!bridge)
 		goto err_out;
 
+	bridge->domain = PCI_DOMAIN(db);
 	bridge->dev.parent = parent;
 	bridge->dev.release = pci_release_host_bridge_dev;
 	dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus);
@@ -2057,7 +2059,7 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 			res, ret ? "can not be" : "is");
 }
 
-struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
 	struct pci_host_bridge_window *window;
@@ -2071,15 +2073,15 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 			break;
 		}
 
-	b = pci_create_root_bus(parent, bus, ops, sysdata, resources);
+	b = pci_create_root_bus(parent, db, ops, sysdata, resources);
 	if (!b)
 		return NULL;
 
 	if (!found) {
 		dev_info(&b->dev,
 		 "No busn resource found for root bus, will use [bus %02x-ff]\n",
-			bus);
-		pci_bus_insert_busn_res(b, bus, 255);
+			PCI_BUSNUM(db));
+		pci_bus_insert_busn_res(b, PCI_BUSNUM(db), 255);
 	}
 
 	max = pci_scan_child_bus(b);
@@ -2091,7 +2093,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
+struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
@@ -2100,7 +2102,7 @@ struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
 	pci_add_resource(&resources, &ioport_resource);
 	pci_add_resource(&resources, &iomem_resource);
 	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);
+	b = pci_create_root_bus(NULL, db, ops, sysdata, &resources);
 	if (b) {
 		pci_scan_child_bus(b);
 	} else {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a6fa2f1..c771508 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -402,6 +402,7 @@ struct pci_host_bridge_window {
 };
 
 struct pci_host_bridge {
+	u16	domain;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
 	struct list_head windows;	/* pci_host_bridge_windows */
@@ -769,14 +770,14 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops, void *sysdata);
-struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysdata);
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
 void pci_bus_release_busn_res(struct pci_bus *b);
-struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 dombus,
 					     struct pci_ops *ops, void *sysdata,
 					     struct list_head *resources);
 struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
diff --git a/include/uapi/linux/pci.h b/include/uapi/linux/pci.h
index 3c292bc..89c6f15 100644
--- a/include/uapi/linux/pci.h
+++ b/include/uapi/linux/pci.h
@@ -30,6 +30,9 @@
 #define PCI_DEVFN(slot, func)	((((slot) & 0x1f) << 3) | ((func) & 0x07))
 #define PCI_SLOT(devfn)		(((devfn) >> 3) & 0x1f)
 #define PCI_FUNC(devfn)		((devfn) & 0x07)
+#define PCI_DOMAIN(db)		((db) >> 16)
+#define PCI_BUSNUM(db)		((db) & 0xffff)
+#define PCI_DOMBUS(domain, bus)		(((domain) << 16) | (bus))
 
 /* Ioctls for /proc/bus/pci/X/Y nodes. */
 #define PCIIOC_BASE		('P' << 24 | 'C' << 16 | 'I' << 8)
-- 
1.7.1

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

* [PATCH 06/28] PCI: Combine PCI domain and bus number in u32 arg
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Currently, we use int type for bus number in
pci_create_root_bus(), pci_scan_root_bus() and
pci_scan_bus_legacy. Because PCI bus number
always <= 255, so we could change the bus number
argument type to u32, and combine PCI domain and
bus number in one. Also add a domain member in
pci_host_bridge to save domain number. Finally,
we could eliminate lots of the platform specific
pci_domain_nr() in the last of the series.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c      |   16 +++++++++-------
 include/linux/pci.h      |    7 ++++---
 include/uapi/linux/pci.h |    3 +++
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ed894cb..50f58b3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1889,7 +1889,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
 	int error;
@@ -1900,6 +1900,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	resource_size_t offset;
 	char bus_addr[64];
 	char *fmt;
+	u8	bus = PCI_BUSNUM(db);
 
 	b = pci_alloc_bus(NULL);
 	if (!b)
@@ -1920,6 +1921,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	if (!bridge)
 		goto err_out;
 
+	bridge->domain = PCI_DOMAIN(db);
 	bridge->dev.parent = parent;
 	bridge->dev.release = pci_release_host_bridge_dev;
 	dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus);
@@ -2057,7 +2059,7 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 			res, ret ? "can not be" : "is");
 }
 
-struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
 	struct pci_host_bridge_window *window;
@@ -2071,15 +2073,15 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 			break;
 		}
 
-	b = pci_create_root_bus(parent, bus, ops, sysdata, resources);
+	b = pci_create_root_bus(parent, db, ops, sysdata, resources);
 	if (!b)
 		return NULL;
 
 	if (!found) {
 		dev_info(&b->dev,
 		 "No busn resource found for root bus, will use [bus %02x-ff]\n",
-			bus);
-		pci_bus_insert_busn_res(b, bus, 255);
+			PCI_BUSNUM(db));
+		pci_bus_insert_busn_res(b, PCI_BUSNUM(db), 255);
 	}
 
 	max = pci_scan_child_bus(b);
@@ -2091,7 +2093,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
+struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
@@ -2100,7 +2102,7 @@ struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
 	pci_add_resource(&resources, &ioport_resource);
 	pci_add_resource(&resources, &iomem_resource);
 	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);
+	b = pci_create_root_bus(NULL, db, ops, sysdata, &resources);
 	if (b) {
 		pci_scan_child_bus(b);
 	} else {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a6fa2f1..c771508 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -402,6 +402,7 @@ struct pci_host_bridge_window {
 };
 
 struct pci_host_bridge {
+	u16	domain;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
 	struct list_head windows;	/* pci_host_bridge_windows */
@@ -769,14 +770,14 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops, void *sysdata);
-struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysdata);
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
 void pci_bus_release_busn_res(struct pci_bus *b);
-struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 dombus,
 					     struct pci_ops *ops, void *sysdata,
 					     struct list_head *resources);
 struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
diff --git a/include/uapi/linux/pci.h b/include/uapi/linux/pci.h
index 3c292bc..89c6f15 100644
--- a/include/uapi/linux/pci.h
+++ b/include/uapi/linux/pci.h
@@ -30,6 +30,9 @@
 #define PCI_DEVFN(slot, func)	((((slot) & 0x1f) << 3) | ((func) & 0x07))
 #define PCI_SLOT(devfn)		(((devfn) >> 3) & 0x1f)
 #define PCI_FUNC(devfn)		((devfn) & 0x07)
+#define PCI_DOMAIN(db)		((db) >> 16)
+#define PCI_BUSNUM(db)		((db) & 0xffff)
+#define PCI_DOMBUS(domain, bus)		(((domain) << 16) | (bus))
 
 /* Ioctls for /proc/bus/pci/X/Y nodes. */
 #define PCIIOC_BASE		('P' << 24 | 'C' << 16 | 'I' << 8)
-- 
1.7.1


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

* [PATCH 06/28] PCI: Combine PCI domain and bus number in u32 arg
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Currently, we use int type for bus number in
pci_create_root_bus(), pci_scan_root_bus() and
pci_scan_bus_legacy. Because PCI bus number
always <= 255, so we could change the bus number
argument type to u32, and combine PCI domain and
bus number in one. Also add a domain member in
pci_host_bridge to save domain number. Finally,
we could eliminate lots of the platform specific
pci_domain_nr() in the last of the series.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c      |   16 +++++++++-------
 include/linux/pci.h      |    7 ++++---
 include/uapi/linux/pci.h |    3 +++
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ed894cb..50f58b3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1889,7 +1889,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
 	int error;
@@ -1900,6 +1900,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	resource_size_t offset;
 	char bus_addr[64];
 	char *fmt;
+	u8	bus = PCI_BUSNUM(db);
 
 	b = pci_alloc_bus(NULL);
 	if (!b)
@@ -1920,6 +1921,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	if (!bridge)
 		goto err_out;
 
+	bridge->domain = PCI_DOMAIN(db);
 	bridge->dev.parent = parent;
 	bridge->dev.release = pci_release_host_bridge_dev;
 	dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus);
@@ -2057,7 +2059,7 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 			res, ret ? "can not be" : "is");
 }
 
-struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
 	struct pci_host_bridge_window *window;
@@ -2071,15 +2073,15 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 			break;
 		}
 
-	b = pci_create_root_bus(parent, bus, ops, sysdata, resources);
+	b = pci_create_root_bus(parent, db, ops, sysdata, resources);
 	if (!b)
 		return NULL;
 
 	if (!found) {
 		dev_info(&b->dev,
 		 "No busn resource found for root bus, will use [bus %02x-ff]\n",
-			bus);
-		pci_bus_insert_busn_res(b, bus, 255);
+			PCI_BUSNUM(db));
+		pci_bus_insert_busn_res(b, PCI_BUSNUM(db), 255);
 	}
 
 	max = pci_scan_child_bus(b);
@@ -2091,7 +2093,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
+struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
@@ -2100,7 +2102,7 @@ struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
 	pci_add_resource(&resources, &ioport_resource);
 	pci_add_resource(&resources, &iomem_resource);
 	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);
+	b = pci_create_root_bus(NULL, db, ops, sysdata, &resources);
 	if (b) {
 		pci_scan_child_bus(b);
 	} else {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a6fa2f1..c771508 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -402,6 +402,7 @@ struct pci_host_bridge_window {
 };
 
 struct pci_host_bridge {
+	u16	domain;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
 	struct list_head windows;	/* pci_host_bridge_windows */
@@ -769,14 +770,14 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops, void *sysdata);
-struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysdata);
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
 void pci_bus_release_busn_res(struct pci_bus *b);
-struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 dombus,
 					     struct pci_ops *ops, void *sysdata,
 					     struct list_head *resources);
 struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
diff --git a/include/uapi/linux/pci.h b/include/uapi/linux/pci.h
index 3c292bc..89c6f15 100644
--- a/include/uapi/linux/pci.h
+++ b/include/uapi/linux/pci.h
@@ -30,6 +30,9 @@
 #define PCI_DEVFN(slot, func)	((((slot) & 0x1f) << 3) | ((func) & 0x07))
 #define PCI_SLOT(devfn)		(((devfn) >> 3) & 0x1f)
 #define PCI_FUNC(devfn)		((devfn) & 0x07)
+#define PCI_DOMAIN(db)		((db) >> 16)
+#define PCI_BUSNUM(db)		((db) & 0xffff)
+#define PCI_DOMBUS(domain, bus)		(((domain) << 16) | (bus))
 
 /* Ioctls for /proc/bus/pci/X/Y nodes. */
 #define PCIIOC_BASE		('P' << 24 | 'C' << 16 | 'I' << 8)
-- 
1.7.1

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

* [PATCH 06/28] PCI: Combine PCI domain and bus number in u32 arg
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Currently, we use int type for bus number in
pci_create_root_bus(), pci_scan_root_bus() and
pci_scan_bus_legacy. Because PCI bus number
always <= 255, so we could change the bus number
argument type to u32, and combine PCI domain and
bus number in one. Also add a domain member in
pci_host_bridge to save domain number. Finally,
we could eliminate lots of the platform specific
pci_domain_nr() in the last of the series.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c      |   16 +++++++++-------
 include/linux/pci.h      |    7 ++++---
 include/uapi/linux/pci.h |    3 +++
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ed894cb..50f58b3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1889,7 +1889,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
 	int error;
@@ -1900,6 +1900,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	resource_size_t offset;
 	char bus_addr[64];
 	char *fmt;
+	u8	bus = PCI_BUSNUM(db);
 
 	b = pci_alloc_bus(NULL);
 	if (!b)
@@ -1920,6 +1921,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	if (!bridge)
 		goto err_out;
 
+	bridge->domain = PCI_DOMAIN(db);
 	bridge->dev.parent = parent;
 	bridge->dev.release = pci_release_host_bridge_dev;
 	dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus);
@@ -2057,7 +2059,7 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 			res, ret ? "can not be" : "is");
 }
 
-struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
 	struct pci_host_bridge_window *window;
@@ -2071,15 +2073,15 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 			break;
 		}
 
-	b = pci_create_root_bus(parent, bus, ops, sysdata, resources);
+	b = pci_create_root_bus(parent, db, ops, sysdata, resources);
 	if (!b)
 		return NULL;
 
 	if (!found) {
 		dev_info(&b->dev,
 		 "No busn resource found for root bus, will use [bus %02x-ff]\n",
-			bus);
-		pci_bus_insert_busn_res(b, bus, 255);
+			PCI_BUSNUM(db));
+		pci_bus_insert_busn_res(b, PCI_BUSNUM(db), 255);
 	}
 
 	max = pci_scan_child_bus(b);
@@ -2091,7 +2093,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
+struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
@@ -2100,7 +2102,7 @@ struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
 	pci_add_resource(&resources, &ioport_resource);
 	pci_add_resource(&resources, &iomem_resource);
 	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);
+	b = pci_create_root_bus(NULL, db, ops, sysdata, &resources);
 	if (b) {
 		pci_scan_child_bus(b);
 	} else {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a6fa2f1..c771508 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -402,6 +402,7 @@ struct pci_host_bridge_window {
 };
 
 struct pci_host_bridge {
+	u16	domain;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
 	struct list_head windows;	/* pci_host_bridge_windows */
@@ -769,14 +770,14 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops, void *sysdata);
-struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysdata);
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
 void pci_bus_release_busn_res(struct pci_bus *b);
-struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 dombus,
 					     struct pci_ops *ops, void *sysdata,
 					     struct list_head *resources);
 struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
diff --git a/include/uapi/linux/pci.h b/include/uapi/linux/pci.h
index 3c292bc..89c6f15 100644
--- a/include/uapi/linux/pci.h
+++ b/include/uapi/linux/pci.h
@@ -30,6 +30,9 @@
 #define PCI_DEVFN(slot, func)	((((slot) & 0x1f) << 3) | ((func) & 0x07))
 #define PCI_SLOT(devfn)		(((devfn) >> 3) & 0x1f)
 #define PCI_FUNC(devfn)		((devfn) & 0x07)
+#define PCI_DOMAIN(db)		((db) >> 16)
+#define PCI_BUSNUM(db)		((db) & 0xffff)
+#define PCI_DOMBUS(domain, bus)		(((domain) << 16) | (bus))
 
 /* Ioctls for /proc/bus/pci/X/Y nodes. */
 #define PCIIOC_BASE		('P' << 24 | 'C' << 16 | 'I' << 8)
-- 
1.7.1


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

* [PATCH 06/28] PCI: Combine PCI domain and bus number in u32 arg
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Currently, we use int type for bus number in
pci_create_root_bus(), pci_scan_root_bus() and
pci_scan_bus_legacy. Because PCI bus number
always <= 255, so we could change the bus number
argument type to u32, and combine PCI domain and
bus number in one. Also add a domain member in
pci_host_bridge to save domain number. Finally,
we could eliminate lots of the platform specific
pci_domain_nr() in the last of the series.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c      |   16 +++++++++-------
 include/linux/pci.h      |    7 ++++---
 include/uapi/linux/pci.h |    3 +++
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ed894cb..50f58b3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1889,7 +1889,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
 	int error;
@@ -1900,6 +1900,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	resource_size_t offset;
 	char bus_addr[64];
 	char *fmt;
+	u8	bus = PCI_BUSNUM(db);
 
 	b = pci_alloc_bus(NULL);
 	if (!b)
@@ -1920,6 +1921,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	if (!bridge)
 		goto err_out;
 
+	bridge->domain = PCI_DOMAIN(db);
 	bridge->dev.parent = parent;
 	bridge->dev.release = pci_release_host_bridge_dev;
 	dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus);
@@ -2057,7 +2059,7 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 			res, ret ? "can not be" : "is");
 }
 
-struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
 	struct pci_host_bridge_window *window;
@@ -2071,15 +2073,15 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 			break;
 		}
 
-	b = pci_create_root_bus(parent, bus, ops, sysdata, resources);
+	b = pci_create_root_bus(parent, db, ops, sysdata, resources);
 	if (!b)
 		return NULL;
 
 	if (!found) {
 		dev_info(&b->dev,
 		 "No busn resource found for root bus, will use [bus %02x-ff]\n",
-			bus);
-		pci_bus_insert_busn_res(b, bus, 255);
+			PCI_BUSNUM(db));
+		pci_bus_insert_busn_res(b, PCI_BUSNUM(db), 255);
 	}
 
 	max = pci_scan_child_bus(b);
@@ -2091,7 +2093,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
+struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
@@ -2100,7 +2102,7 @@ struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops,
 	pci_add_resource(&resources, &ioport_resource);
 	pci_add_resource(&resources, &iomem_resource);
 	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);
+	b = pci_create_root_bus(NULL, db, ops, sysdata, &resources);
 	if (b) {
 		pci_scan_child_bus(b);
 	} else {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a6fa2f1..c771508 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -402,6 +402,7 @@ struct pci_host_bridge_window {
 };
 
 struct pci_host_bridge {
+	u16	domain;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
 	struct list_head windows;	/* pci_host_bridge_windows */
@@ -769,14 +770,14 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus_legacy(int bus, struct pci_ops *ops, void *sysdata);
-struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysdata);
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
 void pci_bus_release_busn_res(struct pci_bus *b);
-struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 dombus,
 					     struct pci_ops *ops, void *sysdata,
 					     struct list_head *resources);
 struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
diff --git a/include/uapi/linux/pci.h b/include/uapi/linux/pci.h
index 3c292bc..89c6f15 100644
--- a/include/uapi/linux/pci.h
+++ b/include/uapi/linux/pci.h
@@ -30,6 +30,9 @@
 #define PCI_DEVFN(slot, func)	((((slot) & 0x1f) << 3) | ((func) & 0x07))
 #define PCI_SLOT(devfn)		(((devfn) >> 3) & 0x1f)
 #define PCI_FUNC(devfn)		((devfn) & 0x07)
+#define PCI_DOMAIN(db)		((db) >> 16)
+#define PCI_BUSNUM(db)		((db) & 0xffff)
+#define PCI_DOMBUS(domain, bus)		(((domain) << 16) | (bus))
 
 /* Ioctls for /proc/bus/pci/X/Y nodes. */
 #define PCIIOC_BASE		('P' << 24 | 'C' << 16 | 'I' << 8)
-- 
1.7.1

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

* [PATCH 07/28] PCI: Pass PCI domain number combined with root bus number
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we could pass PCI domain combined with bus number
in u32 argu. Because in arm/arm64, PCI domain number
is assigned by pci_bus_assign_domain_nr(). So we leave
pci_scan_root_bus() and pci_create_root_bus() in arm/arm64
unchanged. A new function pci_host_assign_domain_nr()
will be introduced for arm/arm64 to assign domain number
in later patch.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/kernel/pci.c          |    5 +++--
 arch/alpha/kernel/sys_nautilus.c |    3 ++-
 arch/ia64/pci/pci.c              |    4 ++--
 arch/ia64/sn/kernel/io_init.c    |    5 +++--
 arch/microblaze/pci/pci-common.c |    5 +++--
 arch/mips/pci/pci.c              |    4 ++--
 arch/powerpc/kernel/pci-common.c |    5 +++--
 arch/s390/pci/pci.c              |    5 +++--
 arch/sh/drivers/pci/pci.c        |    5 +++--
 arch/sparc/kernel/pci.c          |    5 +++--
 arch/tile/kernel/pci.c           |    4 ++--
 arch/tile/kernel/pci_gx.c        |    5 +++--
 arch/x86/pci/acpi.c              |    6 +++---
 arch/x86/pci/common.c            |    3 ++-
 drivers/pci/xen-pcifront.c       |    5 +++--
 15 files changed, 40 insertions(+), 29 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 97f9730..b15f9f2 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -332,8 +332,9 @@ common_init_pci(void)
 		pci_add_resource_offset(&resources, hose->mem_space,
 					hose->mem_space->start);
 
-		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
-					hose, &resources);
+		bus = pci_scan_root_bus(NULL,
+				PCI_DOMBUS(hose->index, next_busno), alpha_mv.pci_ops,
+				hose, &resources);
 		if (bus)
 			pci_bus_add_devices(bus);
 		hose->bus = bus;
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 2c864bb..f7bfdf3 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -206,7 +206,8 @@ nautilus_init_pci(void)
 	unsigned long memtop = max_low_pfn << PAGE_SHIFT;
 
 	/* Scan our single hose.  */
-	bus = pci_scan_bus_legacy(0, alpha_mv.pci_ops, hose);
+	bus = pci_scan_bus_legacy(PCI_DOMBUS(hose->index, 0),
+			alpha_mv.pci_ops, hose);
 	hose->bus = bus;
 	pcibios_claim_one_bus(bus);
 
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 291a582..e457015 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -465,8 +465,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	 * should handle the case here, but it appears that IA64 hasn't
 	 * such quirk. So we just ignore the case now.
 	 */
-	pbus = pci_create_root_bus(NULL, bus, &pci_root_ops, controller,
-				   &info->resources);
+	pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus),
+			&pci_root_ops, controller, &info->resources);
 	if (!pbus) {
 		pci_free_resource_list(&info->resources);
 		__release_pci_root_info(info);
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 63b43a6..bcdc5b8 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -266,8 +266,9 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
 	pci_add_resource_offset(&resources,	&res[1],
 			prom_bussoft_ptr->bs_legacy_mem);
 
-	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller,
-				&resources);
+	bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(controller->segment, busnum),
+			&pci_root_ops, controller, &resources);
  	if (bus == NULL) {
 		kfree(res);
 		kfree(controller);
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 009b271..890bd36 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1339,8 +1339,9 @@ static void pcibios_scan_phb(struct pci_controller *hose)
 
 	pcibios_setup_phb_resources(hose, &resources);
 
-	bus = pci_scan_root_bus(hose->parent, hose->first_busno,
-				hose->ops, hose, &resources);
+	bus = pci_scan_root_bus(hose->parent,
+			PCI_DOMBUS(hose->global_number, hose->first_busno),
+			hose->ops, hose, &resources);
 	if (bus == NULL) {
 		pr_err("Failed to create bus for PCI domain %04x\n",
 		       hose->global_number);
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 9eb54b5..980755a 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -92,8 +92,8 @@ static void pcibios_scanbus(struct pci_controller *hose)
 	pci_add_resource_offset(&resources,
 				hose->mem_resource, hose->mem_offset);
 	pci_add_resource_offset(&resources, hose->io_resource, hose->io_offset);
-	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
-				&resources);
+	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(hose->index, next_busno),
+			hose->pci_ops, hose, &resources);
 	if (!bus)
 		pci_free_resource_list(&resources);
 
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 37d512d..927c3dd 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1602,8 +1602,9 @@ void pcibios_scan_phb(struct pci_controller *hose)
 	pci_add_resource(&resources, &hose->busn);
 
 	/* Create an empty bus for the toplevel */
-	bus = pci_create_root_bus(hose->parent, hose->first_busno,
-				  hose->ops, hose, &resources);
+	bus = pci_create_root_bus(hose->parent,
+			PCI_DOMBUS(hose->global_number, hose->first_busno),
+			hose->ops, hose, &resources);
 	if (bus == NULL) {
 		pr_err("Failed to create bus for PCI domain %04x\n",
 			hose->global_number);
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 0b32769..612decf 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -750,8 +750,9 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
 	if (ret)
 		return ret;
 
-	zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops,
-				      zdev, &resources);
+	zdev->bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(zdev->domain, ZPCI_BUS_NR), &pci_root_ops,
+			zdev, &resources);
 	if (!zdev->bus) {
 		zpci_cleanup_bus_resources(zdev);
 		return -EIO;
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index efc1051..7ee0772 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -52,8 +52,9 @@ static void pcibios_scanbus(struct pci_channel *hose)
 		pci_add_resource_offset(&resources, res, offset);
 	}
 
-	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
-				&resources);
+	bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(hose->index, next_busno),
+			hose->pci_ops, hose, &resources);
 	hose->bus = bus;
 
 	need_domain_info = need_domain_info || hose->index;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index b36365f..d798b42 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -664,8 +664,9 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 	pbm->busn.end	= pbm->pci_last_busno;
 	pbm->busn.flags	= IORESOURCE_BUS;
 	pci_add_resource(&resources, &pbm->busn);
-	bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops,
-				  pbm, &resources);
+	bus = pci_create_root_bus(parent,
+			PCI_DOMBUS(pbm->index, pbm->pci_first_busno),
+			pbm->pci_ops, pbm, &resources);
 	if (!bus) {
 		printk(KERN_ERR "Failed to create bus for %s\n",
 		       node->full_name);
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index 83d3e30..2603db5 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -306,8 +306,8 @@ int __init pcibios_init(void)
 
 			pci_add_resource(&resources, &ioport_resource);
 			pci_add_resource(&resources, &iomem_resource);
-			bus = pci_scan_root_bus(NULL, 0, controller->ops,
-						controller, &resources);
+			bus = pci_scan_root_bus(NULL, PCI_DOMBUS(controller->index, 0),
+					controller->ops, controller, &resources);
 			controller->root_bus = bus;
 			controller->last_busno = bus->busn_res.end;
 		}
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index d7a0729..1e6ff84 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -881,8 +881,9 @@ int __init pcibios_init(void)
 					controller->mem_offset);
 		pci_add_resource(&resources, &controller->io_space);
 		controller->first_busno = next_busno;
-		bus = pci_scan_root_bus(NULL, next_busno, controller->ops,
-					controller, &resources);
+		bus = pci_scan_root_bus(NULL,
+				PCI_DOMBUS(controller->index, next_busno),
+				controller->ops, controller, &resources);
 		controller->root_bus = bus;
 		next_busno = bus->busn_res.end + 1;
 	}
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index cfd1b13..8edea63 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -536,9 +536,9 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 		}
 
 		if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
-				    (u8)root->secondary.end, root->mcfg_addr))
-			bus = pci_create_root_bus(NULL, busnum, &pci_root_ops,
-						  sd, &resources);
+					(u8)root->secondary.end, root->mcfg_addr))
+			bus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, busnum),
+					&pci_root_ops, sd, &resources);
 
 		if (bus) {
 			pci_scan_child_bus(bus);
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 300d39e..d6879ee 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -470,7 +470,8 @@ void pcibios_scan_root(int busnum)
 	sd->node = x86_pci_root_bus_node(busnum);
 	x86_pci_root_bus_resources(busnum, &resources);
 	printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
-	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
+	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(0, busnum),
+			&pci_root_ops, sd, &resources);
 	if (!bus) {
 		pci_free_resource_list(&resources);
 		kfree(sd);
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 240ddbc..a010dfa 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -477,8 +477,9 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 
 	pci_lock_rescan_remove();
 
-	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
-				  &pcifront_bus_ops, sd, &resources);
+	b = pci_scan_root_bus(&pdev->xdev->dev,
+			PCI_DOMBUS(sd->domain, bus),
+			&pcifront_bus_ops, sd, &resources);
 	if (!b) {
 		dev_err(&pdev->xdev->dev,
 			"Error creating PCI Frontend Bus!\n");
-- 
1.7.1


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

* [PATCH 07/28] PCI: Pass PCI domain number combined with root bus number
  2015-01-16  1:43 ` Yijing Wang
                   ` (15 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we could pass PCI domain combined with bus number
in u32 argu. Because in arm/arm64, PCI domain number
is assigned by pci_bus_assign_domain_nr(). So we leave
pci_scan_root_bus() and pci_create_root_bus() in arm/arm64
unchanged. A new function pci_host_assign_domain_nr()
will be introduced for arm/arm64 to assign domain number
in later patch.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/kernel/pci.c          |    5 +++--
 arch/alpha/kernel/sys_nautilus.c |    3 ++-
 arch/ia64/pci/pci.c              |    4 ++--
 arch/ia64/sn/kernel/io_init.c    |    5 +++--
 arch/microblaze/pci/pci-common.c |    5 +++--
 arch/mips/pci/pci.c              |    4 ++--
 arch/powerpc/kernel/pci-common.c |    5 +++--
 arch/s390/pci/pci.c              |    5 +++--
 arch/sh/drivers/pci/pci.c        |    5 +++--
 arch/sparc/kernel/pci.c          |    5 +++--
 arch/tile/kernel/pci.c           |    4 ++--
 arch/tile/kernel/pci_gx.c        |    5 +++--
 arch/x86/pci/acpi.c              |    6 +++---
 arch/x86/pci/common.c            |    3 ++-
 drivers/pci/xen-pcifront.c       |    5 +++--
 15 files changed, 40 insertions(+), 29 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 97f9730..b15f9f2 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -332,8 +332,9 @@ common_init_pci(void)
 		pci_add_resource_offset(&resources, hose->mem_space,
 					hose->mem_space->start);
 
-		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
-					hose, &resources);
+		bus = pci_scan_root_bus(NULL,
+				PCI_DOMBUS(hose->index, next_busno), alpha_mv.pci_ops,
+				hose, &resources);
 		if (bus)
 			pci_bus_add_devices(bus);
 		hose->bus = bus;
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 2c864bb..f7bfdf3 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -206,7 +206,8 @@ nautilus_init_pci(void)
 	unsigned long memtop = max_low_pfn << PAGE_SHIFT;
 
 	/* Scan our single hose.  */
-	bus = pci_scan_bus_legacy(0, alpha_mv.pci_ops, hose);
+	bus = pci_scan_bus_legacy(PCI_DOMBUS(hose->index, 0),
+			alpha_mv.pci_ops, hose);
 	hose->bus = bus;
 	pcibios_claim_one_bus(bus);
 
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 291a582..e457015 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -465,8 +465,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	 * should handle the case here, but it appears that IA64 hasn't
 	 * such quirk. So we just ignore the case now.
 	 */
-	pbus = pci_create_root_bus(NULL, bus, &pci_root_ops, controller,
-				   &info->resources);
+	pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus),
+			&pci_root_ops, controller, &info->resources);
 	if (!pbus) {
 		pci_free_resource_list(&info->resources);
 		__release_pci_root_info(info);
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 63b43a6..bcdc5b8 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -266,8 +266,9 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
 	pci_add_resource_offset(&resources,	&res[1],
 			prom_bussoft_ptr->bs_legacy_mem);
 
-	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller,
-				&resources);
+	bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(controller->segment, busnum),
+			&pci_root_ops, controller, &resources);
  	if (bus == NULL) {
 		kfree(res);
 		kfree(controller);
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 009b271..890bd36 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1339,8 +1339,9 @@ static void pcibios_scan_phb(struct pci_controller *hose)
 
 	pcibios_setup_phb_resources(hose, &resources);
 
-	bus = pci_scan_root_bus(hose->parent, hose->first_busno,
-				hose->ops, hose, &resources);
+	bus = pci_scan_root_bus(hose->parent,
+			PCI_DOMBUS(hose->global_number, hose->first_busno),
+			hose->ops, hose, &resources);
 	if (bus == NULL) {
 		pr_err("Failed to create bus for PCI domain %04x\n",
 		       hose->global_number);
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 9eb54b5..980755a 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -92,8 +92,8 @@ static void pcibios_scanbus(struct pci_controller *hose)
 	pci_add_resource_offset(&resources,
 				hose->mem_resource, hose->mem_offset);
 	pci_add_resource_offset(&resources, hose->io_resource, hose->io_offset);
-	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
-				&resources);
+	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(hose->index, next_busno),
+			hose->pci_ops, hose, &resources);
 	if (!bus)
 		pci_free_resource_list(&resources);
 
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 37d512d..927c3dd 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1602,8 +1602,9 @@ void pcibios_scan_phb(struct pci_controller *hose)
 	pci_add_resource(&resources, &hose->busn);
 
 	/* Create an empty bus for the toplevel */
-	bus = pci_create_root_bus(hose->parent, hose->first_busno,
-				  hose->ops, hose, &resources);
+	bus = pci_create_root_bus(hose->parent,
+			PCI_DOMBUS(hose->global_number, hose->first_busno),
+			hose->ops, hose, &resources);
 	if (bus == NULL) {
 		pr_err("Failed to create bus for PCI domain %04x\n",
 			hose->global_number);
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 0b32769..612decf 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -750,8 +750,9 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
 	if (ret)
 		return ret;
 
-	zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops,
-				      zdev, &resources);
+	zdev->bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(zdev->domain, ZPCI_BUS_NR), &pci_root_ops,
+			zdev, &resources);
 	if (!zdev->bus) {
 		zpci_cleanup_bus_resources(zdev);
 		return -EIO;
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index efc1051..7ee0772 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -52,8 +52,9 @@ static void pcibios_scanbus(struct pci_channel *hose)
 		pci_add_resource_offset(&resources, res, offset);
 	}
 
-	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
-				&resources);
+	bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(hose->index, next_busno),
+			hose->pci_ops, hose, &resources);
 	hose->bus = bus;
 
 	need_domain_info = need_domain_info || hose->index;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index b36365f..d798b42 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -664,8 +664,9 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 	pbm->busn.end	= pbm->pci_last_busno;
 	pbm->busn.flags	= IORESOURCE_BUS;
 	pci_add_resource(&resources, &pbm->busn);
-	bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops,
-				  pbm, &resources);
+	bus = pci_create_root_bus(parent,
+			PCI_DOMBUS(pbm->index, pbm->pci_first_busno),
+			pbm->pci_ops, pbm, &resources);
 	if (!bus) {
 		printk(KERN_ERR "Failed to create bus for %s\n",
 		       node->full_name);
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index 83d3e30..2603db5 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -306,8 +306,8 @@ int __init pcibios_init(void)
 
 			pci_add_resource(&resources, &ioport_resource);
 			pci_add_resource(&resources, &iomem_resource);
-			bus = pci_scan_root_bus(NULL, 0, controller->ops,
-						controller, &resources);
+			bus = pci_scan_root_bus(NULL, PCI_DOMBUS(controller->index, 0),
+					controller->ops, controller, &resources);
 			controller->root_bus = bus;
 			controller->last_busno = bus->busn_res.end;
 		}
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index d7a0729..1e6ff84 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -881,8 +881,9 @@ int __init pcibios_init(void)
 					controller->mem_offset);
 		pci_add_resource(&resources, &controller->io_space);
 		controller->first_busno = next_busno;
-		bus = pci_scan_root_bus(NULL, next_busno, controller->ops,
-					controller, &resources);
+		bus = pci_scan_root_bus(NULL,
+				PCI_DOMBUS(controller->index, next_busno),
+				controller->ops, controller, &resources);
 		controller->root_bus = bus;
 		next_busno = bus->busn_res.end + 1;
 	}
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index cfd1b13..8edea63 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -536,9 +536,9 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 		}
 
 		if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
-				    (u8)root->secondary.end, root->mcfg_addr))
-			bus = pci_create_root_bus(NULL, busnum, &pci_root_ops,
-						  sd, &resources);
+					(u8)root->secondary.end, root->mcfg_addr))
+			bus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, busnum),
+					&pci_root_ops, sd, &resources);
 
 		if (bus) {
 			pci_scan_child_bus(bus);
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 300d39e..d6879ee 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -470,7 +470,8 @@ void pcibios_scan_root(int busnum)
 	sd->node = x86_pci_root_bus_node(busnum);
 	x86_pci_root_bus_resources(busnum, &resources);
 	printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
-	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
+	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(0, busnum),
+			&pci_root_ops, sd, &resources);
 	if (!bus) {
 		pci_free_resource_list(&resources);
 		kfree(sd);
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 240ddbc..a010dfa 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -477,8 +477,9 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 
 	pci_lock_rescan_remove();
 
-	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
-				  &pcifront_bus_ops, sd, &resources);
+	b = pci_scan_root_bus(&pdev->xdev->dev,
+			PCI_DOMBUS(sd->domain, bus),
+			&pcifront_bus_ops, sd, &resources);
 	if (!b) {
 		dev_err(&pdev->xdev->dev,
 			"Error creating PCI Frontend Bus!\n");
-- 
1.7.1

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

* [PATCH 07/28] PCI: Pass PCI domain number combined with root bus number
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we could pass PCI domain combined with bus number
in u32 argu. Because in arm/arm64, PCI domain number
is assigned by pci_bus_assign_domain_nr(). So we leave
pci_scan_root_bus() and pci_create_root_bus() in arm/arm64
unchanged. A new function pci_host_assign_domain_nr()
will be introduced for arm/arm64 to assign domain number
in later patch.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/kernel/pci.c          |    5 +++--
 arch/alpha/kernel/sys_nautilus.c |    3 ++-
 arch/ia64/pci/pci.c              |    4 ++--
 arch/ia64/sn/kernel/io_init.c    |    5 +++--
 arch/microblaze/pci/pci-common.c |    5 +++--
 arch/mips/pci/pci.c              |    4 ++--
 arch/powerpc/kernel/pci-common.c |    5 +++--
 arch/s390/pci/pci.c              |    5 +++--
 arch/sh/drivers/pci/pci.c        |    5 +++--
 arch/sparc/kernel/pci.c          |    5 +++--
 arch/tile/kernel/pci.c           |    4 ++--
 arch/tile/kernel/pci_gx.c        |    5 +++--
 arch/x86/pci/acpi.c              |    6 +++---
 arch/x86/pci/common.c            |    3 ++-
 drivers/pci/xen-pcifront.c       |    5 +++--
 15 files changed, 40 insertions(+), 29 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 97f9730..b15f9f2 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -332,8 +332,9 @@ common_init_pci(void)
 		pci_add_resource_offset(&resources, hose->mem_space,
 					hose->mem_space->start);
 
-		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
-					hose, &resources);
+		bus = pci_scan_root_bus(NULL,
+				PCI_DOMBUS(hose->index, next_busno), alpha_mv.pci_ops,
+				hose, &resources);
 		if (bus)
 			pci_bus_add_devices(bus);
 		hose->bus = bus;
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 2c864bb..f7bfdf3 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -206,7 +206,8 @@ nautilus_init_pci(void)
 	unsigned long memtop = max_low_pfn << PAGE_SHIFT;
 
 	/* Scan our single hose.  */
-	bus = pci_scan_bus_legacy(0, alpha_mv.pci_ops, hose);
+	bus = pci_scan_bus_legacy(PCI_DOMBUS(hose->index, 0),
+			alpha_mv.pci_ops, hose);
 	hose->bus = bus;
 	pcibios_claim_one_bus(bus);
 
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 291a582..e457015 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -465,8 +465,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	 * should handle the case here, but it appears that IA64 hasn't
 	 * such quirk. So we just ignore the case now.
 	 */
-	pbus = pci_create_root_bus(NULL, bus, &pci_root_ops, controller,
-				   &info->resources);
+	pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus),
+			&pci_root_ops, controller, &info->resources);
 	if (!pbus) {
 		pci_free_resource_list(&info->resources);
 		__release_pci_root_info(info);
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 63b43a6..bcdc5b8 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -266,8 +266,9 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
 	pci_add_resource_offset(&resources,	&res[1],
 			prom_bussoft_ptr->bs_legacy_mem);
 
-	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller,
-				&resources);
+	bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(controller->segment, busnum),
+			&pci_root_ops, controller, &resources);
  	if (bus == NULL) {
 		kfree(res);
 		kfree(controller);
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 009b271..890bd36 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1339,8 +1339,9 @@ static void pcibios_scan_phb(struct pci_controller *hose)
 
 	pcibios_setup_phb_resources(hose, &resources);
 
-	bus = pci_scan_root_bus(hose->parent, hose->first_busno,
-				hose->ops, hose, &resources);
+	bus = pci_scan_root_bus(hose->parent,
+			PCI_DOMBUS(hose->global_number, hose->first_busno),
+			hose->ops, hose, &resources);
 	if (bus == NULL) {
 		pr_err("Failed to create bus for PCI domain %04x\n",
 		       hose->global_number);
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 9eb54b5..980755a 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -92,8 +92,8 @@ static void pcibios_scanbus(struct pci_controller *hose)
 	pci_add_resource_offset(&resources,
 				hose->mem_resource, hose->mem_offset);
 	pci_add_resource_offset(&resources, hose->io_resource, hose->io_offset);
-	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
-				&resources);
+	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(hose->index, next_busno),
+			hose->pci_ops, hose, &resources);
 	if (!bus)
 		pci_free_resource_list(&resources);
 
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 37d512d..927c3dd 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1602,8 +1602,9 @@ void pcibios_scan_phb(struct pci_controller *hose)
 	pci_add_resource(&resources, &hose->busn);
 
 	/* Create an empty bus for the toplevel */
-	bus = pci_create_root_bus(hose->parent, hose->first_busno,
-				  hose->ops, hose, &resources);
+	bus = pci_create_root_bus(hose->parent,
+			PCI_DOMBUS(hose->global_number, hose->first_busno),
+			hose->ops, hose, &resources);
 	if (bus == NULL) {
 		pr_err("Failed to create bus for PCI domain %04x\n",
 			hose->global_number);
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 0b32769..612decf 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -750,8 +750,9 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
 	if (ret)
 		return ret;
 
-	zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops,
-				      zdev, &resources);
+	zdev->bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(zdev->domain, ZPCI_BUS_NR), &pci_root_ops,
+			zdev, &resources);
 	if (!zdev->bus) {
 		zpci_cleanup_bus_resources(zdev);
 		return -EIO;
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index efc1051..7ee0772 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -52,8 +52,9 @@ static void pcibios_scanbus(struct pci_channel *hose)
 		pci_add_resource_offset(&resources, res, offset);
 	}
 
-	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
-				&resources);
+	bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(hose->index, next_busno),
+			hose->pci_ops, hose, &resources);
 	hose->bus = bus;
 
 	need_domain_info = need_domain_info || hose->index;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index b36365f..d798b42 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -664,8 +664,9 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 	pbm->busn.end	= pbm->pci_last_busno;
 	pbm->busn.flags	= IORESOURCE_BUS;
 	pci_add_resource(&resources, &pbm->busn);
-	bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops,
-				  pbm, &resources);
+	bus = pci_create_root_bus(parent,
+			PCI_DOMBUS(pbm->index, pbm->pci_first_busno),
+			pbm->pci_ops, pbm, &resources);
 	if (!bus) {
 		printk(KERN_ERR "Failed to create bus for %s\n",
 		       node->full_name);
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index 83d3e30..2603db5 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -306,8 +306,8 @@ int __init pcibios_init(void)
 
 			pci_add_resource(&resources, &ioport_resource);
 			pci_add_resource(&resources, &iomem_resource);
-			bus = pci_scan_root_bus(NULL, 0, controller->ops,
-						controller, &resources);
+			bus = pci_scan_root_bus(NULL, PCI_DOMBUS(controller->index, 0),
+					controller->ops, controller, &resources);
 			controller->root_bus = bus;
 			controller->last_busno = bus->busn_res.end;
 		}
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index d7a0729..1e6ff84 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -881,8 +881,9 @@ int __init pcibios_init(void)
 					controller->mem_offset);
 		pci_add_resource(&resources, &controller->io_space);
 		controller->first_busno = next_busno;
-		bus = pci_scan_root_bus(NULL, next_busno, controller->ops,
-					controller, &resources);
+		bus = pci_scan_root_bus(NULL,
+				PCI_DOMBUS(controller->index, next_busno),
+				controller->ops, controller, &resources);
 		controller->root_bus = bus;
 		next_busno = bus->busn_res.end + 1;
 	}
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index cfd1b13..8edea63 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -536,9 +536,9 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 		}
 
 		if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
-				    (u8)root->secondary.end, root->mcfg_addr))
-			bus = pci_create_root_bus(NULL, busnum, &pci_root_ops,
-						  sd, &resources);
+					(u8)root->secondary.end, root->mcfg_addr))
+			bus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, busnum),
+					&pci_root_ops, sd, &resources);
 
 		if (bus) {
 			pci_scan_child_bus(bus);
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 300d39e..d6879ee 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -470,7 +470,8 @@ void pcibios_scan_root(int busnum)
 	sd->node = x86_pci_root_bus_node(busnum);
 	x86_pci_root_bus_resources(busnum, &resources);
 	printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
-	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
+	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(0, busnum),
+			&pci_root_ops, sd, &resources);
 	if (!bus) {
 		pci_free_resource_list(&resources);
 		kfree(sd);
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 240ddbc..a010dfa 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -477,8 +477,9 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 
 	pci_lock_rescan_remove();
 
-	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
-				  &pcifront_bus_ops, sd, &resources);
+	b = pci_scan_root_bus(&pdev->xdev->dev,
+			PCI_DOMBUS(sd->domain, bus),
+			&pcifront_bus_ops, sd, &resources);
 	if (!b) {
 		dev_err(&pdev->xdev->dev,
 			"Error creating PCI Frontend Bus!\n");
-- 
1.7.1


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

* [PATCH 07/28] PCI: Pass PCI domain number combined with root bus number
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Now we could pass PCI domain combined with bus number
in u32 argu. Because in arm/arm64, PCI domain number
is assigned by pci_bus_assign_domain_nr(). So we leave
pci_scan_root_bus() and pci_create_root_bus() in arm/arm64
unchanged. A new function pci_host_assign_domain_nr()
will be introduced for arm/arm64 to assign domain number
in later patch.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/kernel/pci.c          |    5 +++--
 arch/alpha/kernel/sys_nautilus.c |    3 ++-
 arch/ia64/pci/pci.c              |    4 ++--
 arch/ia64/sn/kernel/io_init.c    |    5 +++--
 arch/microblaze/pci/pci-common.c |    5 +++--
 arch/mips/pci/pci.c              |    4 ++--
 arch/powerpc/kernel/pci-common.c |    5 +++--
 arch/s390/pci/pci.c              |    5 +++--
 arch/sh/drivers/pci/pci.c        |    5 +++--
 arch/sparc/kernel/pci.c          |    5 +++--
 arch/tile/kernel/pci.c           |    4 ++--
 arch/tile/kernel/pci_gx.c        |    5 +++--
 arch/x86/pci/acpi.c              |    6 +++---
 arch/x86/pci/common.c            |    3 ++-
 drivers/pci/xen-pcifront.c       |    5 +++--
 15 files changed, 40 insertions(+), 29 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 97f9730..b15f9f2 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -332,8 +332,9 @@ common_init_pci(void)
 		pci_add_resource_offset(&resources, hose->mem_space,
 					hose->mem_space->start);
 
-		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
-					hose, &resources);
+		bus = pci_scan_root_bus(NULL,
+				PCI_DOMBUS(hose->index, next_busno), alpha_mv.pci_ops,
+				hose, &resources);
 		if (bus)
 			pci_bus_add_devices(bus);
 		hose->bus = bus;
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 2c864bb..f7bfdf3 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -206,7 +206,8 @@ nautilus_init_pci(void)
 	unsigned long memtop = max_low_pfn << PAGE_SHIFT;
 
 	/* Scan our single hose.  */
-	bus = pci_scan_bus_legacy(0, alpha_mv.pci_ops, hose);
+	bus = pci_scan_bus_legacy(PCI_DOMBUS(hose->index, 0),
+			alpha_mv.pci_ops, hose);
 	hose->bus = bus;
 	pcibios_claim_one_bus(bus);
 
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 291a582..e457015 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -465,8 +465,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	 * should handle the case here, but it appears that IA64 hasn't
 	 * such quirk. So we just ignore the case now.
 	 */
-	pbus = pci_create_root_bus(NULL, bus, &pci_root_ops, controller,
-				   &info->resources);
+	pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus),
+			&pci_root_ops, controller, &info->resources);
 	if (!pbus) {
 		pci_free_resource_list(&info->resources);
 		__release_pci_root_info(info);
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 63b43a6..bcdc5b8 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -266,8 +266,9 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
 	pci_add_resource_offset(&resources,	&res[1],
 			prom_bussoft_ptr->bs_legacy_mem);
 
-	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller,
-				&resources);
+	bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(controller->segment, busnum),
+			&pci_root_ops, controller, &resources);
  	if (bus == NULL) {
 		kfree(res);
 		kfree(controller);
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 009b271..890bd36 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1339,8 +1339,9 @@ static void pcibios_scan_phb(struct pci_controller *hose)
 
 	pcibios_setup_phb_resources(hose, &resources);
 
-	bus = pci_scan_root_bus(hose->parent, hose->first_busno,
-				hose->ops, hose, &resources);
+	bus = pci_scan_root_bus(hose->parent,
+			PCI_DOMBUS(hose->global_number, hose->first_busno),
+			hose->ops, hose, &resources);
 	if (bus == NULL) {
 		pr_err("Failed to create bus for PCI domain %04x\n",
 		       hose->global_number);
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 9eb54b5..980755a 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -92,8 +92,8 @@ static void pcibios_scanbus(struct pci_controller *hose)
 	pci_add_resource_offset(&resources,
 				hose->mem_resource, hose->mem_offset);
 	pci_add_resource_offset(&resources, hose->io_resource, hose->io_offset);
-	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
-				&resources);
+	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(hose->index, next_busno),
+			hose->pci_ops, hose, &resources);
 	if (!bus)
 		pci_free_resource_list(&resources);
 
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 37d512d..927c3dd 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1602,8 +1602,9 @@ void pcibios_scan_phb(struct pci_controller *hose)
 	pci_add_resource(&resources, &hose->busn);
 
 	/* Create an empty bus for the toplevel */
-	bus = pci_create_root_bus(hose->parent, hose->first_busno,
-				  hose->ops, hose, &resources);
+	bus = pci_create_root_bus(hose->parent,
+			PCI_DOMBUS(hose->global_number, hose->first_busno),
+			hose->ops, hose, &resources);
 	if (bus == NULL) {
 		pr_err("Failed to create bus for PCI domain %04x\n",
 			hose->global_number);
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 0b32769..612decf 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -750,8 +750,9 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
 	if (ret)
 		return ret;
 
-	zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops,
-				      zdev, &resources);
+	zdev->bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(zdev->domain, ZPCI_BUS_NR), &pci_root_ops,
+			zdev, &resources);
 	if (!zdev->bus) {
 		zpci_cleanup_bus_resources(zdev);
 		return -EIO;
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index efc1051..7ee0772 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -52,8 +52,9 @@ static void pcibios_scanbus(struct pci_channel *hose)
 		pci_add_resource_offset(&resources, res, offset);
 	}
 
-	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
-				&resources);
+	bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(hose->index, next_busno),
+			hose->pci_ops, hose, &resources);
 	hose->bus = bus;
 
 	need_domain_info = need_domain_info || hose->index;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index b36365f..d798b42 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -664,8 +664,9 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 	pbm->busn.end	= pbm->pci_last_busno;
 	pbm->busn.flags	= IORESOURCE_BUS;
 	pci_add_resource(&resources, &pbm->busn);
-	bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops,
-				  pbm, &resources);
+	bus = pci_create_root_bus(parent,
+			PCI_DOMBUS(pbm->index, pbm->pci_first_busno),
+			pbm->pci_ops, pbm, &resources);
 	if (!bus) {
 		printk(KERN_ERR "Failed to create bus for %s\n",
 		       node->full_name);
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index 83d3e30..2603db5 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -306,8 +306,8 @@ int __init pcibios_init(void)
 
 			pci_add_resource(&resources, &ioport_resource);
 			pci_add_resource(&resources, &iomem_resource);
-			bus = pci_scan_root_bus(NULL, 0, controller->ops,
-						controller, &resources);
+			bus = pci_scan_root_bus(NULL, PCI_DOMBUS(controller->index, 0),
+					controller->ops, controller, &resources);
 			controller->root_bus = bus;
 			controller->last_busno = bus->busn_res.end;
 		}
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index d7a0729..1e6ff84 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -881,8 +881,9 @@ int __init pcibios_init(void)
 					controller->mem_offset);
 		pci_add_resource(&resources, &controller->io_space);
 		controller->first_busno = next_busno;
-		bus = pci_scan_root_bus(NULL, next_busno, controller->ops,
-					controller, &resources);
+		bus = pci_scan_root_bus(NULL,
+				PCI_DOMBUS(controller->index, next_busno),
+				controller->ops, controller, &resources);
 		controller->root_bus = bus;
 		next_busno = bus->busn_res.end + 1;
 	}
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index cfd1b13..8edea63 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -536,9 +536,9 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 		}
 
 		if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
-				    (u8)root->secondary.end, root->mcfg_addr))
-			bus = pci_create_root_bus(NULL, busnum, &pci_root_ops,
-						  sd, &resources);
+					(u8)root->secondary.end, root->mcfg_addr))
+			bus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, busnum),
+					&pci_root_ops, sd, &resources);
 
 		if (bus) {
 			pci_scan_child_bus(bus);
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 300d39e..d6879ee 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -470,7 +470,8 @@ void pcibios_scan_root(int busnum)
 	sd->node = x86_pci_root_bus_node(busnum);
 	x86_pci_root_bus_resources(busnum, &resources);
 	printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
-	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
+	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(0, busnum),
+			&pci_root_ops, sd, &resources);
 	if (!bus) {
 		pci_free_resource_list(&resources);
 		kfree(sd);
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 240ddbc..a010dfa 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -477,8 +477,9 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 
 	pci_lock_rescan_remove();
 
-	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
-				  &pcifront_bus_ops, sd, &resources);
+	b = pci_scan_root_bus(&pdev->xdev->dev,
+			PCI_DOMBUS(sd->domain, bus),
+			&pcifront_bus_ops, sd, &resources);
 	if (!b) {
 		dev_err(&pdev->xdev->dev,
 			"Error creating PCI Frontend Bus!\n");
-- 
1.7.1

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

* [PATCH 07/28] PCI: Pass PCI domain number combined with root bus number
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we could pass PCI domain combined with bus number
in u32 argu. Because in arm/arm64, PCI domain number
is assigned by pci_bus_assign_domain_nr(). So we leave
pci_scan_root_bus() and pci_create_root_bus() in arm/arm64
unchanged. A new function pci_host_assign_domain_nr()
will be introduced for arm/arm64 to assign domain number
in later patch.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/kernel/pci.c          |    5 +++--
 arch/alpha/kernel/sys_nautilus.c |    3 ++-
 arch/ia64/pci/pci.c              |    4 ++--
 arch/ia64/sn/kernel/io_init.c    |    5 +++--
 arch/microblaze/pci/pci-common.c |    5 +++--
 arch/mips/pci/pci.c              |    4 ++--
 arch/powerpc/kernel/pci-common.c |    5 +++--
 arch/s390/pci/pci.c              |    5 +++--
 arch/sh/drivers/pci/pci.c        |    5 +++--
 arch/sparc/kernel/pci.c          |    5 +++--
 arch/tile/kernel/pci.c           |    4 ++--
 arch/tile/kernel/pci_gx.c        |    5 +++--
 arch/x86/pci/acpi.c              |    6 +++---
 arch/x86/pci/common.c            |    3 ++-
 drivers/pci/xen-pcifront.c       |    5 +++--
 15 files changed, 40 insertions(+), 29 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 97f9730..b15f9f2 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -332,8 +332,9 @@ common_init_pci(void)
 		pci_add_resource_offset(&resources, hose->mem_space,
 					hose->mem_space->start);
 
-		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
-					hose, &resources);
+		bus = pci_scan_root_bus(NULL,
+				PCI_DOMBUS(hose->index, next_busno), alpha_mv.pci_ops,
+				hose, &resources);
 		if (bus)
 			pci_bus_add_devices(bus);
 		hose->bus = bus;
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 2c864bb..f7bfdf3 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -206,7 +206,8 @@ nautilus_init_pci(void)
 	unsigned long memtop = max_low_pfn << PAGE_SHIFT;
 
 	/* Scan our single hose.  */
-	bus = pci_scan_bus_legacy(0, alpha_mv.pci_ops, hose);
+	bus = pci_scan_bus_legacy(PCI_DOMBUS(hose->index, 0),
+			alpha_mv.pci_ops, hose);
 	hose->bus = bus;
 	pcibios_claim_one_bus(bus);
 
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 291a582..e457015 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -465,8 +465,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	 * should handle the case here, but it appears that IA64 hasn't
 	 * such quirk. So we just ignore the case now.
 	 */
-	pbus = pci_create_root_bus(NULL, bus, &pci_root_ops, controller,
-				   &info->resources);
+	pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus),
+			&pci_root_ops, controller, &info->resources);
 	if (!pbus) {
 		pci_free_resource_list(&info->resources);
 		__release_pci_root_info(info);
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 63b43a6..bcdc5b8 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -266,8 +266,9 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
 	pci_add_resource_offset(&resources,	&res[1],
 			prom_bussoft_ptr->bs_legacy_mem);
 
-	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller,
-				&resources);
+	bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(controller->segment, busnum),
+			&pci_root_ops, controller, &resources);
  	if (bus = NULL) {
 		kfree(res);
 		kfree(controller);
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 009b271..890bd36 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1339,8 +1339,9 @@ static void pcibios_scan_phb(struct pci_controller *hose)
 
 	pcibios_setup_phb_resources(hose, &resources);
 
-	bus = pci_scan_root_bus(hose->parent, hose->first_busno,
-				hose->ops, hose, &resources);
+	bus = pci_scan_root_bus(hose->parent,
+			PCI_DOMBUS(hose->global_number, hose->first_busno),
+			hose->ops, hose, &resources);
 	if (bus = NULL) {
 		pr_err("Failed to create bus for PCI domain %04x\n",
 		       hose->global_number);
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 9eb54b5..980755a 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -92,8 +92,8 @@ static void pcibios_scanbus(struct pci_controller *hose)
 	pci_add_resource_offset(&resources,
 				hose->mem_resource, hose->mem_offset);
 	pci_add_resource_offset(&resources, hose->io_resource, hose->io_offset);
-	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
-				&resources);
+	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(hose->index, next_busno),
+			hose->pci_ops, hose, &resources);
 	if (!bus)
 		pci_free_resource_list(&resources);
 
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 37d512d..927c3dd 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1602,8 +1602,9 @@ void pcibios_scan_phb(struct pci_controller *hose)
 	pci_add_resource(&resources, &hose->busn);
 
 	/* Create an empty bus for the toplevel */
-	bus = pci_create_root_bus(hose->parent, hose->first_busno,
-				  hose->ops, hose, &resources);
+	bus = pci_create_root_bus(hose->parent,
+			PCI_DOMBUS(hose->global_number, hose->first_busno),
+			hose->ops, hose, &resources);
 	if (bus = NULL) {
 		pr_err("Failed to create bus for PCI domain %04x\n",
 			hose->global_number);
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 0b32769..612decf 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -750,8 +750,9 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
 	if (ret)
 		return ret;
 
-	zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops,
-				      zdev, &resources);
+	zdev->bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(zdev->domain, ZPCI_BUS_NR), &pci_root_ops,
+			zdev, &resources);
 	if (!zdev->bus) {
 		zpci_cleanup_bus_resources(zdev);
 		return -EIO;
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index efc1051..7ee0772 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -52,8 +52,9 @@ static void pcibios_scanbus(struct pci_channel *hose)
 		pci_add_resource_offset(&resources, res, offset);
 	}
 
-	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
-				&resources);
+	bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(hose->index, next_busno),
+			hose->pci_ops, hose, &resources);
 	hose->bus = bus;
 
 	need_domain_info = need_domain_info || hose->index;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index b36365f..d798b42 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -664,8 +664,9 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 	pbm->busn.end	= pbm->pci_last_busno;
 	pbm->busn.flags	= IORESOURCE_BUS;
 	pci_add_resource(&resources, &pbm->busn);
-	bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops,
-				  pbm, &resources);
+	bus = pci_create_root_bus(parent,
+			PCI_DOMBUS(pbm->index, pbm->pci_first_busno),
+			pbm->pci_ops, pbm, &resources);
 	if (!bus) {
 		printk(KERN_ERR "Failed to create bus for %s\n",
 		       node->full_name);
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index 83d3e30..2603db5 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -306,8 +306,8 @@ int __init pcibios_init(void)
 
 			pci_add_resource(&resources, &ioport_resource);
 			pci_add_resource(&resources, &iomem_resource);
-			bus = pci_scan_root_bus(NULL, 0, controller->ops,
-						controller, &resources);
+			bus = pci_scan_root_bus(NULL, PCI_DOMBUS(controller->index, 0),
+					controller->ops, controller, &resources);
 			controller->root_bus = bus;
 			controller->last_busno = bus->busn_res.end;
 		}
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index d7a0729..1e6ff84 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -881,8 +881,9 @@ int __init pcibios_init(void)
 					controller->mem_offset);
 		pci_add_resource(&resources, &controller->io_space);
 		controller->first_busno = next_busno;
-		bus = pci_scan_root_bus(NULL, next_busno, controller->ops,
-					controller, &resources);
+		bus = pci_scan_root_bus(NULL,
+				PCI_DOMBUS(controller->index, next_busno),
+				controller->ops, controller, &resources);
 		controller->root_bus = bus;
 		next_busno = bus->busn_res.end + 1;
 	}
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index cfd1b13..8edea63 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -536,9 +536,9 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 		}
 
 		if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
-				    (u8)root->secondary.end, root->mcfg_addr))
-			bus = pci_create_root_bus(NULL, busnum, &pci_root_ops,
-						  sd, &resources);
+					(u8)root->secondary.end, root->mcfg_addr))
+			bus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, busnum),
+					&pci_root_ops, sd, &resources);
 
 		if (bus) {
 			pci_scan_child_bus(bus);
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 300d39e..d6879ee 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -470,7 +470,8 @@ void pcibios_scan_root(int busnum)
 	sd->node = x86_pci_root_bus_node(busnum);
 	x86_pci_root_bus_resources(busnum, &resources);
 	printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
-	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
+	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(0, busnum),
+			&pci_root_ops, sd, &resources);
 	if (!bus) {
 		pci_free_resource_list(&resources);
 		kfree(sd);
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 240ddbc..a010dfa 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -477,8 +477,9 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 
 	pci_lock_rescan_remove();
 
-	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
-				  &pcifront_bus_ops, sd, &resources);
+	b = pci_scan_root_bus(&pdev->xdev->dev,
+			PCI_DOMBUS(sd->domain, bus),
+			&pcifront_bus_ops, sd, &resources);
 	if (!b) {
 		dev_err(&pdev->xdev->dev,
 			"Error creating PCI Frontend Bus!\n");
-- 
1.7.1


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

* [PATCH 07/28] PCI: Pass PCI domain number combined with root bus number
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we could pass PCI domain combined with bus number
in u32 argu. Because in arm/arm64, PCI domain number
is assigned by pci_bus_assign_domain_nr(). So we leave
pci_scan_root_bus() and pci_create_root_bus() in arm/arm64
unchanged. A new function pci_host_assign_domain_nr()
will be introduced for arm/arm64 to assign domain number
in later patch.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/kernel/pci.c          |    5 +++--
 arch/alpha/kernel/sys_nautilus.c |    3 ++-
 arch/ia64/pci/pci.c              |    4 ++--
 arch/ia64/sn/kernel/io_init.c    |    5 +++--
 arch/microblaze/pci/pci-common.c |    5 +++--
 arch/mips/pci/pci.c              |    4 ++--
 arch/powerpc/kernel/pci-common.c |    5 +++--
 arch/s390/pci/pci.c              |    5 +++--
 arch/sh/drivers/pci/pci.c        |    5 +++--
 arch/sparc/kernel/pci.c          |    5 +++--
 arch/tile/kernel/pci.c           |    4 ++--
 arch/tile/kernel/pci_gx.c        |    5 +++--
 arch/x86/pci/acpi.c              |    6 +++---
 arch/x86/pci/common.c            |    3 ++-
 drivers/pci/xen-pcifront.c       |    5 +++--
 15 files changed, 40 insertions(+), 29 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 97f9730..b15f9f2 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -332,8 +332,9 @@ common_init_pci(void)
 		pci_add_resource_offset(&resources, hose->mem_space,
 					hose->mem_space->start);
 
-		bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
-					hose, &resources);
+		bus = pci_scan_root_bus(NULL,
+				PCI_DOMBUS(hose->index, next_busno), alpha_mv.pci_ops,
+				hose, &resources);
 		if (bus)
 			pci_bus_add_devices(bus);
 		hose->bus = bus;
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 2c864bb..f7bfdf3 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -206,7 +206,8 @@ nautilus_init_pci(void)
 	unsigned long memtop = max_low_pfn << PAGE_SHIFT;
 
 	/* Scan our single hose.  */
-	bus = pci_scan_bus_legacy(0, alpha_mv.pci_ops, hose);
+	bus = pci_scan_bus_legacy(PCI_DOMBUS(hose->index, 0),
+			alpha_mv.pci_ops, hose);
 	hose->bus = bus;
 	pcibios_claim_one_bus(bus);
 
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 291a582..e457015 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -465,8 +465,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	 * should handle the case here, but it appears that IA64 hasn't
 	 * such quirk. So we just ignore the case now.
 	 */
-	pbus = pci_create_root_bus(NULL, bus, &pci_root_ops, controller,
-				   &info->resources);
+	pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus),
+			&pci_root_ops, controller, &info->resources);
 	if (!pbus) {
 		pci_free_resource_list(&info->resources);
 		__release_pci_root_info(info);
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 63b43a6..bcdc5b8 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -266,8 +266,9 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
 	pci_add_resource_offset(&resources,	&res[1],
 			prom_bussoft_ptr->bs_legacy_mem);
 
-	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller,
-				&resources);
+	bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(controller->segment, busnum),
+			&pci_root_ops, controller, &resources);
  	if (bus == NULL) {
 		kfree(res);
 		kfree(controller);
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 009b271..890bd36 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1339,8 +1339,9 @@ static void pcibios_scan_phb(struct pci_controller *hose)
 
 	pcibios_setup_phb_resources(hose, &resources);
 
-	bus = pci_scan_root_bus(hose->parent, hose->first_busno,
-				hose->ops, hose, &resources);
+	bus = pci_scan_root_bus(hose->parent,
+			PCI_DOMBUS(hose->global_number, hose->first_busno),
+			hose->ops, hose, &resources);
 	if (bus == NULL) {
 		pr_err("Failed to create bus for PCI domain %04x\n",
 		       hose->global_number);
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 9eb54b5..980755a 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -92,8 +92,8 @@ static void pcibios_scanbus(struct pci_controller *hose)
 	pci_add_resource_offset(&resources,
 				hose->mem_resource, hose->mem_offset);
 	pci_add_resource_offset(&resources, hose->io_resource, hose->io_offset);
-	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
-				&resources);
+	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(hose->index, next_busno),
+			hose->pci_ops, hose, &resources);
 	if (!bus)
 		pci_free_resource_list(&resources);
 
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 37d512d..927c3dd 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1602,8 +1602,9 @@ void pcibios_scan_phb(struct pci_controller *hose)
 	pci_add_resource(&resources, &hose->busn);
 
 	/* Create an empty bus for the toplevel */
-	bus = pci_create_root_bus(hose->parent, hose->first_busno,
-				  hose->ops, hose, &resources);
+	bus = pci_create_root_bus(hose->parent,
+			PCI_DOMBUS(hose->global_number, hose->first_busno),
+			hose->ops, hose, &resources);
 	if (bus == NULL) {
 		pr_err("Failed to create bus for PCI domain %04x\n",
 			hose->global_number);
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 0b32769..612decf 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -750,8 +750,9 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
 	if (ret)
 		return ret;
 
-	zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops,
-				      zdev, &resources);
+	zdev->bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(zdev->domain, ZPCI_BUS_NR), &pci_root_ops,
+			zdev, &resources);
 	if (!zdev->bus) {
 		zpci_cleanup_bus_resources(zdev);
 		return -EIO;
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index efc1051..7ee0772 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -52,8 +52,9 @@ static void pcibios_scanbus(struct pci_channel *hose)
 		pci_add_resource_offset(&resources, res, offset);
 	}
 
-	bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
-				&resources);
+	bus = pci_scan_root_bus(NULL,
+			PCI_DOMBUS(hose->index, next_busno),
+			hose->pci_ops, hose, &resources);
 	hose->bus = bus;
 
 	need_domain_info = need_domain_info || hose->index;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index b36365f..d798b42 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -664,8 +664,9 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 	pbm->busn.end	= pbm->pci_last_busno;
 	pbm->busn.flags	= IORESOURCE_BUS;
 	pci_add_resource(&resources, &pbm->busn);
-	bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops,
-				  pbm, &resources);
+	bus = pci_create_root_bus(parent,
+			PCI_DOMBUS(pbm->index, pbm->pci_first_busno),
+			pbm->pci_ops, pbm, &resources);
 	if (!bus) {
 		printk(KERN_ERR "Failed to create bus for %s\n",
 		       node->full_name);
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index 83d3e30..2603db5 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -306,8 +306,8 @@ int __init pcibios_init(void)
 
 			pci_add_resource(&resources, &ioport_resource);
 			pci_add_resource(&resources, &iomem_resource);
-			bus = pci_scan_root_bus(NULL, 0, controller->ops,
-						controller, &resources);
+			bus = pci_scan_root_bus(NULL, PCI_DOMBUS(controller->index, 0),
+					controller->ops, controller, &resources);
 			controller->root_bus = bus;
 			controller->last_busno = bus->busn_res.end;
 		}
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index d7a0729..1e6ff84 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -881,8 +881,9 @@ int __init pcibios_init(void)
 					controller->mem_offset);
 		pci_add_resource(&resources, &controller->io_space);
 		controller->first_busno = next_busno;
-		bus = pci_scan_root_bus(NULL, next_busno, controller->ops,
-					controller, &resources);
+		bus = pci_scan_root_bus(NULL,
+				PCI_DOMBUS(controller->index, next_busno),
+				controller->ops, controller, &resources);
 		controller->root_bus = bus;
 		next_busno = bus->busn_res.end + 1;
 	}
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index cfd1b13..8edea63 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -536,9 +536,9 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 		}
 
 		if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
-				    (u8)root->secondary.end, root->mcfg_addr))
-			bus = pci_create_root_bus(NULL, busnum, &pci_root_ops,
-						  sd, &resources);
+					(u8)root->secondary.end, root->mcfg_addr))
+			bus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, busnum),
+					&pci_root_ops, sd, &resources);
 
 		if (bus) {
 			pci_scan_child_bus(bus);
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 300d39e..d6879ee 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -470,7 +470,8 @@ void pcibios_scan_root(int busnum)
 	sd->node = x86_pci_root_bus_node(busnum);
 	x86_pci_root_bus_resources(busnum, &resources);
 	printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
-	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
+	bus = pci_scan_root_bus(NULL, PCI_DOMBUS(0, busnum),
+			&pci_root_ops, sd, &resources);
 	if (!bus) {
 		pci_free_resource_list(&resources);
 		kfree(sd);
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 240ddbc..a010dfa 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -477,8 +477,9 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 
 	pci_lock_rescan_remove();
 
-	b = pci_scan_root_bus(&pdev->xdev->dev, bus,
-				  &pcifront_bus_ops, sd, &resources);
+	b = pci_scan_root_bus(&pdev->xdev->dev,
+			PCI_DOMBUS(sd->domain, bus),
+			&pcifront_bus_ops, sd, &resources);
 	if (!b) {
 		dev_err(&pdev->xdev->dev,
 			"Error creating PCI Frontend Bus!\n");
-- 
1.7.1

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

* [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Introduce pci_host_assign_domain_nr() to assign domain
number for pci_host_bridge. Later we will remove
pci_bus_assign_domain_nr().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/pci.c   |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/pci.h |    4 ++++
 2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c419554..8b35e8e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4443,6 +4443,53 @@ int pci_get_new_domain_nr(void)
 }
 
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
+void pci_host_assign_domain_nr(struct pci_host_bridge *host)
+{
+	static int use_dt_domains = -1;
+	struct device *parent = host->dev.parent;
+	int domain = of_get_pci_domain_nr(parent->of_node);
+
+	/*
+	 * Check DT domain and use_dt_domains values.
+	 *
+	 * If DT domain property is valid (domain >= 0) and
+	 * use_dt_domains != 0, the DT assignment is valid since this means
+	 * we have not previously allocated a domain number by using
+	 * pci_get_new_domain_nr(); we should also update use_dt_domains to
+	 * 1, to indicate that we have just assigned a domain number from
+	 * DT.
+	 *
+	 * If DT domain property value is not valid (ie domain < 0), and we
+	 * have not previously assigned a domain number from DT
+	 * (use_dt_domains != 1) we should assign a domain number by
+	 * using the:
+	 *
+	 * pci_get_new_domain_nr()
+	 *
+	 * API and update the use_dt_domains value to keep track of method we
+	 * are using to assign domain numbers (use_dt_domains = 0).
+	 *
+	 * All other combinations imply we have a platform that is trying
+	 * to mix domain numbers obtained from DT and pci_get_new_domain_nr(),
+	 * which is a recipe for domain mishandling and it is prevented by
+	 * invalidating the domain value (domain = -1) and printing a
+	 * corresponding error.
+	 */
+	if (domain >= 0 && use_dt_domains) {
+		use_dt_domains = 1;
+	} else if (domain < 0 && use_dt_domains != 1) {
+		use_dt_domains = 0;
+		domain = pci_get_new_domain_nr();
+	} else {
+		dev_err(parent, "Node %s has inconsistent \"linux,pci-domain\" property in DT\n",
+			parent->of_node->full_name);
+		domain = -1;
+	}
+
+	host->domain_nr = domain;
+}
+
+
 void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
 {
 	static int use_dt_domains = -1;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c771508..1b9c799 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1316,11 +1316,15 @@ 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);
+void pci_host_assign_domain_nr(struct pci_host_bridge *host);
 #else
 static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
 					struct device *parent)
 {
 }
+static inline void pci_host_assign_domain_nr(struct pci_host_bridge *host)
+{
+}
 #endif
 
 /* some architectures require additional setup to direct VGA traffic */
-- 
1.7.1


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

* [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
  2015-01-16  1:43 ` Yijing Wang
                   ` (18 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Introduce pci_host_assign_domain_nr() to assign domain
number for pci_host_bridge. Later we will remove
pci_bus_assign_domain_nr().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/pci.c   |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/pci.h |    4 ++++
 2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c419554..8b35e8e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4443,6 +4443,53 @@ int pci_get_new_domain_nr(void)
 }
 
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
+void pci_host_assign_domain_nr(struct pci_host_bridge *host)
+{
+	static int use_dt_domains = -1;
+	struct device *parent = host->dev.parent;
+	int domain = of_get_pci_domain_nr(parent->of_node);
+
+	/*
+	 * Check DT domain and use_dt_domains values.
+	 *
+	 * If DT domain property is valid (domain >= 0) and
+	 * use_dt_domains != 0, the DT assignment is valid since this means
+	 * we have not previously allocated a domain number by using
+	 * pci_get_new_domain_nr(); we should also update use_dt_domains to
+	 * 1, to indicate that we have just assigned a domain number from
+	 * DT.
+	 *
+	 * If DT domain property value is not valid (ie domain < 0), and we
+	 * have not previously assigned a domain number from DT
+	 * (use_dt_domains != 1) we should assign a domain number by
+	 * using the:
+	 *
+	 * pci_get_new_domain_nr()
+	 *
+	 * API and update the use_dt_domains value to keep track of method we
+	 * are using to assign domain numbers (use_dt_domains = 0).
+	 *
+	 * All other combinations imply we have a platform that is trying
+	 * to mix domain numbers obtained from DT and pci_get_new_domain_nr(),
+	 * which is a recipe for domain mishandling and it is prevented by
+	 * invalidating the domain value (domain = -1) and printing a
+	 * corresponding error.
+	 */
+	if (domain >= 0 && use_dt_domains) {
+		use_dt_domains = 1;
+	} else if (domain < 0 && use_dt_domains != 1) {
+		use_dt_domains = 0;
+		domain = pci_get_new_domain_nr();
+	} else {
+		dev_err(parent, "Node %s has inconsistent \"linux,pci-domain\" property in DT\n",
+			parent->of_node->full_name);
+		domain = -1;
+	}
+
+	host->domain_nr = domain;
+}
+
+
 void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
 {
 	static int use_dt_domains = -1;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c771508..1b9c799 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1316,11 +1316,15 @@ 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);
+void pci_host_assign_domain_nr(struct pci_host_bridge *host);
 #else
 static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
 					struct device *parent)
 {
 }
+static inline void pci_host_assign_domain_nr(struct pci_host_bridge *host)
+{
+}
 #endif
 
 /* some architectures require additional setup to direct VGA traffic */
-- 
1.7.1

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

* [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Introduce pci_host_assign_domain_nr() to assign domain
number for pci_host_bridge. Later we will remove
pci_bus_assign_domain_nr().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/pci.c   |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/pci.h |    4 ++++
 2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c419554..8b35e8e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4443,6 +4443,53 @@ int pci_get_new_domain_nr(void)
 }
 
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
+void pci_host_assign_domain_nr(struct pci_host_bridge *host)
+{
+	static int use_dt_domains = -1;
+	struct device *parent = host->dev.parent;
+	int domain = of_get_pci_domain_nr(parent->of_node);
+
+	/*
+	 * Check DT domain and use_dt_domains values.
+	 *
+	 * If DT domain property is valid (domain >= 0) and
+	 * use_dt_domains != 0, the DT assignment is valid since this means
+	 * we have not previously allocated a domain number by using
+	 * pci_get_new_domain_nr(); we should also update use_dt_domains to
+	 * 1, to indicate that we have just assigned a domain number from
+	 * DT.
+	 *
+	 * If DT domain property value is not valid (ie domain < 0), and we
+	 * have not previously assigned a domain number from DT
+	 * (use_dt_domains != 1) we should assign a domain number by
+	 * using the:
+	 *
+	 * pci_get_new_domain_nr()
+	 *
+	 * API and update the use_dt_domains value to keep track of method we
+	 * are using to assign domain numbers (use_dt_domains = 0).
+	 *
+	 * All other combinations imply we have a platform that is trying
+	 * to mix domain numbers obtained from DT and pci_get_new_domain_nr(),
+	 * which is a recipe for domain mishandling and it is prevented by
+	 * invalidating the domain value (domain = -1) and printing a
+	 * corresponding error.
+	 */
+	if (domain >= 0 && use_dt_domains) {
+		use_dt_domains = 1;
+	} else if (domain < 0 && use_dt_domains != 1) {
+		use_dt_domains = 0;
+		domain = pci_get_new_domain_nr();
+	} else {
+		dev_err(parent, "Node %s has inconsistent \"linux,pci-domain\" property in DT\n",
+			parent->of_node->full_name);
+		domain = -1;
+	}
+
+	host->domain_nr = domain;
+}
+
+
 void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
 {
 	static int use_dt_domains = -1;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c771508..1b9c799 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1316,11 +1316,15 @@ 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);
+void pci_host_assign_domain_nr(struct pci_host_bridge *host);
 #else
 static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
 					struct device *parent)
 {
 }
+static inline void pci_host_assign_domain_nr(struct pci_host_bridge *host)
+{
+}
 #endif
 
 /* some architectures require additional setup to direct VGA traffic */
-- 
1.7.1


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

* [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Introduce pci_host_assign_domain_nr() to assign domain
number for pci_host_bridge. Later we will remove
pci_bus_assign_domain_nr().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/pci.c   |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/pci.h |    4 ++++
 2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c419554..8b35e8e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4443,6 +4443,53 @@ int pci_get_new_domain_nr(void)
 }
 
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
+void pci_host_assign_domain_nr(struct pci_host_bridge *host)
+{
+	static int use_dt_domains = -1;
+	struct device *parent = host->dev.parent;
+	int domain = of_get_pci_domain_nr(parent->of_node);
+
+	/*
+	 * Check DT domain and use_dt_domains values.
+	 *
+	 * If DT domain property is valid (domain >= 0) and
+	 * use_dt_domains != 0, the DT assignment is valid since this means
+	 * we have not previously allocated a domain number by using
+	 * pci_get_new_domain_nr(); we should also update use_dt_domains to
+	 * 1, to indicate that we have just assigned a domain number from
+	 * DT.
+	 *
+	 * If DT domain property value is not valid (ie domain < 0), and we
+	 * have not previously assigned a domain number from DT
+	 * (use_dt_domains != 1) we should assign a domain number by
+	 * using the:
+	 *
+	 * pci_get_new_domain_nr()
+	 *
+	 * API and update the use_dt_domains value to keep track of method we
+	 * are using to assign domain numbers (use_dt_domains = 0).
+	 *
+	 * All other combinations imply we have a platform that is trying
+	 * to mix domain numbers obtained from DT and pci_get_new_domain_nr(),
+	 * which is a recipe for domain mishandling and it is prevented by
+	 * invalidating the domain value (domain = -1) and printing a
+	 * corresponding error.
+	 */
+	if (domain >= 0 && use_dt_domains) {
+		use_dt_domains = 1;
+	} else if (domain < 0 && use_dt_domains != 1) {
+		use_dt_domains = 0;
+		domain = pci_get_new_domain_nr();
+	} else {
+		dev_err(parent, "Node %s has inconsistent \"linux,pci-domain\" property in DT\n",
+			parent->of_node->full_name);
+		domain = -1;
+	}
+
+	host->domain_nr = domain;
+}
+
+
 void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
 {
 	static int use_dt_domains = -1;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c771508..1b9c799 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1316,11 +1316,15 @@ 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);
+void pci_host_assign_domain_nr(struct pci_host_bridge *host);
 #else
 static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
 					struct device *parent)
 {
 }
+static inline void pci_host_assign_domain_nr(struct pci_host_bridge *host)
+{
+}
 #endif
 
 /* some architectures require additional setup to direct VGA traffic */
-- 
1.7.1

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

* [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Introduce pci_host_assign_domain_nr() to assign domain
number for pci_host_bridge. Later we will remove
pci_bus_assign_domain_nr().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/pci.c   |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/pci.h |    4 ++++
 2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c419554..8b35e8e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4443,6 +4443,53 @@ int pci_get_new_domain_nr(void)
 }
 
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
+void pci_host_assign_domain_nr(struct pci_host_bridge *host)
+{
+	static int use_dt_domains = -1;
+	struct device *parent = host->dev.parent;
+	int domain = of_get_pci_domain_nr(parent->of_node);
+
+	/*
+	 * Check DT domain and use_dt_domains values.
+	 *
+	 * If DT domain property is valid (domain >= 0) and
+	 * use_dt_domains != 0, the DT assignment is valid since this means
+	 * we have not previously allocated a domain number by using
+	 * pci_get_new_domain_nr(); we should also update use_dt_domains to
+	 * 1, to indicate that we have just assigned a domain number from
+	 * DT.
+	 *
+	 * If DT domain property value is not valid (ie domain < 0), and we
+	 * have not previously assigned a domain number from DT
+	 * (use_dt_domains != 1) we should assign a domain number by
+	 * using the:
+	 *
+	 * pci_get_new_domain_nr()
+	 *
+	 * API and update the use_dt_domains value to keep track of method we
+	 * are using to assign domain numbers (use_dt_domains = 0).
+	 *
+	 * All other combinations imply we have a platform that is trying
+	 * to mix domain numbers obtained from DT and pci_get_new_domain_nr(),
+	 * which is a recipe for domain mishandling and it is prevented by
+	 * invalidating the domain value (domain = -1) and printing a
+	 * corresponding error.
+	 */
+	if (domain >= 0 && use_dt_domains) {
+		use_dt_domains = 1;
+	} else if (domain < 0 && use_dt_domains != 1) {
+		use_dt_domains = 0;
+		domain = pci_get_new_domain_nr();
+	} else {
+		dev_err(parent, "Node %s has inconsistent \"linux,pci-domain\" property in DT\n",
+			parent->of_node->full_name);
+		domain = -1;
+	}
+
+	host->domain_nr = domain;
+}
+
+
 void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
 {
 	static int use_dt_domains = -1;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c771508..1b9c799 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1316,11 +1316,15 @@ 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);
+void pci_host_assign_domain_nr(struct pci_host_bridge *host);
 #else
 static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
 					struct device *parent)
 {
 }
+static inline void pci_host_assign_domain_nr(struct pci_host_bridge *host)
+{
+}
 #endif
 
 /* some architectures require additional setup to direct VGA traffic */
-- 
1.7.1


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

* [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Introduce pci_host_assign_domain_nr() to assign domain
number for pci_host_bridge. Later we will remove
pci_bus_assign_domain_nr().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/pci.c   |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/pci.h |    4 ++++
 2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c419554..8b35e8e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4443,6 +4443,53 @@ int pci_get_new_domain_nr(void)
 }
 
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
+void pci_host_assign_domain_nr(struct pci_host_bridge *host)
+{
+	static int use_dt_domains = -1;
+	struct device *parent = host->dev.parent;
+	int domain = of_get_pci_domain_nr(parent->of_node);
+
+	/*
+	 * Check DT domain and use_dt_domains values.
+	 *
+	 * If DT domain property is valid (domain >= 0) and
+	 * use_dt_domains != 0, the DT assignment is valid since this means
+	 * we have not previously allocated a domain number by using
+	 * pci_get_new_domain_nr(); we should also update use_dt_domains to
+	 * 1, to indicate that we have just assigned a domain number from
+	 * DT.
+	 *
+	 * If DT domain property value is not valid (ie domain < 0), and we
+	 * have not previously assigned a domain number from DT
+	 * (use_dt_domains != 1) we should assign a domain number by
+	 * using the:
+	 *
+	 * pci_get_new_domain_nr()
+	 *
+	 * API and update the use_dt_domains value to keep track of method we
+	 * are using to assign domain numbers (use_dt_domains = 0).
+	 *
+	 * All other combinations imply we have a platform that is trying
+	 * to mix domain numbers obtained from DT and pci_get_new_domain_nr(),
+	 * which is a recipe for domain mishandling and it is prevented by
+	 * invalidating the domain value (domain = -1) and printing a
+	 * corresponding error.
+	 */
+	if (domain >= 0 && use_dt_domains) {
+		use_dt_domains = 1;
+	} else if (domain < 0 && use_dt_domains != 1) {
+		use_dt_domains = 0;
+		domain = pci_get_new_domain_nr();
+	} else {
+		dev_err(parent, "Node %s has inconsistent \"linux,pci-domain\" property in DT\n",
+			parent->of_node->full_name);
+		domain = -1;
+	}
+
+	host->domain_nr = domain;
+}
+
+
 void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
 {
 	static int use_dt_domains = -1;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c771508..1b9c799 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1316,11 +1316,15 @@ 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);
+void pci_host_assign_domain_nr(struct pci_host_bridge *host);
 #else
 static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
 					struct device *parent)
 {
 }
+static inline void pci_host_assign_domain_nr(struct pci_host_bridge *host)
+{
+}
 #endif
 
 /* some architectures require additional setup to direct VGA traffic */
-- 
1.7.1

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

* [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

We want to make a generic pci_host_bridge, then we could
place common PCI infos like domain number in it. Ripping
out pci_host_bridge creation from pci_create_root_bus()
make code more better readability. Further more, we could
use the generic pci_host_bridge to hold host bridge specific
operations like pcibios_root_bridge_prepare().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |   78 +++++++++++++++++++++++++++++
 drivers/pci/probe.c       |  121 +++++++++++++++++++--------------------------
 include/linux/pci.h       |    6 ++-
 3 files changed, 134 insertions(+), 71 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 0e5f3c9..c9ee582 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -8,6 +8,84 @@
 
 #include "pci.h"
 
+static LIST_HEAD(pci_host_bridge_list);
+static DEFINE_MUTEX(phb_mutex);
+
+static void pci_release_host_bridge_dev(struct device *dev)
+{
+	struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
+
+	if (bridge->release_fn)
+		bridge->release_fn(bridge);
+
+	pci_free_resource_list(&bridge->windows);
+	kfree(bridge);
+}
+
+struct pci_host_bridge *pci_create_host_bridge(
+		struct device *parent, u32 db, struct list_head *resources)
+{
+	int error;
+	int bus = PCI_BUSNUM(db);
+	int domain = PCI_DOMAIN(db);
+	struct pci_host_bridge *host, *temp;
+	struct pci_host_bridge_window *window, *n;
+
+	host = kzalloc(sizeof(*host), GFP_KERNEL);
+	if (!host)
+		return NULL;
+
+	host->busnum = bus;
+	host->domain = domain;
+	/* If support CONFIG_PCI_DOMAINS_GENERIC, use
+	 * pci_host_assign_domain_nr() to assign domain
+	 * number instead argu u32 db.
+	 */
+	pci_host_assign_domain_nr(host);
+
+	mutex_lock(&phb_mutex);
+	list_for_each_entry(temp, &pci_host_bridge_list, list)
+		if (temp->domain == host->domain
+				&& host->busnum == temp->busnum) {
+			dev_dbg(&host->dev, "pci host bridge pci%04x:%02x exist\n",
+					host->domain, host->busnum);
+			mutex_unlock(&phb_mutex);
+			kfree(host);
+			return NULL;
+		}
+	mutex_unlock(&phb_mutex);
+
+	host->dev.parent = parent;
+	INIT_LIST_HEAD(&host->windows);
+	host->dev.release = pci_release_host_bridge_dev;
+	dev_set_name(&host->dev, "pci%04x:%02x", host->domain,
+			host->busnum);
+
+	error = device_register(&host->dev);
+	if (error) {
+		put_device(&host->dev);
+		return NULL;
+	}
+
+	list_for_each_entry_safe(window, n, resources, list)
+		list_move_tail(&window->list, &host->windows);
+
+	mutex_lock(&phb_mutex);
+	list_add_tail(&host->list, &pci_host_bridge_list);
+	mutex_unlock(&phb_mutex);
+	return host;
+}
+EXPORT_SYMBOL(pci_create_host_bridge);
+
+void pci_free_host_bridge(struct pci_host_bridge *host)
+{
+	mutex_lock(&phb_mutex);
+	list_del(&host->list);
+	mutex_unlock(&phb_mutex);
+
+	device_unregister(&host->dev);
+}
+
 static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
 {
 	while (bus->parent)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 50f58b3..2e0b952 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -502,31 +502,6 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
 	return b;
 }
 
-static void pci_release_host_bridge_dev(struct device *dev)
-{
-	struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
-
-	if (bridge->release_fn)
-		bridge->release_fn(bridge);
-
-	pci_free_resource_list(&bridge->windows);
-
-	kfree(bridge);
-}
-
-static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)
-{
-	struct pci_host_bridge *bridge;
-
-	bridge = kzalloc(sizeof(*bridge), GFP_KERNEL);
-	if (!bridge)
-		return NULL;
-
-	INIT_LIST_HEAD(&bridge->windows);
-	bridge->bus = b;
-	return bridge;
-}
-
 static const unsigned char pcix_bus_speed[] = {
 	PCI_SPEED_UNKNOWN,		/* 0 */
 	PCI_SPEED_66MHz_PCIX,		/* 1 */
@@ -1889,54 +1864,35 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+static struct pci_bus *__pci_create_root_bus(
+		struct pci_host_bridge *bridge, struct pci_ops *ops,
+		void *sysdata)
 {
 	int error;
-	struct pci_host_bridge *bridge;
-	struct pci_bus *b, *b2;
-	struct pci_host_bridge_window *window, *n;
+	struct pci_bus *b;
+	struct pci_host_bridge_window *window;
+	struct device *parent;
 	struct resource *res;
 	resource_size_t offset;
 	char bus_addr[64];
 	char *fmt;
-	u8	bus = PCI_BUSNUM(db);
 
+	parent = bridge->dev.parent;
 	b = pci_alloc_bus(NULL);
 	if (!b)
 		return NULL;
 
 	b->sysdata = sysdata;
 	b->ops = ops;
-	b->number = b->busn_res.start = bus;
+	b->number = b->busn_res.start = bridge->busnum;
 	pci_bus_assign_domain_nr(b, parent);
-	b2 = pci_find_bus(pci_domain_nr(b), bus);
-	if (b2) {
-		/* If we already got to this bus through a different bridge, ignore it */
-		dev_dbg(&b2->dev, "bus already known\n");
-		goto err_out;
-	}
 
-	bridge = pci_alloc_host_bridge(b);
-	if (!bridge)
-		goto err_out;
-
-	bridge->domain = PCI_DOMAIN(db);
-	bridge->dev.parent = parent;
-	bridge->dev.release = pci_release_host_bridge_dev;
-	dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus);
+	bridge->bus = b;
+	b->bridge = get_device(&bridge->dev);
 	error = pcibios_root_bridge_prepare(bridge);
-	if (error) {
-		kfree(bridge);
+	if (error)
 		goto err_out;
-	}
 
-	error = device_register(&bridge->dev);
-	if (error) {
-		put_device(&bridge->dev);
-		goto err_out;
-	}
-	b->bridge = get_device(&bridge->dev);
 	device_enable_async_suspend(b->bridge);
 	pci_set_bus_of_node(b);
 
@@ -1945,10 +1901,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 
 	b->dev.class = &pcibus_class;
 	b->dev.parent = b->bridge;
-	dev_set_name(&b->dev, "%04x:%02x", pci_domain_nr(b), bus);
+	dev_set_name(&b->dev, "%04x:%02x", bridge->domain,
+			bridge->busnum);
 	error = device_register(&b->dev);
 	if (error)
-		goto class_dev_reg_err;
+		goto err_out;
 
 	pcibios_add_bus(b);
 
@@ -1961,12 +1918,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 		printk(KERN_INFO "PCI host bridge to bus %s\n", dev_name(&b->dev));
 
 	/* Add initial resources to the bus */
-	list_for_each_entry_safe(window, n, resources, list) {
-		list_move_tail(&window->list, &bridge->windows);
+	list_for_each_entry(window, &bridge->windows, list) {
 		res = window->res;
 		offset = window->offset;
 		if (res->flags & IORESOURCE_BUS)
-			pci_bus_insert_busn_res(b, bus, res->end);
+			pci_bus_insert_busn_res(b, bridge->busnum, res->end);
 		else
 			pci_bus_add_resource(b, res, 0);
 		if (offset) {
@@ -1988,14 +1944,23 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 
 	return b;
 
-class_dev_reg_err:
-	put_device(&bridge->dev);
-	device_unregister(&bridge->dev);
 err_out:
 	kfree(b);
 	return NULL;
 }
 
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
+		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+{
+	struct pci_host_bridge *host;
+
+	host = pci_create_host_bridge(parent, db, resources);
+	if (!host)
+		return NULL;
+
+	return __pci_create_root_bus(host, ops, sysdata);
+}
+
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
 {
 	struct resource *res = &b->busn_res;
@@ -2059,29 +2024,33 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 			res, ret ? "can not be" : "is");
 }
 
-struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+static struct pci_bus *__pci_scan_root_bus(
+		struct pci_host_bridge *host, struct pci_ops *ops,
+		void *sysdata)
 {
+
 	struct pci_host_bridge_window *window;
 	bool found = false;
 	struct pci_bus *b;
 	int max;
 
-	list_for_each_entry(window, resources, list)
+	list_for_each_entry(window, &host->windows, list)
 		if (window->res->flags & IORESOURCE_BUS) {
 			found = true;
 			break;
 		}
 
-	b = pci_create_root_bus(parent, db, ops, sysdata, resources);
-	if (!b)
+	b = __pci_create_root_bus(host, ops, sysdata);
+	if (!b) {
+		pci_free_host_bridge(host);
 		return NULL;
+	}
 
 	if (!found) {
 		dev_info(&b->dev,
 		 "No busn resource found for root bus, will use [bus %02x-ff]\n",
-			PCI_BUSNUM(db));
-		pci_bus_insert_busn_res(b, PCI_BUSNUM(db), 255);
+			host->busnum);
+		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}
 
 	max = pci_scan_child_bus(b);
@@ -2091,6 +2060,18 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 
 	return b;
 }
+
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
+		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+{
+	struct pci_host_bridge *host;
+
+	host = pci_create_host_bridge(parent, db, resources);
+	if (!host)
+		return NULL;
+
+	return __pci_scan_root_bus(host, ops, sysdata);
+}
 EXPORT_SYMBOL(pci_scan_root_bus);
 
 struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 1b9c799..5ee0033 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -403,8 +403,10 @@ struct pci_host_bridge_window {
 
 struct pci_host_bridge {
 	u16	domain;
+	u16 busnum;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
+	struct list_head list;
 	struct list_head windows;	/* pci_host_bridge_windows */
 	void (*release_fn)(struct pci_host_bridge *);
 	void *release_data;
@@ -416,7 +418,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 		     void *release_data);
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
-
+struct pci_host_bridge *pci_create_host_bridge(
+		struct device *parent, u32 dombus, struct list_head *resources);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
@@ -774,6 +777,7 @@ struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysda
 struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
+void pci_free_host_bridge(struct pci_host_bridge *host);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
 void pci_bus_release_busn_res(struct pci_bus *b);
-- 
1.7.1


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

* [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
  2015-01-16  1:43 ` Yijing Wang
                   ` (20 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

We want to make a generic pci_host_bridge, then we could
place common PCI infos like domain number in it. Ripping
out pci_host_bridge creation from pci_create_root_bus()
make code more better readability. Further more, we could
use the generic pci_host_bridge to hold host bridge specific
operations like pcibios_root_bridge_prepare().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |   78 +++++++++++++++++++++++++++++
 drivers/pci/probe.c       |  121 +++++++++++++++++++--------------------------
 include/linux/pci.h       |    6 ++-
 3 files changed, 134 insertions(+), 71 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 0e5f3c9..c9ee582 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -8,6 +8,84 @@
 
 #include "pci.h"
 
+static LIST_HEAD(pci_host_bridge_list);
+static DEFINE_MUTEX(phb_mutex);
+
+static void pci_release_host_bridge_dev(struct device *dev)
+{
+	struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
+
+	if (bridge->release_fn)
+		bridge->release_fn(bridge);
+
+	pci_free_resource_list(&bridge->windows);
+	kfree(bridge);
+}
+
+struct pci_host_bridge *pci_create_host_bridge(
+		struct device *parent, u32 db, struct list_head *resources)
+{
+	int error;
+	int bus = PCI_BUSNUM(db);
+	int domain = PCI_DOMAIN(db);
+	struct pci_host_bridge *host, *temp;
+	struct pci_host_bridge_window *window, *n;
+
+	host = kzalloc(sizeof(*host), GFP_KERNEL);
+	if (!host)
+		return NULL;
+
+	host->busnum = bus;
+	host->domain = domain;
+	/* If support CONFIG_PCI_DOMAINS_GENERIC, use
+	 * pci_host_assign_domain_nr() to assign domain
+	 * number instead argu u32 db.
+	 */
+	pci_host_assign_domain_nr(host);
+
+	mutex_lock(&phb_mutex);
+	list_for_each_entry(temp, &pci_host_bridge_list, list)
+		if (temp->domain == host->domain
+				&& host->busnum == temp->busnum) {
+			dev_dbg(&host->dev, "pci host bridge pci%04x:%02x exist\n",
+					host->domain, host->busnum);
+			mutex_unlock(&phb_mutex);
+			kfree(host);
+			return NULL;
+		}
+	mutex_unlock(&phb_mutex);
+
+	host->dev.parent = parent;
+	INIT_LIST_HEAD(&host->windows);
+	host->dev.release = pci_release_host_bridge_dev;
+	dev_set_name(&host->dev, "pci%04x:%02x", host->domain,
+			host->busnum);
+
+	error = device_register(&host->dev);
+	if (error) {
+		put_device(&host->dev);
+		return NULL;
+	}
+
+	list_for_each_entry_safe(window, n, resources, list)
+		list_move_tail(&window->list, &host->windows);
+
+	mutex_lock(&phb_mutex);
+	list_add_tail(&host->list, &pci_host_bridge_list);
+	mutex_unlock(&phb_mutex);
+	return host;
+}
+EXPORT_SYMBOL(pci_create_host_bridge);
+
+void pci_free_host_bridge(struct pci_host_bridge *host)
+{
+	mutex_lock(&phb_mutex);
+	list_del(&host->list);
+	mutex_unlock(&phb_mutex);
+
+	device_unregister(&host->dev);
+}
+
 static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
 {
 	while (bus->parent)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 50f58b3..2e0b952 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -502,31 +502,6 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
 	return b;
 }
 
-static void pci_release_host_bridge_dev(struct device *dev)
-{
-	struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
-
-	if (bridge->release_fn)
-		bridge->release_fn(bridge);
-
-	pci_free_resource_list(&bridge->windows);
-
-	kfree(bridge);
-}
-
-static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)
-{
-	struct pci_host_bridge *bridge;
-
-	bridge = kzalloc(sizeof(*bridge), GFP_KERNEL);
-	if (!bridge)
-		return NULL;
-
-	INIT_LIST_HEAD(&bridge->windows);
-	bridge->bus = b;
-	return bridge;
-}
-
 static const unsigned char pcix_bus_speed[] = {
 	PCI_SPEED_UNKNOWN,		/* 0 */
 	PCI_SPEED_66MHz_PCIX,		/* 1 */
@@ -1889,54 +1864,35 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+static struct pci_bus *__pci_create_root_bus(
+		struct pci_host_bridge *bridge, struct pci_ops *ops,
+		void *sysdata)
 {
 	int error;
-	struct pci_host_bridge *bridge;
-	struct pci_bus *b, *b2;
-	struct pci_host_bridge_window *window, *n;
+	struct pci_bus *b;
+	struct pci_host_bridge_window *window;
+	struct device *parent;
 	struct resource *res;
 	resource_size_t offset;
 	char bus_addr[64];
 	char *fmt;
-	u8	bus = PCI_BUSNUM(db);
 
+	parent = bridge->dev.parent;
 	b = pci_alloc_bus(NULL);
 	if (!b)
 		return NULL;
 
 	b->sysdata = sysdata;
 	b->ops = ops;
-	b->number = b->busn_res.start = bus;
+	b->number = b->busn_res.start = bridge->busnum;
 	pci_bus_assign_domain_nr(b, parent);
-	b2 = pci_find_bus(pci_domain_nr(b), bus);
-	if (b2) {
-		/* If we already got to this bus through a different bridge, ignore it */
-		dev_dbg(&b2->dev, "bus already known\n");
-		goto err_out;
-	}
 
-	bridge = pci_alloc_host_bridge(b);
-	if (!bridge)
-		goto err_out;
-
-	bridge->domain = PCI_DOMAIN(db);
-	bridge->dev.parent = parent;
-	bridge->dev.release = pci_release_host_bridge_dev;
-	dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus);
+	bridge->bus = b;
+	b->bridge = get_device(&bridge->dev);
 	error = pcibios_root_bridge_prepare(bridge);
-	if (error) {
-		kfree(bridge);
+	if (error)
 		goto err_out;
-	}
 
-	error = device_register(&bridge->dev);
-	if (error) {
-		put_device(&bridge->dev);
-		goto err_out;
-	}
-	b->bridge = get_device(&bridge->dev);
 	device_enable_async_suspend(b->bridge);
 	pci_set_bus_of_node(b);
 
@@ -1945,10 +1901,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 
 	b->dev.class = &pcibus_class;
 	b->dev.parent = b->bridge;
-	dev_set_name(&b->dev, "%04x:%02x", pci_domain_nr(b), bus);
+	dev_set_name(&b->dev, "%04x:%02x", bridge->domain,
+			bridge->busnum);
 	error = device_register(&b->dev);
 	if (error)
-		goto class_dev_reg_err;
+		goto err_out;
 
 	pcibios_add_bus(b);
 
@@ -1961,12 +1918,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 		printk(KERN_INFO "PCI host bridge to bus %s\n", dev_name(&b->dev));
 
 	/* Add initial resources to the bus */
-	list_for_each_entry_safe(window, n, resources, list) {
-		list_move_tail(&window->list, &bridge->windows);
+	list_for_each_entry(window, &bridge->windows, list) {
 		res = window->res;
 		offset = window->offset;
 		if (res->flags & IORESOURCE_BUS)
-			pci_bus_insert_busn_res(b, bus, res->end);
+			pci_bus_insert_busn_res(b, bridge->busnum, res->end);
 		else
 			pci_bus_add_resource(b, res, 0);
 		if (offset) {
@@ -1988,14 +1944,23 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 
 	return b;
 
-class_dev_reg_err:
-	put_device(&bridge->dev);
-	device_unregister(&bridge->dev);
 err_out:
 	kfree(b);
 	return NULL;
 }
 
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
+		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+{
+	struct pci_host_bridge *host;
+
+	host = pci_create_host_bridge(parent, db, resources);
+	if (!host)
+		return NULL;
+
+	return __pci_create_root_bus(host, ops, sysdata);
+}
+
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
 {
 	struct resource *res = &b->busn_res;
@@ -2059,29 +2024,33 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 			res, ret ? "can not be" : "is");
 }
 
-struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+static struct pci_bus *__pci_scan_root_bus(
+		struct pci_host_bridge *host, struct pci_ops *ops,
+		void *sysdata)
 {
+
 	struct pci_host_bridge_window *window;
 	bool found = false;
 	struct pci_bus *b;
 	int max;
 
-	list_for_each_entry(window, resources, list)
+	list_for_each_entry(window, &host->windows, list)
 		if (window->res->flags & IORESOURCE_BUS) {
 			found = true;
 			break;
 		}
 
-	b = pci_create_root_bus(parent, db, ops, sysdata, resources);
-	if (!b)
+	b = __pci_create_root_bus(host, ops, sysdata);
+	if (!b) {
+		pci_free_host_bridge(host);
 		return NULL;
+	}
 
 	if (!found) {
 		dev_info(&b->dev,
 		 "No busn resource found for root bus, will use [bus %02x-ff]\n",
-			PCI_BUSNUM(db));
-		pci_bus_insert_busn_res(b, PCI_BUSNUM(db), 255);
+			host->busnum);
+		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}
 
 	max = pci_scan_child_bus(b);
@@ -2091,6 +2060,18 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 
 	return b;
 }
+
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
+		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+{
+	struct pci_host_bridge *host;
+
+	host = pci_create_host_bridge(parent, db, resources);
+	if (!host)
+		return NULL;
+
+	return __pci_scan_root_bus(host, ops, sysdata);
+}
 EXPORT_SYMBOL(pci_scan_root_bus);
 
 struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 1b9c799..5ee0033 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -403,8 +403,10 @@ struct pci_host_bridge_window {
 
 struct pci_host_bridge {
 	u16	domain;
+	u16 busnum;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
+	struct list_head list;
 	struct list_head windows;	/* pci_host_bridge_windows */
 	void (*release_fn)(struct pci_host_bridge *);
 	void *release_data;
@@ -416,7 +418,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 		     void *release_data);
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
-
+struct pci_host_bridge *pci_create_host_bridge(
+		struct device *parent, u32 dombus, struct list_head *resources);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
@@ -774,6 +777,7 @@ struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysda
 struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
+void pci_free_host_bridge(struct pci_host_bridge *host);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
 void pci_bus_release_busn_res(struct pci_bus *b);
-- 
1.7.1

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

* [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

We want to make a generic pci_host_bridge, then we could
place common PCI infos like domain number in it. Ripping
out pci_host_bridge creation from pci_create_root_bus()
make code more better readability. Further more, we could
use the generic pci_host_bridge to hold host bridge specific
operations like pcibios_root_bridge_prepare().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |   78 +++++++++++++++++++++++++++++
 drivers/pci/probe.c       |  121 +++++++++++++++++++--------------------------
 include/linux/pci.h       |    6 ++-
 3 files changed, 134 insertions(+), 71 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 0e5f3c9..c9ee582 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -8,6 +8,84 @@
 
 #include "pci.h"
 
+static LIST_HEAD(pci_host_bridge_list);
+static DEFINE_MUTEX(phb_mutex);
+
+static void pci_release_host_bridge_dev(struct device *dev)
+{
+	struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
+
+	if (bridge->release_fn)
+		bridge->release_fn(bridge);
+
+	pci_free_resource_list(&bridge->windows);
+	kfree(bridge);
+}
+
+struct pci_host_bridge *pci_create_host_bridge(
+		struct device *parent, u32 db, struct list_head *resources)
+{
+	int error;
+	int bus = PCI_BUSNUM(db);
+	int domain = PCI_DOMAIN(db);
+	struct pci_host_bridge *host, *temp;
+	struct pci_host_bridge_window *window, *n;
+
+	host = kzalloc(sizeof(*host), GFP_KERNEL);
+	if (!host)
+		return NULL;
+
+	host->busnum = bus;
+	host->domain = domain;
+	/* If support CONFIG_PCI_DOMAINS_GENERIC, use
+	 * pci_host_assign_domain_nr() to assign domain
+	 * number instead argu u32 db.
+	 */
+	pci_host_assign_domain_nr(host);
+
+	mutex_lock(&phb_mutex);
+	list_for_each_entry(temp, &pci_host_bridge_list, list)
+		if (temp->domain == host->domain
+				&& host->busnum == temp->busnum) {
+			dev_dbg(&host->dev, "pci host bridge pci%04x:%02x exist\n",
+					host->domain, host->busnum);
+			mutex_unlock(&phb_mutex);
+			kfree(host);
+			return NULL;
+		}
+	mutex_unlock(&phb_mutex);
+
+	host->dev.parent = parent;
+	INIT_LIST_HEAD(&host->windows);
+	host->dev.release = pci_release_host_bridge_dev;
+	dev_set_name(&host->dev, "pci%04x:%02x", host->domain,
+			host->busnum);
+
+	error = device_register(&host->dev);
+	if (error) {
+		put_device(&host->dev);
+		return NULL;
+	}
+
+	list_for_each_entry_safe(window, n, resources, list)
+		list_move_tail(&window->list, &host->windows);
+
+	mutex_lock(&phb_mutex);
+	list_add_tail(&host->list, &pci_host_bridge_list);
+	mutex_unlock(&phb_mutex);
+	return host;
+}
+EXPORT_SYMBOL(pci_create_host_bridge);
+
+void pci_free_host_bridge(struct pci_host_bridge *host)
+{
+	mutex_lock(&phb_mutex);
+	list_del(&host->list);
+	mutex_unlock(&phb_mutex);
+
+	device_unregister(&host->dev);
+}
+
 static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
 {
 	while (bus->parent)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 50f58b3..2e0b952 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -502,31 +502,6 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
 	return b;
 }
 
-static void pci_release_host_bridge_dev(struct device *dev)
-{
-	struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
-
-	if (bridge->release_fn)
-		bridge->release_fn(bridge);
-
-	pci_free_resource_list(&bridge->windows);
-
-	kfree(bridge);
-}
-
-static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)
-{
-	struct pci_host_bridge *bridge;
-
-	bridge = kzalloc(sizeof(*bridge), GFP_KERNEL);
-	if (!bridge)
-		return NULL;
-
-	INIT_LIST_HEAD(&bridge->windows);
-	bridge->bus = b;
-	return bridge;
-}
-
 static const unsigned char pcix_bus_speed[] = {
 	PCI_SPEED_UNKNOWN,		/* 0 */
 	PCI_SPEED_66MHz_PCIX,		/* 1 */
@@ -1889,54 +1864,35 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+static struct pci_bus *__pci_create_root_bus(
+		struct pci_host_bridge *bridge, struct pci_ops *ops,
+		void *sysdata)
 {
 	int error;
-	struct pci_host_bridge *bridge;
-	struct pci_bus *b, *b2;
-	struct pci_host_bridge_window *window, *n;
+	struct pci_bus *b;
+	struct pci_host_bridge_window *window;
+	struct device *parent;
 	struct resource *res;
 	resource_size_t offset;
 	char bus_addr[64];
 	char *fmt;
-	u8	bus = PCI_BUSNUM(db);
 
+	parent = bridge->dev.parent;
 	b = pci_alloc_bus(NULL);
 	if (!b)
 		return NULL;
 
 	b->sysdata = sysdata;
 	b->ops = ops;
-	b->number = b->busn_res.start = bus;
+	b->number = b->busn_res.start = bridge->busnum;
 	pci_bus_assign_domain_nr(b, parent);
-	b2 = pci_find_bus(pci_domain_nr(b), bus);
-	if (b2) {
-		/* If we already got to this bus through a different bridge, ignore it */
-		dev_dbg(&b2->dev, "bus already known\n");
-		goto err_out;
-	}
 
-	bridge = pci_alloc_host_bridge(b);
-	if (!bridge)
-		goto err_out;
-
-	bridge->domain = PCI_DOMAIN(db);
-	bridge->dev.parent = parent;
-	bridge->dev.release = pci_release_host_bridge_dev;
-	dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus);
+	bridge->bus = b;
+	b->bridge = get_device(&bridge->dev);
 	error = pcibios_root_bridge_prepare(bridge);
-	if (error) {
-		kfree(bridge);
+	if (error)
 		goto err_out;
-	}
 
-	error = device_register(&bridge->dev);
-	if (error) {
-		put_device(&bridge->dev);
-		goto err_out;
-	}
-	b->bridge = get_device(&bridge->dev);
 	device_enable_async_suspend(b->bridge);
 	pci_set_bus_of_node(b);
 
@@ -1945,10 +1901,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 
 	b->dev.class = &pcibus_class;
 	b->dev.parent = b->bridge;
-	dev_set_name(&b->dev, "%04x:%02x", pci_domain_nr(b), bus);
+	dev_set_name(&b->dev, "%04x:%02x", bridge->domain,
+			bridge->busnum);
 	error = device_register(&b->dev);
 	if (error)
-		goto class_dev_reg_err;
+		goto err_out;
 
 	pcibios_add_bus(b);
 
@@ -1961,12 +1918,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 		printk(KERN_INFO "PCI host bridge to bus %s\n", dev_name(&b->dev));
 
 	/* Add initial resources to the bus */
-	list_for_each_entry_safe(window, n, resources, list) {
-		list_move_tail(&window->list, &bridge->windows);
+	list_for_each_entry(window, &bridge->windows, list) {
 		res = window->res;
 		offset = window->offset;
 		if (res->flags & IORESOURCE_BUS)
-			pci_bus_insert_busn_res(b, bus, res->end);
+			pci_bus_insert_busn_res(b, bridge->busnum, res->end);
 		else
 			pci_bus_add_resource(b, res, 0);
 		if (offset) {
@@ -1988,14 +1944,23 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 
 	return b;
 
-class_dev_reg_err:
-	put_device(&bridge->dev);
-	device_unregister(&bridge->dev);
 err_out:
 	kfree(b);
 	return NULL;
 }
 
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
+		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+{
+	struct pci_host_bridge *host;
+
+	host = pci_create_host_bridge(parent, db, resources);
+	if (!host)
+		return NULL;
+
+	return __pci_create_root_bus(host, ops, sysdata);
+}
+
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
 {
 	struct resource *res = &b->busn_res;
@@ -2059,29 +2024,33 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 			res, ret ? "can not be" : "is");
 }
 
-struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+static struct pci_bus *__pci_scan_root_bus(
+		struct pci_host_bridge *host, struct pci_ops *ops,
+		void *sysdata)
 {
+
 	struct pci_host_bridge_window *window;
 	bool found = false;
 	struct pci_bus *b;
 	int max;
 
-	list_for_each_entry(window, resources, list)
+	list_for_each_entry(window, &host->windows, list)
 		if (window->res->flags & IORESOURCE_BUS) {
 			found = true;
 			break;
 		}
 
-	b = pci_create_root_bus(parent, db, ops, sysdata, resources);
-	if (!b)
+	b = __pci_create_root_bus(host, ops, sysdata);
+	if (!b) {
+		pci_free_host_bridge(host);
 		return NULL;
+	}
 
 	if (!found) {
 		dev_info(&b->dev,
 		 "No busn resource found for root bus, will use [bus %02x-ff]\n",
-			PCI_BUSNUM(db));
-		pci_bus_insert_busn_res(b, PCI_BUSNUM(db), 255);
+			host->busnum);
+		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}
 
 	max = pci_scan_child_bus(b);
@@ -2091,6 +2060,18 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 
 	return b;
 }
+
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
+		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+{
+	struct pci_host_bridge *host;
+
+	host = pci_create_host_bridge(parent, db, resources);
+	if (!host)
+		return NULL;
+
+	return __pci_scan_root_bus(host, ops, sysdata);
+}
 EXPORT_SYMBOL(pci_scan_root_bus);
 
 struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 1b9c799..5ee0033 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -403,8 +403,10 @@ struct pci_host_bridge_window {
 
 struct pci_host_bridge {
 	u16	domain;
+	u16 busnum;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
+	struct list_head list;
 	struct list_head windows;	/* pci_host_bridge_windows */
 	void (*release_fn)(struct pci_host_bridge *);
 	void *release_data;
@@ -416,7 +418,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 		     void *release_data);
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
-
+struct pci_host_bridge *pci_create_host_bridge(
+		struct device *parent, u32 dombus, struct list_head *resources);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
@@ -774,6 +777,7 @@ struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysda
 struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
+void pci_free_host_bridge(struct pci_host_bridge *host);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
 void pci_bus_release_busn_res(struct pci_bus *b);
-- 
1.7.1


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

* [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

We want to make a generic pci_host_bridge, then we could
place common PCI infos like domain number in it. Ripping
out pci_host_bridge creation from pci_create_root_bus()
make code more better readability. Further more, we could
use the generic pci_host_bridge to hold host bridge specific
operations like pcibios_root_bridge_prepare().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |   78 +++++++++++++++++++++++++++++
 drivers/pci/probe.c       |  121 +++++++++++++++++++--------------------------
 include/linux/pci.h       |    6 ++-
 3 files changed, 134 insertions(+), 71 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 0e5f3c9..c9ee582 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -8,6 +8,84 @@
 
 #include "pci.h"
 
+static LIST_HEAD(pci_host_bridge_list);
+static DEFINE_MUTEX(phb_mutex);
+
+static void pci_release_host_bridge_dev(struct device *dev)
+{
+	struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
+
+	if (bridge->release_fn)
+		bridge->release_fn(bridge);
+
+	pci_free_resource_list(&bridge->windows);
+	kfree(bridge);
+}
+
+struct pci_host_bridge *pci_create_host_bridge(
+		struct device *parent, u32 db, struct list_head *resources)
+{
+	int error;
+	int bus = PCI_BUSNUM(db);
+	int domain = PCI_DOMAIN(db);
+	struct pci_host_bridge *host, *temp;
+	struct pci_host_bridge_window *window, *n;
+
+	host = kzalloc(sizeof(*host), GFP_KERNEL);
+	if (!host)
+		return NULL;
+
+	host->busnum = bus;
+	host->domain = domain;
+	/* If support CONFIG_PCI_DOMAINS_GENERIC, use
+	 * pci_host_assign_domain_nr() to assign domain
+	 * number instead argu u32 db.
+	 */
+	pci_host_assign_domain_nr(host);
+
+	mutex_lock(&phb_mutex);
+	list_for_each_entry(temp, &pci_host_bridge_list, list)
+		if (temp->domain == host->domain
+				&& host->busnum == temp->busnum) {
+			dev_dbg(&host->dev, "pci host bridge pci%04x:%02x exist\n",
+					host->domain, host->busnum);
+			mutex_unlock(&phb_mutex);
+			kfree(host);
+			return NULL;
+		}
+	mutex_unlock(&phb_mutex);
+
+	host->dev.parent = parent;
+	INIT_LIST_HEAD(&host->windows);
+	host->dev.release = pci_release_host_bridge_dev;
+	dev_set_name(&host->dev, "pci%04x:%02x", host->domain,
+			host->busnum);
+
+	error = device_register(&host->dev);
+	if (error) {
+		put_device(&host->dev);
+		return NULL;
+	}
+
+	list_for_each_entry_safe(window, n, resources, list)
+		list_move_tail(&window->list, &host->windows);
+
+	mutex_lock(&phb_mutex);
+	list_add_tail(&host->list, &pci_host_bridge_list);
+	mutex_unlock(&phb_mutex);
+	return host;
+}
+EXPORT_SYMBOL(pci_create_host_bridge);
+
+void pci_free_host_bridge(struct pci_host_bridge *host)
+{
+	mutex_lock(&phb_mutex);
+	list_del(&host->list);
+	mutex_unlock(&phb_mutex);
+
+	device_unregister(&host->dev);
+}
+
 static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
 {
 	while (bus->parent)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 50f58b3..2e0b952 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -502,31 +502,6 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
 	return b;
 }
 
-static void pci_release_host_bridge_dev(struct device *dev)
-{
-	struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
-
-	if (bridge->release_fn)
-		bridge->release_fn(bridge);
-
-	pci_free_resource_list(&bridge->windows);
-
-	kfree(bridge);
-}
-
-static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)
-{
-	struct pci_host_bridge *bridge;
-
-	bridge = kzalloc(sizeof(*bridge), GFP_KERNEL);
-	if (!bridge)
-		return NULL;
-
-	INIT_LIST_HEAD(&bridge->windows);
-	bridge->bus = b;
-	return bridge;
-}
-
 static const unsigned char pcix_bus_speed[] = {
 	PCI_SPEED_UNKNOWN,		/* 0 */
 	PCI_SPEED_66MHz_PCIX,		/* 1 */
@@ -1889,54 +1864,35 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+static struct pci_bus *__pci_create_root_bus(
+		struct pci_host_bridge *bridge, struct pci_ops *ops,
+		void *sysdata)
 {
 	int error;
-	struct pci_host_bridge *bridge;
-	struct pci_bus *b, *b2;
-	struct pci_host_bridge_window *window, *n;
+	struct pci_bus *b;
+	struct pci_host_bridge_window *window;
+	struct device *parent;
 	struct resource *res;
 	resource_size_t offset;
 	char bus_addr[64];
 	char *fmt;
-	u8	bus = PCI_BUSNUM(db);
 
+	parent = bridge->dev.parent;
 	b = pci_alloc_bus(NULL);
 	if (!b)
 		return NULL;
 
 	b->sysdata = sysdata;
 	b->ops = ops;
-	b->number = b->busn_res.start = bus;
+	b->number = b->busn_res.start = bridge->busnum;
 	pci_bus_assign_domain_nr(b, parent);
-	b2 = pci_find_bus(pci_domain_nr(b), bus);
-	if (b2) {
-		/* If we already got to this bus through a different bridge, ignore it */
-		dev_dbg(&b2->dev, "bus already known\n");
-		goto err_out;
-	}
 
-	bridge = pci_alloc_host_bridge(b);
-	if (!bridge)
-		goto err_out;
-
-	bridge->domain = PCI_DOMAIN(db);
-	bridge->dev.parent = parent;
-	bridge->dev.release = pci_release_host_bridge_dev;
-	dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus);
+	bridge->bus = b;
+	b->bridge = get_device(&bridge->dev);
 	error = pcibios_root_bridge_prepare(bridge);
-	if (error) {
-		kfree(bridge);
+	if (error)
 		goto err_out;
-	}
 
-	error = device_register(&bridge->dev);
-	if (error) {
-		put_device(&bridge->dev);
-		goto err_out;
-	}
-	b->bridge = get_device(&bridge->dev);
 	device_enable_async_suspend(b->bridge);
 	pci_set_bus_of_node(b);
 
@@ -1945,10 +1901,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 
 	b->dev.class = &pcibus_class;
 	b->dev.parent = b->bridge;
-	dev_set_name(&b->dev, "%04x:%02x", pci_domain_nr(b), bus);
+	dev_set_name(&b->dev, "%04x:%02x", bridge->domain,
+			bridge->busnum);
 	error = device_register(&b->dev);
 	if (error)
-		goto class_dev_reg_err;
+		goto err_out;
 
 	pcibios_add_bus(b);
 
@@ -1961,12 +1918,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 		printk(KERN_INFO "PCI host bridge to bus %s\n", dev_name(&b->dev));
 
 	/* Add initial resources to the bus */
-	list_for_each_entry_safe(window, n, resources, list) {
-		list_move_tail(&window->list, &bridge->windows);
+	list_for_each_entry(window, &bridge->windows, list) {
 		res = window->res;
 		offset = window->offset;
 		if (res->flags & IORESOURCE_BUS)
-			pci_bus_insert_busn_res(b, bus, res->end);
+			pci_bus_insert_busn_res(b, bridge->busnum, res->end);
 		else
 			pci_bus_add_resource(b, res, 0);
 		if (offset) {
@@ -1988,14 +1944,23 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 
 	return b;
 
-class_dev_reg_err:
-	put_device(&bridge->dev);
-	device_unregister(&bridge->dev);
 err_out:
 	kfree(b);
 	return NULL;
 }
 
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
+		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+{
+	struct pci_host_bridge *host;
+
+	host = pci_create_host_bridge(parent, db, resources);
+	if (!host)
+		return NULL;
+
+	return __pci_create_root_bus(host, ops, sysdata);
+}
+
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
 {
 	struct resource *res = &b->busn_res;
@@ -2059,29 +2024,33 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 			res, ret ? "can not be" : "is");
 }
 
-struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+static struct pci_bus *__pci_scan_root_bus(
+		struct pci_host_bridge *host, struct pci_ops *ops,
+		void *sysdata)
 {
+
 	struct pci_host_bridge_window *window;
 	bool found = false;
 	struct pci_bus *b;
 	int max;
 
-	list_for_each_entry(window, resources, list)
+	list_for_each_entry(window, &host->windows, list)
 		if (window->res->flags & IORESOURCE_BUS) {
 			found = true;
 			break;
 		}
 
-	b = pci_create_root_bus(parent, db, ops, sysdata, resources);
-	if (!b)
+	b = __pci_create_root_bus(host, ops, sysdata);
+	if (!b) {
+		pci_free_host_bridge(host);
 		return NULL;
+	}
 
 	if (!found) {
 		dev_info(&b->dev,
 		 "No busn resource found for root bus, will use [bus %02x-ff]\n",
-			PCI_BUSNUM(db));
-		pci_bus_insert_busn_res(b, PCI_BUSNUM(db), 255);
+			host->busnum);
+		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}
 
 	max = pci_scan_child_bus(b);
@@ -2091,6 +2060,18 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 
 	return b;
 }
+
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
+		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+{
+	struct pci_host_bridge *host;
+
+	host = pci_create_host_bridge(parent, db, resources);
+	if (!host)
+		return NULL;
+
+	return __pci_scan_root_bus(host, ops, sysdata);
+}
 EXPORT_SYMBOL(pci_scan_root_bus);
 
 struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 1b9c799..5ee0033 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -403,8 +403,10 @@ struct pci_host_bridge_window {
 
 struct pci_host_bridge {
 	u16	domain;
+	u16 busnum;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
+	struct list_head list;
 	struct list_head windows;	/* pci_host_bridge_windows */
 	void (*release_fn)(struct pci_host_bridge *);
 	void *release_data;
@@ -416,7 +418,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 		     void *release_data);
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
-
+struct pci_host_bridge *pci_create_host_bridge(
+		struct device *parent, u32 dombus, struct list_head *resources);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
@@ -774,6 +777,7 @@ struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysda
 struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
+void pci_free_host_bridge(struct pci_host_bridge *host);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
 void pci_bus_release_busn_res(struct pci_bus *b);
-- 
1.7.1

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

* [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

We want to make a generic pci_host_bridge, then we could
place common PCI infos like domain number in it. Ripping
out pci_host_bridge creation from pci_create_root_bus()
make code more better readability. Further more, we could
use the generic pci_host_bridge to hold host bridge specific
operations like pcibios_root_bridge_prepare().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |   78 +++++++++++++++++++++++++++++
 drivers/pci/probe.c       |  121 +++++++++++++++++++--------------------------
 include/linux/pci.h       |    6 ++-
 3 files changed, 134 insertions(+), 71 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 0e5f3c9..c9ee582 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -8,6 +8,84 @@
 
 #include "pci.h"
 
+static LIST_HEAD(pci_host_bridge_list);
+static DEFINE_MUTEX(phb_mutex);
+
+static void pci_release_host_bridge_dev(struct device *dev)
+{
+	struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
+
+	if (bridge->release_fn)
+		bridge->release_fn(bridge);
+
+	pci_free_resource_list(&bridge->windows);
+	kfree(bridge);
+}
+
+struct pci_host_bridge *pci_create_host_bridge(
+		struct device *parent, u32 db, struct list_head *resources)
+{
+	int error;
+	int bus = PCI_BUSNUM(db);
+	int domain = PCI_DOMAIN(db);
+	struct pci_host_bridge *host, *temp;
+	struct pci_host_bridge_window *window, *n;
+
+	host = kzalloc(sizeof(*host), GFP_KERNEL);
+	if (!host)
+		return NULL;
+
+	host->busnum = bus;
+	host->domain = domain;
+	/* If support CONFIG_PCI_DOMAINS_GENERIC, use
+	 * pci_host_assign_domain_nr() to assign domain
+	 * number instead argu u32 db.
+	 */
+	pci_host_assign_domain_nr(host);
+
+	mutex_lock(&phb_mutex);
+	list_for_each_entry(temp, &pci_host_bridge_list, list)
+		if (temp->domain = host->domain
+				&& host->busnum = temp->busnum) {
+			dev_dbg(&host->dev, "pci host bridge pci%04x:%02x exist\n",
+					host->domain, host->busnum);
+			mutex_unlock(&phb_mutex);
+			kfree(host);
+			return NULL;
+		}
+	mutex_unlock(&phb_mutex);
+
+	host->dev.parent = parent;
+	INIT_LIST_HEAD(&host->windows);
+	host->dev.release = pci_release_host_bridge_dev;
+	dev_set_name(&host->dev, "pci%04x:%02x", host->domain,
+			host->busnum);
+
+	error = device_register(&host->dev);
+	if (error) {
+		put_device(&host->dev);
+		return NULL;
+	}
+
+	list_for_each_entry_safe(window, n, resources, list)
+		list_move_tail(&window->list, &host->windows);
+
+	mutex_lock(&phb_mutex);
+	list_add_tail(&host->list, &pci_host_bridge_list);
+	mutex_unlock(&phb_mutex);
+	return host;
+}
+EXPORT_SYMBOL(pci_create_host_bridge);
+
+void pci_free_host_bridge(struct pci_host_bridge *host)
+{
+	mutex_lock(&phb_mutex);
+	list_del(&host->list);
+	mutex_unlock(&phb_mutex);
+
+	device_unregister(&host->dev);
+}
+
 static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
 {
 	while (bus->parent)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 50f58b3..2e0b952 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -502,31 +502,6 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
 	return b;
 }
 
-static void pci_release_host_bridge_dev(struct device *dev)
-{
-	struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
-
-	if (bridge->release_fn)
-		bridge->release_fn(bridge);
-
-	pci_free_resource_list(&bridge->windows);
-
-	kfree(bridge);
-}
-
-static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)
-{
-	struct pci_host_bridge *bridge;
-
-	bridge = kzalloc(sizeof(*bridge), GFP_KERNEL);
-	if (!bridge)
-		return NULL;
-
-	INIT_LIST_HEAD(&bridge->windows);
-	bridge->bus = b;
-	return bridge;
-}
-
 static const unsigned char pcix_bus_speed[] = {
 	PCI_SPEED_UNKNOWN,		/* 0 */
 	PCI_SPEED_66MHz_PCIX,		/* 1 */
@@ -1889,54 +1864,35 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+static struct pci_bus *__pci_create_root_bus(
+		struct pci_host_bridge *bridge, struct pci_ops *ops,
+		void *sysdata)
 {
 	int error;
-	struct pci_host_bridge *bridge;
-	struct pci_bus *b, *b2;
-	struct pci_host_bridge_window *window, *n;
+	struct pci_bus *b;
+	struct pci_host_bridge_window *window;
+	struct device *parent;
 	struct resource *res;
 	resource_size_t offset;
 	char bus_addr[64];
 	char *fmt;
-	u8	bus = PCI_BUSNUM(db);
 
+	parent = bridge->dev.parent;
 	b = pci_alloc_bus(NULL);
 	if (!b)
 		return NULL;
 
 	b->sysdata = sysdata;
 	b->ops = ops;
-	b->number = b->busn_res.start = bus;
+	b->number = b->busn_res.start = bridge->busnum;
 	pci_bus_assign_domain_nr(b, parent);
-	b2 = pci_find_bus(pci_domain_nr(b), bus);
-	if (b2) {
-		/* If we already got to this bus through a different bridge, ignore it */
-		dev_dbg(&b2->dev, "bus already known\n");
-		goto err_out;
-	}
 
-	bridge = pci_alloc_host_bridge(b);
-	if (!bridge)
-		goto err_out;
-
-	bridge->domain = PCI_DOMAIN(db);
-	bridge->dev.parent = parent;
-	bridge->dev.release = pci_release_host_bridge_dev;
-	dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus);
+	bridge->bus = b;
+	b->bridge = get_device(&bridge->dev);
 	error = pcibios_root_bridge_prepare(bridge);
-	if (error) {
-		kfree(bridge);
+	if (error)
 		goto err_out;
-	}
 
-	error = device_register(&bridge->dev);
-	if (error) {
-		put_device(&bridge->dev);
-		goto err_out;
-	}
-	b->bridge = get_device(&bridge->dev);
 	device_enable_async_suspend(b->bridge);
 	pci_set_bus_of_node(b);
 
@@ -1945,10 +1901,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 
 	b->dev.class = &pcibus_class;
 	b->dev.parent = b->bridge;
-	dev_set_name(&b->dev, "%04x:%02x", pci_domain_nr(b), bus);
+	dev_set_name(&b->dev, "%04x:%02x", bridge->domain,
+			bridge->busnum);
 	error = device_register(&b->dev);
 	if (error)
-		goto class_dev_reg_err;
+		goto err_out;
 
 	pcibios_add_bus(b);
 
@@ -1961,12 +1918,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 		printk(KERN_INFO "PCI host bridge to bus %s\n", dev_name(&b->dev));
 
 	/* Add initial resources to the bus */
-	list_for_each_entry_safe(window, n, resources, list) {
-		list_move_tail(&window->list, &bridge->windows);
+	list_for_each_entry(window, &bridge->windows, list) {
 		res = window->res;
 		offset = window->offset;
 		if (res->flags & IORESOURCE_BUS)
-			pci_bus_insert_busn_res(b, bus, res->end);
+			pci_bus_insert_busn_res(b, bridge->busnum, res->end);
 		else
 			pci_bus_add_resource(b, res, 0);
 		if (offset) {
@@ -1988,14 +1944,23 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 
 	return b;
 
-class_dev_reg_err:
-	put_device(&bridge->dev);
-	device_unregister(&bridge->dev);
 err_out:
 	kfree(b);
 	return NULL;
 }
 
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
+		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+{
+	struct pci_host_bridge *host;
+
+	host = pci_create_host_bridge(parent, db, resources);
+	if (!host)
+		return NULL;
+
+	return __pci_create_root_bus(host, ops, sysdata);
+}
+
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
 {
 	struct resource *res = &b->busn_res;
@@ -2059,29 +2024,33 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 			res, ret ? "can not be" : "is");
 }
 
-struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+static struct pci_bus *__pci_scan_root_bus(
+		struct pci_host_bridge *host, struct pci_ops *ops,
+		void *sysdata)
 {
+
 	struct pci_host_bridge_window *window;
 	bool found = false;
 	struct pci_bus *b;
 	int max;
 
-	list_for_each_entry(window, resources, list)
+	list_for_each_entry(window, &host->windows, list)
 		if (window->res->flags & IORESOURCE_BUS) {
 			found = true;
 			break;
 		}
 
-	b = pci_create_root_bus(parent, db, ops, sysdata, resources);
-	if (!b)
+	b = __pci_create_root_bus(host, ops, sysdata);
+	if (!b) {
+		pci_free_host_bridge(host);
 		return NULL;
+	}
 
 	if (!found) {
 		dev_info(&b->dev,
 		 "No busn resource found for root bus, will use [bus %02x-ff]\n",
-			PCI_BUSNUM(db));
-		pci_bus_insert_busn_res(b, PCI_BUSNUM(db), 255);
+			host->busnum);
+		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}
 
 	max = pci_scan_child_bus(b);
@@ -2091,6 +2060,18 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 
 	return b;
 }
+
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
+		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+{
+	struct pci_host_bridge *host;
+
+	host = pci_create_host_bridge(parent, db, resources);
+	if (!host)
+		return NULL;
+
+	return __pci_scan_root_bus(host, ops, sysdata);
+}
 EXPORT_SYMBOL(pci_scan_root_bus);
 
 struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 1b9c799..5ee0033 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -403,8 +403,10 @@ struct pci_host_bridge_window {
 
 struct pci_host_bridge {
 	u16	domain;
+	u16 busnum;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
+	struct list_head list;
 	struct list_head windows;	/* pci_host_bridge_windows */
 	void (*release_fn)(struct pci_host_bridge *);
 	void *release_data;
@@ -416,7 +418,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 		     void *release_data);
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
-
+struct pci_host_bridge *pci_create_host_bridge(
+		struct device *parent, u32 dombus, struct list_head *resources);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
@@ -774,6 +777,7 @@ struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysda
 struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
+void pci_free_host_bridge(struct pci_host_bridge *host);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
 void pci_bus_release_busn_res(struct pci_bus *b);
-- 
1.7.1


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

* [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

We want to make a generic pci_host_bridge, then we could
place common PCI infos like domain number in it. Ripping
out pci_host_bridge creation from pci_create_root_bus()
make code more better readability. Further more, we could
use the generic pci_host_bridge to hold host bridge specific
operations like pcibios_root_bridge_prepare().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |   78 +++++++++++++++++++++++++++++
 drivers/pci/probe.c       |  121 +++++++++++++++++++--------------------------
 include/linux/pci.h       |    6 ++-
 3 files changed, 134 insertions(+), 71 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 0e5f3c9..c9ee582 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -8,6 +8,84 @@
 
 #include "pci.h"
 
+static LIST_HEAD(pci_host_bridge_list);
+static DEFINE_MUTEX(phb_mutex);
+
+static void pci_release_host_bridge_dev(struct device *dev)
+{
+	struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
+
+	if (bridge->release_fn)
+		bridge->release_fn(bridge);
+
+	pci_free_resource_list(&bridge->windows);
+	kfree(bridge);
+}
+
+struct pci_host_bridge *pci_create_host_bridge(
+		struct device *parent, u32 db, struct list_head *resources)
+{
+	int error;
+	int bus = PCI_BUSNUM(db);
+	int domain = PCI_DOMAIN(db);
+	struct pci_host_bridge *host, *temp;
+	struct pci_host_bridge_window *window, *n;
+
+	host = kzalloc(sizeof(*host), GFP_KERNEL);
+	if (!host)
+		return NULL;
+
+	host->busnum = bus;
+	host->domain = domain;
+	/* If support CONFIG_PCI_DOMAINS_GENERIC, use
+	 * pci_host_assign_domain_nr() to assign domain
+	 * number instead argu u32 db.
+	 */
+	pci_host_assign_domain_nr(host);
+
+	mutex_lock(&phb_mutex);
+	list_for_each_entry(temp, &pci_host_bridge_list, list)
+		if (temp->domain == host->domain
+				&& host->busnum == temp->busnum) {
+			dev_dbg(&host->dev, "pci host bridge pci%04x:%02x exist\n",
+					host->domain, host->busnum);
+			mutex_unlock(&phb_mutex);
+			kfree(host);
+			return NULL;
+		}
+	mutex_unlock(&phb_mutex);
+
+	host->dev.parent = parent;
+	INIT_LIST_HEAD(&host->windows);
+	host->dev.release = pci_release_host_bridge_dev;
+	dev_set_name(&host->dev, "pci%04x:%02x", host->domain,
+			host->busnum);
+
+	error = device_register(&host->dev);
+	if (error) {
+		put_device(&host->dev);
+		return NULL;
+	}
+
+	list_for_each_entry_safe(window, n, resources, list)
+		list_move_tail(&window->list, &host->windows);
+
+	mutex_lock(&phb_mutex);
+	list_add_tail(&host->list, &pci_host_bridge_list);
+	mutex_unlock(&phb_mutex);
+	return host;
+}
+EXPORT_SYMBOL(pci_create_host_bridge);
+
+void pci_free_host_bridge(struct pci_host_bridge *host)
+{
+	mutex_lock(&phb_mutex);
+	list_del(&host->list);
+	mutex_unlock(&phb_mutex);
+
+	device_unregister(&host->dev);
+}
+
 static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
 {
 	while (bus->parent)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 50f58b3..2e0b952 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -502,31 +502,6 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
 	return b;
 }
 
-static void pci_release_host_bridge_dev(struct device *dev)
-{
-	struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
-
-	if (bridge->release_fn)
-		bridge->release_fn(bridge);
-
-	pci_free_resource_list(&bridge->windows);
-
-	kfree(bridge);
-}
-
-static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)
-{
-	struct pci_host_bridge *bridge;
-
-	bridge = kzalloc(sizeof(*bridge), GFP_KERNEL);
-	if (!bridge)
-		return NULL;
-
-	INIT_LIST_HEAD(&bridge->windows);
-	bridge->bus = b;
-	return bridge;
-}
-
 static const unsigned char pcix_bus_speed[] = {
 	PCI_SPEED_UNKNOWN,		/* 0 */
 	PCI_SPEED_66MHz_PCIX,		/* 1 */
@@ -1889,54 +1864,35 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+static struct pci_bus *__pci_create_root_bus(
+		struct pci_host_bridge *bridge, struct pci_ops *ops,
+		void *sysdata)
 {
 	int error;
-	struct pci_host_bridge *bridge;
-	struct pci_bus *b, *b2;
-	struct pci_host_bridge_window *window, *n;
+	struct pci_bus *b;
+	struct pci_host_bridge_window *window;
+	struct device *parent;
 	struct resource *res;
 	resource_size_t offset;
 	char bus_addr[64];
 	char *fmt;
-	u8	bus = PCI_BUSNUM(db);
 
+	parent = bridge->dev.parent;
 	b = pci_alloc_bus(NULL);
 	if (!b)
 		return NULL;
 
 	b->sysdata = sysdata;
 	b->ops = ops;
-	b->number = b->busn_res.start = bus;
+	b->number = b->busn_res.start = bridge->busnum;
 	pci_bus_assign_domain_nr(b, parent);
-	b2 = pci_find_bus(pci_domain_nr(b), bus);
-	if (b2) {
-		/* If we already got to this bus through a different bridge, ignore it */
-		dev_dbg(&b2->dev, "bus already known\n");
-		goto err_out;
-	}
 
-	bridge = pci_alloc_host_bridge(b);
-	if (!bridge)
-		goto err_out;
-
-	bridge->domain = PCI_DOMAIN(db);
-	bridge->dev.parent = parent;
-	bridge->dev.release = pci_release_host_bridge_dev;
-	dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus);
+	bridge->bus = b;
+	b->bridge = get_device(&bridge->dev);
 	error = pcibios_root_bridge_prepare(bridge);
-	if (error) {
-		kfree(bridge);
+	if (error)
 		goto err_out;
-	}
 
-	error = device_register(&bridge->dev);
-	if (error) {
-		put_device(&bridge->dev);
-		goto err_out;
-	}
-	b->bridge = get_device(&bridge->dev);
 	device_enable_async_suspend(b->bridge);
 	pci_set_bus_of_node(b);
 
@@ -1945,10 +1901,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 
 	b->dev.class = &pcibus_class;
 	b->dev.parent = b->bridge;
-	dev_set_name(&b->dev, "%04x:%02x", pci_domain_nr(b), bus);
+	dev_set_name(&b->dev, "%04x:%02x", bridge->domain,
+			bridge->busnum);
 	error = device_register(&b->dev);
 	if (error)
-		goto class_dev_reg_err;
+		goto err_out;
 
 	pcibios_add_bus(b);
 
@@ -1961,12 +1918,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 		printk(KERN_INFO "PCI host bridge to bus %s\n", dev_name(&b->dev));
 
 	/* Add initial resources to the bus */
-	list_for_each_entry_safe(window, n, resources, list) {
-		list_move_tail(&window->list, &bridge->windows);
+	list_for_each_entry(window, &bridge->windows, list) {
 		res = window->res;
 		offset = window->offset;
 		if (res->flags & IORESOURCE_BUS)
-			pci_bus_insert_busn_res(b, bus, res->end);
+			pci_bus_insert_busn_res(b, bridge->busnum, res->end);
 		else
 			pci_bus_add_resource(b, res, 0);
 		if (offset) {
@@ -1988,14 +1944,23 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 
 	return b;
 
-class_dev_reg_err:
-	put_device(&bridge->dev);
-	device_unregister(&bridge->dev);
 err_out:
 	kfree(b);
 	return NULL;
 }
 
+struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
+		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+{
+	struct pci_host_bridge *host;
+
+	host = pci_create_host_bridge(parent, db, resources);
+	if (!host)
+		return NULL;
+
+	return __pci_create_root_bus(host, ops, sysdata);
+}
+
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
 {
 	struct resource *res = &b->busn_res;
@@ -2059,29 +2024,33 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 			res, ret ? "can not be" : "is");
 }
 
-struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+static struct pci_bus *__pci_scan_root_bus(
+		struct pci_host_bridge *host, struct pci_ops *ops,
+		void *sysdata)
 {
+
 	struct pci_host_bridge_window *window;
 	bool found = false;
 	struct pci_bus *b;
 	int max;
 
-	list_for_each_entry(window, resources, list)
+	list_for_each_entry(window, &host->windows, list)
 		if (window->res->flags & IORESOURCE_BUS) {
 			found = true;
 			break;
 		}
 
-	b = pci_create_root_bus(parent, db, ops, sysdata, resources);
-	if (!b)
+	b = __pci_create_root_bus(host, ops, sysdata);
+	if (!b) {
+		pci_free_host_bridge(host);
 		return NULL;
+	}
 
 	if (!found) {
 		dev_info(&b->dev,
 		 "No busn resource found for root bus, will use [bus %02x-ff]\n",
-			PCI_BUSNUM(db));
-		pci_bus_insert_busn_res(b, PCI_BUSNUM(db), 255);
+			host->busnum);
+		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}
 
 	max = pci_scan_child_bus(b);
@@ -2091,6 +2060,18 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 
 	return b;
 }
+
+struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
+		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+{
+	struct pci_host_bridge *host;
+
+	host = pci_create_host_bridge(parent, db, resources);
+	if (!host)
+		return NULL;
+
+	return __pci_scan_root_bus(host, ops, sysdata);
+}
 EXPORT_SYMBOL(pci_scan_root_bus);
 
 struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 1b9c799..5ee0033 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -403,8 +403,10 @@ struct pci_host_bridge_window {
 
 struct pci_host_bridge {
 	u16	domain;
+	u16 busnum;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
+	struct list_head list;
 	struct list_head windows;	/* pci_host_bridge_windows */
 	void (*release_fn)(struct pci_host_bridge *);
 	void *release_data;
@@ -416,7 +418,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 		     void *release_data);
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
-
+struct pci_host_bridge *pci_create_host_bridge(
+		struct device *parent, u32 dombus, struct list_head *resources);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
@@ -774,6 +777,7 @@ struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysda
 struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
+void pci_free_host_bridge(struct pci_host_bridge *host);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
 void pci_bus_release_busn_res(struct pci_bus *b);
-- 
1.7.1

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

* [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Save platform specific sysdata in pci_host_bridge
drvdata, host bridge specific operation need to
access it before the pci bus creation.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |    4 +++-
 drivers/pci/probe.c       |   18 ++++++++----------
 include/linux/pci.h       |    3 ++-
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index c9ee582..0b6ba5c 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -23,7 +23,8 @@ static void pci_release_host_bridge_dev(struct device *dev)
 }
 
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 db, struct list_head *resources)
+		struct device *parent, u32 db,
+		struct list_head *resources, void *sysdata)
 {
 	int error;
 	int bus = PCI_BUSNUM(db);
@@ -58,6 +59,7 @@ struct pci_host_bridge *pci_create_host_bridge(
 	host->dev.parent = parent;
 	INIT_LIST_HEAD(&host->windows);
 	host->dev.release = pci_release_host_bridge_dev;
+	dev_set_drvdata(&host->dev, sysdata);
 	dev_set_name(&host->dev, "pci%04x:%02x", host->domain, 
 			host->busnum);
 
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 2e0b952..98a8d97 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1865,8 +1865,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 }
 
 static struct pci_bus *__pci_create_root_bus(
-		struct pci_host_bridge *bridge, struct pci_ops *ops,
-		void *sysdata)
+		struct pci_host_bridge *bridge, struct pci_ops *ops)
 {
 	int error;
 	struct pci_bus *b;
@@ -1882,7 +1881,7 @@ static struct pci_bus *__pci_create_root_bus(
 	if (!b)
 		return NULL;
 
-	b->sysdata = sysdata;
+	b->sysdata = dev_get_drvdata(&bridge->dev);
 	b->ops = ops;
 	b->number = b->busn_res.start = bridge->busnum;
 	pci_bus_assign_domain_nr(b, parent);
@@ -1954,11 +1953,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources);
+	host = pci_create_host_bridge(parent, db, resources, sysdata);
 	if (!host)
 		return NULL;
 	
-	return __pci_create_root_bus(host, ops, sysdata);
+	return __pci_create_root_bus(host, ops);
 }
 
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
@@ -2025,8 +2024,7 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 }
 
 static struct pci_bus *__pci_scan_root_bus(
-		struct pci_host_bridge *host, struct pci_ops *ops,
-		void *sysdata)
+		struct pci_host_bridge *host, struct pci_ops *ops)
 {
 
 	struct pci_host_bridge_window *window;
@@ -2040,7 +2038,7 @@ static struct pci_bus *__pci_scan_root_bus(
 			break;
 		}
 
-	b = __pci_create_root_bus(host, ops, sysdata);
+	b = __pci_create_root_bus(host, ops);
 	if (!b) {
 		pci_free_host_bridge(host);
 		return NULL;
@@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources);
+	host = pci_create_host_bridge(parent, db, resources, sysdata);
 	if (!host)
 		return NULL;
 
-	return __pci_scan_root_bus(host, ops, sysdata);
+	return __pci_scan_root_bus(host, ops);
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5ee0033..3ee8436 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -419,7 +419,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 dombus, struct list_head *resources);
+		struct device *parent, u32 dombus,
+		struct list_head *resources, void *sysdata);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1


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

* [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
  2015-01-16  1:43 ` Yijing Wang
                   ` (22 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Save platform specific sysdata in pci_host_bridge
drvdata, host bridge specific operation need to
access it before the pci bus creation.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |    4 +++-
 drivers/pci/probe.c       |   18 ++++++++----------
 include/linux/pci.h       |    3 ++-
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index c9ee582..0b6ba5c 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -23,7 +23,8 @@ static void pci_release_host_bridge_dev(struct device *dev)
 }
 
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 db, struct list_head *resources)
+		struct device *parent, u32 db,
+		struct list_head *resources, void *sysdata)
 {
 	int error;
 	int bus = PCI_BUSNUM(db);
@@ -58,6 +59,7 @@ struct pci_host_bridge *pci_create_host_bridge(
 	host->dev.parent = parent;
 	INIT_LIST_HEAD(&host->windows);
 	host->dev.release = pci_release_host_bridge_dev;
+	dev_set_drvdata(&host->dev, sysdata);
 	dev_set_name(&host->dev, "pci%04x:%02x", host->domain, 
 			host->busnum);
 
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 2e0b952..98a8d97 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1865,8 +1865,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 }
 
 static struct pci_bus *__pci_create_root_bus(
-		struct pci_host_bridge *bridge, struct pci_ops *ops,
-		void *sysdata)
+		struct pci_host_bridge *bridge, struct pci_ops *ops)
 {
 	int error;
 	struct pci_bus *b;
@@ -1882,7 +1881,7 @@ static struct pci_bus *__pci_create_root_bus(
 	if (!b)
 		return NULL;
 
-	b->sysdata = sysdata;
+	b->sysdata = dev_get_drvdata(&bridge->dev);
 	b->ops = ops;
 	b->number = b->busn_res.start = bridge->busnum;
 	pci_bus_assign_domain_nr(b, parent);
@@ -1954,11 +1953,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources);
+	host = pci_create_host_bridge(parent, db, resources, sysdata);
 	if (!host)
 		return NULL;
 	
-	return __pci_create_root_bus(host, ops, sysdata);
+	return __pci_create_root_bus(host, ops);
 }
 
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
@@ -2025,8 +2024,7 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 }
 
 static struct pci_bus *__pci_scan_root_bus(
-		struct pci_host_bridge *host, struct pci_ops *ops,
-		void *sysdata)
+		struct pci_host_bridge *host, struct pci_ops *ops)
 {
 
 	struct pci_host_bridge_window *window;
@@ -2040,7 +2038,7 @@ static struct pci_bus *__pci_scan_root_bus(
 			break;
 		}
 
-	b = __pci_create_root_bus(host, ops, sysdata);
+	b = __pci_create_root_bus(host, ops);
 	if (!b) {
 		pci_free_host_bridge(host);
 		return NULL;
@@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources);
+	host = pci_create_host_bridge(parent, db, resources, sysdata);
 	if (!host)
 		return NULL;
 
-	return __pci_scan_root_bus(host, ops, sysdata);
+	return __pci_scan_root_bus(host, ops);
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5ee0033..3ee8436 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -419,7 +419,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 dombus, struct list_head *resources);
+		struct device *parent, u32 dombus,
+		struct list_head *resources, void *sysdata);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1

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

* [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Save platform specific sysdata in pci_host_bridge
drvdata, host bridge specific operation need to
access it before the pci bus creation.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |    4 +++-
 drivers/pci/probe.c       |   18 ++++++++----------
 include/linux/pci.h       |    3 ++-
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index c9ee582..0b6ba5c 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -23,7 +23,8 @@ static void pci_release_host_bridge_dev(struct device *dev)
 }
 
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 db, struct list_head *resources)
+		struct device *parent, u32 db,
+		struct list_head *resources, void *sysdata)
 {
 	int error;
 	int bus = PCI_BUSNUM(db);
@@ -58,6 +59,7 @@ struct pci_host_bridge *pci_create_host_bridge(
 	host->dev.parent = parent;
 	INIT_LIST_HEAD(&host->windows);
 	host->dev.release = pci_release_host_bridge_dev;
+	dev_set_drvdata(&host->dev, sysdata);
 	dev_set_name(&host->dev, "pci%04x:%02x", host->domain, 
 			host->busnum);
 
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 2e0b952..98a8d97 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1865,8 +1865,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 }
 
 static struct pci_bus *__pci_create_root_bus(
-		struct pci_host_bridge *bridge, struct pci_ops *ops,
-		void *sysdata)
+		struct pci_host_bridge *bridge, struct pci_ops *ops)
 {
 	int error;
 	struct pci_bus *b;
@@ -1882,7 +1881,7 @@ static struct pci_bus *__pci_create_root_bus(
 	if (!b)
 		return NULL;
 
-	b->sysdata = sysdata;
+	b->sysdata = dev_get_drvdata(&bridge->dev);
 	b->ops = ops;
 	b->number = b->busn_res.start = bridge->busnum;
 	pci_bus_assign_domain_nr(b, parent);
@@ -1954,11 +1953,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources);
+	host = pci_create_host_bridge(parent, db, resources, sysdata);
 	if (!host)
 		return NULL;
 	
-	return __pci_create_root_bus(host, ops, sysdata);
+	return __pci_create_root_bus(host, ops);
 }
 
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
@@ -2025,8 +2024,7 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 }
 
 static struct pci_bus *__pci_scan_root_bus(
-		struct pci_host_bridge *host, struct pci_ops *ops,
-		void *sysdata)
+		struct pci_host_bridge *host, struct pci_ops *ops)
 {
 
 	struct pci_host_bridge_window *window;
@@ -2040,7 +2038,7 @@ static struct pci_bus *__pci_scan_root_bus(
 			break;
 		}
 
-	b = __pci_create_root_bus(host, ops, sysdata);
+	b = __pci_create_root_bus(host, ops);
 	if (!b) {
 		pci_free_host_bridge(host);
 		return NULL;
@@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources);
+	host = pci_create_host_bridge(parent, db, resources, sysdata);
 	if (!host)
 		return NULL;
 
-	return __pci_scan_root_bus(host, ops, sysdata);
+	return __pci_scan_root_bus(host, ops);
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5ee0033..3ee8436 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -419,7 +419,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 dombus, struct list_head *resources);
+		struct device *parent, u32 dombus,
+		struct list_head *resources, void *sysdata);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1


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

* [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Save platform specific sysdata in pci_host_bridge
drvdata, host bridge specific operation need to
access it before the pci bus creation.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |    4 +++-
 drivers/pci/probe.c       |   18 ++++++++----------
 include/linux/pci.h       |    3 ++-
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index c9ee582..0b6ba5c 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -23,7 +23,8 @@ static void pci_release_host_bridge_dev(struct device *dev)
 }
 
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 db, struct list_head *resources)
+		struct device *parent, u32 db,
+		struct list_head *resources, void *sysdata)
 {
 	int error;
 	int bus = PCI_BUSNUM(db);
@@ -58,6 +59,7 @@ struct pci_host_bridge *pci_create_host_bridge(
 	host->dev.parent = parent;
 	INIT_LIST_HEAD(&host->windows);
 	host->dev.release = pci_release_host_bridge_dev;
+	dev_set_drvdata(&host->dev, sysdata);
 	dev_set_name(&host->dev, "pci%04x:%02x", host->domain, 
 			host->busnum);
 
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 2e0b952..98a8d97 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1865,8 +1865,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 }
 
 static struct pci_bus *__pci_create_root_bus(
-		struct pci_host_bridge *bridge, struct pci_ops *ops,
-		void *sysdata)
+		struct pci_host_bridge *bridge, struct pci_ops *ops)
 {
 	int error;
 	struct pci_bus *b;
@@ -1882,7 +1881,7 @@ static struct pci_bus *__pci_create_root_bus(
 	if (!b)
 		return NULL;
 
-	b->sysdata = sysdata;
+	b->sysdata = dev_get_drvdata(&bridge->dev);
 	b->ops = ops;
 	b->number = b->busn_res.start = bridge->busnum;
 	pci_bus_assign_domain_nr(b, parent);
@@ -1954,11 +1953,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources);
+	host = pci_create_host_bridge(parent, db, resources, sysdata);
 	if (!host)
 		return NULL;
 	
-	return __pci_create_root_bus(host, ops, sysdata);
+	return __pci_create_root_bus(host, ops);
 }
 
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
@@ -2025,8 +2024,7 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 }
 
 static struct pci_bus *__pci_scan_root_bus(
-		struct pci_host_bridge *host, struct pci_ops *ops,
-		void *sysdata)
+		struct pci_host_bridge *host, struct pci_ops *ops)
 {
 
 	struct pci_host_bridge_window *window;
@@ -2040,7 +2038,7 @@ static struct pci_bus *__pci_scan_root_bus(
 			break;
 		}
 
-	b = __pci_create_root_bus(host, ops, sysdata);
+	b = __pci_create_root_bus(host, ops);
 	if (!b) {
 		pci_free_host_bridge(host);
 		return NULL;
@@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources);
+	host = pci_create_host_bridge(parent, db, resources, sysdata);
 	if (!host)
 		return NULL;
 
-	return __pci_scan_root_bus(host, ops, sysdata);
+	return __pci_scan_root_bus(host, ops);
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5ee0033..3ee8436 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -419,7 +419,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 dombus, struct list_head *resources);
+		struct device *parent, u32 dombus,
+		struct list_head *resources, void *sysdata);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1

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

* [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Save platform specific sysdata in pci_host_bridge
drvdata, host bridge specific operation need to
access it before the pci bus creation.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |    4 +++-
 drivers/pci/probe.c       |   18 ++++++++----------
 include/linux/pci.h       |    3 ++-
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index c9ee582..0b6ba5c 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -23,7 +23,8 @@ static void pci_release_host_bridge_dev(struct device *dev)
 }
 
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 db, struct list_head *resources)
+		struct device *parent, u32 db,
+		struct list_head *resources, void *sysdata)
 {
 	int error;
 	int bus = PCI_BUSNUM(db);
@@ -58,6 +59,7 @@ struct pci_host_bridge *pci_create_host_bridge(
 	host->dev.parent = parent;
 	INIT_LIST_HEAD(&host->windows);
 	host->dev.release = pci_release_host_bridge_dev;
+	dev_set_drvdata(&host->dev, sysdata);
 	dev_set_name(&host->dev, "pci%04x:%02x", host->domain, 
 			host->busnum);
 
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 2e0b952..98a8d97 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1865,8 +1865,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 }
 
 static struct pci_bus *__pci_create_root_bus(
-		struct pci_host_bridge *bridge, struct pci_ops *ops,
-		void *sysdata)
+		struct pci_host_bridge *bridge, struct pci_ops *ops)
 {
 	int error;
 	struct pci_bus *b;
@@ -1882,7 +1881,7 @@ static struct pci_bus *__pci_create_root_bus(
 	if (!b)
 		return NULL;
 
-	b->sysdata = sysdata;
+	b->sysdata = dev_get_drvdata(&bridge->dev);
 	b->ops = ops;
 	b->number = b->busn_res.start = bridge->busnum;
 	pci_bus_assign_domain_nr(b, parent);
@@ -1954,11 +1953,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources);
+	host = pci_create_host_bridge(parent, db, resources, sysdata);
 	if (!host)
 		return NULL;
 	
-	return __pci_create_root_bus(host, ops, sysdata);
+	return __pci_create_root_bus(host, ops);
 }
 
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
@@ -2025,8 +2024,7 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 }
 
 static struct pci_bus *__pci_scan_root_bus(
-		struct pci_host_bridge *host, struct pci_ops *ops,
-		void *sysdata)
+		struct pci_host_bridge *host, struct pci_ops *ops)
 {
 
 	struct pci_host_bridge_window *window;
@@ -2040,7 +2038,7 @@ static struct pci_bus *__pci_scan_root_bus(
 			break;
 		}
 
-	b = __pci_create_root_bus(host, ops, sysdata);
+	b = __pci_create_root_bus(host, ops);
 	if (!b) {
 		pci_free_host_bridge(host);
 		return NULL;
@@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources);
+	host = pci_create_host_bridge(parent, db, resources, sysdata);
 	if (!host)
 		return NULL;
 
-	return __pci_scan_root_bus(host, ops, sysdata);
+	return __pci_scan_root_bus(host, ops);
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5ee0033..3ee8436 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -419,7 +419,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 dombus, struct list_head *resources);
+		struct device *parent, u32 dombus,
+		struct list_head *resources, void *sysdata);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1


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

* [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Save platform specific sysdata in pci_host_bridge
drvdata, host bridge specific operation need to
access it before the pci bus creation.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |    4 +++-
 drivers/pci/probe.c       |   18 ++++++++----------
 include/linux/pci.h       |    3 ++-
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index c9ee582..0b6ba5c 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -23,7 +23,8 @@ static void pci_release_host_bridge_dev(struct device *dev)
 }
 
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 db, struct list_head *resources)
+		struct device *parent, u32 db,
+		struct list_head *resources, void *sysdata)
 {
 	int error;
 	int bus = PCI_BUSNUM(db);
@@ -58,6 +59,7 @@ struct pci_host_bridge *pci_create_host_bridge(
 	host->dev.parent = parent;
 	INIT_LIST_HEAD(&host->windows);
 	host->dev.release = pci_release_host_bridge_dev;
+	dev_set_drvdata(&host->dev, sysdata);
 	dev_set_name(&host->dev, "pci%04x:%02x", host->domain, 
 			host->busnum);
 
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 2e0b952..98a8d97 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1865,8 +1865,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 }
 
 static struct pci_bus *__pci_create_root_bus(
-		struct pci_host_bridge *bridge, struct pci_ops *ops,
-		void *sysdata)
+		struct pci_host_bridge *bridge, struct pci_ops *ops)
 {
 	int error;
 	struct pci_bus *b;
@@ -1882,7 +1881,7 @@ static struct pci_bus *__pci_create_root_bus(
 	if (!b)
 		return NULL;
 
-	b->sysdata = sysdata;
+	b->sysdata = dev_get_drvdata(&bridge->dev);
 	b->ops = ops;
 	b->number = b->busn_res.start = bridge->busnum;
 	pci_bus_assign_domain_nr(b, parent);
@@ -1954,11 +1953,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources);
+	host = pci_create_host_bridge(parent, db, resources, sysdata);
 	if (!host)
 		return NULL;
 	
-	return __pci_create_root_bus(host, ops, sysdata);
+	return __pci_create_root_bus(host, ops);
 }
 
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
@@ -2025,8 +2024,7 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 }
 
 static struct pci_bus *__pci_scan_root_bus(
-		struct pci_host_bridge *host, struct pci_ops *ops,
-		void *sysdata)
+		struct pci_host_bridge *host, struct pci_ops *ops)
 {
 
 	struct pci_host_bridge_window *window;
@@ -2040,7 +2038,7 @@ static struct pci_bus *__pci_scan_root_bus(
 			break;
 		}
 
-	b = __pci_create_root_bus(host, ops, sysdata);
+	b = __pci_create_root_bus(host, ops);
 	if (!b) {
 		pci_free_host_bridge(host);
 		return NULL;
@@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources);
+	host = pci_create_host_bridge(parent, db, resources, sysdata);
 	if (!host)
 		return NULL;
 
-	return __pci_scan_root_bus(host, ops, sysdata);
+	return __pci_scan_root_bus(host, ops);
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5ee0033..3ee8436 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -419,7 +419,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 dombus, struct list_head *resources);
+		struct device *parent, u32 dombus,
+		struct list_head *resources, void *sysdata);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1


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

* [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we have weak functions like pcibios_root_bridge_prepare()
to setup pci host bridge, We could introduce pci_host_bridge_ops
which contain host bridge specific ops to setup pci_host_bridge.
Then host bridge driver could add pci_host_bridge_ops hooks
intead of weak function to setup pci_host_bridge.
This patch add following pci_host_bridge_ops hooks:

pci_host_bridge_ops {
	/* set root bus speed, some platform need this like powerpc */
	void (*phb_set_root_bus_speed)(struct pci_host_bridge *host);
	/* setup pci_host_bridge before pci_host_bridge be added to driver core */
	int (*phb_prepare)(struct pci_host_bridge *host);
	/* probe whether pci_host_bridge scan mode is of mode */
	void (*phb_probe_mode)(struct pci_host_bridge *);
	/* platform specific of scan hook to scan pci device */
	void (*phb_of_scan_bus)(struct pci_host_bridge *);
}

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |   12 ++++++++++--
 drivers/pci/probe.c       |   19 ++++++++++++++-----
 include/linux/pci.h       |   16 ++++++++++++++--
 3 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 0b6ba5c..ccbf168 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -23,8 +23,8 @@ static void pci_release_host_bridge_dev(struct device *dev)
 }
 
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 db, 
-		struct list_head *resources, void *sysdata)
+		struct device *parent, u32 db, struct list_head *resources,
+		void *sysdata, struct pci_host_bridge_ops *ops)
 {
 	int error;
 	int bus = PCI_BUSNUM(db);
@@ -56,6 +56,7 @@ struct pci_host_bridge *pci_create_host_bridge(
 		}
 	mutex_unlock(&phb_mutex);
 
+	host->ops = ops;
 	host->dev.parent = parent;
 	INIT_LIST_HEAD(&host->windows);
 	host->dev.release = pci_release_host_bridge_dev;
@@ -63,6 +64,13 @@ struct pci_host_bridge *pci_create_host_bridge(
 	dev_set_name(&host->dev, "pci%04x:%02x", host->domain, 
 			host->busnum);
 
+	if (host->ops && host->ops->phb_prepare) {
+		error = host->ops->phb_prepare(host);
+		if(error) {
+			kfree(host);
+			return NULL;
+		}
+	}
 	error = device_register(&host->dev);
 	if (error) {
 		put_device(&host->dev);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 98a8d97..5f748ed 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1888,6 +1888,8 @@ static struct pci_bus *__pci_create_root_bus(
 
 	bridge->bus = b;
 	b->bridge = get_device(&bridge->dev);
+	if (bridge->ops && bridge->ops->phb_set_root_bus_speed)
+		bridge->ops->phb_set_root_bus_speed(bridge);
 	error = pcibios_root_bridge_prepare(bridge);
 	if (error)
 		goto err_out;
@@ -1953,7 +1955,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources, sysdata);
+	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
 	if (!host)
 		return NULL;
 	
@@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
 		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}
 
-	max = pci_scan_child_bus(b);
+	if (host->ops && host->ops->phb_probe_mode)
+		host->ops->phb_probe_mode(host);
 
-	if (!found)
-		pci_bus_update_busn_res_end(b, max);
+	if (host->of_scan) {
+		if (host->ops &&host->ops->phb_of_scan_bus)
+			host->ops->phb_of_scan_bus(host);
+	} else {
+		max = pci_scan_child_bus(b);
+		if (!found)
+			pci_bus_update_busn_res_end(b, max);
+	}
 
 	return b;
 }
@@ -2064,7 +2073,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources, sysdata);
+	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
 	if (!host)
 		return NULL;
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3ee8436..c06b95d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -401,13 +401,25 @@ struct pci_host_bridge_window {
 	resource_size_t offset;		/* bus address + offset = CPU address */
 };
 
+struct pci_host_bridge;
+struct pci_host_bridge_ops {
+	void (*phb_set_root_bus_speed)(struct pci_host_bridge *host);
+	int (*phb_prepare)(struct pci_host_bridge *host);
+	/* Override domain number by host specific .phv_assign_domain_nr()  */
+	void (*phb_assign_domain_nr)(struct pci_host_bridge *);
+	void (*phb_probe_mode)(struct pci_host_bridge *);
+	void (*phb_of_scan_bus)(struct pci_host_bridge *);
+};
+
 struct pci_host_bridge {
 	u16	domain;
 	u16 busnum;
+	bool of_scan;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
 	struct list_head list;
 	struct list_head windows;	/* pci_host_bridge_windows */
+	struct pci_host_bridge_ops *ops;
 	void (*release_fn)(struct pci_host_bridge *);
 	void *release_data;
 };
@@ -419,8 +431,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 dombus, 
-		struct list_head *resources, void *sysdata);
+		struct device *parent, u32 dombus, struct list_head *resources,
+		void *sysdata, struct pci_host_bridge_ops *ops);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1


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

* [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge
  2015-01-16  1:43 ` Yijing Wang
                   ` (24 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we have weak functions like pcibios_root_bridge_prepare()
to setup pci host bridge, We could introduce pci_host_bridge_ops
which contain host bridge specific ops to setup pci_host_bridge.
Then host bridge driver could add pci_host_bridge_ops hooks
intead of weak function to setup pci_host_bridge.
This patch add following pci_host_bridge_ops hooks:

pci_host_bridge_ops {
	/* set root bus speed, some platform need this like powerpc */
	void (*phb_set_root_bus_speed)(struct pci_host_bridge *host);
	/* setup pci_host_bridge before pci_host_bridge be added to driver core */
	int (*phb_prepare)(struct pci_host_bridge *host);
	/* probe whether pci_host_bridge scan mode is of mode */
	void (*phb_probe_mode)(struct pci_host_bridge *);
	/* platform specific of scan hook to scan pci device */
	void (*phb_of_scan_bus)(struct pci_host_bridge *);
}

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |   12 ++++++++++--
 drivers/pci/probe.c       |   19 ++++++++++++++-----
 include/linux/pci.h       |   16 ++++++++++++++--
 3 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 0b6ba5c..ccbf168 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -23,8 +23,8 @@ static void pci_release_host_bridge_dev(struct device *dev)
 }
 
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 db, 
-		struct list_head *resources, void *sysdata)
+		struct device *parent, u32 db, struct list_head *resources,
+		void *sysdata, struct pci_host_bridge_ops *ops)
 {
 	int error;
 	int bus = PCI_BUSNUM(db);
@@ -56,6 +56,7 @@ struct pci_host_bridge *pci_create_host_bridge(
 		}
 	mutex_unlock(&phb_mutex);
 
+	host->ops = ops;
 	host->dev.parent = parent;
 	INIT_LIST_HEAD(&host->windows);
 	host->dev.release = pci_release_host_bridge_dev;
@@ -63,6 +64,13 @@ struct pci_host_bridge *pci_create_host_bridge(
 	dev_set_name(&host->dev, "pci%04x:%02x", host->domain, 
 			host->busnum);
 
+	if (host->ops && host->ops->phb_prepare) {
+		error = host->ops->phb_prepare(host);
+		if(error) {
+			kfree(host);
+			return NULL;
+		}
+	}
 	error = device_register(&host->dev);
 	if (error) {
 		put_device(&host->dev);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 98a8d97..5f748ed 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1888,6 +1888,8 @@ static struct pci_bus *__pci_create_root_bus(
 
 	bridge->bus = b;
 	b->bridge = get_device(&bridge->dev);
+	if (bridge->ops && bridge->ops->phb_set_root_bus_speed)
+		bridge->ops->phb_set_root_bus_speed(bridge);
 	error = pcibios_root_bridge_prepare(bridge);
 	if (error)
 		goto err_out;
@@ -1953,7 +1955,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources, sysdata);
+	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
 	if (!host)
 		return NULL;
 	
@@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
 		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}
 
-	max = pci_scan_child_bus(b);
+	if (host->ops && host->ops->phb_probe_mode)
+		host->ops->phb_probe_mode(host);
 
-	if (!found)
-		pci_bus_update_busn_res_end(b, max);
+	if (host->of_scan) {
+		if (host->ops &&host->ops->phb_of_scan_bus)
+			host->ops->phb_of_scan_bus(host);
+	} else {
+		max = pci_scan_child_bus(b);
+		if (!found)
+			pci_bus_update_busn_res_end(b, max);
+	}
 
 	return b;
 }
@@ -2064,7 +2073,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources, sysdata);
+	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
 	if (!host)
 		return NULL;
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3ee8436..c06b95d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -401,13 +401,25 @@ struct pci_host_bridge_window {
 	resource_size_t offset;		/* bus address + offset = CPU address */
 };
 
+struct pci_host_bridge;
+struct pci_host_bridge_ops {
+	void (*phb_set_root_bus_speed)(struct pci_host_bridge *host);
+	int (*phb_prepare)(struct pci_host_bridge *host);
+	/* Override domain number by host specific .phv_assign_domain_nr()  */
+	void (*phb_assign_domain_nr)(struct pci_host_bridge *);
+	void (*phb_probe_mode)(struct pci_host_bridge *);
+	void (*phb_of_scan_bus)(struct pci_host_bridge *);
+};
+
 struct pci_host_bridge {
 	u16	domain;
 	u16 busnum;
+	bool of_scan;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
 	struct list_head list;
 	struct list_head windows;	/* pci_host_bridge_windows */
+	struct pci_host_bridge_ops *ops;
 	void (*release_fn)(struct pci_host_bridge *);
 	void *release_data;
 };
@@ -419,8 +431,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 dombus, 
-		struct list_head *resources, void *sysdata);
+		struct device *parent, u32 dombus, struct list_head *resources,
+		void *sysdata, struct pci_host_bridge_ops *ops);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1

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

* [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we have weak functions like pcibios_root_bridge_prepare()
to setup pci host bridge, We could introduce pci_host_bridge_ops
which contain host bridge specific ops to setup pci_host_bridge.
Then host bridge driver could add pci_host_bridge_ops hooks
intead of weak function to setup pci_host_bridge.
This patch add following pci_host_bridge_ops hooks:

pci_host_bridge_ops {
	/* set root bus speed, some platform need this like powerpc */
	void (*phb_set_root_bus_speed)(struct pci_host_bridge *host);
	/* setup pci_host_bridge before pci_host_bridge be added to driver core */
	int (*phb_prepare)(struct pci_host_bridge *host);
	/* probe whether pci_host_bridge scan mode is of mode */
	void (*phb_probe_mode)(struct pci_host_bridge *);
	/* platform specific of scan hook to scan pci device */
	void (*phb_of_scan_bus)(struct pci_host_bridge *);
}

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |   12 ++++++++++--
 drivers/pci/probe.c       |   19 ++++++++++++++-----
 include/linux/pci.h       |   16 ++++++++++++++--
 3 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 0b6ba5c..ccbf168 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -23,8 +23,8 @@ static void pci_release_host_bridge_dev(struct device *dev)
 }
 
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 db, 
-		struct list_head *resources, void *sysdata)
+		struct device *parent, u32 db, struct list_head *resources,
+		void *sysdata, struct pci_host_bridge_ops *ops)
 {
 	int error;
 	int bus = PCI_BUSNUM(db);
@@ -56,6 +56,7 @@ struct pci_host_bridge *pci_create_host_bridge(
 		}
 	mutex_unlock(&phb_mutex);
 
+	host->ops = ops;
 	host->dev.parent = parent;
 	INIT_LIST_HEAD(&host->windows);
 	host->dev.release = pci_release_host_bridge_dev;
@@ -63,6 +64,13 @@ struct pci_host_bridge *pci_create_host_bridge(
 	dev_set_name(&host->dev, "pci%04x:%02x", host->domain, 
 			host->busnum);
 
+	if (host->ops && host->ops->phb_prepare) {
+		error = host->ops->phb_prepare(host);
+		if(error) {
+			kfree(host);
+			return NULL;
+		}
+	}
 	error = device_register(&host->dev);
 	if (error) {
 		put_device(&host->dev);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 98a8d97..5f748ed 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1888,6 +1888,8 @@ static struct pci_bus *__pci_create_root_bus(
 
 	bridge->bus = b;
 	b->bridge = get_device(&bridge->dev);
+	if (bridge->ops && bridge->ops->phb_set_root_bus_speed)
+		bridge->ops->phb_set_root_bus_speed(bridge);
 	error = pcibios_root_bridge_prepare(bridge);
 	if (error)
 		goto err_out;
@@ -1953,7 +1955,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources, sysdata);
+	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
 	if (!host)
 		return NULL;
 	
@@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
 		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}
 
-	max = pci_scan_child_bus(b);
+	if (host->ops && host->ops->phb_probe_mode)
+		host->ops->phb_probe_mode(host);
 
-	if (!found)
-		pci_bus_update_busn_res_end(b, max);
+	if (host->of_scan) {
+		if (host->ops &&host->ops->phb_of_scan_bus)
+			host->ops->phb_of_scan_bus(host);
+	} else {
+		max = pci_scan_child_bus(b);
+		if (!found)
+			pci_bus_update_busn_res_end(b, max);
+	}
 
 	return b;
 }
@@ -2064,7 +2073,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources, sysdata);
+	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
 	if (!host)
 		return NULL;
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3ee8436..c06b95d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -401,13 +401,25 @@ struct pci_host_bridge_window {
 	resource_size_t offset;		/* bus address + offset = CPU address */
 };
 
+struct pci_host_bridge;
+struct pci_host_bridge_ops {
+	void (*phb_set_root_bus_speed)(struct pci_host_bridge *host);
+	int (*phb_prepare)(struct pci_host_bridge *host);
+	/* Override domain number by host specific .phv_assign_domain_nr()  */
+	void (*phb_assign_domain_nr)(struct pci_host_bridge *);
+	void (*phb_probe_mode)(struct pci_host_bridge *);
+	void (*phb_of_scan_bus)(struct pci_host_bridge *);
+};
+
 struct pci_host_bridge {
 	u16	domain;
 	u16 busnum;
+	bool of_scan;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
 	struct list_head list;
 	struct list_head windows;	/* pci_host_bridge_windows */
+	struct pci_host_bridge_ops *ops;
 	void (*release_fn)(struct pci_host_bridge *);
 	void *release_data;
 };
@@ -419,8 +431,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 dombus, 
-		struct list_head *resources, void *sysdata);
+		struct device *parent, u32 dombus, struct list_head *resources,
+		void *sysdata, struct pci_host_bridge_ops *ops);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1


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

* [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Now we have weak functions like pcibios_root_bridge_prepare()
to setup pci host bridge, We could introduce pci_host_bridge_ops
which contain host bridge specific ops to setup pci_host_bridge.
Then host bridge driver could add pci_host_bridge_ops hooks
intead of weak function to setup pci_host_bridge.
This patch add following pci_host_bridge_ops hooks:

pci_host_bridge_ops {
	/* set root bus speed, some platform need this like powerpc */
	void (*phb_set_root_bus_speed)(struct pci_host_bridge *host);
	/* setup pci_host_bridge before pci_host_bridge be added to driver core */
	int (*phb_prepare)(struct pci_host_bridge *host);
	/* probe whether pci_host_bridge scan mode is of mode */
	void (*phb_probe_mode)(struct pci_host_bridge *);
	/* platform specific of scan hook to scan pci device */
	void (*phb_of_scan_bus)(struct pci_host_bridge *);
}

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |   12 ++++++++++--
 drivers/pci/probe.c       |   19 ++++++++++++++-----
 include/linux/pci.h       |   16 ++++++++++++++--
 3 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 0b6ba5c..ccbf168 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -23,8 +23,8 @@ static void pci_release_host_bridge_dev(struct device *dev)
 }
 
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 db, 
-		struct list_head *resources, void *sysdata)
+		struct device *parent, u32 db, struct list_head *resources,
+		void *sysdata, struct pci_host_bridge_ops *ops)
 {
 	int error;
 	int bus = PCI_BUSNUM(db);
@@ -56,6 +56,7 @@ struct pci_host_bridge *pci_create_host_bridge(
 		}
 	mutex_unlock(&phb_mutex);
 
+	host->ops = ops;
 	host->dev.parent = parent;
 	INIT_LIST_HEAD(&host->windows);
 	host->dev.release = pci_release_host_bridge_dev;
@@ -63,6 +64,13 @@ struct pci_host_bridge *pci_create_host_bridge(
 	dev_set_name(&host->dev, "pci%04x:%02x", host->domain, 
 			host->busnum);
 
+	if (host->ops && host->ops->phb_prepare) {
+		error = host->ops->phb_prepare(host);
+		if(error) {
+			kfree(host);
+			return NULL;
+		}
+	}
 	error = device_register(&host->dev);
 	if (error) {
 		put_device(&host->dev);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 98a8d97..5f748ed 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1888,6 +1888,8 @@ static struct pci_bus *__pci_create_root_bus(
 
 	bridge->bus = b;
 	b->bridge = get_device(&bridge->dev);
+	if (bridge->ops && bridge->ops->phb_set_root_bus_speed)
+		bridge->ops->phb_set_root_bus_speed(bridge);
 	error = pcibios_root_bridge_prepare(bridge);
 	if (error)
 		goto err_out;
@@ -1953,7 +1955,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources, sysdata);
+	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
 	if (!host)
 		return NULL;
 	
@@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
 		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}
 
-	max = pci_scan_child_bus(b);
+	if (host->ops && host->ops->phb_probe_mode)
+		host->ops->phb_probe_mode(host);
 
-	if (!found)
-		pci_bus_update_busn_res_end(b, max);
+	if (host->of_scan) {
+		if (host->ops &&host->ops->phb_of_scan_bus)
+			host->ops->phb_of_scan_bus(host);
+	} else {
+		max = pci_scan_child_bus(b);
+		if (!found)
+			pci_bus_update_busn_res_end(b, max);
+	}
 
 	return b;
 }
@@ -2064,7 +2073,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources, sysdata);
+	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
 	if (!host)
 		return NULL;
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3ee8436..c06b95d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -401,13 +401,25 @@ struct pci_host_bridge_window {
 	resource_size_t offset;		/* bus address + offset = CPU address */
 };
 
+struct pci_host_bridge;
+struct pci_host_bridge_ops {
+	void (*phb_set_root_bus_speed)(struct pci_host_bridge *host);
+	int (*phb_prepare)(struct pci_host_bridge *host);
+	/* Override domain number by host specific .phv_assign_domain_nr()  */
+	void (*phb_assign_domain_nr)(struct pci_host_bridge *);
+	void (*phb_probe_mode)(struct pci_host_bridge *);
+	void (*phb_of_scan_bus)(struct pci_host_bridge *);
+};
+
 struct pci_host_bridge {
 	u16	domain;
 	u16 busnum;
+	bool of_scan;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
 	struct list_head list;
 	struct list_head windows;	/* pci_host_bridge_windows */
+	struct pci_host_bridge_ops *ops;
 	void (*release_fn)(struct pci_host_bridge *);
 	void *release_data;
 };
@@ -419,8 +431,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 dombus, 
-		struct list_head *resources, void *sysdata);
+		struct device *parent, u32 dombus, struct list_head *resources,
+		void *sysdata, struct pci_host_bridge_ops *ops);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1

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

* [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we have weak functions like pcibios_root_bridge_prepare()
to setup pci host bridge, We could introduce pci_host_bridge_ops
which contain host bridge specific ops to setup pci_host_bridge.
Then host bridge driver could add pci_host_bridge_ops hooks
intead of weak function to setup pci_host_bridge.
This patch add following pci_host_bridge_ops hooks:

pci_host_bridge_ops {
	/* set root bus speed, some platform need this like powerpc */
	void (*phb_set_root_bus_speed)(struct pci_host_bridge *host);
	/* setup pci_host_bridge before pci_host_bridge be added to driver core */
	int (*phb_prepare)(struct pci_host_bridge *host);
	/* probe whether pci_host_bridge scan mode is of mode */
	void (*phb_probe_mode)(struct pci_host_bridge *);
	/* platform specific of scan hook to scan pci device */
	void (*phb_of_scan_bus)(struct pci_host_bridge *);
}

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |   12 ++++++++++--
 drivers/pci/probe.c       |   19 ++++++++++++++-----
 include/linux/pci.h       |   16 ++++++++++++++--
 3 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 0b6ba5c..ccbf168 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -23,8 +23,8 @@ static void pci_release_host_bridge_dev(struct device *dev)
 }
 
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 db, 
-		struct list_head *resources, void *sysdata)
+		struct device *parent, u32 db, struct list_head *resources,
+		void *sysdata, struct pci_host_bridge_ops *ops)
 {
 	int error;
 	int bus = PCI_BUSNUM(db);
@@ -56,6 +56,7 @@ struct pci_host_bridge *pci_create_host_bridge(
 		}
 	mutex_unlock(&phb_mutex);
 
+	host->ops = ops;
 	host->dev.parent = parent;
 	INIT_LIST_HEAD(&host->windows);
 	host->dev.release = pci_release_host_bridge_dev;
@@ -63,6 +64,13 @@ struct pci_host_bridge *pci_create_host_bridge(
 	dev_set_name(&host->dev, "pci%04x:%02x", host->domain, 
 			host->busnum);
 
+	if (host->ops && host->ops->phb_prepare) {
+		error = host->ops->phb_prepare(host);
+		if(error) {
+			kfree(host);
+			return NULL;
+		}
+	}
 	error = device_register(&host->dev);
 	if (error) {
 		put_device(&host->dev);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 98a8d97..5f748ed 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1888,6 +1888,8 @@ static struct pci_bus *__pci_create_root_bus(
 
 	bridge->bus = b;
 	b->bridge = get_device(&bridge->dev);
+	if (bridge->ops && bridge->ops->phb_set_root_bus_speed)
+		bridge->ops->phb_set_root_bus_speed(bridge);
 	error = pcibios_root_bridge_prepare(bridge);
 	if (error)
 		goto err_out;
@@ -1953,7 +1955,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources, sysdata);
+	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
 	if (!host)
 		return NULL;
 	
@@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
 		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}
 
-	max = pci_scan_child_bus(b);
+	if (host->ops && host->ops->phb_probe_mode)
+		host->ops->phb_probe_mode(host);
 
-	if (!found)
-		pci_bus_update_busn_res_end(b, max);
+	if (host->of_scan) {
+		if (host->ops &&host->ops->phb_of_scan_bus)
+			host->ops->phb_of_scan_bus(host);
+	} else {
+		max = pci_scan_child_bus(b);
+		if (!found)
+			pci_bus_update_busn_res_end(b, max);
+	}
 
 	return b;
 }
@@ -2064,7 +2073,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources, sysdata);
+	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
 	if (!host)
 		return NULL;
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3ee8436..c06b95d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -401,13 +401,25 @@ struct pci_host_bridge_window {
 	resource_size_t offset;		/* bus address + offset = CPU address */
 };
 
+struct pci_host_bridge;
+struct pci_host_bridge_ops {
+	void (*phb_set_root_bus_speed)(struct pci_host_bridge *host);
+	int (*phb_prepare)(struct pci_host_bridge *host);
+	/* Override domain number by host specific .phv_assign_domain_nr()  */
+	void (*phb_assign_domain_nr)(struct pci_host_bridge *);
+	void (*phb_probe_mode)(struct pci_host_bridge *);
+	void (*phb_of_scan_bus)(struct pci_host_bridge *);
+};
+
 struct pci_host_bridge {
 	u16	domain;
 	u16 busnum;
+	bool of_scan;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
 	struct list_head list;
 	struct list_head windows;	/* pci_host_bridge_windows */
+	struct pci_host_bridge_ops *ops;
 	void (*release_fn)(struct pci_host_bridge *);
 	void *release_data;
 };
@@ -419,8 +431,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 dombus, 
-		struct list_head *resources, void *sysdata);
+		struct device *parent, u32 dombus, struct list_head *resources,
+		void *sysdata, struct pci_host_bridge_ops *ops);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1


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

* [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we have weak functions like pcibios_root_bridge_prepare()
to setup pci host bridge, We could introduce pci_host_bridge_ops
which contain host bridge specific ops to setup pci_host_bridge.
Then host bridge driver could add pci_host_bridge_ops hooks
intead of weak function to setup pci_host_bridge.
This patch add following pci_host_bridge_ops hooks:

pci_host_bridge_ops {
	/* set root bus speed, some platform need this like powerpc */
	void (*phb_set_root_bus_speed)(struct pci_host_bridge *host);
	/* setup pci_host_bridge before pci_host_bridge be added to driver core */
	int (*phb_prepare)(struct pci_host_bridge *host);
	/* probe whether pci_host_bridge scan mode is of mode */
	void (*phb_probe_mode)(struct pci_host_bridge *);
	/* platform specific of scan hook to scan pci device */
	void (*phb_of_scan_bus)(struct pci_host_bridge *);
}

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |   12 ++++++++++--
 drivers/pci/probe.c       |   19 ++++++++++++++-----
 include/linux/pci.h       |   16 ++++++++++++++--
 3 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 0b6ba5c..ccbf168 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -23,8 +23,8 @@ static void pci_release_host_bridge_dev(struct device *dev)
 }
 
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 db, 
-		struct list_head *resources, void *sysdata)
+		struct device *parent, u32 db, struct list_head *resources,
+		void *sysdata, struct pci_host_bridge_ops *ops)
 {
 	int error;
 	int bus = PCI_BUSNUM(db);
@@ -56,6 +56,7 @@ struct pci_host_bridge *pci_create_host_bridge(
 		}
 	mutex_unlock(&phb_mutex);
 
+	host->ops = ops;
 	host->dev.parent = parent;
 	INIT_LIST_HEAD(&host->windows);
 	host->dev.release = pci_release_host_bridge_dev;
@@ -63,6 +64,13 @@ struct pci_host_bridge *pci_create_host_bridge(
 	dev_set_name(&host->dev, "pci%04x:%02x", host->domain, 
 			host->busnum);
 
+	if (host->ops && host->ops->phb_prepare) {
+		error = host->ops->phb_prepare(host);
+		if(error) {
+			kfree(host);
+			return NULL;
+		}
+	}
 	error = device_register(&host->dev);
 	if (error) {
 		put_device(&host->dev);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 98a8d97..5f748ed 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1888,6 +1888,8 @@ static struct pci_bus *__pci_create_root_bus(
 
 	bridge->bus = b;
 	b->bridge = get_device(&bridge->dev);
+	if (bridge->ops && bridge->ops->phb_set_root_bus_speed)
+		bridge->ops->phb_set_root_bus_speed(bridge);
 	error = pcibios_root_bridge_prepare(bridge);
 	if (error)
 		goto err_out;
@@ -1953,7 +1955,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources, sysdata);
+	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
 	if (!host)
 		return NULL;
 	
@@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
 		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}
 
-	max = pci_scan_child_bus(b);
+	if (host->ops && host->ops->phb_probe_mode)
+		host->ops->phb_probe_mode(host);
 
-	if (!found)
-		pci_bus_update_busn_res_end(b, max);
+	if (host->of_scan) {
+		if (host->ops &&host->ops->phb_of_scan_bus)
+			host->ops->phb_of_scan_bus(host);
+	} else {
+		max = pci_scan_child_bus(b);
+		if (!found)
+			pci_bus_update_busn_res_end(b, max);
+	}
 
 	return b;
 }
@@ -2064,7 +2073,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 {
 	struct pci_host_bridge *host;
 
-	host = pci_create_host_bridge(parent, db, resources, sysdata);
+	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
 	if (!host)
 		return NULL;
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3ee8436..c06b95d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -401,13 +401,25 @@ struct pci_host_bridge_window {
 	resource_size_t offset;		/* bus address + offset = CPU address */
 };
 
+struct pci_host_bridge;
+struct pci_host_bridge_ops {
+	void (*phb_set_root_bus_speed)(struct pci_host_bridge *host);
+	int (*phb_prepare)(struct pci_host_bridge *host);
+	/* Override domain number by host specific .phv_assign_domain_nr()  */
+	void (*phb_assign_domain_nr)(struct pci_host_bridge *);
+	void (*phb_probe_mode)(struct pci_host_bridge *);
+	void (*phb_of_scan_bus)(struct pci_host_bridge *);
+};
+
 struct pci_host_bridge {
 	u16	domain;
 	u16 busnum;
+	bool of_scan;
 	struct device dev;
 	struct pci_bus *bus;		/* root bus */
 	struct list_head list;
 	struct list_head windows;	/* pci_host_bridge_windows */
+	struct pci_host_bridge_ops *ops;
 	void (*release_fn)(struct pci_host_bridge *);
 	void *release_data;
 };
@@ -419,8 +431,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
-		struct device *parent, u32 dombus, 
-		struct list_head *resources, void *sysdata);
+		struct device *parent, u32 dombus, struct list_head *resources,
+		void *sysdata, struct pci_host_bridge_ops *ops);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1

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

* [PATCH 12/28] PCI: Introduce new scan function pci_scan_root_bridge()
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Introduce new scan function pci_scan_root_bridge() to
support host bridge drivers that need to provide platform
own pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   21 +++++++++++++++++++++
 include/linux/pci.h |    3 +++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 5f748ed..51d69c3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2068,6 +2068,27 @@ static struct pci_bus *__pci_scan_root_bus(
 	return b;
 }
 
+struct pci_host_bridge *pci_scan_root_bridge(struct device *parent,
+		u32 db, struct pci_ops *ops, void *sysdata,
+		struct list_head *resources, struct pci_host_bridge_ops *phb_ops)
+{
+	struct pci_host_bridge *host;
+	struct pci_bus *bus;
+
+	host = pci_create_host_bridge(parent, db, resources,
+			sysdata, phb_ops);
+	if (!host)
+		return NULL;
+
+	bus = __pci_scan_root_bus(host, ops);
+	if (!bus)
+		pci_free_host_bridge(host);
+
+	return host;
+}
+EXPORT_SYMBOL(pci_scan_root_bridge);
+
+
 struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c06b95d..5592737 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -797,6 +797,9 @@ void pci_bus_release_busn_res(struct pci_bus *b);
 struct pci_bus *pci_scan_root_bus(struct device *parent, u32 dombus,
 					     struct pci_ops *ops, void *sysdata,
 					     struct list_head *resources);
+struct pci_host_bridge *pci_scan_root_bridge(struct device *parent,
+		u32 dombus, struct pci_ops *ops, void *sysdata,
+		struct list_head *resources, struct pci_host_bridge_ops *phb_ops);
 struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
 				int busnr);
 void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
-- 
1.7.1


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

* [PATCH 12/28] PCI: Introduce new scan function pci_scan_root_bridge()
  2015-01-16  1:43 ` Yijing Wang
                   ` (26 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Introduce new scan function pci_scan_root_bridge() to
support host bridge drivers that need to provide platform
own pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   21 +++++++++++++++++++++
 include/linux/pci.h |    3 +++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 5f748ed..51d69c3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2068,6 +2068,27 @@ static struct pci_bus *__pci_scan_root_bus(
 	return b;
 }
 
+struct pci_host_bridge *pci_scan_root_bridge(struct device *parent,
+		u32 db, struct pci_ops *ops, void *sysdata,
+		struct list_head *resources, struct pci_host_bridge_ops *phb_ops)
+{
+	struct pci_host_bridge *host;
+	struct pci_bus *bus;
+
+	host = pci_create_host_bridge(parent, db, resources,
+			sysdata, phb_ops);
+	if (!host)
+		return NULL;
+
+	bus = __pci_scan_root_bus(host, ops);
+	if (!bus)
+		pci_free_host_bridge(host);
+
+	return host;
+}
+EXPORT_SYMBOL(pci_scan_root_bridge);
+
+
 struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c06b95d..5592737 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -797,6 +797,9 @@ void pci_bus_release_busn_res(struct pci_bus *b);
 struct pci_bus *pci_scan_root_bus(struct device *parent, u32 dombus,
 					     struct pci_ops *ops, void *sysdata,
 					     struct list_head *resources);
+struct pci_host_bridge *pci_scan_root_bridge(struct device *parent,
+		u32 dombus, struct pci_ops *ops, void *sysdata,
+		struct list_head *resources, struct pci_host_bridge_ops *phb_ops);
 struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
 				int busnr);
 void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
-- 
1.7.1

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

* [PATCH 12/28] PCI: Introduce new scan function pci_scan_root_bridge()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Introduce new scan function pci_scan_root_bridge() to
support host bridge drivers that need to provide platform
own pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   21 +++++++++++++++++++++
 include/linux/pci.h |    3 +++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 5f748ed..51d69c3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2068,6 +2068,27 @@ static struct pci_bus *__pci_scan_root_bus(
 	return b;
 }
 
+struct pci_host_bridge *pci_scan_root_bridge(struct device *parent,
+		u32 db, struct pci_ops *ops, void *sysdata,
+		struct list_head *resources, struct pci_host_bridge_ops *phb_ops)
+{
+	struct pci_host_bridge *host;
+	struct pci_bus *bus;
+
+	host = pci_create_host_bridge(parent, db, resources,
+			sysdata, phb_ops);
+	if (!host)
+		return NULL;
+
+	bus = __pci_scan_root_bus(host, ops);
+	if (!bus)
+		pci_free_host_bridge(host);
+
+	return host;
+}
+EXPORT_SYMBOL(pci_scan_root_bridge);
+
+
 struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c06b95d..5592737 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -797,6 +797,9 @@ void pci_bus_release_busn_res(struct pci_bus *b);
 struct pci_bus *pci_scan_root_bus(struct device *parent, u32 dombus,
 					     struct pci_ops *ops, void *sysdata,
 					     struct list_head *resources);
+struct pci_host_bridge *pci_scan_root_bridge(struct device *parent,
+		u32 dombus, struct pci_ops *ops, void *sysdata,
+		struct list_head *resources, struct pci_host_bridge_ops *phb_ops);
 struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
 				int busnr);
 void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
-- 
1.7.1


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

* [PATCH 12/28] PCI: Introduce new scan function pci_scan_root_bridge()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Introduce new scan function pci_scan_root_bridge() to
support host bridge drivers that need to provide platform
own pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   21 +++++++++++++++++++++
 include/linux/pci.h |    3 +++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 5f748ed..51d69c3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2068,6 +2068,27 @@ static struct pci_bus *__pci_scan_root_bus(
 	return b;
 }
 
+struct pci_host_bridge *pci_scan_root_bridge(struct device *parent,
+		u32 db, struct pci_ops *ops, void *sysdata,
+		struct list_head *resources, struct pci_host_bridge_ops *phb_ops)
+{
+	struct pci_host_bridge *host;
+	struct pci_bus *bus;
+
+	host = pci_create_host_bridge(parent, db, resources,
+			sysdata, phb_ops);
+	if (!host)
+		return NULL;
+
+	bus = __pci_scan_root_bus(host, ops);
+	if (!bus)
+		pci_free_host_bridge(host);
+
+	return host;
+}
+EXPORT_SYMBOL(pci_scan_root_bridge);
+
+
 struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c06b95d..5592737 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -797,6 +797,9 @@ void pci_bus_release_busn_res(struct pci_bus *b);
 struct pci_bus *pci_scan_root_bus(struct device *parent, u32 dombus,
 					     struct pci_ops *ops, void *sysdata,
 					     struct list_head *resources);
+struct pci_host_bridge *pci_scan_root_bridge(struct device *parent,
+		u32 dombus, struct pci_ops *ops, void *sysdata,
+		struct list_head *resources, struct pci_host_bridge_ops *phb_ops);
 struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
 				int busnr);
 void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
-- 
1.7.1

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

* [PATCH 12/28] PCI: Introduce new scan function pci_scan_root_bridge()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Introduce new scan function pci_scan_root_bridge() to
support host bridge drivers that need to provide platform
own pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   21 +++++++++++++++++++++
 include/linux/pci.h |    3 +++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 5f748ed..51d69c3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2068,6 +2068,27 @@ static struct pci_bus *__pci_scan_root_bus(
 	return b;
 }
 
+struct pci_host_bridge *pci_scan_root_bridge(struct device *parent,
+		u32 db, struct pci_ops *ops, void *sysdata,
+		struct list_head *resources, struct pci_host_bridge_ops *phb_ops)
+{
+	struct pci_host_bridge *host;
+	struct pci_bus *bus;
+
+	host = pci_create_host_bridge(parent, db, resources,
+			sysdata, phb_ops);
+	if (!host)
+		return NULL;
+
+	bus = __pci_scan_root_bus(host, ops);
+	if (!bus)
+		pci_free_host_bridge(host);
+
+	return host;
+}
+EXPORT_SYMBOL(pci_scan_root_bridge);
+
+
 struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c06b95d..5592737 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -797,6 +797,9 @@ void pci_bus_release_busn_res(struct pci_bus *b);
 struct pci_bus *pci_scan_root_bus(struct device *parent, u32 dombus,
 					     struct pci_ops *ops, void *sysdata,
 					     struct list_head *resources);
+struct pci_host_bridge *pci_scan_root_bridge(struct device *parent,
+		u32 dombus, struct pci_ops *ops, void *sysdata,
+		struct list_head *resources, struct pci_host_bridge_ops *phb_ops);
 struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
 				int busnr);
 void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
-- 
1.7.1


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

* [PATCH 12/28] PCI: Introduce new scan function pci_scan_root_bridge()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Introduce new scan function pci_scan_root_bridge() to
support host bridge drivers that need to provide platform
own pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   21 +++++++++++++++++++++
 include/linux/pci.h |    3 +++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 5f748ed..51d69c3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2068,6 +2068,27 @@ static struct pci_bus *__pci_scan_root_bus(
 	return b;
 }
 
+struct pci_host_bridge *pci_scan_root_bridge(struct device *parent,
+		u32 db, struct pci_ops *ops, void *sysdata,
+		struct list_head *resources, struct pci_host_bridge_ops *phb_ops)
+{
+	struct pci_host_bridge *host;
+	struct pci_bus *bus;
+
+	host = pci_create_host_bridge(parent, db, resources,
+			sysdata, phb_ops);
+	if (!host)
+		return NULL;
+
+	bus = __pci_scan_root_bus(host, ops);
+	if (!bus)
+		pci_free_host_bridge(host);
+
+	return host;
+}
+EXPORT_SYMBOL(pci_scan_root_bridge);
+
+
 struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
 		struct pci_ops *ops, void *sysdata, struct list_head *resources)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c06b95d..5592737 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -797,6 +797,9 @@ void pci_bus_release_busn_res(struct pci_bus *b);
 struct pci_bus *pci_scan_root_bus(struct device *parent, u32 dombus,
 					     struct pci_ops *ops, void *sysdata,
 					     struct list_head *resources);
+struct pci_host_bridge *pci_scan_root_bridge(struct device *parent,
+		u32 dombus, struct pci_ops *ops, void *sysdata,
+		struct list_head *resources, struct pci_host_bridge_ops *phb_ops);
 struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
 				int busnr);
 void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
-- 
1.7.1

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

* [PATCH 13/28] PCI/x86: Refine pci_acpi_scan_root() with generic pci_host_bridge
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/x86/pci/acpi.c |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 8edea63..f9a55c2 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -467,6 +467,18 @@ static void probe_pci_root_info(struct pci_root_info *info,
 				info);
 }
 
+static int pci_host_bridge_prepare(struct pci_host_bridge *bridge)
+{
+	struct pci_sysdata *sd = dev_get_drvdata(&bridge->dev);
+
+	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
+	return 0;
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_prepare = pci_host_bridge_prepare,
+};
+
 struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 {
 	struct acpi_device *device = root->device;
@@ -475,6 +487,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	int busnum = root->secondary.start;
 	LIST_HEAD(resources);
 	struct pci_bus *bus;
+	struct pci_host_bridge *host = NULL;
 	struct pci_sysdata *sd;
 	int node;
 
@@ -537,14 +550,13 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 
 		if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
 					(u8)root->secondary.end, root->mcfg_addr)) 
-			bus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, busnum), 
-					&pci_root_ops, sd, &resources);
-
-		if (bus) {
-			pci_scan_child_bus(bus);
-			pci_set_host_bridge_release(
-				to_pci_host_bridge(bus->bridge),
-				release_pci_root_info, info);
+			host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, busnum),
+					&pci_root_ops, sd, &resources, &phb_ops);
+
+		if (host) {
+			bus = host->bus;
+			pci_set_host_bridge_release(host, release_pci_root_info,
+					info);
 		} else {
 			pci_free_resource_list(&resources);
 			__release_pci_root_info(info);
@@ -566,14 +578,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	return bus;
 }
 
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	struct pci_sysdata *sd = bridge->bus->sysdata;
-
-	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
-	return 0;
-}
-
 int __init pci_acpi_init(void)
 {
 	struct pci_dev *dev = NULL;
-- 
1.7.1


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

* [PATCH 13/28] PCI/x86: Refine pci_acpi_scan_root() with generic pci_host_bridge
  2015-01-16  1:43 ` Yijing Wang
                   ` (28 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/x86/pci/acpi.c |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 8edea63..f9a55c2 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -467,6 +467,18 @@ static void probe_pci_root_info(struct pci_root_info *info,
 				info);
 }
 
+static int pci_host_bridge_prepare(struct pci_host_bridge *bridge)
+{
+	struct pci_sysdata *sd = dev_get_drvdata(&bridge->dev);
+
+	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
+	return 0;
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_prepare = pci_host_bridge_prepare,
+};
+
 struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 {
 	struct acpi_device *device = root->device;
@@ -475,6 +487,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	int busnum = root->secondary.start;
 	LIST_HEAD(resources);
 	struct pci_bus *bus;
+	struct pci_host_bridge *host = NULL;
 	struct pci_sysdata *sd;
 	int node;
 
@@ -537,14 +550,13 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 
 		if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
 					(u8)root->secondary.end, root->mcfg_addr)) 
-			bus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, busnum), 
-					&pci_root_ops, sd, &resources);
-
-		if (bus) {
-			pci_scan_child_bus(bus);
-			pci_set_host_bridge_release(
-				to_pci_host_bridge(bus->bridge),
-				release_pci_root_info, info);
+			host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, busnum),
+					&pci_root_ops, sd, &resources, &phb_ops);
+
+		if (host) {
+			bus = host->bus;
+			pci_set_host_bridge_release(host, release_pci_root_info,
+					info);
 		} else {
 			pci_free_resource_list(&resources);
 			__release_pci_root_info(info);
@@ -566,14 +578,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	return bus;
 }
 
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	struct pci_sysdata *sd = bridge->bus->sysdata;
-
-	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
-	return 0;
-}
-
 int __init pci_acpi_init(void)
 {
 	struct pci_dev *dev = NULL;
-- 
1.7.1

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

* [PATCH 13/28] PCI/x86: Refine pci_acpi_scan_root() with generic pci_host_bridge
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/x86/pci/acpi.c |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 8edea63..f9a55c2 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -467,6 +467,18 @@ static void probe_pci_root_info(struct pci_root_info *info,
 				info);
 }
 
+static int pci_host_bridge_prepare(struct pci_host_bridge *bridge)
+{
+	struct pci_sysdata *sd = dev_get_drvdata(&bridge->dev);
+
+	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
+	return 0;
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_prepare = pci_host_bridge_prepare,
+};
+
 struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 {
 	struct acpi_device *device = root->device;
@@ -475,6 +487,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	int busnum = root->secondary.start;
 	LIST_HEAD(resources);
 	struct pci_bus *bus;
+	struct pci_host_bridge *host = NULL;
 	struct pci_sysdata *sd;
 	int node;
 
@@ -537,14 +550,13 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 
 		if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
 					(u8)root->secondary.end, root->mcfg_addr)) 
-			bus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, busnum), 
-					&pci_root_ops, sd, &resources);
-
-		if (bus) {
-			pci_scan_child_bus(bus);
-			pci_set_host_bridge_release(
-				to_pci_host_bridge(bus->bridge),
-				release_pci_root_info, info);
+			host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, busnum),
+					&pci_root_ops, sd, &resources, &phb_ops);
+
+		if (host) {
+			bus = host->bus;
+			pci_set_host_bridge_release(host, release_pci_root_info,
+					info);
 		} else {
 			pci_free_resource_list(&resources);
 			__release_pci_root_info(info);
@@ -566,14 +578,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	return bus;
 }
 
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	struct pci_sysdata *sd = bridge->bus->sysdata;
-
-	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
-	return 0;
-}
-
 int __init pci_acpi_init(void)
 {
 	struct pci_dev *dev = NULL;
-- 
1.7.1


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

* [PATCH 13/28] PCI/x86: Refine pci_acpi_scan_root() with generic pci_host_bridge
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/x86/pci/acpi.c |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 8edea63..f9a55c2 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -467,6 +467,18 @@ static void probe_pci_root_info(struct pci_root_info *info,
 				info);
 }
 
+static int pci_host_bridge_prepare(struct pci_host_bridge *bridge)
+{
+	struct pci_sysdata *sd = dev_get_drvdata(&bridge->dev);
+
+	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
+	return 0;
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_prepare = pci_host_bridge_prepare,
+};
+
 struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 {
 	struct acpi_device *device = root->device;
@@ -475,6 +487,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	int busnum = root->secondary.start;
 	LIST_HEAD(resources);
 	struct pci_bus *bus;
+	struct pci_host_bridge *host = NULL;
 	struct pci_sysdata *sd;
 	int node;
 
@@ -537,14 +550,13 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 
 		if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
 					(u8)root->secondary.end, root->mcfg_addr)) 
-			bus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, busnum), 
-					&pci_root_ops, sd, &resources);
-
-		if (bus) {
-			pci_scan_child_bus(bus);
-			pci_set_host_bridge_release(
-				to_pci_host_bridge(bus->bridge),
-				release_pci_root_info, info);
+			host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, busnum),
+					&pci_root_ops, sd, &resources, &phb_ops);
+
+		if (host) {
+			bus = host->bus;
+			pci_set_host_bridge_release(host, release_pci_root_info,
+					info);
 		} else {
 			pci_free_resource_list(&resources);
 			__release_pci_root_info(info);
@@ -566,14 +578,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	return bus;
 }
 
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	struct pci_sysdata *sd = bridge->bus->sysdata;
-
-	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
-	return 0;
-}
-
 int __init pci_acpi_init(void)
 {
 	struct pci_dev *dev = NULL;
-- 
1.7.1

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

* [PATCH 13/28] PCI/x86: Refine pci_acpi_scan_root() with generic pci_host_bridge
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/x86/pci/acpi.c |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 8edea63..f9a55c2 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -467,6 +467,18 @@ static void probe_pci_root_info(struct pci_root_info *info,
 				info);
 }
 
+static int pci_host_bridge_prepare(struct pci_host_bridge *bridge)
+{
+	struct pci_sysdata *sd = dev_get_drvdata(&bridge->dev);
+
+	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
+	return 0;
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_prepare = pci_host_bridge_prepare,
+};
+
 struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 {
 	struct acpi_device *device = root->device;
@@ -475,6 +487,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	int busnum = root->secondary.start;
 	LIST_HEAD(resources);
 	struct pci_bus *bus;
+	struct pci_host_bridge *host = NULL;
 	struct pci_sysdata *sd;
 	int node;
 
@@ -537,14 +550,13 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 
 		if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
 					(u8)root->secondary.end, root->mcfg_addr)) 
-			bus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, busnum), 
-					&pci_root_ops, sd, &resources);
-
-		if (bus) {
-			pci_scan_child_bus(bus);
-			pci_set_host_bridge_release(
-				to_pci_host_bridge(bus->bridge),
-				release_pci_root_info, info);
+			host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, busnum),
+					&pci_root_ops, sd, &resources, &phb_ops);
+
+		if (host) {
+			bus = host->bus;
+			pci_set_host_bridge_release(host, release_pci_root_info,
+					info);
 		} else {
 			pci_free_resource_list(&resources);
 			__release_pci_root_info(info);
@@ -566,14 +578,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	return bus;
 }
 
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	struct pci_sysdata *sd = bridge->bus->sysdata;
-
-	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
-	return 0;
-}
-
 int __init pci_acpi_init(void)
 {
 	struct pci_dev *dev = NULL;
-- 
1.7.1


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

* [PATCH 13/28] PCI/x86: Refine pci_acpi_scan_root() with generic pci_host_bridge
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/x86/pci/acpi.c |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 8edea63..f9a55c2 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -467,6 +467,18 @@ static void probe_pci_root_info(struct pci_root_info *info,
 				info);
 }
 
+static int pci_host_bridge_prepare(struct pci_host_bridge *bridge)
+{
+	struct pci_sysdata *sd = dev_get_drvdata(&bridge->dev);
+
+	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
+	return 0;
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_prepare = pci_host_bridge_prepare,
+};
+
 struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 {
 	struct acpi_device *device = root->device;
@@ -475,6 +487,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	int busnum = root->secondary.start;
 	LIST_HEAD(resources);
 	struct pci_bus *bus;
+	struct pci_host_bridge *host = NULL;
 	struct pci_sysdata *sd;
 	int node;
 
@@ -537,14 +550,13 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 
 		if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
 					(u8)root->secondary.end, root->mcfg_addr)) 
-			bus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, busnum), 
-					&pci_root_ops, sd, &resources);
-
-		if (bus) {
-			pci_scan_child_bus(bus);
-			pci_set_host_bridge_release(
-				to_pci_host_bridge(bus->bridge),
-				release_pci_root_info, info);
+			host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, busnum),
+					&pci_root_ops, sd, &resources, &phb_ops);
+
+		if (host) {
+			bus = host->bus;
+			pci_set_host_bridge_release(host, release_pci_root_info,
+					info);
 		} else {
 			pci_free_resource_list(&resources);
 			__release_pci_root_info(info);
@@ -566,14 +578,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	return bus;
 }
 
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	struct pci_sysdata *sd = bridge->bus->sysdata;
-
-	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
-	return 0;
-}
-
 int __init pci_acpi_init(void)
 {
 	struct pci_dev *dev = NULL;
-- 
1.7.1


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

* [PATCH 14/28] PCI/IA64: Refine pci_acpi_scan_root() with generic pci_host_bridge
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, Yijing Wang

From: Yijing Wang <wangyijing0307@gmail.com>

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/ia64/pci/pci.c |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index e457015..7736c02 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -420,6 +420,18 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
 	return 0;
 }
 
+static int pci_host_bridge_prepare(struct pci_host_bridge *bridge)
+{
+	struct pci_sysdata *sd = dev_get_drvdata(&bridge->dev);
+
+	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
+	return 0;
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_prepare = pci_host_bridge_prepare,
+};
+
 struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 {
 	struct acpi_device *device = root->device;
@@ -428,7 +440,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	struct pci_controller *controller;
 	struct pci_root_info *info = NULL;
 	int busnum = root->secondary.start;
-	struct pci_bus *pbus;
+	struct pci_host_bridge *host;
 	int ret;
 
 	controller = alloc_pci_controller(domain);
@@ -465,26 +477,16 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	 * should handle the case here, but it appears that IA64 hasn't
 	 * such quirk. So we just ignore the case now.
 	 */
-	pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus), 
-			&pci_root_ops, controller, &info->resources);
-	if (!pbus) {
+	host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, bus),
+			&pci_root_ops, controller, &info->resources, &phb_ops);
+	if (!host) {
 		pci_free_resource_list(&info->resources);
 		__release_pci_root_info(info);
 		return NULL;
 	}
 
-	pci_set_host_bridge_release(to_pci_host_bridge(pbus->bridge),
-			release_pci_root_info, info);
-	pci_scan_child_bus(pbus);
-	return pbus;
-}
-
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	struct pci_controller *controller = bridge->bus->sysdata;
-
-	ACPI_COMPANION_SET(&bridge->dev, controller->companion);
-	return 0;
+	pci_set_host_bridge_release(host, release_pci_root_info, info);
+	return host->bus;
 }
 
 static int is_valid_resource(struct pci_dev *dev, int idx)
-- 
1.7.1


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

* [PATCH 14/28] PCI/IA64: Refine pci_acpi_scan_root() with generic pci_host_bridge
  2015-01-16  1:43 ` Yijing Wang
                   ` (30 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, Yijing Wang

From: Yijing Wang <wangyijing0307@gmail.com>

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/ia64/pci/pci.c |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index e457015..7736c02 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -420,6 +420,18 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
 	return 0;
 }
 
+static int pci_host_bridge_prepare(struct pci_host_bridge *bridge)
+{
+	struct pci_sysdata *sd = dev_get_drvdata(&bridge->dev);
+
+	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
+	return 0;
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_prepare = pci_host_bridge_prepare,
+};
+
 struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 {
 	struct acpi_device *device = root->device;
@@ -428,7 +440,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	struct pci_controller *controller;
 	struct pci_root_info *info = NULL;
 	int busnum = root->secondary.start;
-	struct pci_bus *pbus;
+	struct pci_host_bridge *host;
 	int ret;
 
 	controller = alloc_pci_controller(domain);
@@ -465,26 +477,16 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	 * should handle the case here, but it appears that IA64 hasn't
 	 * such quirk. So we just ignore the case now.
 	 */
-	pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus), 
-			&pci_root_ops, controller, &info->resources);
-	if (!pbus) {
+	host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, bus),
+			&pci_root_ops, controller, &info->resources, &phb_ops);
+	if (!host) {
 		pci_free_resource_list(&info->resources);
 		__release_pci_root_info(info);
 		return NULL;
 	}
 
-	pci_set_host_bridge_release(to_pci_host_bridge(pbus->bridge),
-			release_pci_root_info, info);
-	pci_scan_child_bus(pbus);
-	return pbus;
-}
-
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	struct pci_controller *controller = bridge->bus->sysdata;
-
-	ACPI_COMPANION_SET(&bridge->dev, controller->companion);
-	return 0;
+	pci_set_host_bridge_release(host, release_pci_root_info, info);
+	return host->bus;
 }
 
 static int is_valid_resource(struct pci_dev *dev, int idx)
-- 
1.7.1

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

* [PATCH 14/28] PCI/IA64: Refine pci_acpi_scan_root() with generic pci_host_bridge
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, Yijing Wang

From: Yijing Wang <wangyijing0307@gmail.com>

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/ia64/pci/pci.c |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index e457015..7736c02 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -420,6 +420,18 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
 	return 0;
 }
 
+static int pci_host_bridge_prepare(struct pci_host_bridge *bridge)
+{
+	struct pci_sysdata *sd = dev_get_drvdata(&bridge->dev);
+
+	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
+	return 0;
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_prepare = pci_host_bridge_prepare,
+};
+
 struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 {
 	struct acpi_device *device = root->device;
@@ -428,7 +440,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	struct pci_controller *controller;
 	struct pci_root_info *info = NULL;
 	int busnum = root->secondary.start;
-	struct pci_bus *pbus;
+	struct pci_host_bridge *host;
 	int ret;
 
 	controller = alloc_pci_controller(domain);
@@ -465,26 +477,16 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	 * should handle the case here, but it appears that IA64 hasn't
 	 * such quirk. So we just ignore the case now.
 	 */
-	pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus), 
-			&pci_root_ops, controller, &info->resources);
-	if (!pbus) {
+	host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, bus),
+			&pci_root_ops, controller, &info->resources, &phb_ops);
+	if (!host) {
 		pci_free_resource_list(&info->resources);
 		__release_pci_root_info(info);
 		return NULL;
 	}
 
-	pci_set_host_bridge_release(to_pci_host_bridge(pbus->bridge),
-			release_pci_root_info, info);
-	pci_scan_child_bus(pbus);
-	return pbus;
-}
-
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	struct pci_controller *controller = bridge->bus->sysdata;
-
-	ACPI_COMPANION_SET(&bridge->dev, controller->companion);
-	return 0;
+	pci_set_host_bridge_release(host, release_pci_root_info, info);
+	return host->bus;
 }
 
 static int is_valid_resource(struct pci_dev *dev, int idx)
-- 
1.7.1


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

* [PATCH 14/28] PCI/IA64: Refine pci_acpi_scan_root() with generic pci_host_bridge
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

From: Yijing Wang <wangyijing0307@gmail.com>

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/ia64/pci/pci.c |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index e457015..7736c02 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -420,6 +420,18 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
 	return 0;
 }
 
+static int pci_host_bridge_prepare(struct pci_host_bridge *bridge)
+{
+	struct pci_sysdata *sd = dev_get_drvdata(&bridge->dev);
+
+	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
+	return 0;
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_prepare = pci_host_bridge_prepare,
+};
+
 struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 {
 	struct acpi_device *device = root->device;
@@ -428,7 +440,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	struct pci_controller *controller;
 	struct pci_root_info *info = NULL;
 	int busnum = root->secondary.start;
-	struct pci_bus *pbus;
+	struct pci_host_bridge *host;
 	int ret;
 
 	controller = alloc_pci_controller(domain);
@@ -465,26 +477,16 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	 * should handle the case here, but it appears that IA64 hasn't
 	 * such quirk. So we just ignore the case now.
 	 */
-	pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus), 
-			&pci_root_ops, controller, &info->resources);
-	if (!pbus) {
+	host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, bus),
+			&pci_root_ops, controller, &info->resources, &phb_ops);
+	if (!host) {
 		pci_free_resource_list(&info->resources);
 		__release_pci_root_info(info);
 		return NULL;
 	}
 
-	pci_set_host_bridge_release(to_pci_host_bridge(pbus->bridge),
-			release_pci_root_info, info);
-	pci_scan_child_bus(pbus);
-	return pbus;
-}
-
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	struct pci_controller *controller = bridge->bus->sysdata;
-
-	ACPI_COMPANION_SET(&bridge->dev, controller->companion);
-	return 0;
+	pci_set_host_bridge_release(host, release_pci_root_info, info);
+	return host->bus;
 }
 
 static int is_valid_resource(struct pci_dev *dev, int idx)
-- 
1.7.1

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

* [PATCH 14/28] PCI/IA64: Refine pci_acpi_scan_root() with generic pci_host_bridge
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, Yijing Wang

From: Yijing Wang <wangyijing0307@gmail.com>

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/ia64/pci/pci.c |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index e457015..7736c02 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -420,6 +420,18 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
 	return 0;
 }
 
+static int pci_host_bridge_prepare(struct pci_host_bridge *bridge)
+{
+	struct pci_sysdata *sd = dev_get_drvdata(&bridge->dev);
+
+	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
+	return 0;
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_prepare = pci_host_bridge_prepare,
+};
+
 struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 {
 	struct acpi_device *device = root->device;
@@ -428,7 +440,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	struct pci_controller *controller;
 	struct pci_root_info *info = NULL;
 	int busnum = root->secondary.start;
-	struct pci_bus *pbus;
+	struct pci_host_bridge *host;
 	int ret;
 
 	controller = alloc_pci_controller(domain);
@@ -465,26 +477,16 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	 * should handle the case here, but it appears that IA64 hasn't
 	 * such quirk. So we just ignore the case now.
 	 */
-	pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus), 
-			&pci_root_ops, controller, &info->resources);
-	if (!pbus) {
+	host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, bus),
+			&pci_root_ops, controller, &info->resources, &phb_ops);
+	if (!host) {
 		pci_free_resource_list(&info->resources);
 		__release_pci_root_info(info);
 		return NULL;
 	}
 
-	pci_set_host_bridge_release(to_pci_host_bridge(pbus->bridge),
-			release_pci_root_info, info);
-	pci_scan_child_bus(pbus);
-	return pbus;
-}
-
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	struct pci_controller *controller = bridge->bus->sysdata;
-
-	ACPI_COMPANION_SET(&bridge->dev, controller->companion);
-	return 0;
+	pci_set_host_bridge_release(host, release_pci_root_info, info);
+	return host->bus;
 }
 
 static int is_valid_resource(struct pci_dev *dev, int idx)
-- 
1.7.1


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

* [PATCH 14/28] PCI/IA64: Refine pci_acpi_scan_root() with generic pci_host_bridge
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Liviu Dudau, Tony Luck, Russell King, Arnd Bergmann,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, Yijing Wang, linux-alpha,
	Yijing Wang, linux-ia64, Thomas Gleixner, Guan Xuetao,
	Yinghai Lu, Jiang Liu, linux-arm-kernel

From: Yijing Wang <wangyijing0307@gmail.com>

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/ia64/pci/pci.c |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index e457015..7736c02 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -420,6 +420,18 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
 	return 0;
 }
 
+static int pci_host_bridge_prepare(struct pci_host_bridge *bridge)
+{
+	struct pci_sysdata *sd = dev_get_drvdata(&bridge->dev);
+
+	ACPI_COMPANION_SET(&bridge->dev, sd->companion);
+	return 0;
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_prepare = pci_host_bridge_prepare,
+};
+
 struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 {
 	struct acpi_device *device = root->device;
@@ -428,7 +440,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	struct pci_controller *controller;
 	struct pci_root_info *info = NULL;
 	int busnum = root->secondary.start;
-	struct pci_bus *pbus;
+	struct pci_host_bridge *host;
 	int ret;
 
 	controller = alloc_pci_controller(domain);
@@ -465,26 +477,16 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	 * should handle the case here, but it appears that IA64 hasn't
 	 * such quirk. So we just ignore the case now.
 	 */
-	pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus), 
-			&pci_root_ops, controller, &info->resources);
-	if (!pbus) {
+	host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, bus),
+			&pci_root_ops, controller, &info->resources, &phb_ops);
+	if (!host) {
 		pci_free_resource_list(&info->resources);
 		__release_pci_root_info(info);
 		return NULL;
 	}
 
-	pci_set_host_bridge_release(to_pci_host_bridge(pbus->bridge),
-			release_pci_root_info, info);
-	pci_scan_child_bus(pbus);
-	return pbus;
-}
-
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	struct pci_controller *controller = bridge->bus->sysdata;
-
-	ACPI_COMPANION_SET(&bridge->dev, controller->companion);
-	return 0;
+	pci_set_host_bridge_release(host, release_pci_root_info, info);
+	return host->bus;
 }
 
 static int is_valid_resource(struct pci_dev *dev, int idx)
-- 
1.7.1

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

* [PATCH 15/28] PCI/powerpc: Rename pcibios_root_bridge_prepare() for better readability
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Pcibios_root_bridge_prepare() in powerpc is used
to set root bus speed. So rename it to
pcibios_set_root_bus_speed() for better readability.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/powerpc/include/asm/machdep.h       |    2 +-
 arch/powerpc/kernel/pci-common.c         |    4 ++--
 arch/powerpc/platforms/pseries/pci.c     |    2 +-
 arch/powerpc/platforms/pseries/pseries.h |    2 +-
 arch/powerpc/platforms/pseries/setup.c   |    2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index c8175a3..8e7f2a8 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -129,7 +129,7 @@ struct machdep_calls {
 	void		(*pcibios_fixup)(void);
 	int		(*pci_probe_mode)(struct pci_bus *);
 	void		(*pci_irq_fixup)(struct pci_dev *dev);
-	int		(*pcibios_root_bridge_prepare)(struct pci_host_bridge
+	int		(*pcibios_set_root_bus_speed)(struct pci_host_bridge
 				*bridge);
 
 	/* To setup PHBs when using automatic OF platform driver for PCI */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 927c3dd..2cf941e 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -769,8 +769,8 @@ int pci_proc_domain(struct pci_bus *bus)
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 {
-	if (ppc_md.pcibios_root_bridge_prepare)
-		return ppc_md.pcibios_root_bridge_prepare(bridge);
+	if (ppc_md.pcibios_set_root_bus_speed)
+		return ppc_md.pcibios_set_root_bus_speed(bridge);
 
 	return 0;
 }
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index fe16a50..af685d6 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -110,7 +110,7 @@ static void fixup_winbond_82c105(struct pci_dev* dev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
 			 fixup_winbond_82c105);
 
-int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
+int pseries_set_root_bus_speed(struct pci_host_bridge *bridge)
 {
 	struct device_node *dn, *pdn;
 	struct pci_bus *bus;
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index 1796c54..5d0be3a 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -63,7 +63,7 @@ extern int dlpar_detach_node(struct device_node *);
 
 /* PCI root bridge prepare function override for pseries */
 struct pci_host_bridge;
-int pseries_root_bridge_prepare(struct pci_host_bridge *bridge);
+int pseries_set_root_bus_speed(struct pci_host_bridge *bridge);
 
 unsigned long pseries_memory_block_size(void);
 
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index e445b67..b196c0d 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -496,7 +496,7 @@ static void __init pSeries_setup_arch(void)
 		ppc_md.enable_pmcs = power4_enable_pmcs;
 	}
 
-	ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
+	ppc_md.pcibios_set_root_bus_speed = pseries_set_root_bus_speed;
 
 	if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
 		long rc;
-- 
1.7.1


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

* [PATCH 15/28] PCI/powerpc: Rename pcibios_root_bridge_prepare() for better readability
  2015-01-16  1:43 ` Yijing Wang
                   ` (32 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Pcibios_root_bridge_prepare() in powerpc is used
to set root bus speed. So rename it to
pcibios_set_root_bus_speed() for better readability.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/powerpc/include/asm/machdep.h       |    2 +-
 arch/powerpc/kernel/pci-common.c         |    4 ++--
 arch/powerpc/platforms/pseries/pci.c     |    2 +-
 arch/powerpc/platforms/pseries/pseries.h |    2 +-
 arch/powerpc/platforms/pseries/setup.c   |    2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index c8175a3..8e7f2a8 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -129,7 +129,7 @@ struct machdep_calls {
 	void		(*pcibios_fixup)(void);
 	int		(*pci_probe_mode)(struct pci_bus *);
 	void		(*pci_irq_fixup)(struct pci_dev *dev);
-	int		(*pcibios_root_bridge_prepare)(struct pci_host_bridge
+	int		(*pcibios_set_root_bus_speed)(struct pci_host_bridge
 				*bridge);
 
 	/* To setup PHBs when using automatic OF platform driver for PCI */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 927c3dd..2cf941e 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -769,8 +769,8 @@ int pci_proc_domain(struct pci_bus *bus)
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 {
-	if (ppc_md.pcibios_root_bridge_prepare)
-		return ppc_md.pcibios_root_bridge_prepare(bridge);
+	if (ppc_md.pcibios_set_root_bus_speed)
+		return ppc_md.pcibios_set_root_bus_speed(bridge);
 
 	return 0;
 }
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index fe16a50..af685d6 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -110,7 +110,7 @@ static void fixup_winbond_82c105(struct pci_dev* dev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
 			 fixup_winbond_82c105);
 
-int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
+int pseries_set_root_bus_speed(struct pci_host_bridge *bridge)
 {
 	struct device_node *dn, *pdn;
 	struct pci_bus *bus;
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index 1796c54..5d0be3a 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -63,7 +63,7 @@ extern int dlpar_detach_node(struct device_node *);
 
 /* PCI root bridge prepare function override for pseries */
 struct pci_host_bridge;
-int pseries_root_bridge_prepare(struct pci_host_bridge *bridge);
+int pseries_set_root_bus_speed(struct pci_host_bridge *bridge);
 
 unsigned long pseries_memory_block_size(void);
 
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index e445b67..b196c0d 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -496,7 +496,7 @@ static void __init pSeries_setup_arch(void)
 		ppc_md.enable_pmcs = power4_enable_pmcs;
 	}
 
-	ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
+	ppc_md.pcibios_set_root_bus_speed = pseries_set_root_bus_speed;
 
 	if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
 		long rc;
-- 
1.7.1

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

* [PATCH 15/28] PCI/powerpc: Rename pcibios_root_bridge_prepare() for better readability
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Pcibios_root_bridge_prepare() in powerpc is used
to set root bus speed. So rename it to
pcibios_set_root_bus_speed() for better readability.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/powerpc/include/asm/machdep.h       |    2 +-
 arch/powerpc/kernel/pci-common.c         |    4 ++--
 arch/powerpc/platforms/pseries/pci.c     |    2 +-
 arch/powerpc/platforms/pseries/pseries.h |    2 +-
 arch/powerpc/platforms/pseries/setup.c   |    2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index c8175a3..8e7f2a8 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -129,7 +129,7 @@ struct machdep_calls {
 	void		(*pcibios_fixup)(void);
 	int		(*pci_probe_mode)(struct pci_bus *);
 	void		(*pci_irq_fixup)(struct pci_dev *dev);
-	int		(*pcibios_root_bridge_prepare)(struct pci_host_bridge
+	int		(*pcibios_set_root_bus_speed)(struct pci_host_bridge
 				*bridge);
 
 	/* To setup PHBs when using automatic OF platform driver for PCI */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 927c3dd..2cf941e 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -769,8 +769,8 @@ int pci_proc_domain(struct pci_bus *bus)
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 {
-	if (ppc_md.pcibios_root_bridge_prepare)
-		return ppc_md.pcibios_root_bridge_prepare(bridge);
+	if (ppc_md.pcibios_set_root_bus_speed)
+		return ppc_md.pcibios_set_root_bus_speed(bridge);
 
 	return 0;
 }
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index fe16a50..af685d6 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -110,7 +110,7 @@ static void fixup_winbond_82c105(struct pci_dev* dev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
 			 fixup_winbond_82c105);
 
-int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
+int pseries_set_root_bus_speed(struct pci_host_bridge *bridge)
 {
 	struct device_node *dn, *pdn;
 	struct pci_bus *bus;
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index 1796c54..5d0be3a 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -63,7 +63,7 @@ extern int dlpar_detach_node(struct device_node *);
 
 /* PCI root bridge prepare function override for pseries */
 struct pci_host_bridge;
-int pseries_root_bridge_prepare(struct pci_host_bridge *bridge);
+int pseries_set_root_bus_speed(struct pci_host_bridge *bridge);
 
 unsigned long pseries_memory_block_size(void);
 
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index e445b67..b196c0d 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -496,7 +496,7 @@ static void __init pSeries_setup_arch(void)
 		ppc_md.enable_pmcs = power4_enable_pmcs;
 	}
 
-	ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
+	ppc_md.pcibios_set_root_bus_speed = pseries_set_root_bus_speed;
 
 	if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
 		long rc;
-- 
1.7.1


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

* [PATCH 15/28] PCI/powerpc: Rename pcibios_root_bridge_prepare() for better readability
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Pcibios_root_bridge_prepare() in powerpc is used
to set root bus speed. So rename it to
pcibios_set_root_bus_speed() for better readability.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/powerpc/include/asm/machdep.h       |    2 +-
 arch/powerpc/kernel/pci-common.c         |    4 ++--
 arch/powerpc/platforms/pseries/pci.c     |    2 +-
 arch/powerpc/platforms/pseries/pseries.h |    2 +-
 arch/powerpc/platforms/pseries/setup.c   |    2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index c8175a3..8e7f2a8 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -129,7 +129,7 @@ struct machdep_calls {
 	void		(*pcibios_fixup)(void);
 	int		(*pci_probe_mode)(struct pci_bus *);
 	void		(*pci_irq_fixup)(struct pci_dev *dev);
-	int		(*pcibios_root_bridge_prepare)(struct pci_host_bridge
+	int		(*pcibios_set_root_bus_speed)(struct pci_host_bridge
 				*bridge);
 
 	/* To setup PHBs when using automatic OF platform driver for PCI */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 927c3dd..2cf941e 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -769,8 +769,8 @@ int pci_proc_domain(struct pci_bus *bus)
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 {
-	if (ppc_md.pcibios_root_bridge_prepare)
-		return ppc_md.pcibios_root_bridge_prepare(bridge);
+	if (ppc_md.pcibios_set_root_bus_speed)
+		return ppc_md.pcibios_set_root_bus_speed(bridge);
 
 	return 0;
 }
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index fe16a50..af685d6 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -110,7 +110,7 @@ static void fixup_winbond_82c105(struct pci_dev* dev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
 			 fixup_winbond_82c105);
 
-int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
+int pseries_set_root_bus_speed(struct pci_host_bridge *bridge)
 {
 	struct device_node *dn, *pdn;
 	struct pci_bus *bus;
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index 1796c54..5d0be3a 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -63,7 +63,7 @@ extern int dlpar_detach_node(struct device_node *);
 
 /* PCI root bridge prepare function override for pseries */
 struct pci_host_bridge;
-int pseries_root_bridge_prepare(struct pci_host_bridge *bridge);
+int pseries_set_root_bus_speed(struct pci_host_bridge *bridge);
 
 unsigned long pseries_memory_block_size(void);
 
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index e445b67..b196c0d 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -496,7 +496,7 @@ static void __init pSeries_setup_arch(void)
 		ppc_md.enable_pmcs = power4_enable_pmcs;
 	}
 
-	ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
+	ppc_md.pcibios_set_root_bus_speed = pseries_set_root_bus_speed;
 
 	if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
 		long rc;
-- 
1.7.1

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

* [PATCH 15/28] PCI/powerpc: Rename pcibios_root_bridge_prepare() for better readability
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Pcibios_root_bridge_prepare() in powerpc is used
to set root bus speed. So rename it to
pcibios_set_root_bus_speed() for better readability.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/powerpc/include/asm/machdep.h       |    2 +-
 arch/powerpc/kernel/pci-common.c         |    4 ++--
 arch/powerpc/platforms/pseries/pci.c     |    2 +-
 arch/powerpc/platforms/pseries/pseries.h |    2 +-
 arch/powerpc/platforms/pseries/setup.c   |    2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index c8175a3..8e7f2a8 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -129,7 +129,7 @@ struct machdep_calls {
 	void		(*pcibios_fixup)(void);
 	int		(*pci_probe_mode)(struct pci_bus *);
 	void		(*pci_irq_fixup)(struct pci_dev *dev);
-	int		(*pcibios_root_bridge_prepare)(struct pci_host_bridge
+	int		(*pcibios_set_root_bus_speed)(struct pci_host_bridge
 				*bridge);
 
 	/* To setup PHBs when using automatic OF platform driver for PCI */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 927c3dd..2cf941e 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -769,8 +769,8 @@ int pci_proc_domain(struct pci_bus *bus)
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 {
-	if (ppc_md.pcibios_root_bridge_prepare)
-		return ppc_md.pcibios_root_bridge_prepare(bridge);
+	if (ppc_md.pcibios_set_root_bus_speed)
+		return ppc_md.pcibios_set_root_bus_speed(bridge);
 
 	return 0;
 }
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index fe16a50..af685d6 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -110,7 +110,7 @@ static void fixup_winbond_82c105(struct pci_dev* dev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
 			 fixup_winbond_82c105);
 
-int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
+int pseries_set_root_bus_speed(struct pci_host_bridge *bridge)
 {
 	struct device_node *dn, *pdn;
 	struct pci_bus *bus;
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index 1796c54..5d0be3a 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -63,7 +63,7 @@ extern int dlpar_detach_node(struct device_node *);
 
 /* PCI root bridge prepare function override for pseries */
 struct pci_host_bridge;
-int pseries_root_bridge_prepare(struct pci_host_bridge *bridge);
+int pseries_set_root_bus_speed(struct pci_host_bridge *bridge);
 
 unsigned long pseries_memory_block_size(void);
 
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index e445b67..b196c0d 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -496,7 +496,7 @@ static void __init pSeries_setup_arch(void)
 		ppc_md.enable_pmcs = power4_enable_pmcs;
 	}
 
-	ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
+	ppc_md.pcibios_set_root_bus_speed = pseries_set_root_bus_speed;
 
 	if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
 		long rc;
-- 
1.7.1


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

* [PATCH 15/28] PCI/powerpc: Rename pcibios_root_bridge_prepare() for better readability
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Pcibios_root_bridge_prepare() in powerpc is used
to set root bus speed. So rename it to
pcibios_set_root_bus_speed() for better readability.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/powerpc/include/asm/machdep.h       |    2 +-
 arch/powerpc/kernel/pci-common.c         |    4 ++--
 arch/powerpc/platforms/pseries/pci.c     |    2 +-
 arch/powerpc/platforms/pseries/pseries.h |    2 +-
 arch/powerpc/platforms/pseries/setup.c   |    2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index c8175a3..8e7f2a8 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -129,7 +129,7 @@ struct machdep_calls {
 	void		(*pcibios_fixup)(void);
 	int		(*pci_probe_mode)(struct pci_bus *);
 	void		(*pci_irq_fixup)(struct pci_dev *dev);
-	int		(*pcibios_root_bridge_prepare)(struct pci_host_bridge
+	int		(*pcibios_set_root_bus_speed)(struct pci_host_bridge
 				*bridge);
 
 	/* To setup PHBs when using automatic OF platform driver for PCI */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 927c3dd..2cf941e 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -769,8 +769,8 @@ int pci_proc_domain(struct pci_bus *bus)
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 {
-	if (ppc_md.pcibios_root_bridge_prepare)
-		return ppc_md.pcibios_root_bridge_prepare(bridge);
+	if (ppc_md.pcibios_set_root_bus_speed)
+		return ppc_md.pcibios_set_root_bus_speed(bridge);
 
 	return 0;
 }
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index fe16a50..af685d6 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -110,7 +110,7 @@ static void fixup_winbond_82c105(struct pci_dev* dev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
 			 fixup_winbond_82c105);
 
-int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
+int pseries_set_root_bus_speed(struct pci_host_bridge *bridge)
 {
 	struct device_node *dn, *pdn;
 	struct pci_bus *bus;
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index 1796c54..5d0be3a 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -63,7 +63,7 @@ extern int dlpar_detach_node(struct device_node *);
 
 /* PCI root bridge prepare function override for pseries */
 struct pci_host_bridge;
-int pseries_root_bridge_prepare(struct pci_host_bridge *bridge);
+int pseries_set_root_bus_speed(struct pci_host_bridge *bridge);
 
 unsigned long pseries_memory_block_size(void);
 
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index e445b67..b196c0d 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -496,7 +496,7 @@ static void __init pSeries_setup_arch(void)
 		ppc_md.enable_pmcs = power4_enable_pmcs;
 	}
 
-	ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
+	ppc_md.pcibios_set_root_bus_speed = pseries_set_root_bus_speed;
 
 	if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
 		long rc;
-- 
1.7.1

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

* [PATCH 16/28] PCI/powerpc: Use pci_scan_root_bridge() for simplicity
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we could use pci_scan_root_bridge() to scan
pci buses, provide powerpc specific pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/powerpc/kernel/pci-common.c |   57 ++++++++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 2cf941e..0c7fb81 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -767,7 +767,8 @@ int pci_proc_domain(struct pci_bus *bus)
 	return 1;
 }
 
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
+static int pci_host_bridge_set_root_bus_speed(
+		struct pci_host_bridge *bridge)
 {
 	if (ppc_md.pcibios_set_root_bus_speed)
 		return ppc_md.pcibios_set_root_bus_speed(bridge);
@@ -775,6 +776,27 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 	return 0;
 }
 
+static void pci_host_bridge_probe_mode(struct pci_host_bridge *host)
+{
+	int mode = PCI_PROBE_NORMAL;
+	struct pci_bus *bus = host->bus;
+	struct pci_controller *hose = dev_get_drvdata(&host->dev);
+
+	/* Get probe mode and perform scan */
+	if (hose->dn && ppc_md.pci_probe_mode)
+		mode = ppc_md.pci_probe_mode(bus);
+
+	pr_debug("    probe mode: %d\n", mode);
+	if (mode == PCI_PROBE_DEVTREE)
+		host->of_scan = true;
+}
+
+static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host)
+{
+	struct pci_controller *hose = dev_get_drvdata(&host->dev);
+
+	of_scan_bus(host->dn, bus);
+}
 /* This header fixup will do the resource fixup for all devices as they are
  * probed, but not for bridge ranges
  */
@@ -1577,6 +1599,12 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
 	return of_node_get(hose->dn);
 }
 
+static struct pci_host_bridge_ops *phb_ops = {
+	.phb_set_root_bus_speed = pci_host_bridge_set_root_bus_speed,
+	.phb_probe_mode = pci_host_bridge_probe_mode,
+	.phb_of_scan_bus = pci_host_bridge_of_scan_bus,
+};
+
 /**
  * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus
  * @hose: Pointer to the PCI host controller instance structure
@@ -1584,9 +1612,9 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
 void pcibios_scan_phb(struct pci_controller *hose)
 {
 	LIST_HEAD(resources);
+	struct pci_host_bridge *host;
 	struct pci_bus *bus;
 	struct device_node *node = hose->dn;
-	int mode;
 
 	pr_debug("PCI: Scanning PHB %s\n", of_node_full_name(node));
 
@@ -1602,30 +1630,17 @@ void pcibios_scan_phb(struct pci_controller *hose)
 	pci_add_resource(&resources, &hose->busn);
 
 	/* Create an empty bus for the toplevel */
-	bus = pci_create_root_bus(hose->parent, 
+	host = pci_scan_root_bridge(hose->parent,
 			PCI_DOMBUS(hose->global_number, hose->first_busno),
-			hose->ops, hose, &resources);
-	if (bus == NULL) {
-		pr_err("Failed to create bus for PCI domain %04x\n",
+			hose->ops, hose, &resources, &phb_ops);
+	if (host == NULL) {
+		pr_err("Failed to create host bridge for PCI domain %04x\n",
 			hose->global_number);
 		pci_free_resource_list(&resources);
 		return;
 	}
-	hose->bus = bus;
-
-	/* Get probe mode and perform scan */
-	mode = PCI_PROBE_NORMAL;
-	if (node && ppc_md.pci_probe_mode)
-		mode = ppc_md.pci_probe_mode(bus);
-	pr_debug("    probe mode: %d\n", mode);
-	if (mode == PCI_PROBE_DEVTREE)
-		of_scan_bus(node, bus);
-
-	if (mode == PCI_PROBE_NORMAL) {
-		pci_bus_update_busn_res_end(bus, 255);
-		hose->last_busno = pci_scan_child_bus(bus);
-		pci_bus_update_busn_res_end(bus, hose->last_busno);
-	}
+	hose->bus = host->bus;
+	hose->last_busno = host->bus->busn_res.end;
 
 	/* Platform gets a chance to do some global fixups before
 	 * we proceed to resource allocation
-- 
1.7.1


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

* [PATCH 16/28] PCI/powerpc: Use pci_scan_root_bridge() for simplicity
  2015-01-16  1:43 ` Yijing Wang
                   ` (34 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we could use pci_scan_root_bridge() to scan
pci buses, provide powerpc specific pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/powerpc/kernel/pci-common.c |   57 ++++++++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 2cf941e..0c7fb81 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -767,7 +767,8 @@ int pci_proc_domain(struct pci_bus *bus)
 	return 1;
 }
 
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
+static int pci_host_bridge_set_root_bus_speed(
+		struct pci_host_bridge *bridge)
 {
 	if (ppc_md.pcibios_set_root_bus_speed)
 		return ppc_md.pcibios_set_root_bus_speed(bridge);
@@ -775,6 +776,27 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 	return 0;
 }
 
+static void pci_host_bridge_probe_mode(struct pci_host_bridge *host)
+{
+	int mode = PCI_PROBE_NORMAL;
+	struct pci_bus *bus = host->bus;
+	struct pci_controller *hose = dev_get_drvdata(&host->dev);
+
+	/* Get probe mode and perform scan */
+	if (hose->dn && ppc_md.pci_probe_mode)
+		mode = ppc_md.pci_probe_mode(bus);
+
+	pr_debug("    probe mode: %d\n", mode);
+	if (mode == PCI_PROBE_DEVTREE)
+		host->of_scan = true;
+}
+
+static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host)
+{
+	struct pci_controller *hose = dev_get_drvdata(&host->dev);
+
+	of_scan_bus(host->dn, bus);
+}
 /* This header fixup will do the resource fixup for all devices as they are
  * probed, but not for bridge ranges
  */
@@ -1577,6 +1599,12 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
 	return of_node_get(hose->dn);
 }
 
+static struct pci_host_bridge_ops *phb_ops = {
+	.phb_set_root_bus_speed = pci_host_bridge_set_root_bus_speed,
+	.phb_probe_mode = pci_host_bridge_probe_mode,
+	.phb_of_scan_bus = pci_host_bridge_of_scan_bus,
+};
+
 /**
  * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus
  * @hose: Pointer to the PCI host controller instance structure
@@ -1584,9 +1612,9 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
 void pcibios_scan_phb(struct pci_controller *hose)
 {
 	LIST_HEAD(resources);
+	struct pci_host_bridge *host;
 	struct pci_bus *bus;
 	struct device_node *node = hose->dn;
-	int mode;
 
 	pr_debug("PCI: Scanning PHB %s\n", of_node_full_name(node));
 
@@ -1602,30 +1630,17 @@ void pcibios_scan_phb(struct pci_controller *hose)
 	pci_add_resource(&resources, &hose->busn);
 
 	/* Create an empty bus for the toplevel */
-	bus = pci_create_root_bus(hose->parent, 
+	host = pci_scan_root_bridge(hose->parent,
 			PCI_DOMBUS(hose->global_number, hose->first_busno),
-			hose->ops, hose, &resources);
-	if (bus == NULL) {
-		pr_err("Failed to create bus for PCI domain %04x\n",
+			hose->ops, hose, &resources, &phb_ops);
+	if (host == NULL) {
+		pr_err("Failed to create host bridge for PCI domain %04x\n",
 			hose->global_number);
 		pci_free_resource_list(&resources);
 		return;
 	}
-	hose->bus = bus;
-
-	/* Get probe mode and perform scan */
-	mode = PCI_PROBE_NORMAL;
-	if (node && ppc_md.pci_probe_mode)
-		mode = ppc_md.pci_probe_mode(bus);
-	pr_debug("    probe mode: %d\n", mode);
-	if (mode == PCI_PROBE_DEVTREE)
-		of_scan_bus(node, bus);
-
-	if (mode == PCI_PROBE_NORMAL) {
-		pci_bus_update_busn_res_end(bus, 255);
-		hose->last_busno = pci_scan_child_bus(bus);
-		pci_bus_update_busn_res_end(bus, hose->last_busno);
-	}
+	hose->bus = host->bus;
+	hose->last_busno = host->bus->busn_res.end;
 
 	/* Platform gets a chance to do some global fixups before
 	 * we proceed to resource allocation
-- 
1.7.1

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

* [PATCH 16/28] PCI/powerpc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we could use pci_scan_root_bridge() to scan
pci buses, provide powerpc specific pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/powerpc/kernel/pci-common.c |   57 ++++++++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 2cf941e..0c7fb81 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -767,7 +767,8 @@ int pci_proc_domain(struct pci_bus *bus)
 	return 1;
 }
 
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
+static int pci_host_bridge_set_root_bus_speed(
+		struct pci_host_bridge *bridge)
 {
 	if (ppc_md.pcibios_set_root_bus_speed)
 		return ppc_md.pcibios_set_root_bus_speed(bridge);
@@ -775,6 +776,27 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 	return 0;
 }
 
+static void pci_host_bridge_probe_mode(struct pci_host_bridge *host)
+{
+	int mode = PCI_PROBE_NORMAL;
+	struct pci_bus *bus = host->bus;
+	struct pci_controller *hose = dev_get_drvdata(&host->dev);
+
+	/* Get probe mode and perform scan */
+	if (hose->dn && ppc_md.pci_probe_mode)
+		mode = ppc_md.pci_probe_mode(bus);
+
+	pr_debug("    probe mode: %d\n", mode);
+	if (mode == PCI_PROBE_DEVTREE)
+		host->of_scan = true;
+}
+
+static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host)
+{
+	struct pci_controller *hose = dev_get_drvdata(&host->dev);
+
+	of_scan_bus(host->dn, bus);
+}
 /* This header fixup will do the resource fixup for all devices as they are
  * probed, but not for bridge ranges
  */
@@ -1577,6 +1599,12 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
 	return of_node_get(hose->dn);
 }
 
+static struct pci_host_bridge_ops *phb_ops = {
+	.phb_set_root_bus_speed = pci_host_bridge_set_root_bus_speed,
+	.phb_probe_mode = pci_host_bridge_probe_mode,
+	.phb_of_scan_bus = pci_host_bridge_of_scan_bus,
+};
+
 /**
  * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus
  * @hose: Pointer to the PCI host controller instance structure
@@ -1584,9 +1612,9 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
 void pcibios_scan_phb(struct pci_controller *hose)
 {
 	LIST_HEAD(resources);
+	struct pci_host_bridge *host;
 	struct pci_bus *bus;
 	struct device_node *node = hose->dn;
-	int mode;
 
 	pr_debug("PCI: Scanning PHB %s\n", of_node_full_name(node));
 
@@ -1602,30 +1630,17 @@ void pcibios_scan_phb(struct pci_controller *hose)
 	pci_add_resource(&resources, &hose->busn);
 
 	/* Create an empty bus for the toplevel */
-	bus = pci_create_root_bus(hose->parent, 
+	host = pci_scan_root_bridge(hose->parent,
 			PCI_DOMBUS(hose->global_number, hose->first_busno),
-			hose->ops, hose, &resources);
-	if (bus == NULL) {
-		pr_err("Failed to create bus for PCI domain %04x\n",
+			hose->ops, hose, &resources, &phb_ops);
+	if (host == NULL) {
+		pr_err("Failed to create host bridge for PCI domain %04x\n",
 			hose->global_number);
 		pci_free_resource_list(&resources);
 		return;
 	}
-	hose->bus = bus;
-
-	/* Get probe mode and perform scan */
-	mode = PCI_PROBE_NORMAL;
-	if (node && ppc_md.pci_probe_mode)
-		mode = ppc_md.pci_probe_mode(bus);
-	pr_debug("    probe mode: %d\n", mode);
-	if (mode == PCI_PROBE_DEVTREE)
-		of_scan_bus(node, bus);
-
-	if (mode == PCI_PROBE_NORMAL) {
-		pci_bus_update_busn_res_end(bus, 255);
-		hose->last_busno = pci_scan_child_bus(bus);
-		pci_bus_update_busn_res_end(bus, hose->last_busno);
-	}
+	hose->bus = host->bus;
+	hose->last_busno = host->bus->busn_res.end;
 
 	/* Platform gets a chance to do some global fixups before
 	 * we proceed to resource allocation
-- 
1.7.1


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

* [PATCH 16/28] PCI/powerpc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Now we could use pci_scan_root_bridge() to scan
pci buses, provide powerpc specific pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/powerpc/kernel/pci-common.c |   57 ++++++++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 2cf941e..0c7fb81 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -767,7 +767,8 @@ int pci_proc_domain(struct pci_bus *bus)
 	return 1;
 }
 
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
+static int pci_host_bridge_set_root_bus_speed(
+		struct pci_host_bridge *bridge)
 {
 	if (ppc_md.pcibios_set_root_bus_speed)
 		return ppc_md.pcibios_set_root_bus_speed(bridge);
@@ -775,6 +776,27 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 	return 0;
 }
 
+static void pci_host_bridge_probe_mode(struct pci_host_bridge *host)
+{
+	int mode = PCI_PROBE_NORMAL;
+	struct pci_bus *bus = host->bus;
+	struct pci_controller *hose = dev_get_drvdata(&host->dev);
+
+	/* Get probe mode and perform scan */
+	if (hose->dn && ppc_md.pci_probe_mode)
+		mode = ppc_md.pci_probe_mode(bus);
+
+	pr_debug("    probe mode: %d\n", mode);
+	if (mode == PCI_PROBE_DEVTREE)
+		host->of_scan = true;
+}
+
+static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host)
+{
+	struct pci_controller *hose = dev_get_drvdata(&host->dev);
+
+	of_scan_bus(host->dn, bus);
+}
 /* This header fixup will do the resource fixup for all devices as they are
  * probed, but not for bridge ranges
  */
@@ -1577,6 +1599,12 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
 	return of_node_get(hose->dn);
 }
 
+static struct pci_host_bridge_ops *phb_ops = {
+	.phb_set_root_bus_speed = pci_host_bridge_set_root_bus_speed,
+	.phb_probe_mode = pci_host_bridge_probe_mode,
+	.phb_of_scan_bus = pci_host_bridge_of_scan_bus,
+};
+
 /**
  * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus
  * @hose: Pointer to the PCI host controller instance structure
@@ -1584,9 +1612,9 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
 void pcibios_scan_phb(struct pci_controller *hose)
 {
 	LIST_HEAD(resources);
+	struct pci_host_bridge *host;
 	struct pci_bus *bus;
 	struct device_node *node = hose->dn;
-	int mode;
 
 	pr_debug("PCI: Scanning PHB %s\n", of_node_full_name(node));
 
@@ -1602,30 +1630,17 @@ void pcibios_scan_phb(struct pci_controller *hose)
 	pci_add_resource(&resources, &hose->busn);
 
 	/* Create an empty bus for the toplevel */
-	bus = pci_create_root_bus(hose->parent, 
+	host = pci_scan_root_bridge(hose->parent,
 			PCI_DOMBUS(hose->global_number, hose->first_busno),
-			hose->ops, hose, &resources);
-	if (bus == NULL) {
-		pr_err("Failed to create bus for PCI domain %04x\n",
+			hose->ops, hose, &resources, &phb_ops);
+	if (host == NULL) {
+		pr_err("Failed to create host bridge for PCI domain %04x\n",
 			hose->global_number);
 		pci_free_resource_list(&resources);
 		return;
 	}
-	hose->bus = bus;
-
-	/* Get probe mode and perform scan */
-	mode = PCI_PROBE_NORMAL;
-	if (node && ppc_md.pci_probe_mode)
-		mode = ppc_md.pci_probe_mode(bus);
-	pr_debug("    probe mode: %d\n", mode);
-	if (mode == PCI_PROBE_DEVTREE)
-		of_scan_bus(node, bus);
-
-	if (mode == PCI_PROBE_NORMAL) {
-		pci_bus_update_busn_res_end(bus, 255);
-		hose->last_busno = pci_scan_child_bus(bus);
-		pci_bus_update_busn_res_end(bus, hose->last_busno);
-	}
+	hose->bus = host->bus;
+	hose->last_busno = host->bus->busn_res.end;
 
 	/* Platform gets a chance to do some global fixups before
 	 * we proceed to resource allocation
-- 
1.7.1

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

* [PATCH 16/28] PCI/powerpc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we could use pci_scan_root_bridge() to scan
pci buses, provide powerpc specific pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/powerpc/kernel/pci-common.c |   57 ++++++++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 2cf941e..0c7fb81 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -767,7 +767,8 @@ int pci_proc_domain(struct pci_bus *bus)
 	return 1;
 }
 
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
+static int pci_host_bridge_set_root_bus_speed(
+		struct pci_host_bridge *bridge)
 {
 	if (ppc_md.pcibios_set_root_bus_speed)
 		return ppc_md.pcibios_set_root_bus_speed(bridge);
@@ -775,6 +776,27 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 	return 0;
 }
 
+static void pci_host_bridge_probe_mode(struct pci_host_bridge *host)
+{
+	int mode = PCI_PROBE_NORMAL;
+	struct pci_bus *bus = host->bus;
+	struct pci_controller *hose = dev_get_drvdata(&host->dev);
+
+	/* Get probe mode and perform scan */
+	if (hose->dn && ppc_md.pci_probe_mode)
+		mode = ppc_md.pci_probe_mode(bus);
+
+	pr_debug("    probe mode: %d\n", mode);
+	if (mode = PCI_PROBE_DEVTREE)
+		host->of_scan = true;
+}
+
+static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host)
+{
+	struct pci_controller *hose = dev_get_drvdata(&host->dev);
+
+	of_scan_bus(host->dn, bus);
+}
 /* This header fixup will do the resource fixup for all devices as they are
  * probed, but not for bridge ranges
  */
@@ -1577,6 +1599,12 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
 	return of_node_get(hose->dn);
 }
 
+static struct pci_host_bridge_ops *phb_ops = {
+	.phb_set_root_bus_speed = pci_host_bridge_set_root_bus_speed,
+	.phb_probe_mode = pci_host_bridge_probe_mode,
+	.phb_of_scan_bus = pci_host_bridge_of_scan_bus,
+};
+
 /**
  * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus
  * @hose: Pointer to the PCI host controller instance structure
@@ -1584,9 +1612,9 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
 void pcibios_scan_phb(struct pci_controller *hose)
 {
 	LIST_HEAD(resources);
+	struct pci_host_bridge *host;
 	struct pci_bus *bus;
 	struct device_node *node = hose->dn;
-	int mode;
 
 	pr_debug("PCI: Scanning PHB %s\n", of_node_full_name(node));
 
@@ -1602,30 +1630,17 @@ void pcibios_scan_phb(struct pci_controller *hose)
 	pci_add_resource(&resources, &hose->busn);
 
 	/* Create an empty bus for the toplevel */
-	bus = pci_create_root_bus(hose->parent, 
+	host = pci_scan_root_bridge(hose->parent,
 			PCI_DOMBUS(hose->global_number, hose->first_busno),
-			hose->ops, hose, &resources);
-	if (bus = NULL) {
-		pr_err("Failed to create bus for PCI domain %04x\n",
+			hose->ops, hose, &resources, &phb_ops);
+	if (host = NULL) {
+		pr_err("Failed to create host bridge for PCI domain %04x\n",
 			hose->global_number);
 		pci_free_resource_list(&resources);
 		return;
 	}
-	hose->bus = bus;
-
-	/* Get probe mode and perform scan */
-	mode = PCI_PROBE_NORMAL;
-	if (node && ppc_md.pci_probe_mode)
-		mode = ppc_md.pci_probe_mode(bus);
-	pr_debug("    probe mode: %d\n", mode);
-	if (mode = PCI_PROBE_DEVTREE)
-		of_scan_bus(node, bus);
-
-	if (mode = PCI_PROBE_NORMAL) {
-		pci_bus_update_busn_res_end(bus, 255);
-		hose->last_busno = pci_scan_child_bus(bus);
-		pci_bus_update_busn_res_end(bus, hose->last_busno);
-	}
+	hose->bus = host->bus;
+	hose->last_busno = host->bus->busn_res.end;
 
 	/* Platform gets a chance to do some global fixups before
 	 * we proceed to resource allocation
-- 
1.7.1


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

* [PATCH 16/28] PCI/powerpc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we could use pci_scan_root_bridge() to scan
pci buses, provide powerpc specific pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/powerpc/kernel/pci-common.c |   57 ++++++++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 2cf941e..0c7fb81 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -767,7 +767,8 @@ int pci_proc_domain(struct pci_bus *bus)
 	return 1;
 }
 
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
+static int pci_host_bridge_set_root_bus_speed(
+		struct pci_host_bridge *bridge)
 {
 	if (ppc_md.pcibios_set_root_bus_speed)
 		return ppc_md.pcibios_set_root_bus_speed(bridge);
@@ -775,6 +776,27 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 	return 0;
 }
 
+static void pci_host_bridge_probe_mode(struct pci_host_bridge *host)
+{
+	int mode = PCI_PROBE_NORMAL;
+	struct pci_bus *bus = host->bus;
+	struct pci_controller *hose = dev_get_drvdata(&host->dev);
+
+	/* Get probe mode and perform scan */
+	if (hose->dn && ppc_md.pci_probe_mode)
+		mode = ppc_md.pci_probe_mode(bus);
+
+	pr_debug("    probe mode: %d\n", mode);
+	if (mode == PCI_PROBE_DEVTREE)
+		host->of_scan = true;
+}
+
+static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host)
+{
+	struct pci_controller *hose = dev_get_drvdata(&host->dev);
+
+	of_scan_bus(host->dn, bus);
+}
 /* This header fixup will do the resource fixup for all devices as they are
  * probed, but not for bridge ranges
  */
@@ -1577,6 +1599,12 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
 	return of_node_get(hose->dn);
 }
 
+static struct pci_host_bridge_ops *phb_ops = {
+	.phb_set_root_bus_speed = pci_host_bridge_set_root_bus_speed,
+	.phb_probe_mode = pci_host_bridge_probe_mode,
+	.phb_of_scan_bus = pci_host_bridge_of_scan_bus,
+};
+
 /**
  * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus
  * @hose: Pointer to the PCI host controller instance structure
@@ -1584,9 +1612,9 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
 void pcibios_scan_phb(struct pci_controller *hose)
 {
 	LIST_HEAD(resources);
+	struct pci_host_bridge *host;
 	struct pci_bus *bus;
 	struct device_node *node = hose->dn;
-	int mode;
 
 	pr_debug("PCI: Scanning PHB %s\n", of_node_full_name(node));
 
@@ -1602,30 +1630,17 @@ void pcibios_scan_phb(struct pci_controller *hose)
 	pci_add_resource(&resources, &hose->busn);
 
 	/* Create an empty bus for the toplevel */
-	bus = pci_create_root_bus(hose->parent, 
+	host = pci_scan_root_bridge(hose->parent,
 			PCI_DOMBUS(hose->global_number, hose->first_busno),
-			hose->ops, hose, &resources);
-	if (bus == NULL) {
-		pr_err("Failed to create bus for PCI domain %04x\n",
+			hose->ops, hose, &resources, &phb_ops);
+	if (host == NULL) {
+		pr_err("Failed to create host bridge for PCI domain %04x\n",
 			hose->global_number);
 		pci_free_resource_list(&resources);
 		return;
 	}
-	hose->bus = bus;
-
-	/* Get probe mode and perform scan */
-	mode = PCI_PROBE_NORMAL;
-	if (node && ppc_md.pci_probe_mode)
-		mode = ppc_md.pci_probe_mode(bus);
-	pr_debug("    probe mode: %d\n", mode);
-	if (mode == PCI_PROBE_DEVTREE)
-		of_scan_bus(node, bus);
-
-	if (mode == PCI_PROBE_NORMAL) {
-		pci_bus_update_busn_res_end(bus, 255);
-		hose->last_busno = pci_scan_child_bus(bus);
-		pci_bus_update_busn_res_end(bus, hose->last_busno);
-	}
+	hose->bus = host->bus;
+	hose->last_busno = host->bus->busn_res.end;
 
 	/* Platform gets a chance to do some global fixups before
 	 * we proceed to resource allocation
-- 
1.7.1

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

* [PATCH 17/28] PCI: Remove weak pcibios_root_bridge_prepare()
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now no one use weak pcibios_root_bridge_prepare(),
we could remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   15 ---------------
 include/linux/pci.h |    2 --
 2 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 51d69c3..30323ac 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1844,18 +1844,6 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus)
 }
 EXPORT_SYMBOL_GPL(pci_scan_child_bus);
 
-/**
- * pcibios_root_bridge_prepare - Platform-specific host bridge setup.
- * @bridge: Host bridge to set up.
- *
- * Default empty implementation.  Replace with an architecture-specific setup
- * routine, if necessary.
- */
-int __weak pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	return 0;
-}
-
 void __weak pcibios_add_bus(struct pci_bus *bus)
 {
 }
@@ -1890,9 +1878,6 @@ static struct pci_bus *__pci_create_root_bus(
 	b->bridge = get_device(&bridge->dev);
 	if (bridge->ops && bridge->ops->phb_set_root_bus_speed)
 		bridge->ops->phb_set_root_bus_speed(bridge);
-	error = pcibios_root_bridge_prepare(bridge);
-	if (error)
-		goto err_out;
 
 	device_enable_async_suspend(b->bridge);
 	pci_set_bus_of_node(b);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5592737..da3a071 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -428,8 +428,6 @@ struct pci_host_bridge {
 void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 		     void (*release_fn)(struct pci_host_bridge *),
 		     void *release_data);
-
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
 		struct device *parent, u32 dombus, struct list_head *resources, 
 		void *sysdata, struct pci_host_bridge_ops *ops);
-- 
1.7.1


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

* [PATCH 17/28] PCI: Remove weak pcibios_root_bridge_prepare()
  2015-01-16  1:43 ` Yijing Wang
                   ` (35 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now no one use weak pcibios_root_bridge_prepare(),
we could remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   15 ---------------
 include/linux/pci.h |    2 --
 2 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 51d69c3..30323ac 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1844,18 +1844,6 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus)
 }
 EXPORT_SYMBOL_GPL(pci_scan_child_bus);
 
-/**
- * pcibios_root_bridge_prepare - Platform-specific host bridge setup.
- * @bridge: Host bridge to set up.
- *
- * Default empty implementation.  Replace with an architecture-specific setup
- * routine, if necessary.
- */
-int __weak pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	return 0;
-}
-
 void __weak pcibios_add_bus(struct pci_bus *bus)
 {
 }
@@ -1890,9 +1878,6 @@ static struct pci_bus *__pci_create_root_bus(
 	b->bridge = get_device(&bridge->dev);
 	if (bridge->ops && bridge->ops->phb_set_root_bus_speed)
 		bridge->ops->phb_set_root_bus_speed(bridge);
-	error = pcibios_root_bridge_prepare(bridge);
-	if (error)
-		goto err_out;
 
 	device_enable_async_suspend(b->bridge);
 	pci_set_bus_of_node(b);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5592737..da3a071 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -428,8 +428,6 @@ struct pci_host_bridge {
 void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 		     void (*release_fn)(struct pci_host_bridge *),
 		     void *release_data);
-
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
 		struct device *parent, u32 dombus, struct list_head *resources, 
 		void *sysdata, struct pci_host_bridge_ops *ops);
-- 
1.7.1

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

* [PATCH 17/28] PCI: Remove weak pcibios_root_bridge_prepare()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now no one use weak pcibios_root_bridge_prepare(),
we could remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   15 ---------------
 include/linux/pci.h |    2 --
 2 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 51d69c3..30323ac 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1844,18 +1844,6 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus)
 }
 EXPORT_SYMBOL_GPL(pci_scan_child_bus);
 
-/**
- * pcibios_root_bridge_prepare - Platform-specific host bridge setup.
- * @bridge: Host bridge to set up.
- *
- * Default empty implementation.  Replace with an architecture-specific setup
- * routine, if necessary.
- */
-int __weak pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	return 0;
-}
-
 void __weak pcibios_add_bus(struct pci_bus *bus)
 {
 }
@@ -1890,9 +1878,6 @@ static struct pci_bus *__pci_create_root_bus(
 	b->bridge = get_device(&bridge->dev);
 	if (bridge->ops && bridge->ops->phb_set_root_bus_speed)
 		bridge->ops->phb_set_root_bus_speed(bridge);
-	error = pcibios_root_bridge_prepare(bridge);
-	if (error)
-		goto err_out;
 
 	device_enable_async_suspend(b->bridge);
 	pci_set_bus_of_node(b);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5592737..da3a071 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -428,8 +428,6 @@ struct pci_host_bridge {
 void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 		     void (*release_fn)(struct pci_host_bridge *),
 		     void *release_data);
-
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
 		struct device *parent, u32 dombus, struct list_head *resources, 
 		void *sysdata, struct pci_host_bridge_ops *ops);
-- 
1.7.1


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

* [PATCH 17/28] PCI: Remove weak pcibios_root_bridge_prepare()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Now no one use weak pcibios_root_bridge_prepare(),
we could remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   15 ---------------
 include/linux/pci.h |    2 --
 2 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 51d69c3..30323ac 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1844,18 +1844,6 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus)
 }
 EXPORT_SYMBOL_GPL(pci_scan_child_bus);
 
-/**
- * pcibios_root_bridge_prepare - Platform-specific host bridge setup.
- * @bridge: Host bridge to set up.
- *
- * Default empty implementation.  Replace with an architecture-specific setup
- * routine, if necessary.
- */
-int __weak pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	return 0;
-}
-
 void __weak pcibios_add_bus(struct pci_bus *bus)
 {
 }
@@ -1890,9 +1878,6 @@ static struct pci_bus *__pci_create_root_bus(
 	b->bridge = get_device(&bridge->dev);
 	if (bridge->ops && bridge->ops->phb_set_root_bus_speed)
 		bridge->ops->phb_set_root_bus_speed(bridge);
-	error = pcibios_root_bridge_prepare(bridge);
-	if (error)
-		goto err_out;
 
 	device_enable_async_suspend(b->bridge);
 	pci_set_bus_of_node(b);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5592737..da3a071 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -428,8 +428,6 @@ struct pci_host_bridge {
 void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 		     void (*release_fn)(struct pci_host_bridge *),
 		     void *release_data);
-
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
 		struct device *parent, u32 dombus, struct list_head *resources, 
 		void *sysdata, struct pci_host_bridge_ops *ops);
-- 
1.7.1

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

* [PATCH 17/28] PCI: Remove weak pcibios_root_bridge_prepare()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now no one use weak pcibios_root_bridge_prepare(),
we could remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   15 ---------------
 include/linux/pci.h |    2 --
 2 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 51d69c3..30323ac 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1844,18 +1844,6 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus)
 }
 EXPORT_SYMBOL_GPL(pci_scan_child_bus);
 
-/**
- * pcibios_root_bridge_prepare - Platform-specific host bridge setup.
- * @bridge: Host bridge to set up.
- *
- * Default empty implementation.  Replace with an architecture-specific setup
- * routine, if necessary.
- */
-int __weak pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	return 0;
-}
-
 void __weak pcibios_add_bus(struct pci_bus *bus)
 {
 }
@@ -1890,9 +1878,6 @@ static struct pci_bus *__pci_create_root_bus(
 	b->bridge = get_device(&bridge->dev);
 	if (bridge->ops && bridge->ops->phb_set_root_bus_speed)
 		bridge->ops->phb_set_root_bus_speed(bridge);
-	error = pcibios_root_bridge_prepare(bridge);
-	if (error)
-		goto err_out;
 
 	device_enable_async_suspend(b->bridge);
 	pci_set_bus_of_node(b);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5592737..da3a071 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -428,8 +428,6 @@ struct pci_host_bridge {
 void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 		     void (*release_fn)(struct pci_host_bridge *),
 		     void *release_data);
-
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
 		struct device *parent, u32 dombus, struct list_head *resources, 
 		void *sysdata, struct pci_host_bridge_ops *ops);
-- 
1.7.1


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

* [PATCH 17/28] PCI: Remove weak pcibios_root_bridge_prepare()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now no one use weak pcibios_root_bridge_prepare(),
we could remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   15 ---------------
 include/linux/pci.h |    2 --
 2 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 51d69c3..30323ac 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1844,18 +1844,6 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus)
 }
 EXPORT_SYMBOL_GPL(pci_scan_child_bus);
 
-/**
- * pcibios_root_bridge_prepare - Platform-specific host bridge setup.
- * @bridge: Host bridge to set up.
- *
- * Default empty implementation.  Replace with an architecture-specific setup
- * routine, if necessary.
- */
-int __weak pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-	return 0;
-}
-
 void __weak pcibios_add_bus(struct pci_bus *bus)
 {
 }
@@ -1890,9 +1878,6 @@ static struct pci_bus *__pci_create_root_bus(
 	b->bridge = get_device(&bridge->dev);
 	if (bridge->ops && bridge->ops->phb_set_root_bus_speed)
 		bridge->ops->phb_set_root_bus_speed(bridge);
-	error = pcibios_root_bridge_prepare(bridge);
-	if (error)
-		goto err_out;
 
 	device_enable_async_suspend(b->bridge);
 	pci_set_bus_of_node(b);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5592737..da3a071 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -428,8 +428,6 @@ struct pci_host_bridge {
 void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 		     void (*release_fn)(struct pci_host_bridge *),
 		     void *release_data);
-
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
 struct pci_host_bridge *pci_create_host_bridge(
 		struct device *parent, u32 dombus, struct list_head *resources, 
 		void *sysdata, struct pci_host_bridge_ops *ops);
-- 
1.7.1


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

* [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we could use pci_scan_root_bridge() to scan
pci buses, provide sparc specific pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/sparc/kernel/pci.c |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index d798b42..42dc21f 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -647,12 +647,31 @@ static void pci_claim_bus_resources(struct pci_bus *bus)
 		pci_claim_bus_resources(child_bus);
 }
 
+static void pci_host_bridge_probe_mode(
+		struct pci_host_bridge *host)
+{
+	host->of_scan = true;
+}
+
+static void pci_host_bridge_of_scan_bus(
+		struct pci_host_bridge *host)
+{
+	struct pci_pbm_info *pbm = dev_get_drvdata(&host->dev);
+	struct device_node *node = pbm->op->dev.of_node;
+
+	pci_of_scan_bus(pbm, node, host->bus);
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_of_scan_bus,
+};
+
 struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 				 struct device *parent)
 {
 	LIST_HEAD(resources);
 	struct device_node *node = pbm->op->dev.of_node;
-	struct pci_bus *bus;
+	struct pci_host_bridge *host;
 
 	printk("PCI: Scanning PBM %s\n", node->full_name);
 
@@ -664,17 +683,16 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 	pbm->busn.end	= pbm->pci_last_busno;
 	pbm->busn.flags	= IORESOURCE_BUS;
 	pci_add_resource(&resources, &pbm->busn);
-	bus = pci_create_root_bus(parent, 
+	host = pci_scan_root_bridge(parent,
 			PCI_DOMBUS(pbm->index, pbm->pci_first_busno), 
-			pbm->pci_ops, pbm, &resources);
-	if (!bus) {
-		printk(KERN_ERR "Failed to create bus for %s\n",
+			pbm->pci_ops, pbm, &resources, &phb_ops);
+	if (!host) {
+		printk(KERN_ERR "Failed to create host bridge for %s\n",
 		       node->full_name);
 		pci_free_resource_list(&resources);
 		return NULL;
 	}
 
-	pci_of_scan_bus(pbm, node, bus);
 	pci_bus_add_devices(bus);
 	pci_bus_register_of_sysfs(bus);
 
-- 
1.7.1


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

* [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
  2015-01-16  1:43 ` Yijing Wang
                   ` (38 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we could use pci_scan_root_bridge() to scan
pci buses, provide sparc specific pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/sparc/kernel/pci.c |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index d798b42..42dc21f 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -647,12 +647,31 @@ static void pci_claim_bus_resources(struct pci_bus *bus)
 		pci_claim_bus_resources(child_bus);
 }
 
+static void pci_host_bridge_probe_mode(
+		struct pci_host_bridge *host)
+{
+	host->of_scan = true;
+}
+
+static void pci_host_bridge_of_scan_bus(
+		struct pci_host_bridge *host)
+{
+	struct pci_pbm_info *pbm = dev_get_drvdata(&host->dev);
+	struct device_node *node = pbm->op->dev.of_node;
+
+	pci_of_scan_bus(pbm, node, host->bus);
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_of_scan_bus,
+};
+
 struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 				 struct device *parent)
 {
 	LIST_HEAD(resources);
 	struct device_node *node = pbm->op->dev.of_node;
-	struct pci_bus *bus;
+	struct pci_host_bridge *host;
 
 	printk("PCI: Scanning PBM %s\n", node->full_name);
 
@@ -664,17 +683,16 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 	pbm->busn.end	= pbm->pci_last_busno;
 	pbm->busn.flags	= IORESOURCE_BUS;
 	pci_add_resource(&resources, &pbm->busn);
-	bus = pci_create_root_bus(parent, 
+	host = pci_scan_root_bridge(parent,
 			PCI_DOMBUS(pbm->index, pbm->pci_first_busno), 
-			pbm->pci_ops, pbm, &resources);
-	if (!bus) {
-		printk(KERN_ERR "Failed to create bus for %s\n",
+			pbm->pci_ops, pbm, &resources, &phb_ops);
+	if (!host) {
+		printk(KERN_ERR "Failed to create host bridge for %s\n",
 		       node->full_name);
 		pci_free_resource_list(&resources);
 		return NULL;
 	}
 
-	pci_of_scan_bus(pbm, node, bus);
 	pci_bus_add_devices(bus);
 	pci_bus_register_of_sysfs(bus);
 
-- 
1.7.1

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

* [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we could use pci_scan_root_bridge() to scan
pci buses, provide sparc specific pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/sparc/kernel/pci.c |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index d798b42..42dc21f 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -647,12 +647,31 @@ static void pci_claim_bus_resources(struct pci_bus *bus)
 		pci_claim_bus_resources(child_bus);
 }
 
+static void pci_host_bridge_probe_mode(
+		struct pci_host_bridge *host)
+{
+	host->of_scan = true;
+}
+
+static void pci_host_bridge_of_scan_bus(
+		struct pci_host_bridge *host)
+{
+	struct pci_pbm_info *pbm = dev_get_drvdata(&host->dev);
+	struct device_node *node = pbm->op->dev.of_node;
+
+	pci_of_scan_bus(pbm, node, host->bus);
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_of_scan_bus,
+};
+
 struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 				 struct device *parent)
 {
 	LIST_HEAD(resources);
 	struct device_node *node = pbm->op->dev.of_node;
-	struct pci_bus *bus;
+	struct pci_host_bridge *host;
 
 	printk("PCI: Scanning PBM %s\n", node->full_name);
 
@@ -664,17 +683,16 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 	pbm->busn.end	= pbm->pci_last_busno;
 	pbm->busn.flags	= IORESOURCE_BUS;
 	pci_add_resource(&resources, &pbm->busn);
-	bus = pci_create_root_bus(parent, 
+	host = pci_scan_root_bridge(parent,
 			PCI_DOMBUS(pbm->index, pbm->pci_first_busno), 
-			pbm->pci_ops, pbm, &resources);
-	if (!bus) {
-		printk(KERN_ERR "Failed to create bus for %s\n",
+			pbm->pci_ops, pbm, &resources, &phb_ops);
+	if (!host) {
+		printk(KERN_ERR "Failed to create host bridge for %s\n",
 		       node->full_name);
 		pci_free_resource_list(&resources);
 		return NULL;
 	}
 
-	pci_of_scan_bus(pbm, node, bus);
 	pci_bus_add_devices(bus);
 	pci_bus_register_of_sysfs(bus);
 
-- 
1.7.1


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

* [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Now we could use pci_scan_root_bridge() to scan
pci buses, provide sparc specific pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/sparc/kernel/pci.c |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index d798b42..42dc21f 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -647,12 +647,31 @@ static void pci_claim_bus_resources(struct pci_bus *bus)
 		pci_claim_bus_resources(child_bus);
 }
 
+static void pci_host_bridge_probe_mode(
+		struct pci_host_bridge *host)
+{
+	host->of_scan = true;
+}
+
+static void pci_host_bridge_of_scan_bus(
+		struct pci_host_bridge *host)
+{
+	struct pci_pbm_info *pbm = dev_get_drvdata(&host->dev);
+	struct device_node *node = pbm->op->dev.of_node;
+
+	pci_of_scan_bus(pbm, node, host->bus);
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_of_scan_bus,
+};
+
 struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 				 struct device *parent)
 {
 	LIST_HEAD(resources);
 	struct device_node *node = pbm->op->dev.of_node;
-	struct pci_bus *bus;
+	struct pci_host_bridge *host;
 
 	printk("PCI: Scanning PBM %s\n", node->full_name);
 
@@ -664,17 +683,16 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 	pbm->busn.end	= pbm->pci_last_busno;
 	pbm->busn.flags	= IORESOURCE_BUS;
 	pci_add_resource(&resources, &pbm->busn);
-	bus = pci_create_root_bus(parent, 
+	host = pci_scan_root_bridge(parent,
 			PCI_DOMBUS(pbm->index, pbm->pci_first_busno), 
-			pbm->pci_ops, pbm, &resources);
-	if (!bus) {
-		printk(KERN_ERR "Failed to create bus for %s\n",
+			pbm->pci_ops, pbm, &resources, &phb_ops);
+	if (!host) {
+		printk(KERN_ERR "Failed to create host bridge for %s\n",
 		       node->full_name);
 		pci_free_resource_list(&resources);
 		return NULL;
 	}
 
-	pci_of_scan_bus(pbm, node, bus);
 	pci_bus_add_devices(bus);
 	pci_bus_register_of_sysfs(bus);
 
-- 
1.7.1

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

* [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we could use pci_scan_root_bridge() to scan
pci buses, provide sparc specific pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/sparc/kernel/pci.c |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index d798b42..42dc21f 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -647,12 +647,31 @@ static void pci_claim_bus_resources(struct pci_bus *bus)
 		pci_claim_bus_resources(child_bus);
 }
 
+static void pci_host_bridge_probe_mode(
+		struct pci_host_bridge *host)
+{
+	host->of_scan = true;
+}
+
+static void pci_host_bridge_of_scan_bus(
+		struct pci_host_bridge *host)
+{
+	struct pci_pbm_info *pbm = dev_get_drvdata(&host->dev);
+	struct device_node *node = pbm->op->dev.of_node;
+
+	pci_of_scan_bus(pbm, node, host->bus);
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_of_scan_bus,
+};
+
 struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 				 struct device *parent)
 {
 	LIST_HEAD(resources);
 	struct device_node *node = pbm->op->dev.of_node;
-	struct pci_bus *bus;
+	struct pci_host_bridge *host;
 
 	printk("PCI: Scanning PBM %s\n", node->full_name);
 
@@ -664,17 +683,16 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 	pbm->busn.end	= pbm->pci_last_busno;
 	pbm->busn.flags	= IORESOURCE_BUS;
 	pci_add_resource(&resources, &pbm->busn);
-	bus = pci_create_root_bus(parent, 
+	host = pci_scan_root_bridge(parent,
 			PCI_DOMBUS(pbm->index, pbm->pci_first_busno), 
-			pbm->pci_ops, pbm, &resources);
-	if (!bus) {
-		printk(KERN_ERR "Failed to create bus for %s\n",
+			pbm->pci_ops, pbm, &resources, &phb_ops);
+	if (!host) {
+		printk(KERN_ERR "Failed to create host bridge for %s\n",
 		       node->full_name);
 		pci_free_resource_list(&resources);
 		return NULL;
 	}
 
-	pci_of_scan_bus(pbm, node, bus);
 	pci_bus_add_devices(bus);
 	pci_bus_register_of_sysfs(bus);
 
-- 
1.7.1


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

* [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we could use pci_scan_root_bridge() to scan
pci buses, provide sparc specific pci_host_bridge_ops.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/sparc/kernel/pci.c |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index d798b42..42dc21f 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -647,12 +647,31 @@ static void pci_claim_bus_resources(struct pci_bus *bus)
 		pci_claim_bus_resources(child_bus);
 }
 
+static void pci_host_bridge_probe_mode(
+		struct pci_host_bridge *host)
+{
+	host->of_scan = true;
+}
+
+static void pci_host_bridge_of_scan_bus(
+		struct pci_host_bridge *host)
+{
+	struct pci_pbm_info *pbm = dev_get_drvdata(&host->dev);
+	struct device_node *node = pbm->op->dev.of_node;
+
+	pci_of_scan_bus(pbm, node, host->bus);
+}
+
+static struct pci_host_bridge_ops phb_ops = {
+	.phb_of_scan_bus,
+};
+
 struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 				 struct device *parent)
 {
 	LIST_HEAD(resources);
 	struct device_node *node = pbm->op->dev.of_node;
-	struct pci_bus *bus;
+	struct pci_host_bridge *host;
 
 	printk("PCI: Scanning PBM %s\n", node->full_name);
 
@@ -664,17 +683,16 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 	pbm->busn.end	= pbm->pci_last_busno;
 	pbm->busn.flags	= IORESOURCE_BUS;
 	pci_add_resource(&resources, &pbm->busn);
-	bus = pci_create_root_bus(parent, 
+	host = pci_scan_root_bridge(parent,
 			PCI_DOMBUS(pbm->index, pbm->pci_first_busno), 
-			pbm->pci_ops, pbm, &resources);
-	if (!bus) {
-		printk(KERN_ERR "Failed to create bus for %s\n",
+			pbm->pci_ops, pbm, &resources, &phb_ops);
+	if (!host) {
+		printk(KERN_ERR "Failed to create host bridge for %s\n",
 		       node->full_name);
 		pci_free_resource_list(&resources);
 		return NULL;
 	}
 
-	pci_of_scan_bus(pbm, node, bus);
 	pci_bus_add_devices(bus);
 	pci_bus_register_of_sysfs(bus);
 
-- 
1.7.1

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

* [PATCH 19/28] PCI: Introduce pci_bus_child_max_busnr()
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Sometimes, we need to know the highest reserved
busnr for children bus. Because parent's
bus->busn_res could have padding in it.
This function return the max child busnr as
pci_scan_child_bus().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/hotplug/acpiphp_glue.c |   29 +----------------------------
 drivers/pci/pci.c                  |   25 ++++++++++++++++++++++++-
 include/linux/pci.h                |    2 +-
 3 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index bcb90e4..84f2584 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -397,33 +397,6 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
 	acpi_unlock_hp_context();
 }
 
-/**
- * acpiphp_max_busnr - return the highest reserved bus number under the given bus.
- * @bus: bus to start search with
- */
-static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
-{
-	struct pci_bus *tmp;
-	unsigned char max, n;
-
-	/*
-	 * pci_bus_max_busnr will return the highest
-	 * reserved busnr for all these children.
-	 * that is equivalent to the bus->subordinate
-	 * value.  We don't want to use the parent's
-	 * bus->subordinate value because it could have
-	 * padding in it.
-	 */
-	max = bus->busn_res.start;
-
-	list_for_each_entry(tmp, &bus->children, node) {
-		n = pci_bus_max_busnr(tmp);
-		if (n > max)
-			max = n;
-	}
-	return max;
-}
-
 static void acpiphp_set_acpi_region(struct acpiphp_slot *slot)
 {
 	struct acpiphp_func *func;
@@ -489,7 +462,7 @@ static void enable_slot(struct acpiphp_slot *slot)
 	LIST_HEAD(add_list);
 
 	acpiphp_rescan_slot(slot);
-	max = acpiphp_max_busnr(bus);
+	max = pci_bus_child_max_busnr(bus);
 	for (pass = 0; pass < 2; pass++) {
 		list_for_each_entry(dev, &bus->devices, bus_list) {
 			if (PCI_SLOT(dev->devfn) != slot->device)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 8b35e8e..a05f406 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -121,7 +121,30 @@ unsigned char pci_bus_max_busnr(struct pci_bus *bus)
 	}
 	return max;
 }
-EXPORT_SYMBOL_GPL(pci_bus_max_busnr);
+
+unsigned char pci_bus_child_max_busnr(struct pci_bus *bus)
+{
+	struct pci_bus *tmp;
+	unsigned char max, n;
+
+	/*
+	 * pci_bus_max_busnr will return the highest
+	 * reserved busnr for all these children.
+	 * that is equivalent to the bus->subordinate
+	 * value.  We don't want to use the parent's
+	 * bus->subordinate value because it could have
+	 * padding in it.
+	 */
+	max = bus->busn_res.start;
+
+	list_for_each_entry(tmp, &bus->children, node) {
+		n = pci_bus_max_busnr(tmp);
+		if (n > max)
+			max = n;
+	}
+	return max;
+}
+EXPORT_SYMBOL_GPL(pci_bus_child_max_busnr);
 
 #ifdef CONFIG_HAS_IOMEM
 void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index da3a071..2970a84 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1176,7 +1176,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
 		  void *userdata);
 int pci_cfg_space_size(struct pci_dev *dev);
-unsigned char pci_bus_max_busnr(struct pci_bus *bus);
+unsigned char pci_bus_child_max_busnr(struct pci_bus *bus);
 void pci_setup_bridge(struct pci_bus *bus);
 resource_size_t pcibios_window_alignment(struct pci_bus *bus,
 					 unsigned long type);
-- 
1.7.1


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

* [PATCH 19/28] PCI: Introduce pci_bus_child_max_busnr()
  2015-01-16  1:43 ` Yijing Wang
                   ` (40 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Sometimes, we need to know the highest reserved
busnr for children bus. Because parent's
bus->busn_res could have padding in it.
This function return the max child busnr as
pci_scan_child_bus().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/hotplug/acpiphp_glue.c |   29 +----------------------------
 drivers/pci/pci.c                  |   25 ++++++++++++++++++++++++-
 include/linux/pci.h                |    2 +-
 3 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index bcb90e4..84f2584 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -397,33 +397,6 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
 	acpi_unlock_hp_context();
 }
 
-/**
- * acpiphp_max_busnr - return the highest reserved bus number under the given bus.
- * @bus: bus to start search with
- */
-static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
-{
-	struct pci_bus *tmp;
-	unsigned char max, n;
-
-	/*
-	 * pci_bus_max_busnr will return the highest
-	 * reserved busnr for all these children.
-	 * that is equivalent to the bus->subordinate
-	 * value.  We don't want to use the parent's
-	 * bus->subordinate value because it could have
-	 * padding in it.
-	 */
-	max = bus->busn_res.start;
-
-	list_for_each_entry(tmp, &bus->children, node) {
-		n = pci_bus_max_busnr(tmp);
-		if (n > max)
-			max = n;
-	}
-	return max;
-}
-
 static void acpiphp_set_acpi_region(struct acpiphp_slot *slot)
 {
 	struct acpiphp_func *func;
@@ -489,7 +462,7 @@ static void enable_slot(struct acpiphp_slot *slot)
 	LIST_HEAD(add_list);
 
 	acpiphp_rescan_slot(slot);
-	max = acpiphp_max_busnr(bus);
+	max = pci_bus_child_max_busnr(bus);
 	for (pass = 0; pass < 2; pass++) {
 		list_for_each_entry(dev, &bus->devices, bus_list) {
 			if (PCI_SLOT(dev->devfn) != slot->device)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 8b35e8e..a05f406 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -121,7 +121,30 @@ unsigned char pci_bus_max_busnr(struct pci_bus *bus)
 	}
 	return max;
 }
-EXPORT_SYMBOL_GPL(pci_bus_max_busnr);
+
+unsigned char pci_bus_child_max_busnr(struct pci_bus *bus)
+{
+	struct pci_bus *tmp;
+	unsigned char max, n;
+
+	/*
+	 * pci_bus_max_busnr will return the highest
+	 * reserved busnr for all these children.
+	 * that is equivalent to the bus->subordinate
+	 * value.  We don't want to use the parent's
+	 * bus->subordinate value because it could have
+	 * padding in it.
+	 */
+	max = bus->busn_res.start;
+
+	list_for_each_entry(tmp, &bus->children, node) {
+		n = pci_bus_max_busnr(tmp);
+		if (n > max)
+			max = n;
+	}
+	return max;
+}
+EXPORT_SYMBOL_GPL(pci_bus_child_max_busnr);
 
 #ifdef CONFIG_HAS_IOMEM
 void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index da3a071..2970a84 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1176,7 +1176,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
 		  void *userdata);
 int pci_cfg_space_size(struct pci_dev *dev);
-unsigned char pci_bus_max_busnr(struct pci_bus *bus);
+unsigned char pci_bus_child_max_busnr(struct pci_bus *bus);
 void pci_setup_bridge(struct pci_bus *bus);
 resource_size_t pcibios_window_alignment(struct pci_bus *bus,
 					 unsigned long type);
-- 
1.7.1

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

* [PATCH 19/28] PCI: Introduce pci_bus_child_max_busnr()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Sometimes, we need to know the highest reserved
busnr for children bus. Because parent's
bus->busn_res could have padding in it.
This function return the max child busnr as
pci_scan_child_bus().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/hotplug/acpiphp_glue.c |   29 +----------------------------
 drivers/pci/pci.c                  |   25 ++++++++++++++++++++++++-
 include/linux/pci.h                |    2 +-
 3 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index bcb90e4..84f2584 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -397,33 +397,6 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
 	acpi_unlock_hp_context();
 }
 
-/**
- * acpiphp_max_busnr - return the highest reserved bus number under the given bus.
- * @bus: bus to start search with
- */
-static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
-{
-	struct pci_bus *tmp;
-	unsigned char max, n;
-
-	/*
-	 * pci_bus_max_busnr will return the highest
-	 * reserved busnr for all these children.
-	 * that is equivalent to the bus->subordinate
-	 * value.  We don't want to use the parent's
-	 * bus->subordinate value because it could have
-	 * padding in it.
-	 */
-	max = bus->busn_res.start;
-
-	list_for_each_entry(tmp, &bus->children, node) {
-		n = pci_bus_max_busnr(tmp);
-		if (n > max)
-			max = n;
-	}
-	return max;
-}
-
 static void acpiphp_set_acpi_region(struct acpiphp_slot *slot)
 {
 	struct acpiphp_func *func;
@@ -489,7 +462,7 @@ static void enable_slot(struct acpiphp_slot *slot)
 	LIST_HEAD(add_list);
 
 	acpiphp_rescan_slot(slot);
-	max = acpiphp_max_busnr(bus);
+	max = pci_bus_child_max_busnr(bus);
 	for (pass = 0; pass < 2; pass++) {
 		list_for_each_entry(dev, &bus->devices, bus_list) {
 			if (PCI_SLOT(dev->devfn) != slot->device)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 8b35e8e..a05f406 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -121,7 +121,30 @@ unsigned char pci_bus_max_busnr(struct pci_bus *bus)
 	}
 	return max;
 }
-EXPORT_SYMBOL_GPL(pci_bus_max_busnr);
+
+unsigned char pci_bus_child_max_busnr(struct pci_bus *bus)
+{
+	struct pci_bus *tmp;
+	unsigned char max, n;
+
+	/*
+	 * pci_bus_max_busnr will return the highest
+	 * reserved busnr for all these children.
+	 * that is equivalent to the bus->subordinate
+	 * value.  We don't want to use the parent's
+	 * bus->subordinate value because it could have
+	 * padding in it.
+	 */
+	max = bus->busn_res.start;
+
+	list_for_each_entry(tmp, &bus->children, node) {
+		n = pci_bus_max_busnr(tmp);
+		if (n > max)
+			max = n;
+	}
+	return max;
+}
+EXPORT_SYMBOL_GPL(pci_bus_child_max_busnr);
 
 #ifdef CONFIG_HAS_IOMEM
 void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index da3a071..2970a84 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1176,7 +1176,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
 		  void *userdata);
 int pci_cfg_space_size(struct pci_dev *dev);
-unsigned char pci_bus_max_busnr(struct pci_bus *bus);
+unsigned char pci_bus_child_max_busnr(struct pci_bus *bus);
 void pci_setup_bridge(struct pci_bus *bus);
 resource_size_t pcibios_window_alignment(struct pci_bus *bus,
 					 unsigned long type);
-- 
1.7.1


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

* [PATCH 19/28] PCI: Introduce pci_bus_child_max_busnr()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Sometimes, we need to know the highest reserved
busnr for children bus. Because parent's
bus->busn_res could have padding in it.
This function return the max child busnr as
pci_scan_child_bus().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/hotplug/acpiphp_glue.c |   29 +----------------------------
 drivers/pci/pci.c                  |   25 ++++++++++++++++++++++++-
 include/linux/pci.h                |    2 +-
 3 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index bcb90e4..84f2584 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -397,33 +397,6 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
 	acpi_unlock_hp_context();
 }
 
-/**
- * acpiphp_max_busnr - return the highest reserved bus number under the given bus.
- * @bus: bus to start search with
- */
-static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
-{
-	struct pci_bus *tmp;
-	unsigned char max, n;
-
-	/*
-	 * pci_bus_max_busnr will return the highest
-	 * reserved busnr for all these children.
-	 * that is equivalent to the bus->subordinate
-	 * value.  We don't want to use the parent's
-	 * bus->subordinate value because it could have
-	 * padding in it.
-	 */
-	max = bus->busn_res.start;
-
-	list_for_each_entry(tmp, &bus->children, node) {
-		n = pci_bus_max_busnr(tmp);
-		if (n > max)
-			max = n;
-	}
-	return max;
-}
-
 static void acpiphp_set_acpi_region(struct acpiphp_slot *slot)
 {
 	struct acpiphp_func *func;
@@ -489,7 +462,7 @@ static void enable_slot(struct acpiphp_slot *slot)
 	LIST_HEAD(add_list);
 
 	acpiphp_rescan_slot(slot);
-	max = acpiphp_max_busnr(bus);
+	max = pci_bus_child_max_busnr(bus);
 	for (pass = 0; pass < 2; pass++) {
 		list_for_each_entry(dev, &bus->devices, bus_list) {
 			if (PCI_SLOT(dev->devfn) != slot->device)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 8b35e8e..a05f406 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -121,7 +121,30 @@ unsigned char pci_bus_max_busnr(struct pci_bus *bus)
 	}
 	return max;
 }
-EXPORT_SYMBOL_GPL(pci_bus_max_busnr);
+
+unsigned char pci_bus_child_max_busnr(struct pci_bus *bus)
+{
+	struct pci_bus *tmp;
+	unsigned char max, n;
+
+	/*
+	 * pci_bus_max_busnr will return the highest
+	 * reserved busnr for all these children.
+	 * that is equivalent to the bus->subordinate
+	 * value.  We don't want to use the parent's
+	 * bus->subordinate value because it could have
+	 * padding in it.
+	 */
+	max = bus->busn_res.start;
+
+	list_for_each_entry(tmp, &bus->children, node) {
+		n = pci_bus_max_busnr(tmp);
+		if (n > max)
+			max = n;
+	}
+	return max;
+}
+EXPORT_SYMBOL_GPL(pci_bus_child_max_busnr);
 
 #ifdef CONFIG_HAS_IOMEM
 void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index da3a071..2970a84 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1176,7 +1176,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
 		  void *userdata);
 int pci_cfg_space_size(struct pci_dev *dev);
-unsigned char pci_bus_max_busnr(struct pci_bus *bus);
+unsigned char pci_bus_child_max_busnr(struct pci_bus *bus);
 void pci_setup_bridge(struct pci_bus *bus);
 resource_size_t pcibios_window_alignment(struct pci_bus *bus,
 					 unsigned long type);
-- 
1.7.1

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

* [PATCH 19/28] PCI: Introduce pci_bus_child_max_busnr()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Sometimes, we need to know the highest reserved
busnr for children bus. Because parent's
bus->busn_res could have padding in it.
This function return the max child busnr as
pci_scan_child_bus().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/hotplug/acpiphp_glue.c |   29 +----------------------------
 drivers/pci/pci.c                  |   25 ++++++++++++++++++++++++-
 include/linux/pci.h                |    2 +-
 3 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index bcb90e4..84f2584 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -397,33 +397,6 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
 	acpi_unlock_hp_context();
 }
 
-/**
- * acpiphp_max_busnr - return the highest reserved bus number under the given bus.
- * @bus: bus to start search with
- */
-static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
-{
-	struct pci_bus *tmp;
-	unsigned char max, n;
-
-	/*
-	 * pci_bus_max_busnr will return the highest
-	 * reserved busnr for all these children.
-	 * that is equivalent to the bus->subordinate
-	 * value.  We don't want to use the parent's
-	 * bus->subordinate value because it could have
-	 * padding in it.
-	 */
-	max = bus->busn_res.start;
-
-	list_for_each_entry(tmp, &bus->children, node) {
-		n = pci_bus_max_busnr(tmp);
-		if (n > max)
-			max = n;
-	}
-	return max;
-}
-
 static void acpiphp_set_acpi_region(struct acpiphp_slot *slot)
 {
 	struct acpiphp_func *func;
@@ -489,7 +462,7 @@ static void enable_slot(struct acpiphp_slot *slot)
 	LIST_HEAD(add_list);
 
 	acpiphp_rescan_slot(slot);
-	max = acpiphp_max_busnr(bus);
+	max = pci_bus_child_max_busnr(bus);
 	for (pass = 0; pass < 2; pass++) {
 		list_for_each_entry(dev, &bus->devices, bus_list) {
 			if (PCI_SLOT(dev->devfn) != slot->device)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 8b35e8e..a05f406 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -121,7 +121,30 @@ unsigned char pci_bus_max_busnr(struct pci_bus *bus)
 	}
 	return max;
 }
-EXPORT_SYMBOL_GPL(pci_bus_max_busnr);
+
+unsigned char pci_bus_child_max_busnr(struct pci_bus *bus)
+{
+	struct pci_bus *tmp;
+	unsigned char max, n;
+
+	/*
+	 * pci_bus_max_busnr will return the highest
+	 * reserved busnr for all these children.
+	 * that is equivalent to the bus->subordinate
+	 * value.  We don't want to use the parent's
+	 * bus->subordinate value because it could have
+	 * padding in it.
+	 */
+	max = bus->busn_res.start;
+
+	list_for_each_entry(tmp, &bus->children, node) {
+		n = pci_bus_max_busnr(tmp);
+		if (n > max)
+			max = n;
+	}
+	return max;
+}
+EXPORT_SYMBOL_GPL(pci_bus_child_max_busnr);
 
 #ifdef CONFIG_HAS_IOMEM
 void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index da3a071..2970a84 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1176,7 +1176,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
 		  void *userdata);
 int pci_cfg_space_size(struct pci_dev *dev);
-unsigned char pci_bus_max_busnr(struct pci_bus *bus);
+unsigned char pci_bus_child_max_busnr(struct pci_bus *bus);
 void pci_setup_bridge(struct pci_bus *bus);
 resource_size_t pcibios_window_alignment(struct pci_bus *bus,
 					 unsigned long type);
-- 
1.7.1


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

* [PATCH 19/28] PCI: Introduce pci_bus_child_max_busnr()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Sometimes, we need to know the highest reserved
busnr for children bus. Because parent's
bus->busn_res could have padding in it.
This function return the max child busnr as
pci_scan_child_bus().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/hotplug/acpiphp_glue.c |   29 +----------------------------
 drivers/pci/pci.c                  |   25 ++++++++++++++++++++++++-
 include/linux/pci.h                |    2 +-
 3 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index bcb90e4..84f2584 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -397,33 +397,6 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
 	acpi_unlock_hp_context();
 }
 
-/**
- * acpiphp_max_busnr - return the highest reserved bus number under the given bus.
- * @bus: bus to start search with
- */
-static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
-{
-	struct pci_bus *tmp;
-	unsigned char max, n;
-
-	/*
-	 * pci_bus_max_busnr will return the highest
-	 * reserved busnr for all these children.
-	 * that is equivalent to the bus->subordinate
-	 * value.  We don't want to use the parent's
-	 * bus->subordinate value because it could have
-	 * padding in it.
-	 */
-	max = bus->busn_res.start;
-
-	list_for_each_entry(tmp, &bus->children, node) {
-		n = pci_bus_max_busnr(tmp);
-		if (n > max)
-			max = n;
-	}
-	return max;
-}
-
 static void acpiphp_set_acpi_region(struct acpiphp_slot *slot)
 {
 	struct acpiphp_func *func;
@@ -489,7 +462,7 @@ static void enable_slot(struct acpiphp_slot *slot)
 	LIST_HEAD(add_list);
 
 	acpiphp_rescan_slot(slot);
-	max = acpiphp_max_busnr(bus);
+	max = pci_bus_child_max_busnr(bus);
 	for (pass = 0; pass < 2; pass++) {
 		list_for_each_entry(dev, &bus->devices, bus_list) {
 			if (PCI_SLOT(dev->devfn) != slot->device)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 8b35e8e..a05f406 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -121,7 +121,30 @@ unsigned char pci_bus_max_busnr(struct pci_bus *bus)
 	}
 	return max;
 }
-EXPORT_SYMBOL_GPL(pci_bus_max_busnr);
+
+unsigned char pci_bus_child_max_busnr(struct pci_bus *bus)
+{
+	struct pci_bus *tmp;
+	unsigned char max, n;
+
+	/*
+	 * pci_bus_max_busnr will return the highest
+	 * reserved busnr for all these children.
+	 * that is equivalent to the bus->subordinate
+	 * value.  We don't want to use the parent's
+	 * bus->subordinate value because it could have
+	 * padding in it.
+	 */
+	max = bus->busn_res.start;
+
+	list_for_each_entry(tmp, &bus->children, node) {
+		n = pci_bus_max_busnr(tmp);
+		if (n > max)
+			max = n;
+	}
+	return max;
+}
+EXPORT_SYMBOL_GPL(pci_bus_child_max_busnr);
 
 #ifdef CONFIG_HAS_IOMEM
 void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index da3a071..2970a84 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1176,7 +1176,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
 		  void *userdata);
 int pci_cfg_space_size(struct pci_dev *dev);
-unsigned char pci_bus_max_busnr(struct pci_bus *bus);
+unsigned char pci_bus_child_max_busnr(struct pci_bus *bus);
 void pci_setup_bridge(struct pci_bus *bus);
 resource_size_t pcibios_window_alignment(struct pci_bus *bus,
 					 unsigned long type);
-- 
1.7.1

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

* [PATCH 20/28] PCI/Parisc: Use pci_scan_root_bus() for simplicity
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, Yijing Wang

From: Yijing Wang <wangyijing0307@gmail.com>

Now pci_bus_add_devices() has been ripped out
from pci_scan_root_bus(), we could use pci_scan_root_bus()
instead of pci_create_root_bus() + pci_scan_child_bus()
for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/parisc/dino.c    |   11 ++---------
 drivers/parisc/lba_pci.c |    6 ++----
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index a0580af..e5ee339 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -977,15 +977,11 @@ static int __init dino_probe(struct parisc_device *dev)
 	if (dino_dev->hba.gmmio_space.flags)
 		pci_add_resource(&resources, &dino_dev->hba.gmmio_space);
 
-	dino_dev->hba.bus_num.start = dino_current_bus;
-	dino_dev->hba.bus_num.end = 255;
-	dino_dev->hba.bus_num.flags = IORESOURCE_BUS;
-	pci_add_resource(&resources, &dino_dev->hba.bus_num);
 	/*
 	** It's not used to avoid chicken/egg problems
 	** with configuration accessor functions.
 	*/
-	dino_dev->hba.hba_bus = bus = pci_create_root_bus(&dev->dev,
+	dino_dev->hba.hba_bus = bus = pci_scan_root_bus(&dev->dev,
 			 dino_current_bus, &dino_cfg_ops, NULL, &resources);
 	if (!bus) {
 		printk(KERN_ERR "ERROR: failed to scan PCI bus on %s (duplicate bus number %d?)\n",
@@ -996,13 +992,10 @@ static int __init dino_probe(struct parisc_device *dev)
 		return 0;
 	}
 
-	max = pci_scan_child_bus(bus);
-	pci_bus_update_busn_res_end(bus, max);
-
 	/* This code *depends* on scanning being single threaded
 	 * if it isn't, this global bus number count will fail
 	 */
-	dino_current_bus = max + 1;
+	dino_current_bus = bus->busn_res.end + 1;
 	pci_bus_assign_resources(bus);
 	pci_bus_add_devices(bus);
 	return 0;
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index 37e71ff..9e3a016 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -1564,15 +1564,13 @@ lba_driver_probe(struct parisc_device *dev)
 
 	dev->dev.platform_data = lba_dev;
 	lba_bus = lba_dev->hba.hba_bus =
-		pci_create_root_bus(&dev->dev, lba_dev->hba.bus_num.start,
+		pci_scan_root_bus(&dev->dev, lba_dev->hba.bus_num.start,
 				    cfg_ops, NULL, &resources);
 	if (!lba_bus) {
 		pci_free_resource_list(&resources);
 		return 0;
 	}
 
-	max = pci_scan_child_bus(lba_bus);
-
 	/* This is in lieu of calling pci_assign_unassigned_resources() */
 	if (is_pdc_pat()) {
 		/* assign resources to un-initialized devices */
@@ -1600,7 +1598,7 @@ lba_driver_probe(struct parisc_device *dev)
 		lba_dev->flags |= LBA_FLAG_SKIP_PROBE;
 	}
 
-	lba_next_bus = max + 1;
+	lba_next_bus = pci_bus_child_max_busnr(lba_bus) + 1;
 	pci_bus_add_devices(lba_bus);
 
 	/* Whew! Finally done! Tell services we got this one covered. */
-- 
1.7.1


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

* [PATCH 20/28] PCI/Parisc: Use pci_scan_root_bus() for simplicity
  2015-01-16  1:43 ` Yijing Wang
                   ` (41 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, Yijing Wang

From: Yijing Wang <wangyijing0307@gmail.com>

Now pci_bus_add_devices() has been ripped out
from pci_scan_root_bus(), we could use pci_scan_root_bus()
instead of pci_create_root_bus() + pci_scan_child_bus()
for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/parisc/dino.c    |   11 ++---------
 drivers/parisc/lba_pci.c |    6 ++----
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index a0580af..e5ee339 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -977,15 +977,11 @@ static int __init dino_probe(struct parisc_device *dev)
 	if (dino_dev->hba.gmmio_space.flags)
 		pci_add_resource(&resources, &dino_dev->hba.gmmio_space);
 
-	dino_dev->hba.bus_num.start = dino_current_bus;
-	dino_dev->hba.bus_num.end = 255;
-	dino_dev->hba.bus_num.flags = IORESOURCE_BUS;
-	pci_add_resource(&resources, &dino_dev->hba.bus_num);
 	/*
 	** It's not used to avoid chicken/egg problems
 	** with configuration accessor functions.
 	*/
-	dino_dev->hba.hba_bus = bus = pci_create_root_bus(&dev->dev,
+	dino_dev->hba.hba_bus = bus = pci_scan_root_bus(&dev->dev,
 			 dino_current_bus, &dino_cfg_ops, NULL, &resources);
 	if (!bus) {
 		printk(KERN_ERR "ERROR: failed to scan PCI bus on %s (duplicate bus number %d?)\n",
@@ -996,13 +992,10 @@ static int __init dino_probe(struct parisc_device *dev)
 		return 0;
 	}
 
-	max = pci_scan_child_bus(bus);
-	pci_bus_update_busn_res_end(bus, max);
-
 	/* This code *depends* on scanning being single threaded
 	 * if it isn't, this global bus number count will fail
 	 */
-	dino_current_bus = max + 1;
+	dino_current_bus = bus->busn_res.end + 1;
 	pci_bus_assign_resources(bus);
 	pci_bus_add_devices(bus);
 	return 0;
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index 37e71ff..9e3a016 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -1564,15 +1564,13 @@ lba_driver_probe(struct parisc_device *dev)
 
 	dev->dev.platform_data = lba_dev;
 	lba_bus = lba_dev->hba.hba_bus =
-		pci_create_root_bus(&dev->dev, lba_dev->hba.bus_num.start,
+		pci_scan_root_bus(&dev->dev, lba_dev->hba.bus_num.start,
 				    cfg_ops, NULL, &resources);
 	if (!lba_bus) {
 		pci_free_resource_list(&resources);
 		return 0;
 	}
 
-	max = pci_scan_child_bus(lba_bus);
-
 	/* This is in lieu of calling pci_assign_unassigned_resources() */
 	if (is_pdc_pat()) {
 		/* assign resources to un-initialized devices */
@@ -1600,7 +1598,7 @@ lba_driver_probe(struct parisc_device *dev)
 		lba_dev->flags |= LBA_FLAG_SKIP_PROBE;
 	}
 
-	lba_next_bus = max + 1;
+	lba_next_bus = pci_bus_child_max_busnr(lba_bus) + 1;
 	pci_bus_add_devices(lba_bus);
 
 	/* Whew! Finally done! Tell services we got this one covered. */
-- 
1.7.1

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

* [PATCH 20/28] PCI/Parisc: Use pci_scan_root_bus() for simplicity
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, Yijing Wang

From: Yijing Wang <wangyijing0307@gmail.com>

Now pci_bus_add_devices() has been ripped out
from pci_scan_root_bus(), we could use pci_scan_root_bus()
instead of pci_create_root_bus() + pci_scan_child_bus()
for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/parisc/dino.c    |   11 ++---------
 drivers/parisc/lba_pci.c |    6 ++----
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index a0580af..e5ee339 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -977,15 +977,11 @@ static int __init dino_probe(struct parisc_device *dev)
 	if (dino_dev->hba.gmmio_space.flags)
 		pci_add_resource(&resources, &dino_dev->hba.gmmio_space);
 
-	dino_dev->hba.bus_num.start = dino_current_bus;
-	dino_dev->hba.bus_num.end = 255;
-	dino_dev->hba.bus_num.flags = IORESOURCE_BUS;
-	pci_add_resource(&resources, &dino_dev->hba.bus_num);
 	/*
 	** It's not used to avoid chicken/egg problems
 	** with configuration accessor functions.
 	*/
-	dino_dev->hba.hba_bus = bus = pci_create_root_bus(&dev->dev,
+	dino_dev->hba.hba_bus = bus = pci_scan_root_bus(&dev->dev,
 			 dino_current_bus, &dino_cfg_ops, NULL, &resources);
 	if (!bus) {
 		printk(KERN_ERR "ERROR: failed to scan PCI bus on %s (duplicate bus number %d?)\n",
@@ -996,13 +992,10 @@ static int __init dino_probe(struct parisc_device *dev)
 		return 0;
 	}
 
-	max = pci_scan_child_bus(bus);
-	pci_bus_update_busn_res_end(bus, max);
-
 	/* This code *depends* on scanning being single threaded
 	 * if it isn't, this global bus number count will fail
 	 */
-	dino_current_bus = max + 1;
+	dino_current_bus = bus->busn_res.end + 1;
 	pci_bus_assign_resources(bus);
 	pci_bus_add_devices(bus);
 	return 0;
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index 37e71ff..9e3a016 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -1564,15 +1564,13 @@ lba_driver_probe(struct parisc_device *dev)
 
 	dev->dev.platform_data = lba_dev;
 	lba_bus = lba_dev->hba.hba_bus =
-		pci_create_root_bus(&dev->dev, lba_dev->hba.bus_num.start,
+		pci_scan_root_bus(&dev->dev, lba_dev->hba.bus_num.start,
 				    cfg_ops, NULL, &resources);
 	if (!lba_bus) {
 		pci_free_resource_list(&resources);
 		return 0;
 	}
 
-	max = pci_scan_child_bus(lba_bus);
-
 	/* This is in lieu of calling pci_assign_unassigned_resources() */
 	if (is_pdc_pat()) {
 		/* assign resources to un-initialized devices */
@@ -1600,7 +1598,7 @@ lba_driver_probe(struct parisc_device *dev)
 		lba_dev->flags |= LBA_FLAG_SKIP_PROBE;
 	}
 
-	lba_next_bus = max + 1;
+	lba_next_bus = pci_bus_child_max_busnr(lba_bus) + 1;
 	pci_bus_add_devices(lba_bus);
 
 	/* Whew! Finally done! Tell services we got this one covered. */
-- 
1.7.1


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

* [PATCH 20/28] PCI/Parisc: Use pci_scan_root_bus() for simplicity
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

From: Yijing Wang <wangyijing0307@gmail.com>

Now pci_bus_add_devices() has been ripped out
from pci_scan_root_bus(), we could use pci_scan_root_bus()
instead of pci_create_root_bus() + pci_scan_child_bus()
for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/parisc/dino.c    |   11 ++---------
 drivers/parisc/lba_pci.c |    6 ++----
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index a0580af..e5ee339 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -977,15 +977,11 @@ static int __init dino_probe(struct parisc_device *dev)
 	if (dino_dev->hba.gmmio_space.flags)
 		pci_add_resource(&resources, &dino_dev->hba.gmmio_space);
 
-	dino_dev->hba.bus_num.start = dino_current_bus;
-	dino_dev->hba.bus_num.end = 255;
-	dino_dev->hba.bus_num.flags = IORESOURCE_BUS;
-	pci_add_resource(&resources, &dino_dev->hba.bus_num);
 	/*
 	** It's not used to avoid chicken/egg problems
 	** with configuration accessor functions.
 	*/
-	dino_dev->hba.hba_bus = bus = pci_create_root_bus(&dev->dev,
+	dino_dev->hba.hba_bus = bus = pci_scan_root_bus(&dev->dev,
 			 dino_current_bus, &dino_cfg_ops, NULL, &resources);
 	if (!bus) {
 		printk(KERN_ERR "ERROR: failed to scan PCI bus on %s (duplicate bus number %d?)\n",
@@ -996,13 +992,10 @@ static int __init dino_probe(struct parisc_device *dev)
 		return 0;
 	}
 
-	max = pci_scan_child_bus(bus);
-	pci_bus_update_busn_res_end(bus, max);
-
 	/* This code *depends* on scanning being single threaded
 	 * if it isn't, this global bus number count will fail
 	 */
-	dino_current_bus = max + 1;
+	dino_current_bus = bus->busn_res.end + 1;
 	pci_bus_assign_resources(bus);
 	pci_bus_add_devices(bus);
 	return 0;
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index 37e71ff..9e3a016 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -1564,15 +1564,13 @@ lba_driver_probe(struct parisc_device *dev)
 
 	dev->dev.platform_data = lba_dev;
 	lba_bus = lba_dev->hba.hba_bus =
-		pci_create_root_bus(&dev->dev, lba_dev->hba.bus_num.start,
+		pci_scan_root_bus(&dev->dev, lba_dev->hba.bus_num.start,
 				    cfg_ops, NULL, &resources);
 	if (!lba_bus) {
 		pci_free_resource_list(&resources);
 		return 0;
 	}
 
-	max = pci_scan_child_bus(lba_bus);
-
 	/* This is in lieu of calling pci_assign_unassigned_resources() */
 	if (is_pdc_pat()) {
 		/* assign resources to un-initialized devices */
@@ -1600,7 +1598,7 @@ lba_driver_probe(struct parisc_device *dev)
 		lba_dev->flags |= LBA_FLAG_SKIP_PROBE;
 	}
 
-	lba_next_bus = max + 1;
+	lba_next_bus = pci_bus_child_max_busnr(lba_bus) + 1;
 	pci_bus_add_devices(lba_bus);
 
 	/* Whew! Finally done! Tell services we got this one covered. */
-- 
1.7.1

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

* [PATCH 20/28] PCI/Parisc: Use pci_scan_root_bus() for simplicity
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, Yijing Wang

From: Yijing Wang <wangyijing0307@gmail.com>

Now pci_bus_add_devices() has been ripped out
from pci_scan_root_bus(), we could use pci_scan_root_bus()
instead of pci_create_root_bus() + pci_scan_child_bus()
for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/parisc/dino.c    |   11 ++---------
 drivers/parisc/lba_pci.c |    6 ++----
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index a0580af..e5ee339 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -977,15 +977,11 @@ static int __init dino_probe(struct parisc_device *dev)
 	if (dino_dev->hba.gmmio_space.flags)
 		pci_add_resource(&resources, &dino_dev->hba.gmmio_space);
 
-	dino_dev->hba.bus_num.start = dino_current_bus;
-	dino_dev->hba.bus_num.end = 255;
-	dino_dev->hba.bus_num.flags = IORESOURCE_BUS;
-	pci_add_resource(&resources, &dino_dev->hba.bus_num);
 	/*
 	** It's not used to avoid chicken/egg problems
 	** with configuration accessor functions.
 	*/
-	dino_dev->hba.hba_bus = bus = pci_create_root_bus(&dev->dev,
+	dino_dev->hba.hba_bus = bus = pci_scan_root_bus(&dev->dev,
 			 dino_current_bus, &dino_cfg_ops, NULL, &resources);
 	if (!bus) {
 		printk(KERN_ERR "ERROR: failed to scan PCI bus on %s (duplicate bus number %d?)\n",
@@ -996,13 +992,10 @@ static int __init dino_probe(struct parisc_device *dev)
 		return 0;
 	}
 
-	max = pci_scan_child_bus(bus);
-	pci_bus_update_busn_res_end(bus, max);
-
 	/* This code *depends* on scanning being single threaded
 	 * if it isn't, this global bus number count will fail
 	 */
-	dino_current_bus = max + 1;
+	dino_current_bus = bus->busn_res.end + 1;
 	pci_bus_assign_resources(bus);
 	pci_bus_add_devices(bus);
 	return 0;
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index 37e71ff..9e3a016 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -1564,15 +1564,13 @@ lba_driver_probe(struct parisc_device *dev)
 
 	dev->dev.platform_data = lba_dev;
 	lba_bus = lba_dev->hba.hba_bus -		pci_create_root_bus(&dev->dev, lba_dev->hba.bus_num.start,
+		pci_scan_root_bus(&dev->dev, lba_dev->hba.bus_num.start,
 				    cfg_ops, NULL, &resources);
 	if (!lba_bus) {
 		pci_free_resource_list(&resources);
 		return 0;
 	}
 
-	max = pci_scan_child_bus(lba_bus);
-
 	/* This is in lieu of calling pci_assign_unassigned_resources() */
 	if (is_pdc_pat()) {
 		/* assign resources to un-initialized devices */
@@ -1600,7 +1598,7 @@ lba_driver_probe(struct parisc_device *dev)
 		lba_dev->flags |= LBA_FLAG_SKIP_PROBE;
 	}
 
-	lba_next_bus = max + 1;
+	lba_next_bus = pci_bus_child_max_busnr(lba_bus) + 1;
 	pci_bus_add_devices(lba_bus);
 
 	/* Whew! Finally done! Tell services we got this one covered. */
-- 
1.7.1


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

* [PATCH 20/28] PCI/Parisc: Use pci_scan_root_bus() for simplicity
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang, Yijing Wang

From: Yijing Wang <wangyijing0307@gmail.com>

Now pci_bus_add_devices() has been ripped out
from pci_scan_root_bus(), we could use pci_scan_root_bus()
instead of pci_create_root_bus() + pci_scan_child_bus()
for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/parisc/dino.c    |   11 ++---------
 drivers/parisc/lba_pci.c |    6 ++----
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index a0580af..e5ee339 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -977,15 +977,11 @@ static int __init dino_probe(struct parisc_device *dev)
 	if (dino_dev->hba.gmmio_space.flags)
 		pci_add_resource(&resources, &dino_dev->hba.gmmio_space);
 
-	dino_dev->hba.bus_num.start = dino_current_bus;
-	dino_dev->hba.bus_num.end = 255;
-	dino_dev->hba.bus_num.flags = IORESOURCE_BUS;
-	pci_add_resource(&resources, &dino_dev->hba.bus_num);
 	/*
 	** It's not used to avoid chicken/egg problems
 	** with configuration accessor functions.
 	*/
-	dino_dev->hba.hba_bus = bus = pci_create_root_bus(&dev->dev,
+	dino_dev->hba.hba_bus = bus = pci_scan_root_bus(&dev->dev,
 			 dino_current_bus, &dino_cfg_ops, NULL, &resources);
 	if (!bus) {
 		printk(KERN_ERR "ERROR: failed to scan PCI bus on %s (duplicate bus number %d?)\n",
@@ -996,13 +992,10 @@ static int __init dino_probe(struct parisc_device *dev)
 		return 0;
 	}
 
-	max = pci_scan_child_bus(bus);
-	pci_bus_update_busn_res_end(bus, max);
-
 	/* This code *depends* on scanning being single threaded
 	 * if it isn't, this global bus number count will fail
 	 */
-	dino_current_bus = max + 1;
+	dino_current_bus = bus->busn_res.end + 1;
 	pci_bus_assign_resources(bus);
 	pci_bus_add_devices(bus);
 	return 0;
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index 37e71ff..9e3a016 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -1564,15 +1564,13 @@ lba_driver_probe(struct parisc_device *dev)
 
 	dev->dev.platform_data = lba_dev;
 	lba_bus = lba_dev->hba.hba_bus =
-		pci_create_root_bus(&dev->dev, lba_dev->hba.bus_num.start,
+		pci_scan_root_bus(&dev->dev, lba_dev->hba.bus_num.start,
 				    cfg_ops, NULL, &resources);
 	if (!lba_bus) {
 		pci_free_resource_list(&resources);
 		return 0;
 	}
 
-	max = pci_scan_child_bus(lba_bus);
-
 	/* This is in lieu of calling pci_assign_unassigned_resources() */
 	if (is_pdc_pat()) {
 		/* assign resources to un-initialized devices */
@@ -1600,7 +1598,7 @@ lba_driver_probe(struct parisc_device *dev)
 		lba_dev->flags |= LBA_FLAG_SKIP_PROBE;
 	}
 
-	lba_next_bus = max + 1;
+	lba_next_bus = pci_bus_child_max_busnr(lba_bus) + 1;
 	pci_bus_add_devices(lba_bus);
 
 	/* Whew! Finally done! Tell services we got this one covered. */
-- 
1.7.1

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

* [PATCH 21/28] PCI/mvebu: Use pci_common_init_dev() to simplify code
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Mvebu_pcie_scan_bus() is not necessary, we could use
pci_common_init_dev() instead of pci_common_init(),
and pass the device pointer as the parent. Then
pci_scan_root_bus() will be called to scan the pci busses.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-mvebu.c |   18 +-----------------
 1 files changed, 1 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 1309cfb..d5a2b70 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -750,21 +750,6 @@ static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
 	return 1;
 }
 
-static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys)
-{
-	struct mvebu_pcie *pcie = sys_to_pcie(sys);
-	struct pci_bus *bus;
-
-	bus = pci_create_root_bus(&pcie->pdev->dev, sys->busnr,
-				  &mvebu_pcie_ops, sys, &sys->resources);
-	if (!bus)
-		return NULL;
-
-	pci_scan_child_bus(bus);
-
-	return bus;
-}
-
 static resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev,
 						 const struct resource *res,
 						 resource_size_t start,
@@ -808,12 +793,11 @@ static void mvebu_pcie_enable(struct mvebu_pcie *pcie)
 	hw.nr_controllers = 1;
 	hw.private_data   = (void **)&pcie;
 	hw.setup          = mvebu_pcie_setup;
-	hw.scan           = mvebu_pcie_scan_bus;
 	hw.map_irq        = of_irq_parse_and_map_pci;
 	hw.ops            = &mvebu_pcie_ops;
 	hw.align_resource = mvebu_pcie_align_resource;
 
-	pci_common_init(&hw);
+	pci_common_init_dev(&pcie->pdev->dev, &hw);
 }
 
 /*
-- 
1.7.1


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

* [PATCH 21/28] PCI/mvebu: Use pci_common_init_dev() to simplify code
  2015-01-16  1:43 ` Yijing Wang
                   ` (43 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Mvebu_pcie_scan_bus() is not necessary, we could use
pci_common_init_dev() instead of pci_common_init(),
and pass the device pointer as the parent. Then
pci_scan_root_bus() will be called to scan the pci busses.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-mvebu.c |   18 +-----------------
 1 files changed, 1 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 1309cfb..d5a2b70 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -750,21 +750,6 @@ static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
 	return 1;
 }
 
-static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys)
-{
-	struct mvebu_pcie *pcie = sys_to_pcie(sys);
-	struct pci_bus *bus;
-
-	bus = pci_create_root_bus(&pcie->pdev->dev, sys->busnr,
-				  &mvebu_pcie_ops, sys, &sys->resources);
-	if (!bus)
-		return NULL;
-
-	pci_scan_child_bus(bus);
-
-	return bus;
-}
-
 static resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev,
 						 const struct resource *res,
 						 resource_size_t start,
@@ -808,12 +793,11 @@ static void mvebu_pcie_enable(struct mvebu_pcie *pcie)
 	hw.nr_controllers = 1;
 	hw.private_data   = (void **)&pcie;
 	hw.setup          = mvebu_pcie_setup;
-	hw.scan           = mvebu_pcie_scan_bus;
 	hw.map_irq        = of_irq_parse_and_map_pci;
 	hw.ops            = &mvebu_pcie_ops;
 	hw.align_resource = mvebu_pcie_align_resource;
 
-	pci_common_init(&hw);
+	pci_common_init_dev(&pcie->pdev->dev, &hw);
 }
 
 /*
-- 
1.7.1

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

* [PATCH 21/28] PCI/mvebu: Use pci_common_init_dev() to simplify code
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Mvebu_pcie_scan_bus() is not necessary, we could use
pci_common_init_dev() instead of pci_common_init(),
and pass the device pointer as the parent. Then
pci_scan_root_bus() will be called to scan the pci busses.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-mvebu.c |   18 +-----------------
 1 files changed, 1 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 1309cfb..d5a2b70 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -750,21 +750,6 @@ static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
 	return 1;
 }
 
-static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys)
-{
-	struct mvebu_pcie *pcie = sys_to_pcie(sys);
-	struct pci_bus *bus;
-
-	bus = pci_create_root_bus(&pcie->pdev->dev, sys->busnr,
-				  &mvebu_pcie_ops, sys, &sys->resources);
-	if (!bus)
-		return NULL;
-
-	pci_scan_child_bus(bus);
-
-	return bus;
-}
-
 static resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev,
 						 const struct resource *res,
 						 resource_size_t start,
@@ -808,12 +793,11 @@ static void mvebu_pcie_enable(struct mvebu_pcie *pcie)
 	hw.nr_controllers = 1;
 	hw.private_data   = (void **)&pcie;
 	hw.setup          = mvebu_pcie_setup;
-	hw.scan           = mvebu_pcie_scan_bus;
 	hw.map_irq        = of_irq_parse_and_map_pci;
 	hw.ops            = &mvebu_pcie_ops;
 	hw.align_resource = mvebu_pcie_align_resource;
 
-	pci_common_init(&hw);
+	pci_common_init_dev(&pcie->pdev->dev, &hw);
 }
 
 /*
-- 
1.7.1


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

* [PATCH 21/28] PCI/mvebu: Use pci_common_init_dev() to simplify code
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Mvebu_pcie_scan_bus() is not necessary, we could use
pci_common_init_dev() instead of pci_common_init(),
and pass the device pointer as the parent. Then
pci_scan_root_bus() will be called to scan the pci busses.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-mvebu.c |   18 +-----------------
 1 files changed, 1 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 1309cfb..d5a2b70 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -750,21 +750,6 @@ static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
 	return 1;
 }
 
-static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys)
-{
-	struct mvebu_pcie *pcie = sys_to_pcie(sys);
-	struct pci_bus *bus;
-
-	bus = pci_create_root_bus(&pcie->pdev->dev, sys->busnr,
-				  &mvebu_pcie_ops, sys, &sys->resources);
-	if (!bus)
-		return NULL;
-
-	pci_scan_child_bus(bus);
-
-	return bus;
-}
-
 static resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev,
 						 const struct resource *res,
 						 resource_size_t start,
@@ -808,12 +793,11 @@ static void mvebu_pcie_enable(struct mvebu_pcie *pcie)
 	hw.nr_controllers = 1;
 	hw.private_data   = (void **)&pcie;
 	hw.setup          = mvebu_pcie_setup;
-	hw.scan           = mvebu_pcie_scan_bus;
 	hw.map_irq        = of_irq_parse_and_map_pci;
 	hw.ops            = &mvebu_pcie_ops;
 	hw.align_resource = mvebu_pcie_align_resource;
 
-	pci_common_init(&hw);
+	pci_common_init_dev(&pcie->pdev->dev, &hw);
 }
 
 /*
-- 
1.7.1

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

* [PATCH 21/28] PCI/mvebu: Use pci_common_init_dev() to simplify code
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Mvebu_pcie_scan_bus() is not necessary, we could use
pci_common_init_dev() instead of pci_common_init(),
and pass the device pointer as the parent. Then
pci_scan_root_bus() will be called to scan the pci busses.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-mvebu.c |   18 +-----------------
 1 files changed, 1 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 1309cfb..d5a2b70 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -750,21 +750,6 @@ static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
 	return 1;
 }
 
-static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys)
-{
-	struct mvebu_pcie *pcie = sys_to_pcie(sys);
-	struct pci_bus *bus;
-
-	bus = pci_create_root_bus(&pcie->pdev->dev, sys->busnr,
-				  &mvebu_pcie_ops, sys, &sys->resources);
-	if (!bus)
-		return NULL;
-
-	pci_scan_child_bus(bus);
-
-	return bus;
-}
-
 static resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev,
 						 const struct resource *res,
 						 resource_size_t start,
@@ -808,12 +793,11 @@ static void mvebu_pcie_enable(struct mvebu_pcie *pcie)
 	hw.nr_controllers = 1;
 	hw.private_data   = (void **)&pcie;
 	hw.setup          = mvebu_pcie_setup;
-	hw.scan           = mvebu_pcie_scan_bus;
 	hw.map_irq        = of_irq_parse_and_map_pci;
 	hw.ops            = &mvebu_pcie_ops;
 	hw.align_resource = mvebu_pcie_align_resource;
 
-	pci_common_init(&hw);
+	pci_common_init_dev(&pcie->pdev->dev, &hw);
 }
 
 /*
-- 
1.7.1


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

* [PATCH 21/28] PCI/mvebu: Use pci_common_init_dev() to simplify code
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Mvebu_pcie_scan_bus() is not necessary, we could use
pci_common_init_dev() instead of pci_common_init(),
and pass the device pointer as the parent. Then
pci_scan_root_bus() will be called to scan the pci busses.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-mvebu.c |   18 +-----------------
 1 files changed, 1 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 1309cfb..d5a2b70 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -750,21 +750,6 @@ static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
 	return 1;
 }
 
-static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys)
-{
-	struct mvebu_pcie *pcie = sys_to_pcie(sys);
-	struct pci_bus *bus;
-
-	bus = pci_create_root_bus(&pcie->pdev->dev, sys->busnr,
-				  &mvebu_pcie_ops, sys, &sys->resources);
-	if (!bus)
-		return NULL;
-
-	pci_scan_child_bus(bus);
-
-	return bus;
-}
-
 static resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev,
 						 const struct resource *res,
 						 resource_size_t start,
@@ -808,12 +793,11 @@ static void mvebu_pcie_enable(struct mvebu_pcie *pcie)
 	hw.nr_controllers = 1;
 	hw.private_data   = (void **)&pcie;
 	hw.setup          = mvebu_pcie_setup;
-	hw.scan           = mvebu_pcie_scan_bus;
 	hw.map_irq        = of_irq_parse_and_map_pci;
 	hw.ops            = &mvebu_pcie_ops;
 	hw.align_resource = mvebu_pcie_align_resource;
 
-	pci_common_init(&hw);
+	pci_common_init_dev(&pcie->pdev->dev, &hw);
 }
 
 /*
-- 
1.7.1

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

* [PATCH 22/28] PCI/tegra: Remove redundant tegra_pcie_scan_bus()
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now pci_scan_root_bus() is almost simliar to
pci_create_root_bus() + pci_scan_child_bus().
So we could use common pci_scan_root_bus() in
pci_common_init_dev() to scan pci busses.
tegra_pcie_scan_bus() is redundant, remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-tegra.c |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 6f9c29f..d9d1af0 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -679,21 +679,6 @@ static int tegra_pcie_map_irq(const struct pci_dev *pdev, u8 slot, u8 pin)
 	return irq;
 }
 
-static struct pci_bus *tegra_pcie_scan_bus(int nr, struct pci_sys_data *sys)
-{
-	struct tegra_pcie *pcie = sys_to_pcie(sys);
-	struct pci_bus *bus;
-
-	bus = pci_create_root_bus(pcie->dev, sys->busnr, &tegra_pcie_ops, sys,
-				  &sys->resources);
-	if (!bus)
-		return NULL;
-
-	pci_scan_child_bus(bus);
-
-	return bus;
-}
-
 static irqreturn_t tegra_pcie_isr(int irq, void *arg)
 {
 	const char *err_msg[] = {
-- 
1.7.1


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

* [PATCH 22/28] PCI/tegra: Remove redundant tegra_pcie_scan_bus()
  2015-01-16  1:43 ` Yijing Wang
                   ` (46 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now pci_scan_root_bus() is almost simliar to
pci_create_root_bus() + pci_scan_child_bus().
So we could use common pci_scan_root_bus() in
pci_common_init_dev() to scan pci busses.
tegra_pcie_scan_bus() is redundant, remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-tegra.c |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 6f9c29f..d9d1af0 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -679,21 +679,6 @@ static int tegra_pcie_map_irq(const struct pci_dev *pdev, u8 slot, u8 pin)
 	return irq;
 }
 
-static struct pci_bus *tegra_pcie_scan_bus(int nr, struct pci_sys_data *sys)
-{
-	struct tegra_pcie *pcie = sys_to_pcie(sys);
-	struct pci_bus *bus;
-
-	bus = pci_create_root_bus(pcie->dev, sys->busnr, &tegra_pcie_ops, sys,
-				  &sys->resources);
-	if (!bus)
-		return NULL;
-
-	pci_scan_child_bus(bus);
-
-	return bus;
-}
-
 static irqreturn_t tegra_pcie_isr(int irq, void *arg)
 {
 	const char *err_msg[] = {
-- 
1.7.1

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

* [PATCH 22/28] PCI/tegra: Remove redundant tegra_pcie_scan_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now pci_scan_root_bus() is almost simliar to
pci_create_root_bus() + pci_scan_child_bus().
So we could use common pci_scan_root_bus() in
pci_common_init_dev() to scan pci busses.
tegra_pcie_scan_bus() is redundant, remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-tegra.c |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 6f9c29f..d9d1af0 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -679,21 +679,6 @@ static int tegra_pcie_map_irq(const struct pci_dev *pdev, u8 slot, u8 pin)
 	return irq;
 }
 
-static struct pci_bus *tegra_pcie_scan_bus(int nr, struct pci_sys_data *sys)
-{
-	struct tegra_pcie *pcie = sys_to_pcie(sys);
-	struct pci_bus *bus;
-
-	bus = pci_create_root_bus(pcie->dev, sys->busnr, &tegra_pcie_ops, sys,
-				  &sys->resources);
-	if (!bus)
-		return NULL;
-
-	pci_scan_child_bus(bus);
-
-	return bus;
-}
-
 static irqreturn_t tegra_pcie_isr(int irq, void *arg)
 {
 	const char *err_msg[] = {
-- 
1.7.1


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

* [PATCH 22/28] PCI/tegra: Remove redundant tegra_pcie_scan_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Now pci_scan_root_bus() is almost simliar to
pci_create_root_bus() + pci_scan_child_bus().
So we could use common pci_scan_root_bus() in
pci_common_init_dev() to scan pci busses.
tegra_pcie_scan_bus() is redundant, remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-tegra.c |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 6f9c29f..d9d1af0 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -679,21 +679,6 @@ static int tegra_pcie_map_irq(const struct pci_dev *pdev, u8 slot, u8 pin)
 	return irq;
 }
 
-static struct pci_bus *tegra_pcie_scan_bus(int nr, struct pci_sys_data *sys)
-{
-	struct tegra_pcie *pcie = sys_to_pcie(sys);
-	struct pci_bus *bus;
-
-	bus = pci_create_root_bus(pcie->dev, sys->busnr, &tegra_pcie_ops, sys,
-				  &sys->resources);
-	if (!bus)
-		return NULL;
-
-	pci_scan_child_bus(bus);
-
-	return bus;
-}
-
 static irqreturn_t tegra_pcie_isr(int irq, void *arg)
 {
 	const char *err_msg[] = {
-- 
1.7.1

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

* [PATCH 22/28] PCI/tegra: Remove redundant tegra_pcie_scan_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now pci_scan_root_bus() is almost simliar to
pci_create_root_bus() + pci_scan_child_bus().
So we could use common pci_scan_root_bus() in
pci_common_init_dev() to scan pci busses.
tegra_pcie_scan_bus() is redundant, remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-tegra.c |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 6f9c29f..d9d1af0 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -679,21 +679,6 @@ static int tegra_pcie_map_irq(const struct pci_dev *pdev, u8 slot, u8 pin)
 	return irq;
 }
 
-static struct pci_bus *tegra_pcie_scan_bus(int nr, struct pci_sys_data *sys)
-{
-	struct tegra_pcie *pcie = sys_to_pcie(sys);
-	struct pci_bus *bus;
-
-	bus = pci_create_root_bus(pcie->dev, sys->busnr, &tegra_pcie_ops, sys,
-				  &sys->resources);
-	if (!bus)
-		return NULL;
-
-	pci_scan_child_bus(bus);
-
-	return bus;
-}
-
 static irqreturn_t tegra_pcie_isr(int irq, void *arg)
 {
 	const char *err_msg[] = {
-- 
1.7.1


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

* [PATCH 22/28] PCI/tegra: Remove redundant tegra_pcie_scan_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now pci_scan_root_bus() is almost simliar to
pci_create_root_bus() + pci_scan_child_bus().
So we could use common pci_scan_root_bus() in
pci_common_init_dev() to scan pci busses.
tegra_pcie_scan_bus() is redundant, remove it.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-tegra.c |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 6f9c29f..d9d1af0 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -679,21 +679,6 @@ static int tegra_pcie_map_irq(const struct pci_dev *pdev, u8 slot, u8 pin)
 	return irq;
 }
 
-static struct pci_bus *tegra_pcie_scan_bus(int nr, struct pci_sys_data *sys)
-{
-	struct tegra_pcie *pcie = sys_to_pcie(sys);
-	struct pci_bus *bus;
-
-	bus = pci_create_root_bus(pcie->dev, sys->busnr, &tegra_pcie_ops, sys,
-				  &sys->resources);
-	if (!bus)
-		return NULL;
-
-	pci_scan_child_bus(bus);
-
-	return bus;
-}
-
 static irqreturn_t tegra_pcie_isr(int irq, void *arg)
 {
 	const char *err_msg[] = {
-- 
1.7.1

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

* [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Use pci_scan_root_bus() instead of pci_create_root_bus() +
pci_scan_child_bus() for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pcie-designware.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index eef3111..d37fe27 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
 	struct pcie_port *pp = sys_to_pcie(sys);
 
 	pp->root_bus_nr = sys->busnr;
-	bus = pci_create_root_bus(pp->dev, sys->busnr,
+	bus = pci_scan_root_bus(pp->dev, sys->busnr,
 				  &dw_pcie_ops, sys, &sys->resources);
 	if (!bus)
 		return NULL;
 
-	pci_scan_child_bus(bus);
-
 	if (bus && pp->ops->scan_bus)
 		pp->ops->scan_bus(pp);
 
-- 
1.7.1


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

* [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
  2015-01-16  1:43 ` Yijing Wang
                   ` (47 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Use pci_scan_root_bus() instead of pci_create_root_bus() +
pci_scan_child_bus() for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pcie-designware.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index eef3111..d37fe27 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
 	struct pcie_port *pp = sys_to_pcie(sys);
 
 	pp->root_bus_nr = sys->busnr;
-	bus = pci_create_root_bus(pp->dev, sys->busnr,
+	bus = pci_scan_root_bus(pp->dev, sys->busnr,
 				  &dw_pcie_ops, sys, &sys->resources);
 	if (!bus)
 		return NULL;
 
-	pci_scan_child_bus(bus);
-
 	if (bus && pp->ops->scan_bus)
 		pp->ops->scan_bus(pp);
 
-- 
1.7.1

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

* [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Use pci_scan_root_bus() instead of pci_create_root_bus() +
pci_scan_child_bus() for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pcie-designware.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index eef3111..d37fe27 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
 	struct pcie_port *pp = sys_to_pcie(sys);
 
 	pp->root_bus_nr = sys->busnr;
-	bus = pci_create_root_bus(pp->dev, sys->busnr,
+	bus = pci_scan_root_bus(pp->dev, sys->busnr,
 				  &dw_pcie_ops, sys, &sys->resources);
 	if (!bus)
 		return NULL;
 
-	pci_scan_child_bus(bus);
-
 	if (bus && pp->ops->scan_bus)
 		pp->ops->scan_bus(pp);
 
-- 
1.7.1


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

* [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Use pci_scan_root_bus() instead of pci_create_root_bus() +
pci_scan_child_bus() for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pcie-designware.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index eef3111..d37fe27 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
 	struct pcie_port *pp = sys_to_pcie(sys);
 
 	pp->root_bus_nr = sys->busnr;
-	bus = pci_create_root_bus(pp->dev, sys->busnr,
+	bus = pci_scan_root_bus(pp->dev, sys->busnr,
 				  &dw_pcie_ops, sys, &sys->resources);
 	if (!bus)
 		return NULL;
 
-	pci_scan_child_bus(bus);
-
 	if (bus && pp->ops->scan_bus)
 		pp->ops->scan_bus(pp);
 
-- 
1.7.1

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

* [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Use pci_scan_root_bus() instead of pci_create_root_bus() +
pci_scan_child_bus() for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pcie-designware.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index eef3111..d37fe27 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
 	struct pcie_port *pp = sys_to_pcie(sys);
 
 	pp->root_bus_nr = sys->busnr;
-	bus = pci_create_root_bus(pp->dev, sys->busnr,
+	bus = pci_scan_root_bus(pp->dev, sys->busnr,
 				  &dw_pcie_ops, sys, &sys->resources);
 	if (!bus)
 		return NULL;
 
-	pci_scan_child_bus(bus);
-
 	if (bus && pp->ops->scan_bus)
 		pp->ops->scan_bus(pp);
 
-- 
1.7.1


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

* [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Use pci_scan_root_bus() instead of pci_create_root_bus() +
pci_scan_child_bus() for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pcie-designware.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index eef3111..d37fe27 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
 	struct pcie_port *pp = sys_to_pcie(sys);
 
 	pp->root_bus_nr = sys->busnr;
-	bus = pci_create_root_bus(pp->dev, sys->busnr,
+	bus = pci_scan_root_bus(pp->dev, sys->busnr,
 				  &dw_pcie_ops, sys, &sys->resources);
 	if (!bus)
 		return NULL;
 
-	pci_scan_child_bus(bus);
-
 	if (bus && pp->ops->scan_bus)
 		pp->ops->scan_bus(pp);
 
-- 
1.7.1

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

* [PATCH 24/28] PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Use pci_scan_root_bus() instead of pci_create_root_bus() +
pci_scan_child_bus() for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-xgene.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index b1d0596..7e46a39 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -631,12 +631,11 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	bus = pci_create_root_bus(&pdev->dev, 0,
+	bus = pci_scan_root_bus(&pdev->dev, 0,
 					&xgene_pcie_ops, port, &res);
 	if (!bus)
 		return -ENOMEM;
 
-	pci_scan_child_bus(bus);
 	pci_assign_unassigned_bus_resources(bus);
 	pci_bus_add_devices(bus);
 
-- 
1.7.1


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

* [PATCH 24/28] PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
  2015-01-16  1:43 ` Yijing Wang
                   ` (49 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Use pci_scan_root_bus() instead of pci_create_root_bus() +
pci_scan_child_bus() for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-xgene.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index b1d0596..7e46a39 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -631,12 +631,11 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	bus = pci_create_root_bus(&pdev->dev, 0,
+	bus = pci_scan_root_bus(&pdev->dev, 0,
 					&xgene_pcie_ops, port, &res);
 	if (!bus)
 		return -ENOMEM;
 
-	pci_scan_child_bus(bus);
 	pci_assign_unassigned_bus_resources(bus);
 	pci_bus_add_devices(bus);
 
-- 
1.7.1

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

* [PATCH 24/28] PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Use pci_scan_root_bus() instead of pci_create_root_bus() +
pci_scan_child_bus() for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-xgene.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index b1d0596..7e46a39 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -631,12 +631,11 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	bus = pci_create_root_bus(&pdev->dev, 0,
+	bus = pci_scan_root_bus(&pdev->dev, 0,
 					&xgene_pcie_ops, port, &res);
 	if (!bus)
 		return -ENOMEM;
 
-	pci_scan_child_bus(bus);
 	pci_assign_unassigned_bus_resources(bus);
 	pci_bus_add_devices(bus);
 
-- 
1.7.1


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

* [PATCH 24/28] PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Use pci_scan_root_bus() instead of pci_create_root_bus() +
pci_scan_child_bus() for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-xgene.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index b1d0596..7e46a39 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -631,12 +631,11 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	bus = pci_create_root_bus(&pdev->dev, 0,
+	bus = pci_scan_root_bus(&pdev->dev, 0,
 					&xgene_pcie_ops, port, &res);
 	if (!bus)
 		return -ENOMEM;
 
-	pci_scan_child_bus(bus);
 	pci_assign_unassigned_bus_resources(bus);
 	pci_bus_add_devices(bus);
 
-- 
1.7.1

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

* [PATCH 24/28] PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Use pci_scan_root_bus() instead of pci_create_root_bus() +
pci_scan_child_bus() for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-xgene.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index b1d0596..7e46a39 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -631,12 +631,11 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	bus = pci_create_root_bus(&pdev->dev, 0,
+	bus = pci_scan_root_bus(&pdev->dev, 0,
 					&xgene_pcie_ops, port, &res);
 	if (!bus)
 		return -ENOMEM;
 
-	pci_scan_child_bus(bus);
 	pci_assign_unassigned_bus_resources(bus);
 	pci_bus_add_devices(bus);
 
-- 
1.7.1


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

* [PATCH 24/28] PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Use pci_scan_root_bus() instead of pci_create_root_bus() +
pci_scan_child_bus() for simplicity.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host/pci-xgene.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index b1d0596..7e46a39 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -631,12 +631,11 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	bus = pci_create_root_bus(&pdev->dev, 0,
+	bus = pci_scan_root_bus(&pdev->dev, 0,
 					&xgene_pcie_ops, port, &res);
 	if (!bus)
 		return -ENOMEM;
 
-	pci_scan_child_bus(bus);
 	pci_assign_unassigned_bus_resources(bus);
 	pci_bus_add_devices(bus);
 
-- 
1.7.1

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

* [PATCH 25/28] PCI: Rename __pci_create_root_bus() to pci_create_root_bus()
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now no one use pci_create_root_bus(), we could remove it
and rename __pci_create_root_bus() to pci_create_root_bus().

Signed-off-by: wangyijing@huawei.com
---
 drivers/pci/probe.c |   27 ++++++++-------------------
 include/linux/pci.h |    3 ---
 2 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 30323ac..0817910 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1852,7 +1852,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-static struct pci_bus *__pci_create_root_bus(
+static struct pci_bus *pci_create_root_bus(
 		struct pci_host_bridge *bridge, struct pci_ops *ops)
 {
 	int error;
@@ -1935,18 +1935,6 @@ err_out:
 	return NULL;
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
-{
-	struct pci_host_bridge *host;
-
-	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
-	if (!host)
-		return NULL;
-	
-	return __pci_create_root_bus(host, ops);
-}
-
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
 {
 	struct resource *res = &b->busn_res;
@@ -2025,7 +2013,7 @@ static struct pci_bus *__pci_scan_root_bus(
 			break;
 		}
 
-	b = __pci_create_root_bus(host, ops);
+	b = pci_create_root_bus(host, ops);
 	if (!b) {
 		pci_free_host_bridge(host);
 		return NULL;
@@ -2091,18 +2079,19 @@ struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
-	struct pci_bus *b;
+	struct pci_host_bridge *host;
 
 	pci_add_resource(&resources, &ioport_resource);
 	pci_add_resource(&resources, &iomem_resource);
 	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(NULL, db, ops, sysdata, &resources);
-	if (b) {
-		pci_scan_child_bus(b);
+	host = pci_create_host_bridge(NULL, db, sysdata, &resources, NULL);
+	if (host) {
+		__pci_scan_root_bus(host, ops);
+		return host->bus;
 	} else {
 		pci_free_resource_list(&resources);
 	}
-	return b;
+	return NULL;
 }
 EXPORT_SYMBOL(pci_scan_bus_legacy);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 2970a84..9ddca3b 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -785,9 +785,6 @@ void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
 struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysdata);
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
-				    struct pci_ops *ops, void *sysdata,
-				    struct list_head *resources);
 void pci_free_host_bridge(struct pci_host_bridge *host);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
-- 
1.7.1


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

* [PATCH 25/28] PCI: Rename __pci_create_root_bus() to pci_create_root_bus()
  2015-01-16  1:43 ` Yijing Wang
                   ` (52 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now no one use pci_create_root_bus(), we could remove it
and rename __pci_create_root_bus() to pci_create_root_bus().

Signed-off-by: wangyijing@huawei.com
---
 drivers/pci/probe.c |   27 ++++++++-------------------
 include/linux/pci.h |    3 ---
 2 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 30323ac..0817910 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1852,7 +1852,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-static struct pci_bus *__pci_create_root_bus(
+static struct pci_bus *pci_create_root_bus(
 		struct pci_host_bridge *bridge, struct pci_ops *ops)
 {
 	int error;
@@ -1935,18 +1935,6 @@ err_out:
 	return NULL;
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
-{
-	struct pci_host_bridge *host;
-
-	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
-	if (!host)
-		return NULL;
-	
-	return __pci_create_root_bus(host, ops);
-}
-
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
 {
 	struct resource *res = &b->busn_res;
@@ -2025,7 +2013,7 @@ static struct pci_bus *__pci_scan_root_bus(
 			break;
 		}
 
-	b = __pci_create_root_bus(host, ops);
+	b = pci_create_root_bus(host, ops);
 	if (!b) {
 		pci_free_host_bridge(host);
 		return NULL;
@@ -2091,18 +2079,19 @@ struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
-	struct pci_bus *b;
+	struct pci_host_bridge *host;
 
 	pci_add_resource(&resources, &ioport_resource);
 	pci_add_resource(&resources, &iomem_resource);
 	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(NULL, db, ops, sysdata, &resources);
-	if (b) {
-		pci_scan_child_bus(b);
+	host = pci_create_host_bridge(NULL, db, sysdata, &resources, NULL);
+	if (host) {
+		__pci_scan_root_bus(host, ops);
+		return host->bus;
 	} else {
 		pci_free_resource_list(&resources);
 	}
-	return b;
+	return NULL;
 }
 EXPORT_SYMBOL(pci_scan_bus_legacy);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 2970a84..9ddca3b 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -785,9 +785,6 @@ void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
 struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysdata);
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
-				    struct pci_ops *ops, void *sysdata,
-				    struct list_head *resources);
 void pci_free_host_bridge(struct pci_host_bridge *host);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
-- 
1.7.1

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

* [PATCH 25/28] PCI: Rename __pci_create_root_bus() to pci_create_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now no one use pci_create_root_bus(), we could remove it
and rename __pci_create_root_bus() to pci_create_root_bus().

Signed-off-by: wangyijing@huawei.com
---
 drivers/pci/probe.c |   27 ++++++++-------------------
 include/linux/pci.h |    3 ---
 2 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 30323ac..0817910 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1852,7 +1852,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-static struct pci_bus *__pci_create_root_bus(
+static struct pci_bus *pci_create_root_bus(
 		struct pci_host_bridge *bridge, struct pci_ops *ops)
 {
 	int error;
@@ -1935,18 +1935,6 @@ err_out:
 	return NULL;
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
-{
-	struct pci_host_bridge *host;
-
-	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
-	if (!host)
-		return NULL;
-	
-	return __pci_create_root_bus(host, ops);
-}
-
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
 {
 	struct resource *res = &b->busn_res;
@@ -2025,7 +2013,7 @@ static struct pci_bus *__pci_scan_root_bus(
 			break;
 		}
 
-	b = __pci_create_root_bus(host, ops);
+	b = pci_create_root_bus(host, ops);
 	if (!b) {
 		pci_free_host_bridge(host);
 		return NULL;
@@ -2091,18 +2079,19 @@ struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
-	struct pci_bus *b;
+	struct pci_host_bridge *host;
 
 	pci_add_resource(&resources, &ioport_resource);
 	pci_add_resource(&resources, &iomem_resource);
 	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(NULL, db, ops, sysdata, &resources);
-	if (b) {
-		pci_scan_child_bus(b);
+	host = pci_create_host_bridge(NULL, db, sysdata, &resources, NULL);
+	if (host) {
+		__pci_scan_root_bus(host, ops);
+		return host->bus;
 	} else {
 		pci_free_resource_list(&resources);
 	}
-	return b;
+	return NULL;
 }
 EXPORT_SYMBOL(pci_scan_bus_legacy);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 2970a84..9ddca3b 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -785,9 +785,6 @@ void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
 struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysdata);
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
-				    struct pci_ops *ops, void *sysdata,
-				    struct list_head *resources);
 void pci_free_host_bridge(struct pci_host_bridge *host);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
-- 
1.7.1


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

* [PATCH 25/28] PCI: Rename __pci_create_root_bus() to pci_create_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Now no one use pci_create_root_bus(), we could remove it
and rename __pci_create_root_bus() to pci_create_root_bus().

Signed-off-by: wangyijing at huawei.com
---
 drivers/pci/probe.c |   27 ++++++++-------------------
 include/linux/pci.h |    3 ---
 2 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 30323ac..0817910 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1852,7 +1852,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-static struct pci_bus *__pci_create_root_bus(
+static struct pci_bus *pci_create_root_bus(
 		struct pci_host_bridge *bridge, struct pci_ops *ops)
 {
 	int error;
@@ -1935,18 +1935,6 @@ err_out:
 	return NULL;
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
-{
-	struct pci_host_bridge *host;
-
-	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
-	if (!host)
-		return NULL;
-	
-	return __pci_create_root_bus(host, ops);
-}
-
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
 {
 	struct resource *res = &b->busn_res;
@@ -2025,7 +2013,7 @@ static struct pci_bus *__pci_scan_root_bus(
 			break;
 		}
 
-	b = __pci_create_root_bus(host, ops);
+	b = pci_create_root_bus(host, ops);
 	if (!b) {
 		pci_free_host_bridge(host);
 		return NULL;
@@ -2091,18 +2079,19 @@ struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
-	struct pci_bus *b;
+	struct pci_host_bridge *host;
 
 	pci_add_resource(&resources, &ioport_resource);
 	pci_add_resource(&resources, &iomem_resource);
 	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(NULL, db, ops, sysdata, &resources);
-	if (b) {
-		pci_scan_child_bus(b);
+	host = pci_create_host_bridge(NULL, db, sysdata, &resources, NULL);
+	if (host) {
+		__pci_scan_root_bus(host, ops);
+		return host->bus;
 	} else {
 		pci_free_resource_list(&resources);
 	}
-	return b;
+	return NULL;
 }
 EXPORT_SYMBOL(pci_scan_bus_legacy);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 2970a84..9ddca3b 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -785,9 +785,6 @@ void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
 struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysdata);
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
-				    struct pci_ops *ops, void *sysdata,
-				    struct list_head *resources);
 void pci_free_host_bridge(struct pci_host_bridge *host);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
-- 
1.7.1

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

* [PATCH 25/28] PCI: Rename __pci_create_root_bus() to pci_create_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now no one use pci_create_root_bus(), we could remove it
and rename __pci_create_root_bus() to pci_create_root_bus().

Signed-off-by: wangyijing@huawei.com
---
 drivers/pci/probe.c |   27 ++++++++-------------------
 include/linux/pci.h |    3 ---
 2 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 30323ac..0817910 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1852,7 +1852,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-static struct pci_bus *__pci_create_root_bus(
+static struct pci_bus *pci_create_root_bus(
 		struct pci_host_bridge *bridge, struct pci_ops *ops)
 {
 	int error;
@@ -1935,18 +1935,6 @@ err_out:
 	return NULL;
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
-{
-	struct pci_host_bridge *host;
-
-	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
-	if (!host)
-		return NULL;
-	
-	return __pci_create_root_bus(host, ops);
-}
-
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
 {
 	struct resource *res = &b->busn_res;
@@ -2025,7 +2013,7 @@ static struct pci_bus *__pci_scan_root_bus(
 			break;
 		}
 
-	b = __pci_create_root_bus(host, ops);
+	b = pci_create_root_bus(host, ops);
 	if (!b) {
 		pci_free_host_bridge(host);
 		return NULL;
@@ -2091,18 +2079,19 @@ struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
-	struct pci_bus *b;
+	struct pci_host_bridge *host;
 
 	pci_add_resource(&resources, &ioport_resource);
 	pci_add_resource(&resources, &iomem_resource);
 	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(NULL, db, ops, sysdata, &resources);
-	if (b) {
-		pci_scan_child_bus(b);
+	host = pci_create_host_bridge(NULL, db, sysdata, &resources, NULL);
+	if (host) {
+		__pci_scan_root_bus(host, ops);
+		return host->bus;
 	} else {
 		pci_free_resource_list(&resources);
 	}
-	return b;
+	return NULL;
 }
 EXPORT_SYMBOL(pci_scan_bus_legacy);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 2970a84..9ddca3b 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -785,9 +785,6 @@ void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
 struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysdata);
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
-				    struct pci_ops *ops, void *sysdata,
-				    struct list_head *resources);
 void pci_free_host_bridge(struct pci_host_bridge *host);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
-- 
1.7.1


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

* [PATCH 25/28] PCI: Rename __pci_create_root_bus() to pci_create_root_bus()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now no one use pci_create_root_bus(), we could remove it
and rename __pci_create_root_bus() to pci_create_root_bus().

Signed-off-by: wangyijing@huawei.com
---
 drivers/pci/probe.c |   27 ++++++++-------------------
 include/linux/pci.h |    3 ---
 2 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 30323ac..0817910 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1852,7 +1852,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-static struct pci_bus *__pci_create_root_bus(
+static struct pci_bus *pci_create_root_bus(
 		struct pci_host_bridge *bridge, struct pci_ops *ops)
 {
 	int error;
@@ -1935,18 +1935,6 @@ err_out:
 	return NULL;
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
-{
-	struct pci_host_bridge *host;
-
-	host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
-	if (!host)
-		return NULL;
-	
-	return __pci_create_root_bus(host, ops);
-}
-
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
 {
 	struct resource *res = &b->busn_res;
@@ -2025,7 +2013,7 @@ static struct pci_bus *__pci_scan_root_bus(
 			break;
 		}
 
-	b = __pci_create_root_bus(host, ops);
+	b = pci_create_root_bus(host, ops);
 	if (!b) {
 		pci_free_host_bridge(host);
 		return NULL;
@@ -2091,18 +2079,19 @@ struct pci_bus *pci_scan_bus_legacy(u32 db, struct pci_ops *ops,
 					void *sysdata)
 {
 	LIST_HEAD(resources);
-	struct pci_bus *b;
+	struct pci_host_bridge *host;
 
 	pci_add_resource(&resources, &ioport_resource);
 	pci_add_resource(&resources, &iomem_resource);
 	pci_add_resource(&resources, &busn_resource);
-	b = pci_create_root_bus(NULL, db, ops, sysdata, &resources);
-	if (b) {
-		pci_scan_child_bus(b);
+	host = pci_create_host_bridge(NULL, db, sysdata, &resources, NULL);
+	if (host) {
+		__pci_scan_root_bus(host, ops);
+		return host->bus;
 	} else {
 		pci_free_resource_list(&resources);
 	}
-	return b;
+	return NULL;
 }
 EXPORT_SYMBOL(pci_scan_bus_legacy);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 2970a84..9ddca3b 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -785,9 +785,6 @@ void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
 struct pci_bus *pci_scan_bus_legacy(u32 dombus, struct pci_ops *ops, void *sysdata);
-struct pci_bus *pci_create_root_bus(struct device *parent, u32 dombus,
-				    struct pci_ops *ops, void *sysdata,
-				    struct list_head *resources);
 void pci_free_host_bridge(struct pci_host_bridge *host);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
-- 
1.7.1


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

* [PATCH 26/28] PCI: Export find_pci_host_bridge()
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Export find_pci_host_bridge().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |    2 +-
 include/linux/pci.h       |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index ccbf168..74f7572 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -104,7 +104,7 @@ static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
 	return bus;
 }
 
-static struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus)
+struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus)
 {
 	struct pci_bus *root_bus = find_pci_root_bus(bus);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 9ddca3b..3ebee9d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -431,6 +431,7 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 struct pci_host_bridge *pci_create_host_bridge(
 		struct device *parent, u32 dombus, struct list_head *resources, 
 		void *sysdata, struct pci_host_bridge_ops *ops);
+struct pci_host_bridge *find_pci_host_bridge(struct pci_bus* bus);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1


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

* [PATCH 26/28] PCI: Export find_pci_host_bridge()
  2015-01-16  1:43 ` Yijing Wang
                   ` (53 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Export find_pci_host_bridge().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |    2 +-
 include/linux/pci.h       |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index ccbf168..74f7572 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -104,7 +104,7 @@ static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
 	return bus;
 }
 
-static struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus)
+struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus)
 {
 	struct pci_bus *root_bus = find_pci_root_bus(bus);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 9ddca3b..3ebee9d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -431,6 +431,7 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 struct pci_host_bridge *pci_create_host_bridge(
 		struct device *parent, u32 dombus, struct list_head *resources, 
 		void *sysdata, struct pci_host_bridge_ops *ops);
+struct pci_host_bridge *find_pci_host_bridge(struct pci_bus* bus);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1

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

* [PATCH 26/28] PCI: Export find_pci_host_bridge()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Export find_pci_host_bridge().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |    2 +-
 include/linux/pci.h       |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index ccbf168..74f7572 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -104,7 +104,7 @@ static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
 	return bus;
 }
 
-static struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus)
+struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus)
 {
 	struct pci_bus *root_bus = find_pci_root_bus(bus);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 9ddca3b..3ebee9d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -431,6 +431,7 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 struct pci_host_bridge *pci_create_host_bridge(
 		struct device *parent, u32 dombus, struct list_head *resources, 
 		void *sysdata, struct pci_host_bridge_ops *ops);
+struct pci_host_bridge *find_pci_host_bridge(struct pci_bus* bus);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1


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

* [PATCH 26/28] PCI: Export find_pci_host_bridge()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Export find_pci_host_bridge().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |    2 +-
 include/linux/pci.h       |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index ccbf168..74f7572 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -104,7 +104,7 @@ static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
 	return bus;
 }
 
-static struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus)
+struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus)
 {
 	struct pci_bus *root_bus = find_pci_root_bus(bus);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 9ddca3b..3ebee9d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -431,6 +431,7 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 struct pci_host_bridge *pci_create_host_bridge(
 		struct device *parent, u32 dombus, struct list_head *resources, 
 		void *sysdata, struct pci_host_bridge_ops *ops);
+struct pci_host_bridge *find_pci_host_bridge(struct pci_bus* bus);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1

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

* [PATCH 26/28] PCI: Export find_pci_host_bridge()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Export find_pci_host_bridge().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |    2 +-
 include/linux/pci.h       |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index ccbf168..74f7572 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -104,7 +104,7 @@ static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
 	return bus;
 }
 
-static struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus)
+struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus)
 {
 	struct pci_bus *root_bus = find_pci_root_bus(bus);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 9ddca3b..3ebee9d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -431,6 +431,7 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 struct pci_host_bridge *pci_create_host_bridge(
 		struct device *parent, u32 dombus, struct list_head *resources, 
 		void *sysdata, struct pci_host_bridge_ops *ops);
+struct pci_host_bridge *find_pci_host_bridge(struct pci_bus* bus);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1


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

* [PATCH 26/28] PCI: Export find_pci_host_bridge()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Export find_pci_host_bridge().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/host-bridge.c |    2 +-
 include/linux/pci.h       |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index ccbf168..74f7572 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -104,7 +104,7 @@ static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
 	return bus;
 }
 
-static struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus)
+struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus)
 {
 	struct pci_bus *root_bus = find_pci_root_bus(bus);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 9ddca3b..3ebee9d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -431,6 +431,7 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 struct pci_host_bridge *pci_create_host_bridge(
 		struct device *parent, u32 dombus, struct list_head *resources, 
 		void *sysdata, struct pci_host_bridge_ops *ops);
+struct pci_host_bridge *find_pci_host_bridge(struct pci_bus* bus);
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1

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

* [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now pci_host_bridge holds the domain number,
so we could eliminate all platform specific
pci_domain_nr().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/include/asm/pci.h     |    2 --
 arch/ia64/include/asm/pci.h      |    1 -
 arch/microblaze/pci/pci-common.c |   11 -----------
 arch/mips/include/asm/pci.h      |    2 --
 arch/powerpc/kernel/pci-common.c |   11 -----------
 arch/s390/pci/pci.c              |    6 ------
 arch/sh/include/asm/pci.h        |    2 --
 arch/sparc/kernel/pci.c          |   17 -----------------
 arch/tile/include/asm/pci.h      |    2 --
 arch/x86/include/asm/pci.h       |    6 ------
 drivers/pci/pci.c                |    8 ++++++++
 include/linux/pci.h              |    7 ++-----
 12 files changed, 10 insertions(+), 65 deletions(-)

diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index f7f680f..63a9a1e 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -95,8 +95,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 	return channel ? 15 : 14;
 }
 
-#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_controller *hose = bus->sysdata;
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 52af5ed..1dcea49 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -99,7 +99,6 @@ struct pci_controller {
 
 
 #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
-#define pci_domain_nr(busdev)    (PCI_CONTROLLER(busdev)->segment)
 
 extern struct pci_ops pci_root_ops;
 
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 890bd36..81ac523 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -123,17 +123,6 @@ unsigned long pci_address_to_pio(phys_addr_t address)
 }
 EXPORT_SYMBOL_GPL(pci_address_to_pio);
 
-/*
- * Return the domain number for this bus.
- */
-int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_controller *hose = pci_bus_to_host(bus);
-
-	return hose->global_number;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 /* This routine is meant to be used early during boot, when the
  * PCI bus numbers have not yet been assigned, and you need to
  * issue PCI config cycles to an OF device.
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 6952962..9546396 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -121,8 +121,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 }
 #endif
 
-#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_controller *hose = bus->sysdata;
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 0c7fb81..a482bd6 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -181,17 +181,6 @@ unsigned long pci_address_to_pio(phys_addr_t address)
 }
 EXPORT_SYMBOL_GPL(pci_address_to_pio);
 
-/*
- * Return the domain number for this bus.
- */
-int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_controller *hose = pci_bus_to_host(bus);
-
-	return hose->global_number;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 /* This routine is meant to be used early during boot, when the
  * PCI bus numbers have not yet been assigned, and you need to
  * issue PCI config cycles to an OF device.
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 612decf..8ca02f7 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -101,12 +101,6 @@ static struct zpci_dev *get_zdev_by_bus(struct pci_bus *bus)
 	return (bus && bus->sysdata) ? (struct zpci_dev *) bus->sysdata : NULL;
 }
 
-int pci_domain_nr(struct pci_bus *bus)
-{
-	return ((struct zpci_dev *) bus->sysdata)->domain;
-}
-EXPORT_SYMBOL_GPL(pci_domain_nr);
-
 int pci_proc_domain(struct pci_bus *bus)
 {
 	return pci_domain_nr(bus);
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index 5b45115..4dc3ad6 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -109,8 +109,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 /* Board-specific fixup routines. */
 int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin);
 
-#define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_channel *hose = bus->sysdata;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 42dc21f..519f121 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -906,23 +906,6 @@ int pcibus_to_node(struct pci_bus *pbus)
 EXPORT_SYMBOL(pcibus_to_node);
 #endif
 
-/* Return the domain number for this pci bus */
-
-int pci_domain_nr(struct pci_bus *pbus)
-{
-	struct pci_pbm_info *pbm = pbus->sysdata;
-	int ret;
-
-	if (!pbm) {
-		ret = -ENXIO;
-	} else {
-		ret = pbm->index;
-	}
-
-	return ret;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 #ifdef CONFIG_PCI_MSI
 int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
 {
diff --git a/arch/tile/include/asm/pci.h b/arch/tile/include/asm/pci.h
index dfedd7a..23a726e 100644
--- a/arch/tile/include/asm/pci.h
+++ b/arch/tile/include/asm/pci.h
@@ -199,8 +199,6 @@ int __init pcibios_init(void);
 
 void pcibios_fixup_bus(struct pci_bus *bus);
 
-#define pci_domain_nr(bus) (((struct pci_controller *)(bus)->sysdata)->index)
-
 /*
  * This decides whether to display the domain number in /proc.
  */
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 4e370a5..4fe0458 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -29,12 +29,6 @@ extern int noioapicreroute;
 #ifdef CONFIG_PCI
 
 #ifdef CONFIG_PCI_DOMAINS
-static inline int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_sysdata *sd = bus->sysdata;
-	return sd->domain;
-}
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	return pci_domain_nr(bus);
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a05f406..72232d4 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4465,6 +4465,14 @@ int pci_get_new_domain_nr(void)
 	return atomic_inc_return(&__domain_nr);
 }
 
+int pci_domain_nr(struct pci_bus *bus)
+{
+	struct pci_host_bridge *host = find_pci_host_bridge(bus);
+
+	return host->domain;
+}
+EXPORT_SYMBOL_GPL(pci_domain_nr);
+
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
 void pci_host_assign_domain_nr(struct pci_host_bridge *host)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3ebee9d..e7ca546 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1314,6 +1314,7 @@ void pci_cfg_access_unlock(struct pci_dev *dev);
 #ifdef CONFIG_PCI_DOMAINS
 extern int pci_domains_supported;
 int pci_get_new_domain_nr(void);
+int pci_domain_nr(struct pci_bus *bus);
 #else
 enum { pci_domains_supported = 0 };
 static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
@@ -1327,15 +1328,11 @@ static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
  * domains then this implementation will be used
  */
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
-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);
 void pci_host_assign_domain_nr(struct pci_host_bridge *host);
 #else
 static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
-					struct device *parent)
+		                    struct device *parent)
 {
 }
 static inline void pci_host_assign_domain_nr(struct pci_host_bridge *host)
-- 
1.7.1


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

* [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
  2015-01-16  1:43 ` Yijing Wang
                   ` (56 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now pci_host_bridge holds the domain number,
so we could eliminate all platform specific
pci_domain_nr().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/include/asm/pci.h     |    2 --
 arch/ia64/include/asm/pci.h      |    1 -
 arch/microblaze/pci/pci-common.c |   11 -----------
 arch/mips/include/asm/pci.h      |    2 --
 arch/powerpc/kernel/pci-common.c |   11 -----------
 arch/s390/pci/pci.c              |    6 ------
 arch/sh/include/asm/pci.h        |    2 --
 arch/sparc/kernel/pci.c          |   17 -----------------
 arch/tile/include/asm/pci.h      |    2 --
 arch/x86/include/asm/pci.h       |    6 ------
 drivers/pci/pci.c                |    8 ++++++++
 include/linux/pci.h              |    7 ++-----
 12 files changed, 10 insertions(+), 65 deletions(-)

diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index f7f680f..63a9a1e 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -95,8 +95,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 	return channel ? 15 : 14;
 }
 
-#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_controller *hose = bus->sysdata;
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 52af5ed..1dcea49 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -99,7 +99,6 @@ struct pci_controller {
 
 
 #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
-#define pci_domain_nr(busdev)    (PCI_CONTROLLER(busdev)->segment)
 
 extern struct pci_ops pci_root_ops;
 
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 890bd36..81ac523 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -123,17 +123,6 @@ unsigned long pci_address_to_pio(phys_addr_t address)
 }
 EXPORT_SYMBOL_GPL(pci_address_to_pio);
 
-/*
- * Return the domain number for this bus.
- */
-int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_controller *hose = pci_bus_to_host(bus);
-
-	return hose->global_number;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 /* This routine is meant to be used early during boot, when the
  * PCI bus numbers have not yet been assigned, and you need to
  * issue PCI config cycles to an OF device.
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 6952962..9546396 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -121,8 +121,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 }
 #endif
 
-#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_controller *hose = bus->sysdata;
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 0c7fb81..a482bd6 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -181,17 +181,6 @@ unsigned long pci_address_to_pio(phys_addr_t address)
 }
 EXPORT_SYMBOL_GPL(pci_address_to_pio);
 
-/*
- * Return the domain number for this bus.
- */
-int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_controller *hose = pci_bus_to_host(bus);
-
-	return hose->global_number;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 /* This routine is meant to be used early during boot, when the
  * PCI bus numbers have not yet been assigned, and you need to
  * issue PCI config cycles to an OF device.
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 612decf..8ca02f7 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -101,12 +101,6 @@ static struct zpci_dev *get_zdev_by_bus(struct pci_bus *bus)
 	return (bus && bus->sysdata) ? (struct zpci_dev *) bus->sysdata : NULL;
 }
 
-int pci_domain_nr(struct pci_bus *bus)
-{
-	return ((struct zpci_dev *) bus->sysdata)->domain;
-}
-EXPORT_SYMBOL_GPL(pci_domain_nr);
-
 int pci_proc_domain(struct pci_bus *bus)
 {
 	return pci_domain_nr(bus);
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index 5b45115..4dc3ad6 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -109,8 +109,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 /* Board-specific fixup routines. */
 int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin);
 
-#define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_channel *hose = bus->sysdata;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 42dc21f..519f121 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -906,23 +906,6 @@ int pcibus_to_node(struct pci_bus *pbus)
 EXPORT_SYMBOL(pcibus_to_node);
 #endif
 
-/* Return the domain number for this pci bus */
-
-int pci_domain_nr(struct pci_bus *pbus)
-{
-	struct pci_pbm_info *pbm = pbus->sysdata;
-	int ret;
-
-	if (!pbm) {
-		ret = -ENXIO;
-	} else {
-		ret = pbm->index;
-	}
-
-	return ret;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 #ifdef CONFIG_PCI_MSI
 int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
 {
diff --git a/arch/tile/include/asm/pci.h b/arch/tile/include/asm/pci.h
index dfedd7a..23a726e 100644
--- a/arch/tile/include/asm/pci.h
+++ b/arch/tile/include/asm/pci.h
@@ -199,8 +199,6 @@ int __init pcibios_init(void);
 
 void pcibios_fixup_bus(struct pci_bus *bus);
 
-#define pci_domain_nr(bus) (((struct pci_controller *)(bus)->sysdata)->index)
-
 /*
  * This decides whether to display the domain number in /proc.
  */
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 4e370a5..4fe0458 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -29,12 +29,6 @@ extern int noioapicreroute;
 #ifdef CONFIG_PCI
 
 #ifdef CONFIG_PCI_DOMAINS
-static inline int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_sysdata *sd = bus->sysdata;
-	return sd->domain;
-}
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	return pci_domain_nr(bus);
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a05f406..72232d4 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4465,6 +4465,14 @@ int pci_get_new_domain_nr(void)
 	return atomic_inc_return(&__domain_nr);
 }
 
+int pci_domain_nr(struct pci_bus *bus)
+{
+	struct pci_host_bridge *host = find_pci_host_bridge(bus);
+
+	return host->domain;
+}
+EXPORT_SYMBOL_GPL(pci_domain_nr);
+
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
 void pci_host_assign_domain_nr(struct pci_host_bridge *host)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3ebee9d..e7ca546 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1314,6 +1314,7 @@ void pci_cfg_access_unlock(struct pci_dev *dev);
 #ifdef CONFIG_PCI_DOMAINS
 extern int pci_domains_supported;
 int pci_get_new_domain_nr(void);
+int pci_domain_nr(struct pci_bus *bus);
 #else
 enum { pci_domains_supported = 0 };
 static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
@@ -1327,15 +1328,11 @@ static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
  * domains then this implementation will be used
  */
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
-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);
 void pci_host_assign_domain_nr(struct pci_host_bridge *host);
 #else
 static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
-					struct device *parent)
+		                    struct device *parent)
 {
 }
 static inline void pci_host_assign_domain_nr(struct pci_host_bridge *host)
-- 
1.7.1

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

* [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now pci_host_bridge holds the domain number,
so we could eliminate all platform specific
pci_domain_nr().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/include/asm/pci.h     |    2 --
 arch/ia64/include/asm/pci.h      |    1 -
 arch/microblaze/pci/pci-common.c |   11 -----------
 arch/mips/include/asm/pci.h      |    2 --
 arch/powerpc/kernel/pci-common.c |   11 -----------
 arch/s390/pci/pci.c              |    6 ------
 arch/sh/include/asm/pci.h        |    2 --
 arch/sparc/kernel/pci.c          |   17 -----------------
 arch/tile/include/asm/pci.h      |    2 --
 arch/x86/include/asm/pci.h       |    6 ------
 drivers/pci/pci.c                |    8 ++++++++
 include/linux/pci.h              |    7 ++-----
 12 files changed, 10 insertions(+), 65 deletions(-)

diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index f7f680f..63a9a1e 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -95,8 +95,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 	return channel ? 15 : 14;
 }
 
-#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_controller *hose = bus->sysdata;
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 52af5ed..1dcea49 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -99,7 +99,6 @@ struct pci_controller {
 
 
 #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
-#define pci_domain_nr(busdev)    (PCI_CONTROLLER(busdev)->segment)
 
 extern struct pci_ops pci_root_ops;
 
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 890bd36..81ac523 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -123,17 +123,6 @@ unsigned long pci_address_to_pio(phys_addr_t address)
 }
 EXPORT_SYMBOL_GPL(pci_address_to_pio);
 
-/*
- * Return the domain number for this bus.
- */
-int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_controller *hose = pci_bus_to_host(bus);
-
-	return hose->global_number;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 /* This routine is meant to be used early during boot, when the
  * PCI bus numbers have not yet been assigned, and you need to
  * issue PCI config cycles to an OF device.
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 6952962..9546396 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -121,8 +121,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 }
 #endif
 
-#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_controller *hose = bus->sysdata;
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 0c7fb81..a482bd6 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -181,17 +181,6 @@ unsigned long pci_address_to_pio(phys_addr_t address)
 }
 EXPORT_SYMBOL_GPL(pci_address_to_pio);
 
-/*
- * Return the domain number for this bus.
- */
-int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_controller *hose = pci_bus_to_host(bus);
-
-	return hose->global_number;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 /* This routine is meant to be used early during boot, when the
  * PCI bus numbers have not yet been assigned, and you need to
  * issue PCI config cycles to an OF device.
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 612decf..8ca02f7 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -101,12 +101,6 @@ static struct zpci_dev *get_zdev_by_bus(struct pci_bus *bus)
 	return (bus && bus->sysdata) ? (struct zpci_dev *) bus->sysdata : NULL;
 }
 
-int pci_domain_nr(struct pci_bus *bus)
-{
-	return ((struct zpci_dev *) bus->sysdata)->domain;
-}
-EXPORT_SYMBOL_GPL(pci_domain_nr);
-
 int pci_proc_domain(struct pci_bus *bus)
 {
 	return pci_domain_nr(bus);
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index 5b45115..4dc3ad6 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -109,8 +109,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 /* Board-specific fixup routines. */
 int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin);
 
-#define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_channel *hose = bus->sysdata;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 42dc21f..519f121 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -906,23 +906,6 @@ int pcibus_to_node(struct pci_bus *pbus)
 EXPORT_SYMBOL(pcibus_to_node);
 #endif
 
-/* Return the domain number for this pci bus */
-
-int pci_domain_nr(struct pci_bus *pbus)
-{
-	struct pci_pbm_info *pbm = pbus->sysdata;
-	int ret;
-
-	if (!pbm) {
-		ret = -ENXIO;
-	} else {
-		ret = pbm->index;
-	}
-
-	return ret;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 #ifdef CONFIG_PCI_MSI
 int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
 {
diff --git a/arch/tile/include/asm/pci.h b/arch/tile/include/asm/pci.h
index dfedd7a..23a726e 100644
--- a/arch/tile/include/asm/pci.h
+++ b/arch/tile/include/asm/pci.h
@@ -199,8 +199,6 @@ int __init pcibios_init(void);
 
 void pcibios_fixup_bus(struct pci_bus *bus);
 
-#define pci_domain_nr(bus) (((struct pci_controller *)(bus)->sysdata)->index)
-
 /*
  * This decides whether to display the domain number in /proc.
  */
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 4e370a5..4fe0458 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -29,12 +29,6 @@ extern int noioapicreroute;
 #ifdef CONFIG_PCI
 
 #ifdef CONFIG_PCI_DOMAINS
-static inline int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_sysdata *sd = bus->sysdata;
-	return sd->domain;
-}
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	return pci_domain_nr(bus);
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a05f406..72232d4 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4465,6 +4465,14 @@ int pci_get_new_domain_nr(void)
 	return atomic_inc_return(&__domain_nr);
 }
 
+int pci_domain_nr(struct pci_bus *bus)
+{
+	struct pci_host_bridge *host = find_pci_host_bridge(bus);
+
+	return host->domain;
+}
+EXPORT_SYMBOL_GPL(pci_domain_nr);
+
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
 void pci_host_assign_domain_nr(struct pci_host_bridge *host)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3ebee9d..e7ca546 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1314,6 +1314,7 @@ void pci_cfg_access_unlock(struct pci_dev *dev);
 #ifdef CONFIG_PCI_DOMAINS
 extern int pci_domains_supported;
 int pci_get_new_domain_nr(void);
+int pci_domain_nr(struct pci_bus *bus);
 #else
 enum { pci_domains_supported = 0 };
 static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
@@ -1327,15 +1328,11 @@ static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
  * domains then this implementation will be used
  */
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
-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);
 void pci_host_assign_domain_nr(struct pci_host_bridge *host);
 #else
 static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
-					struct device *parent)
+		                    struct device *parent)
 {
 }
 static inline void pci_host_assign_domain_nr(struct pci_host_bridge *host)
-- 
1.7.1


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

* [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Now pci_host_bridge holds the domain number,
so we could eliminate all platform specific
pci_domain_nr().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/include/asm/pci.h     |    2 --
 arch/ia64/include/asm/pci.h      |    1 -
 arch/microblaze/pci/pci-common.c |   11 -----------
 arch/mips/include/asm/pci.h      |    2 --
 arch/powerpc/kernel/pci-common.c |   11 -----------
 arch/s390/pci/pci.c              |    6 ------
 arch/sh/include/asm/pci.h        |    2 --
 arch/sparc/kernel/pci.c          |   17 -----------------
 arch/tile/include/asm/pci.h      |    2 --
 arch/x86/include/asm/pci.h       |    6 ------
 drivers/pci/pci.c                |    8 ++++++++
 include/linux/pci.h              |    7 ++-----
 12 files changed, 10 insertions(+), 65 deletions(-)

diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index f7f680f..63a9a1e 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -95,8 +95,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 	return channel ? 15 : 14;
 }
 
-#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_controller *hose = bus->sysdata;
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 52af5ed..1dcea49 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -99,7 +99,6 @@ struct pci_controller {
 
 
 #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
-#define pci_domain_nr(busdev)    (PCI_CONTROLLER(busdev)->segment)
 
 extern struct pci_ops pci_root_ops;
 
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 890bd36..81ac523 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -123,17 +123,6 @@ unsigned long pci_address_to_pio(phys_addr_t address)
 }
 EXPORT_SYMBOL_GPL(pci_address_to_pio);
 
-/*
- * Return the domain number for this bus.
- */
-int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_controller *hose = pci_bus_to_host(bus);
-
-	return hose->global_number;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 /* This routine is meant to be used early during boot, when the
  * PCI bus numbers have not yet been assigned, and you need to
  * issue PCI config cycles to an OF device.
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 6952962..9546396 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -121,8 +121,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 }
 #endif
 
-#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_controller *hose = bus->sysdata;
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 0c7fb81..a482bd6 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -181,17 +181,6 @@ unsigned long pci_address_to_pio(phys_addr_t address)
 }
 EXPORT_SYMBOL_GPL(pci_address_to_pio);
 
-/*
- * Return the domain number for this bus.
- */
-int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_controller *hose = pci_bus_to_host(bus);
-
-	return hose->global_number;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 /* This routine is meant to be used early during boot, when the
  * PCI bus numbers have not yet been assigned, and you need to
  * issue PCI config cycles to an OF device.
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 612decf..8ca02f7 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -101,12 +101,6 @@ static struct zpci_dev *get_zdev_by_bus(struct pci_bus *bus)
 	return (bus && bus->sysdata) ? (struct zpci_dev *) bus->sysdata : NULL;
 }
 
-int pci_domain_nr(struct pci_bus *bus)
-{
-	return ((struct zpci_dev *) bus->sysdata)->domain;
-}
-EXPORT_SYMBOL_GPL(pci_domain_nr);
-
 int pci_proc_domain(struct pci_bus *bus)
 {
 	return pci_domain_nr(bus);
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index 5b45115..4dc3ad6 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -109,8 +109,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 /* Board-specific fixup routines. */
 int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin);
 
-#define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_channel *hose = bus->sysdata;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 42dc21f..519f121 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -906,23 +906,6 @@ int pcibus_to_node(struct pci_bus *pbus)
 EXPORT_SYMBOL(pcibus_to_node);
 #endif
 
-/* Return the domain number for this pci bus */
-
-int pci_domain_nr(struct pci_bus *pbus)
-{
-	struct pci_pbm_info *pbm = pbus->sysdata;
-	int ret;
-
-	if (!pbm) {
-		ret = -ENXIO;
-	} else {
-		ret = pbm->index;
-	}
-
-	return ret;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 #ifdef CONFIG_PCI_MSI
 int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
 {
diff --git a/arch/tile/include/asm/pci.h b/arch/tile/include/asm/pci.h
index dfedd7a..23a726e 100644
--- a/arch/tile/include/asm/pci.h
+++ b/arch/tile/include/asm/pci.h
@@ -199,8 +199,6 @@ int __init pcibios_init(void);
 
 void pcibios_fixup_bus(struct pci_bus *bus);
 
-#define pci_domain_nr(bus) (((struct pci_controller *)(bus)->sysdata)->index)
-
 /*
  * This decides whether to display the domain number in /proc.
  */
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 4e370a5..4fe0458 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -29,12 +29,6 @@ extern int noioapicreroute;
 #ifdef CONFIG_PCI
 
 #ifdef CONFIG_PCI_DOMAINS
-static inline int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_sysdata *sd = bus->sysdata;
-	return sd->domain;
-}
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	return pci_domain_nr(bus);
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a05f406..72232d4 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4465,6 +4465,14 @@ int pci_get_new_domain_nr(void)
 	return atomic_inc_return(&__domain_nr);
 }
 
+int pci_domain_nr(struct pci_bus *bus)
+{
+	struct pci_host_bridge *host = find_pci_host_bridge(bus);
+
+	return host->domain;
+}
+EXPORT_SYMBOL_GPL(pci_domain_nr);
+
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
 void pci_host_assign_domain_nr(struct pci_host_bridge *host)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3ebee9d..e7ca546 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1314,6 +1314,7 @@ void pci_cfg_access_unlock(struct pci_dev *dev);
 #ifdef CONFIG_PCI_DOMAINS
 extern int pci_domains_supported;
 int pci_get_new_domain_nr(void);
+int pci_domain_nr(struct pci_bus *bus);
 #else
 enum { pci_domains_supported = 0 };
 static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
@@ -1327,15 +1328,11 @@ static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
  * domains then this implementation will be used
  */
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
-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);
 void pci_host_assign_domain_nr(struct pci_host_bridge *host);
 #else
 static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
-					struct device *parent)
+		                    struct device *parent)
 {
 }
 static inline void pci_host_assign_domain_nr(struct pci_host_bridge *host)
-- 
1.7.1

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

* [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now pci_host_bridge holds the domain number,
so we could eliminate all platform specific
pci_domain_nr().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/include/asm/pci.h     |    2 --
 arch/ia64/include/asm/pci.h      |    1 -
 arch/microblaze/pci/pci-common.c |   11 -----------
 arch/mips/include/asm/pci.h      |    2 --
 arch/powerpc/kernel/pci-common.c |   11 -----------
 arch/s390/pci/pci.c              |    6 ------
 arch/sh/include/asm/pci.h        |    2 --
 arch/sparc/kernel/pci.c          |   17 -----------------
 arch/tile/include/asm/pci.h      |    2 --
 arch/x86/include/asm/pci.h       |    6 ------
 drivers/pci/pci.c                |    8 ++++++++
 include/linux/pci.h              |    7 ++-----
 12 files changed, 10 insertions(+), 65 deletions(-)

diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index f7f680f..63a9a1e 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -95,8 +95,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 	return channel ? 15 : 14;
 }
 
-#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_controller *hose = bus->sysdata;
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 52af5ed..1dcea49 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -99,7 +99,6 @@ struct pci_controller {
 
 
 #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
-#define pci_domain_nr(busdev)    (PCI_CONTROLLER(busdev)->segment)
 
 extern struct pci_ops pci_root_ops;
 
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 890bd36..81ac523 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -123,17 +123,6 @@ unsigned long pci_address_to_pio(phys_addr_t address)
 }
 EXPORT_SYMBOL_GPL(pci_address_to_pio);
 
-/*
- * Return the domain number for this bus.
- */
-int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_controller *hose = pci_bus_to_host(bus);
-
-	return hose->global_number;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 /* This routine is meant to be used early during boot, when the
  * PCI bus numbers have not yet been assigned, and you need to
  * issue PCI config cycles to an OF device.
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 6952962..9546396 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -121,8 +121,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 }
 #endif
 
-#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_controller *hose = bus->sysdata;
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 0c7fb81..a482bd6 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -181,17 +181,6 @@ unsigned long pci_address_to_pio(phys_addr_t address)
 }
 EXPORT_SYMBOL_GPL(pci_address_to_pio);
 
-/*
- * Return the domain number for this bus.
- */
-int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_controller *hose = pci_bus_to_host(bus);
-
-	return hose->global_number;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 /* This routine is meant to be used early during boot, when the
  * PCI bus numbers have not yet been assigned, and you need to
  * issue PCI config cycles to an OF device.
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 612decf..8ca02f7 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -101,12 +101,6 @@ static struct zpci_dev *get_zdev_by_bus(struct pci_bus *bus)
 	return (bus && bus->sysdata) ? (struct zpci_dev *) bus->sysdata : NULL;
 }
 
-int pci_domain_nr(struct pci_bus *bus)
-{
-	return ((struct zpci_dev *) bus->sysdata)->domain;
-}
-EXPORT_SYMBOL_GPL(pci_domain_nr);
-
 int pci_proc_domain(struct pci_bus *bus)
 {
 	return pci_domain_nr(bus);
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index 5b45115..4dc3ad6 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -109,8 +109,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 /* Board-specific fixup routines. */
 int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin);
 
-#define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_channel *hose = bus->sysdata;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 42dc21f..519f121 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -906,23 +906,6 @@ int pcibus_to_node(struct pci_bus *pbus)
 EXPORT_SYMBOL(pcibus_to_node);
 #endif
 
-/* Return the domain number for this pci bus */
-
-int pci_domain_nr(struct pci_bus *pbus)
-{
-	struct pci_pbm_info *pbm = pbus->sysdata;
-	int ret;
-
-	if (!pbm) {
-		ret = -ENXIO;
-	} else {
-		ret = pbm->index;
-	}
-
-	return ret;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 #ifdef CONFIG_PCI_MSI
 int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
 {
diff --git a/arch/tile/include/asm/pci.h b/arch/tile/include/asm/pci.h
index dfedd7a..23a726e 100644
--- a/arch/tile/include/asm/pci.h
+++ b/arch/tile/include/asm/pci.h
@@ -199,8 +199,6 @@ int __init pcibios_init(void);
 
 void pcibios_fixup_bus(struct pci_bus *bus);
 
-#define pci_domain_nr(bus) (((struct pci_controller *)(bus)->sysdata)->index)
-
 /*
  * This decides whether to display the domain number in /proc.
  */
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 4e370a5..4fe0458 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -29,12 +29,6 @@ extern int noioapicreroute;
 #ifdef CONFIG_PCI
 
 #ifdef CONFIG_PCI_DOMAINS
-static inline int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_sysdata *sd = bus->sysdata;
-	return sd->domain;
-}
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	return pci_domain_nr(bus);
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a05f406..72232d4 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4465,6 +4465,14 @@ int pci_get_new_domain_nr(void)
 	return atomic_inc_return(&__domain_nr);
 }
 
+int pci_domain_nr(struct pci_bus *bus)
+{
+	struct pci_host_bridge *host = find_pci_host_bridge(bus);
+
+	return host->domain;
+}
+EXPORT_SYMBOL_GPL(pci_domain_nr);
+
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
 void pci_host_assign_domain_nr(struct pci_host_bridge *host)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3ebee9d..e7ca546 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1314,6 +1314,7 @@ void pci_cfg_access_unlock(struct pci_dev *dev);
 #ifdef CONFIG_PCI_DOMAINS
 extern int pci_domains_supported;
 int pci_get_new_domain_nr(void);
+int pci_domain_nr(struct pci_bus *bus);
 #else
 enum { pci_domains_supported = 0 };
 static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
@@ -1327,15 +1328,11 @@ static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
  * domains then this implementation will be used
  */
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
-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);
 void pci_host_assign_domain_nr(struct pci_host_bridge *host);
 #else
 static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
-					struct device *parent)
+		                    struct device *parent)
 {
 }
 static inline void pci_host_assign_domain_nr(struct pci_host_bridge *host)
-- 
1.7.1


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

* [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now pci_host_bridge holds the domain number,
so we could eliminate all platform specific
pci_domain_nr().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/alpha/include/asm/pci.h     |    2 --
 arch/ia64/include/asm/pci.h      |    1 -
 arch/microblaze/pci/pci-common.c |   11 -----------
 arch/mips/include/asm/pci.h      |    2 --
 arch/powerpc/kernel/pci-common.c |   11 -----------
 arch/s390/pci/pci.c              |    6 ------
 arch/sh/include/asm/pci.h        |    2 --
 arch/sparc/kernel/pci.c          |   17 -----------------
 arch/tile/include/asm/pci.h      |    2 --
 arch/x86/include/asm/pci.h       |    6 ------
 drivers/pci/pci.c                |    8 ++++++++
 include/linux/pci.h              |    7 ++-----
 12 files changed, 10 insertions(+), 65 deletions(-)

diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index f7f680f..63a9a1e 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -95,8 +95,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 	return channel ? 15 : 14;
 }
 
-#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_controller *hose = bus->sysdata;
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 52af5ed..1dcea49 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -99,7 +99,6 @@ struct pci_controller {
 
 
 #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
-#define pci_domain_nr(busdev)    (PCI_CONTROLLER(busdev)->segment)
 
 extern struct pci_ops pci_root_ops;
 
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 890bd36..81ac523 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -123,17 +123,6 @@ unsigned long pci_address_to_pio(phys_addr_t address)
 }
 EXPORT_SYMBOL_GPL(pci_address_to_pio);
 
-/*
- * Return the domain number for this bus.
- */
-int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_controller *hose = pci_bus_to_host(bus);
-
-	return hose->global_number;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 /* This routine is meant to be used early during boot, when the
  * PCI bus numbers have not yet been assigned, and you need to
  * issue PCI config cycles to an OF device.
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 6952962..9546396 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -121,8 +121,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 }
 #endif
 
-#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_controller *hose = bus->sysdata;
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 0c7fb81..a482bd6 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -181,17 +181,6 @@ unsigned long pci_address_to_pio(phys_addr_t address)
 }
 EXPORT_SYMBOL_GPL(pci_address_to_pio);
 
-/*
- * Return the domain number for this bus.
- */
-int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_controller *hose = pci_bus_to_host(bus);
-
-	return hose->global_number;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 /* This routine is meant to be used early during boot, when the
  * PCI bus numbers have not yet been assigned, and you need to
  * issue PCI config cycles to an OF device.
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 612decf..8ca02f7 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -101,12 +101,6 @@ static struct zpci_dev *get_zdev_by_bus(struct pci_bus *bus)
 	return (bus && bus->sysdata) ? (struct zpci_dev *) bus->sysdata : NULL;
 }
 
-int pci_domain_nr(struct pci_bus *bus)
-{
-	return ((struct zpci_dev *) bus->sysdata)->domain;
-}
-EXPORT_SYMBOL_GPL(pci_domain_nr);
-
 int pci_proc_domain(struct pci_bus *bus)
 {
 	return pci_domain_nr(bus);
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index 5b45115..4dc3ad6 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -109,8 +109,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 /* Board-specific fixup routines. */
 int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin);
 
-#define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_channel *hose = bus->sysdata;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 42dc21f..519f121 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -906,23 +906,6 @@ int pcibus_to_node(struct pci_bus *pbus)
 EXPORT_SYMBOL(pcibus_to_node);
 #endif
 
-/* Return the domain number for this pci bus */
-
-int pci_domain_nr(struct pci_bus *pbus)
-{
-	struct pci_pbm_info *pbm = pbus->sysdata;
-	int ret;
-
-	if (!pbm) {
-		ret = -ENXIO;
-	} else {
-		ret = pbm->index;
-	}
-
-	return ret;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 #ifdef CONFIG_PCI_MSI
 int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
 {
diff --git a/arch/tile/include/asm/pci.h b/arch/tile/include/asm/pci.h
index dfedd7a..23a726e 100644
--- a/arch/tile/include/asm/pci.h
+++ b/arch/tile/include/asm/pci.h
@@ -199,8 +199,6 @@ int __init pcibios_init(void);
 
 void pcibios_fixup_bus(struct pci_bus *bus);
 
-#define pci_domain_nr(bus) (((struct pci_controller *)(bus)->sysdata)->index)
-
 /*
  * This decides whether to display the domain number in /proc.
  */
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 4e370a5..4fe0458 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -29,12 +29,6 @@ extern int noioapicreroute;
 #ifdef CONFIG_PCI
 
 #ifdef CONFIG_PCI_DOMAINS
-static inline int pci_domain_nr(struct pci_bus *bus)
-{
-	struct pci_sysdata *sd = bus->sysdata;
-	return sd->domain;
-}
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	return pci_domain_nr(bus);
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a05f406..72232d4 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4465,6 +4465,14 @@ int pci_get_new_domain_nr(void)
 	return atomic_inc_return(&__domain_nr);
 }
 
+int pci_domain_nr(struct pci_bus *bus)
+{
+	struct pci_host_bridge *host = find_pci_host_bridge(bus);
+
+	return host->domain;
+}
+EXPORT_SYMBOL_GPL(pci_domain_nr);
+
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
 void pci_host_assign_domain_nr(struct pci_host_bridge *host)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3ebee9d..e7ca546 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1314,6 +1314,7 @@ void pci_cfg_access_unlock(struct pci_dev *dev);
 #ifdef CONFIG_PCI_DOMAINS
 extern int pci_domains_supported;
 int pci_get_new_domain_nr(void);
+int pci_domain_nr(struct pci_bus *bus);
 #else
 enum { pci_domains_supported = 0 };
 static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
@@ -1327,15 +1328,11 @@ static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
  * domains then this implementation will be used
  */
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
-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);
 void pci_host_assign_domain_nr(struct pci_host_bridge *host);
 #else
 static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
-					struct device *parent)
+		                    struct device *parent)
 {
 }
 static inline void pci_host_assign_domain_nr(struct pci_host_bridge *host)
-- 
1.7.1

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

* [PATCH 28/28] PCI: Remove pci_bus_assign_domain_nr()
  2015-01-16  1:43 ` Yijing Wang
                     ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  1:44   ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we save the domain number in pci_host_bridge,
we could remove pci_bus_assign_domain_nr() and
clean the domain member in pci_bus.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/pci.c   |   48 +-----------------------------------------------
 drivers/pci/probe.c |   12 ++++--------
 include/linux/pci.h |    3 ---
 3 files changed, 5 insertions(+), 58 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 72232d4..3eb3d8e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4472,6 +4472,7 @@ int pci_domain_nr(struct pci_bus *bus)
 	return host->domain;
 }
 EXPORT_SYMBOL_GPL(pci_domain_nr);
+#endif
 
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
 void pci_host_assign_domain_nr(struct pci_host_bridge *host)
@@ -4519,53 +4520,6 @@ void pci_host_assign_domain_nr(struct pci_host_bridge *host)
 
 	host->domain_nr = domain;
 }
-
-
-void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
-{
-	static int use_dt_domains = -1;
-	int domain = of_get_pci_domain_nr(parent->of_node);
-
-	/*
-	 * Check DT domain and use_dt_domains values.
-	 *
-	 * If DT domain property is valid (domain >= 0) and
-	 * use_dt_domains != 0, the DT assignment is valid since this means
-	 * we have not previously allocated a domain number by using
-	 * pci_get_new_domain_nr(); we should also update use_dt_domains to
-	 * 1, to indicate that we have just assigned a domain number from
-	 * DT.
-	 *
-	 * If DT domain property value is not valid (ie domain < 0), and we
-	 * have not previously assigned a domain number from DT
-	 * (use_dt_domains != 1) we should assign a domain number by
-	 * using the:
-	 *
-	 * pci_get_new_domain_nr()
-	 *
-	 * API and update the use_dt_domains value to keep track of method we
-	 * are using to assign domain numbers (use_dt_domains = 0).
-	 *
-	 * All other combinations imply we have a platform that is trying
-	 * to mix domain numbers obtained from DT and pci_get_new_domain_nr(),
-	 * which is a recipe for domain mishandling and it is prevented by
-	 * invalidating the domain value (domain = -1) and printing a
-	 * corresponding error.
-	 */
-	if (domain >= 0 && use_dt_domains) {
-		use_dt_domains = 1;
-	} else if (domain < 0 && use_dt_domains != 1) {
-		use_dt_domains = 0;
-		domain = pci_get_new_domain_nr();
-	} else {
-		dev_err(parent, "Node %s has inconsistent \"linux,pci-domain\" property in DT\n",
-			parent->of_node->full_name);
-		domain = -1;
-	}
-
-	bus->domain_nr = domain;
-}
-#endif
 #endif
 
 /**
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 0817910..d8b76ef 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -480,7 +480,7 @@ void pci_read_bridge_bases(struct pci_bus *child)
 	}
 }
 
-static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
+static struct pci_bus *pci_alloc_bus(void)
 {
 	struct pci_bus *b;
 
@@ -495,10 +495,7 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
 	INIT_LIST_HEAD(&b->resources);
 	b->max_bus_speed = PCI_SPEED_UNKNOWN;
 	b->cur_bus_speed = PCI_SPEED_UNKNOWN;
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
-	if (parent)
-		b->domain_nr = parent->domain_nr;
-#endif
+
 	return b;
 }
 
@@ -645,7 +642,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
 	/*
 	 * Allocate a new bus, and inherit stuff from the parent..
 	 */
-	child = pci_alloc_bus(parent);
+	child = pci_alloc_bus();
 	if (!child)
 		return NULL;
 
@@ -1865,14 +1862,13 @@ static struct pci_bus *pci_create_root_bus(
 	char *fmt;
 
 	parent = bridge->dev.parent;
-	b = pci_alloc_bus(NULL);
+	b = pci_alloc_bus();
 	if (!b)
 		return NULL;
 
 	b->sysdata = dev_get_drvdata(&bridge->dev);
 	b->ops = ops;
 	b->number = b->busn_res.start = bridge->busnum;
-	pci_bus_assign_domain_nr(b, parent);
 
 	bridge->bus = b;
 	b->bridge = get_device(&bridge->dev);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index e7ca546..ac25d2a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -475,9 +475,6 @@ struct pci_bus {
 	unsigned char	primary;	/* number of primary bridge */
 	unsigned char	max_bus_speed;	/* enum pci_bus_speed */
 	unsigned char	cur_bus_speed;	/* enum pci_bus_speed */
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
-	int		domain_nr;
-#endif
 
 	char		name[48];
 
-- 
1.7.1


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

* [PATCH 28/28] PCI: Remove pci_bus_assign_domain_nr()
  2015-01-16  1:43 ` Yijing Wang
                   ` (57 preceding siblings ...)
  (?)
@ 2015-01-16  1:44 ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we save the domain number in pci_host_bridge,
we could remove pci_bus_assign_domain_nr() and
clean the domain member in pci_bus.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/pci.c   |   48 +-----------------------------------------------
 drivers/pci/probe.c |   12 ++++--------
 include/linux/pci.h |    3 ---
 3 files changed, 5 insertions(+), 58 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 72232d4..3eb3d8e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4472,6 +4472,7 @@ int pci_domain_nr(struct pci_bus *bus)
 	return host->domain;
 }
 EXPORT_SYMBOL_GPL(pci_domain_nr);
+#endif
 
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
 void pci_host_assign_domain_nr(struct pci_host_bridge *host)
@@ -4519,53 +4520,6 @@ void pci_host_assign_domain_nr(struct pci_host_bridge *host)
 
 	host->domain_nr = domain;
 }
-
-
-void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
-{
-	static int use_dt_domains = -1;
-	int domain = of_get_pci_domain_nr(parent->of_node);
-
-	/*
-	 * Check DT domain and use_dt_domains values.
-	 *
-	 * If DT domain property is valid (domain >= 0) and
-	 * use_dt_domains != 0, the DT assignment is valid since this means
-	 * we have not previously allocated a domain number by using
-	 * pci_get_new_domain_nr(); we should also update use_dt_domains to
-	 * 1, to indicate that we have just assigned a domain number from
-	 * DT.
-	 *
-	 * If DT domain property value is not valid (ie domain < 0), and we
-	 * have not previously assigned a domain number from DT
-	 * (use_dt_domains != 1) we should assign a domain number by
-	 * using the:
-	 *
-	 * pci_get_new_domain_nr()
-	 *
-	 * API and update the use_dt_domains value to keep track of method we
-	 * are using to assign domain numbers (use_dt_domains = 0).
-	 *
-	 * All other combinations imply we have a platform that is trying
-	 * to mix domain numbers obtained from DT and pci_get_new_domain_nr(),
-	 * which is a recipe for domain mishandling and it is prevented by
-	 * invalidating the domain value (domain = -1) and printing a
-	 * corresponding error.
-	 */
-	if (domain >= 0 && use_dt_domains) {
-		use_dt_domains = 1;
-	} else if (domain < 0 && use_dt_domains != 1) {
-		use_dt_domains = 0;
-		domain = pci_get_new_domain_nr();
-	} else {
-		dev_err(parent, "Node %s has inconsistent \"linux,pci-domain\" property in DT\n",
-			parent->of_node->full_name);
-		domain = -1;
-	}
-
-	bus->domain_nr = domain;
-}
-#endif
 #endif
 
 /**
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 0817910..d8b76ef 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -480,7 +480,7 @@ void pci_read_bridge_bases(struct pci_bus *child)
 	}
 }
 
-static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
+static struct pci_bus *pci_alloc_bus(void)
 {
 	struct pci_bus *b;
 
@@ -495,10 +495,7 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
 	INIT_LIST_HEAD(&b->resources);
 	b->max_bus_speed = PCI_SPEED_UNKNOWN;
 	b->cur_bus_speed = PCI_SPEED_UNKNOWN;
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
-	if (parent)
-		b->domain_nr = parent->domain_nr;
-#endif
+
 	return b;
 }
 
@@ -645,7 +642,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
 	/*
 	 * Allocate a new bus, and inherit stuff from the parent..
 	 */
-	child = pci_alloc_bus(parent);
+	child = pci_alloc_bus();
 	if (!child)
 		return NULL;
 
@@ -1865,14 +1862,13 @@ static struct pci_bus *pci_create_root_bus(
 	char *fmt;
 
 	parent = bridge->dev.parent;
-	b = pci_alloc_bus(NULL);
+	b = pci_alloc_bus();
 	if (!b)
 		return NULL;
 
 	b->sysdata = dev_get_drvdata(&bridge->dev);
 	b->ops = ops;
 	b->number = b->busn_res.start = bridge->busnum;
-	pci_bus_assign_domain_nr(b, parent);
 
 	bridge->bus = b;
 	b->bridge = get_device(&bridge->dev);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index e7ca546..ac25d2a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -475,9 +475,6 @@ struct pci_bus {
 	unsigned char	primary;	/* number of primary bridge */
 	unsigned char	max_bus_speed;	/* enum pci_bus_speed */
 	unsigned char	cur_bus_speed;	/* enum pci_bus_speed */
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
-	int		domain_nr;
-#endif
 
 	char		name[48];
 
-- 
1.7.1

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

* [PATCH 28/28] PCI: Remove pci_bus_assign_domain_nr()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we save the domain number in pci_host_bridge,
we could remove pci_bus_assign_domain_nr() and
clean the domain member in pci_bus.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/pci.c   |   48 +-----------------------------------------------
 drivers/pci/probe.c |   12 ++++--------
 include/linux/pci.h |    3 ---
 3 files changed, 5 insertions(+), 58 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 72232d4..3eb3d8e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4472,6 +4472,7 @@ int pci_domain_nr(struct pci_bus *bus)
 	return host->domain;
 }
 EXPORT_SYMBOL_GPL(pci_domain_nr);
+#endif
 
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
 void pci_host_assign_domain_nr(struct pci_host_bridge *host)
@@ -4519,53 +4520,6 @@ void pci_host_assign_domain_nr(struct pci_host_bridge *host)
 
 	host->domain_nr = domain;
 }
-
-
-void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
-{
-	static int use_dt_domains = -1;
-	int domain = of_get_pci_domain_nr(parent->of_node);
-
-	/*
-	 * Check DT domain and use_dt_domains values.
-	 *
-	 * If DT domain property is valid (domain >= 0) and
-	 * use_dt_domains != 0, the DT assignment is valid since this means
-	 * we have not previously allocated a domain number by using
-	 * pci_get_new_domain_nr(); we should also update use_dt_domains to
-	 * 1, to indicate that we have just assigned a domain number from
-	 * DT.
-	 *
-	 * If DT domain property value is not valid (ie domain < 0), and we
-	 * have not previously assigned a domain number from DT
-	 * (use_dt_domains != 1) we should assign a domain number by
-	 * using the:
-	 *
-	 * pci_get_new_domain_nr()
-	 *
-	 * API and update the use_dt_domains value to keep track of method we
-	 * are using to assign domain numbers (use_dt_domains = 0).
-	 *
-	 * All other combinations imply we have a platform that is trying
-	 * to mix domain numbers obtained from DT and pci_get_new_domain_nr(),
-	 * which is a recipe for domain mishandling and it is prevented by
-	 * invalidating the domain value (domain = -1) and printing a
-	 * corresponding error.
-	 */
-	if (domain >= 0 && use_dt_domains) {
-		use_dt_domains = 1;
-	} else if (domain < 0 && use_dt_domains != 1) {
-		use_dt_domains = 0;
-		domain = pci_get_new_domain_nr();
-	} else {
-		dev_err(parent, "Node %s has inconsistent \"linux,pci-domain\" property in DT\n",
-			parent->of_node->full_name);
-		domain = -1;
-	}
-
-	bus->domain_nr = domain;
-}
-#endif
 #endif
 
 /**
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 0817910..d8b76ef 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -480,7 +480,7 @@ void pci_read_bridge_bases(struct pci_bus *child)
 	}
 }
 
-static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
+static struct pci_bus *pci_alloc_bus(void)
 {
 	struct pci_bus *b;
 
@@ -495,10 +495,7 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
 	INIT_LIST_HEAD(&b->resources);
 	b->max_bus_speed = PCI_SPEED_UNKNOWN;
 	b->cur_bus_speed = PCI_SPEED_UNKNOWN;
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
-	if (parent)
-		b->domain_nr = parent->domain_nr;
-#endif
+
 	return b;
 }
 
@@ -645,7 +642,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
 	/*
 	 * Allocate a new bus, and inherit stuff from the parent..
 	 */
-	child = pci_alloc_bus(parent);
+	child = pci_alloc_bus();
 	if (!child)
 		return NULL;
 
@@ -1865,14 +1862,13 @@ static struct pci_bus *pci_create_root_bus(
 	char *fmt;
 
 	parent = bridge->dev.parent;
-	b = pci_alloc_bus(NULL);
+	b = pci_alloc_bus();
 	if (!b)
 		return NULL;
 
 	b->sysdata = dev_get_drvdata(&bridge->dev);
 	b->ops = ops;
 	b->number = b->busn_res.start = bridge->busnum;
-	pci_bus_assign_domain_nr(b, parent);
 
 	bridge->bus = b;
 	b->bridge = get_device(&bridge->dev);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index e7ca546..ac25d2a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -475,9 +475,6 @@ struct pci_bus {
 	unsigned char	primary;	/* number of primary bridge */
 	unsigned char	max_bus_speed;	/* enum pci_bus_speed */
 	unsigned char	cur_bus_speed;	/* enum pci_bus_speed */
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
-	int		domain_nr;
-#endif
 
 	char		name[48];
 
-- 
1.7.1


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

* [PATCH 28/28] PCI: Remove pci_bus_assign_domain_nr()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Now we save the domain number in pci_host_bridge,
we could remove pci_bus_assign_domain_nr() and
clean the domain member in pci_bus.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/pci.c   |   48 +-----------------------------------------------
 drivers/pci/probe.c |   12 ++++--------
 include/linux/pci.h |    3 ---
 3 files changed, 5 insertions(+), 58 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 72232d4..3eb3d8e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4472,6 +4472,7 @@ int pci_domain_nr(struct pci_bus *bus)
 	return host->domain;
 }
 EXPORT_SYMBOL_GPL(pci_domain_nr);
+#endif
 
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
 void pci_host_assign_domain_nr(struct pci_host_bridge *host)
@@ -4519,53 +4520,6 @@ void pci_host_assign_domain_nr(struct pci_host_bridge *host)
 
 	host->domain_nr = domain;
 }
-
-
-void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
-{
-	static int use_dt_domains = -1;
-	int domain = of_get_pci_domain_nr(parent->of_node);
-
-	/*
-	 * Check DT domain and use_dt_domains values.
-	 *
-	 * If DT domain property is valid (domain >= 0) and
-	 * use_dt_domains != 0, the DT assignment is valid since this means
-	 * we have not previously allocated a domain number by using
-	 * pci_get_new_domain_nr(); we should also update use_dt_domains to
-	 * 1, to indicate that we have just assigned a domain number from
-	 * DT.
-	 *
-	 * If DT domain property value is not valid (ie domain < 0), and we
-	 * have not previously assigned a domain number from DT
-	 * (use_dt_domains != 1) we should assign a domain number by
-	 * using the:
-	 *
-	 * pci_get_new_domain_nr()
-	 *
-	 * API and update the use_dt_domains value to keep track of method we
-	 * are using to assign domain numbers (use_dt_domains = 0).
-	 *
-	 * All other combinations imply we have a platform that is trying
-	 * to mix domain numbers obtained from DT and pci_get_new_domain_nr(),
-	 * which is a recipe for domain mishandling and it is prevented by
-	 * invalidating the domain value (domain = -1) and printing a
-	 * corresponding error.
-	 */
-	if (domain >= 0 && use_dt_domains) {
-		use_dt_domains = 1;
-	} else if (domain < 0 && use_dt_domains != 1) {
-		use_dt_domains = 0;
-		domain = pci_get_new_domain_nr();
-	} else {
-		dev_err(parent, "Node %s has inconsistent \"linux,pci-domain\" property in DT\n",
-			parent->of_node->full_name);
-		domain = -1;
-	}
-
-	bus->domain_nr = domain;
-}
-#endif
 #endif
 
 /**
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 0817910..d8b76ef 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -480,7 +480,7 @@ void pci_read_bridge_bases(struct pci_bus *child)
 	}
 }
 
-static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
+static struct pci_bus *pci_alloc_bus(void)
 {
 	struct pci_bus *b;
 
@@ -495,10 +495,7 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
 	INIT_LIST_HEAD(&b->resources);
 	b->max_bus_speed = PCI_SPEED_UNKNOWN;
 	b->cur_bus_speed = PCI_SPEED_UNKNOWN;
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
-	if (parent)
-		b->domain_nr = parent->domain_nr;
-#endif
+
 	return b;
 }
 
@@ -645,7 +642,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
 	/*
 	 * Allocate a new bus, and inherit stuff from the parent..
 	 */
-	child = pci_alloc_bus(parent);
+	child = pci_alloc_bus();
 	if (!child)
 		return NULL;
 
@@ -1865,14 +1862,13 @@ static struct pci_bus *pci_create_root_bus(
 	char *fmt;
 
 	parent = bridge->dev.parent;
-	b = pci_alloc_bus(NULL);
+	b = pci_alloc_bus();
 	if (!b)
 		return NULL;
 
 	b->sysdata = dev_get_drvdata(&bridge->dev);
 	b->ops = ops;
 	b->number = b->busn_res.start = bridge->busnum;
-	pci_bus_assign_domain_nr(b, parent);
 
 	bridge->bus = b;
 	b->bridge = get_device(&bridge->dev);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index e7ca546..ac25d2a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -475,9 +475,6 @@ struct pci_bus {
 	unsigned char	primary;	/* number of primary bridge */
 	unsigned char	max_bus_speed;	/* enum pci_bus_speed */
 	unsigned char	cur_bus_speed;	/* enum pci_bus_speed */
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
-	int		domain_nr;
-#endif
 
 	char		name[48];
 
-- 
1.7.1

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

* [PATCH 28/28] PCI: Remove pci_bus_assign_domain_nr()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we save the domain number in pci_host_bridge,
we could remove pci_bus_assign_domain_nr() and
clean the domain member in pci_bus.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/pci.c   |   48 +-----------------------------------------------
 drivers/pci/probe.c |   12 ++++--------
 include/linux/pci.h |    3 ---
 3 files changed, 5 insertions(+), 58 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 72232d4..3eb3d8e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4472,6 +4472,7 @@ int pci_domain_nr(struct pci_bus *bus)
 	return host->domain;
 }
 EXPORT_SYMBOL_GPL(pci_domain_nr);
+#endif
 
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
 void pci_host_assign_domain_nr(struct pci_host_bridge *host)
@@ -4519,53 +4520,6 @@ void pci_host_assign_domain_nr(struct pci_host_bridge *host)
 
 	host->domain_nr = domain;
 }
-
-
-void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
-{
-	static int use_dt_domains = -1;
-	int domain = of_get_pci_domain_nr(parent->of_node);
-
-	/*
-	 * Check DT domain and use_dt_domains values.
-	 *
-	 * If DT domain property is valid (domain >= 0) and
-	 * use_dt_domains != 0, the DT assignment is valid since this means
-	 * we have not previously allocated a domain number by using
-	 * pci_get_new_domain_nr(); we should also update use_dt_domains to
-	 * 1, to indicate that we have just assigned a domain number from
-	 * DT.
-	 *
-	 * If DT domain property value is not valid (ie domain < 0), and we
-	 * have not previously assigned a domain number from DT
-	 * (use_dt_domains != 1) we should assign a domain number by
-	 * using the:
-	 *
-	 * pci_get_new_domain_nr()
-	 *
-	 * API and update the use_dt_domains value to keep track of method we
-	 * are using to assign domain numbers (use_dt_domains = 0).
-	 *
-	 * All other combinations imply we have a platform that is trying
-	 * to mix domain numbers obtained from DT and pci_get_new_domain_nr(),
-	 * which is a recipe for domain mishandling and it is prevented by
-	 * invalidating the domain value (domain = -1) and printing a
-	 * corresponding error.
-	 */
-	if (domain >= 0 && use_dt_domains) {
-		use_dt_domains = 1;
-	} else if (domain < 0 && use_dt_domains != 1) {
-		use_dt_domains = 0;
-		domain = pci_get_new_domain_nr();
-	} else {
-		dev_err(parent, "Node %s has inconsistent \"linux,pci-domain\" property in DT\n",
-			parent->of_node->full_name);
-		domain = -1;
-	}
-
-	bus->domain_nr = domain;
-}
-#endif
 #endif
 
 /**
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 0817910..d8b76ef 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -480,7 +480,7 @@ void pci_read_bridge_bases(struct pci_bus *child)
 	}
 }
 
-static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
+static struct pci_bus *pci_alloc_bus(void)
 {
 	struct pci_bus *b;
 
@@ -495,10 +495,7 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
 	INIT_LIST_HEAD(&b->resources);
 	b->max_bus_speed = PCI_SPEED_UNKNOWN;
 	b->cur_bus_speed = PCI_SPEED_UNKNOWN;
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
-	if (parent)
-		b->domain_nr = parent->domain_nr;
-#endif
+
 	return b;
 }
 
@@ -645,7 +642,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
 	/*
 	 * Allocate a new bus, and inherit stuff from the parent..
 	 */
-	child = pci_alloc_bus(parent);
+	child = pci_alloc_bus();
 	if (!child)
 		return NULL;
 
@@ -1865,14 +1862,13 @@ static struct pci_bus *pci_create_root_bus(
 	char *fmt;
 
 	parent = bridge->dev.parent;
-	b = pci_alloc_bus(NULL);
+	b = pci_alloc_bus();
 	if (!b)
 		return NULL;
 
 	b->sysdata = dev_get_drvdata(&bridge->dev);
 	b->ops = ops;
 	b->number = b->busn_res.start = bridge->busnum;
-	pci_bus_assign_domain_nr(b, parent);
 
 	bridge->bus = b;
 	b->bridge = get_device(&bridge->dev);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index e7ca546..ac25d2a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -475,9 +475,6 @@ struct pci_bus {
 	unsigned char	primary;	/* number of primary bridge */
 	unsigned char	max_bus_speed;	/* enum pci_bus_speed */
 	unsigned char	cur_bus_speed;	/* enum pci_bus_speed */
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
-	int		domain_nr;
-#endif
 
 	char		name[48];
 
-- 
1.7.1


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

* [PATCH 28/28] PCI: Remove pci_bus_assign_domain_nr()
@ 2015-01-16  1:44   ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-16  1:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jiang Liu, linux-pci, Yinghai Lu, linux-kernel, Marc Zyngier,
	linux-arm-kernel, Russell King, x86, Thomas Gleixner, Tony Luck,
	linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven,
	Yijing Wang

Now we save the domain number in pci_host_bridge,
we could remove pci_bus_assign_domain_nr() and
clean the domain member in pci_bus.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/pci.c   |   48 +-----------------------------------------------
 drivers/pci/probe.c |   12 ++++--------
 include/linux/pci.h |    3 ---
 3 files changed, 5 insertions(+), 58 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 72232d4..3eb3d8e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4472,6 +4472,7 @@ int pci_domain_nr(struct pci_bus *bus)
 	return host->domain;
 }
 EXPORT_SYMBOL_GPL(pci_domain_nr);
+#endif
 
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
 void pci_host_assign_domain_nr(struct pci_host_bridge *host)
@@ -4519,53 +4520,6 @@ void pci_host_assign_domain_nr(struct pci_host_bridge *host)
 
 	host->domain_nr = domain;
 }
-
-
-void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
-{
-	static int use_dt_domains = -1;
-	int domain = of_get_pci_domain_nr(parent->of_node);
-
-	/*
-	 * Check DT domain and use_dt_domains values.
-	 *
-	 * If DT domain property is valid (domain >= 0) and
-	 * use_dt_domains != 0, the DT assignment is valid since this means
-	 * we have not previously allocated a domain number by using
-	 * pci_get_new_domain_nr(); we should also update use_dt_domains to
-	 * 1, to indicate that we have just assigned a domain number from
-	 * DT.
-	 *
-	 * If DT domain property value is not valid (ie domain < 0), and we
-	 * have not previously assigned a domain number from DT
-	 * (use_dt_domains != 1) we should assign a domain number by
-	 * using the:
-	 *
-	 * pci_get_new_domain_nr()
-	 *
-	 * API and update the use_dt_domains value to keep track of method we
-	 * are using to assign domain numbers (use_dt_domains = 0).
-	 *
-	 * All other combinations imply we have a platform that is trying
-	 * to mix domain numbers obtained from DT and pci_get_new_domain_nr(),
-	 * which is a recipe for domain mishandling and it is prevented by
-	 * invalidating the domain value (domain = -1) and printing a
-	 * corresponding error.
-	 */
-	if (domain >= 0 && use_dt_domains) {
-		use_dt_domains = 1;
-	} else if (domain < 0 && use_dt_domains != 1) {
-		use_dt_domains = 0;
-		domain = pci_get_new_domain_nr();
-	} else {
-		dev_err(parent, "Node %s has inconsistent \"linux,pci-domain\" property in DT\n",
-			parent->of_node->full_name);
-		domain = -1;
-	}
-
-	bus->domain_nr = domain;
-}
-#endif
 #endif
 
 /**
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 0817910..d8b76ef 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -480,7 +480,7 @@ void pci_read_bridge_bases(struct pci_bus *child)
 	}
 }
 
-static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
+static struct pci_bus *pci_alloc_bus(void)
 {
 	struct pci_bus *b;
 
@@ -495,10 +495,7 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
 	INIT_LIST_HEAD(&b->resources);
 	b->max_bus_speed = PCI_SPEED_UNKNOWN;
 	b->cur_bus_speed = PCI_SPEED_UNKNOWN;
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
-	if (parent)
-		b->domain_nr = parent->domain_nr;
-#endif
+
 	return b;
 }
 
@@ -645,7 +642,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
 	/*
 	 * Allocate a new bus, and inherit stuff from the parent..
 	 */
-	child = pci_alloc_bus(parent);
+	child = pci_alloc_bus();
 	if (!child)
 		return NULL;
 
@@ -1865,14 +1862,13 @@ static struct pci_bus *pci_create_root_bus(
 	char *fmt;
 
 	parent = bridge->dev.parent;
-	b = pci_alloc_bus(NULL);
+	b = pci_alloc_bus();
 	if (!b)
 		return NULL;
 
 	b->sysdata = dev_get_drvdata(&bridge->dev);
 	b->ops = ops;
 	b->number = b->busn_res.start = bridge->busnum;
-	pci_bus_assign_domain_nr(b, parent);
 
 	bridge->bus = b;
 	b->bridge = get_device(&bridge->dev);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index e7ca546..ac25d2a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -475,9 +475,6 @@ struct pci_bus {
 	unsigned char	primary;	/* number of primary bridge */
 	unsigned char	max_bus_speed;	/* enum pci_bus_speed */
 	unsigned char	cur_bus_speed;	/* enum pci_bus_speed */
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
-	int		domain_nr;
-#endif
 
 	char		name[48];
 
-- 
1.7.1

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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
  2015-01-16  1:44   ` Yijing Wang
                       ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  9:08     ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:08 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

On Friday 16 January 2015 09:44:06 Yijing Wang wrote:
> Introduce pci_host_assign_domain_nr() to assign domain
> number for pci_host_bridge. Later we will remove
> pci_bus_assign_domain_nr().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>

I'm confused: the same code is already part of the PCI tree, but with
Lorenzo Pieralisi listed as the patch author. The code is good,
and I acked it in the past, but one of you is (probably by accident)
misattributing the patch.

Assuming that the patch that is already merged in next is the right
one, I think you should rebase your series on top of

git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next

to avoid conflicts like this one.

	Arnd

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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
  2015-01-16  1:44   ` Yijing Wang
                     ` (3 preceding siblings ...)
  (?)
@ 2015-01-16  9:08   ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:08 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

On Friday 16 January 2015 09:44:06 Yijing Wang wrote:
> Introduce pci_host_assign_domain_nr() to assign domain
> number for pci_host_bridge. Later we will remove
> pci_bus_assign_domain_nr().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>

I'm confused: the same code is already part of the PCI tree, but with
Lorenzo Pieralisi listed as the patch author. The code is good,
and I acked it in the past, but one of you is (probably by accident)
misattributing the patch.

Assuming that the patch that is already merged in next is the right
one, I think you should rebase your series on top of

git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next

to avoid conflicts like this one.

	Arnd

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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-16  9:08     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:08 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

On Friday 16 January 2015 09:44:06 Yijing Wang wrote:
> Introduce pci_host_assign_domain_nr() to assign domain
> number for pci_host_bridge. Later we will remove
> pci_bus_assign_domain_nr().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>

I'm confused: the same code is already part of the PCI tree, but with
Lorenzo Pieralisi listed as the patch author. The code is good,
and I acked it in the past, but one of you is (probably by accident)
misattributing the patch.

Assuming that the patch that is already merged in next is the right
one, I think you should rebase your series on top of

git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next

to avoid conflicts like this one.

	Arnd

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

* [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-16  9:08     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 16 January 2015 09:44:06 Yijing Wang wrote:
> Introduce pci_host_assign_domain_nr() to assign domain
> number for pci_host_bridge. Later we will remove
> pci_bus_assign_domain_nr().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>

I'm confused: the same code is already part of the PCI tree, but with
Lorenzo Pieralisi listed as the patch author. The code is good,
and I acked it in the past, but one of you is (probably by accident)
misattributing the patch.

Assuming that the patch that is already merged in next is the right
one, I think you should rebase your series on top of

git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next

to avoid conflicts like this one.

	Arnd

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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-16  9:08     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:08 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

On Friday 16 January 2015 09:44:06 Yijing Wang wrote:
> Introduce pci_host_assign_domain_nr() to assign domain
> number for pci_host_bridge. Later we will remove
> pci_bus_assign_domain_nr().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>

I'm confused: the same code is already part of the PCI tree, but with
Lorenzo Pieralisi listed as the patch author. The code is good,
and I acked it in the past, but one of you is (probably by accident)
misattributing the patch.

Assuming that the patch that is already merged in next is the right
one, I think you should rebase your series on top of

git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next

to avoid conflicts like this one.

	Arnd

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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-16  9:08     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:08 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Liviu Dudau, Tony Luck, Russell King, Marc Zyngier, linux-pci,
	x86, linux-kernel, Jiang Liu, Bjorn Helgaas, linux-m68k,
	Lorenzo Pieralisi, Geert Uytterhoeven, linux-alpha, Yijing Wang,
	linux-ia64, Thomas Gleixner, Guan Xuetao, Yinghai Lu,
	David S. Miller

On Friday 16 January 2015 09:44:06 Yijing Wang wrote:
> Introduce pci_host_assign_domain_nr() to assign domain
> number for pci_host_bridge. Later we will remove
> pci_bus_assign_domain_nr().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>

I'm confused: the same code is already part of the PCI tree, but with
Lorenzo Pieralisi listed as the patch author. The code is good,
and I acked it in the past, but one of you is (probably by accident)
misattributing the patch.

Assuming that the patch that is already merged in next is the right
one, I think you should rebase your series on top of

git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next

to avoid conflicts like this one.

	Arnd

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

* Re: [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
  2015-01-16  1:44   ` Yijing Wang
  (?)
  (?)
@ 2015-01-16  9:14     ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:14 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Friday 16 January 2015 09:44:07 Yijing Wang wrote:
> We want to make a generic pci_host_bridge, then we could
> place common PCI infos like domain number in it. Ripping
> out pci_host_bridge creation from pci_create_root_bus()
> make code more better readability. Further more, we could
> use the generic pci_host_bridge to hold host bridge specific
> operations like pcibios_root_bridge_prepare().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 

I assume this patch is doing the right thing, but the description
above doesn't really tell me enough to be sure.

This is supposed to be transparent to the callers, right? If
so, please mention it explicitly in the text.

Also you don't explain what the list of host bridges is
used for. Maybe you can split this out into a separate patch
so you have one patch that just moves code from one file
to the other but no functional changes, and a second patch
that exports pci_create_host_bridge and introduces the list,
with an explanation of what it is used for.

	Arnd

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

* Re: [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
  2015-01-16  1:44   ` Yijing Wang
                     ` (4 preceding siblings ...)
  (?)
@ 2015-01-16  9:14   ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:14 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Friday 16 January 2015 09:44:07 Yijing Wang wrote:
> We want to make a generic pci_host_bridge, then we could
> place common PCI infos like domain number in it. Ripping
> out pci_host_bridge creation from pci_create_root_bus()
> make code more better readability. Further more, we could
> use the generic pci_host_bridge to hold host bridge specific
> operations like pcibios_root_bridge_prepare().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 

I assume this patch is doing the right thing, but the description
above doesn't really tell me enough to be sure.

This is supposed to be transparent to the callers, right? If
so, please mention it explicitly in the text.

Also you don't explain what the list of host bridges is
used for. Maybe you can split this out into a separate patch
so you have one patch that just moves code from one file
to the other but no functional changes, and a second patch
that exports pci_create_host_bridge and introduces the list,
with an explanation of what it is used for.

	Arnd

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

* Re: [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
@ 2015-01-16  9:14     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:14 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Friday 16 January 2015 09:44:07 Yijing Wang wrote:
> We want to make a generic pci_host_bridge, then we could
> place common PCI infos like domain number in it. Ripping
> out pci_host_bridge creation from pci_create_root_bus()
> make code more better readability. Further more, we could
> use the generic pci_host_bridge to hold host bridge specific
> operations like pcibios_root_bridge_prepare().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 

I assume this patch is doing the right thing, but the description
above doesn't really tell me enough to be sure.

This is supposed to be transparent to the callers, right? If
so, please mention it explicitly in the text.

Also you don't explain what the list of host bridges is
used for. Maybe you can split this out into a separate patch
so you have one patch that just moves code from one file
to the other but no functional changes, and a second patch
that exports pci_create_host_bridge and introduces the list,
with an explanation of what it is used for.

	Arnd

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

* [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
@ 2015-01-16  9:14     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 16 January 2015 09:44:07 Yijing Wang wrote:
> We want to make a generic pci_host_bridge, then we could
> place common PCI infos like domain number in it. Ripping
> out pci_host_bridge creation from pci_create_root_bus()
> make code more better readability. Further more, we could
> use the generic pci_host_bridge to hold host bridge specific
> operations like pcibios_root_bridge_prepare().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 

I assume this patch is doing the right thing, but the description
above doesn't really tell me enough to be sure.

This is supposed to be transparent to the callers, right? If
so, please mention it explicitly in the text.

Also you don't explain what the list of host bridges is
used for. Maybe you can split this out into a separate patch
so you have one patch that just moves code from one file
to the other but no functional changes, and a second patch
that exports pci_create_host_bridge and introduces the list,
with an explanation of what it is used for.

	Arnd

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

* Re: [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
@ 2015-01-16  9:14     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:14 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Friday 16 January 2015 09:44:07 Yijing Wang wrote:
> We want to make a generic pci_host_bridge, then we could
> place common PCI infos like domain number in it. Ripping
> out pci_host_bridge creation from pci_create_root_bus()
> make code more better readability. Further more, we could
> use the generic pci_host_bridge to hold host bridge specific
> operations like pcibios_root_bridge_prepare().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 

I assume this patch is doing the right thing, but the description
above doesn't really tell me enough to be sure.

This is supposed to be transparent to the callers, right? If
so, please mention it explicitly in the text.

Also you don't explain what the list of host bridges is
used for. Maybe you can split this out into a separate patch
so you have one patch that just moves code from one file
to the other but no functional changes, and a second patch
that exports pci_create_host_bridge and introduces the list,
with an explanation of what it is used for.

	Arnd

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

* Re: [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
  2015-01-16  1:44   ` Yijing Wang
  (?)
  (?)
@ 2015-01-16  9:18     ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:18 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Friday 16 January 2015 09:44:08 Yijing Wang wrote:
> @@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
>  {
>         struct pci_host_bridge *host;
>  
> -       host = pci_create_host_bridge(parent, db, resources);
> +       host = pci_create_host_bridge(parent, db, resources, sysdata);
>         if (!host)
>                 return NULL;
>  
> -       return __pci_scan_root_bus(host, ops, sysdata);
> +       return __pci_scan_root_bus(host, ops);
>  }
>  EXPORT_SYMBOL(pci_scan_root_bus);
> 

How about keeping the sysdata out of the pci_create_host_bridge interface, and
refactoring it so that the call sequence becomes

	host = pci_create_host_bridge(parent, db, resources);
	host->sysdata = sysdata;
	__pci_scan_root_bus(host, ops);

This way, we can make sysdata completely option. I assume that more of the
fields we have in sysdata today can get moved into pci_host_bridge
over time, so a host bridge driver can just assign those members individually
between pci_create_host_bridge and __pci_scan_root_bus.

	Arnd

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

* Re: [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
@ 2015-01-16  9:18     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:18 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Friday 16 January 2015 09:44:08 Yijing Wang wrote:
> @@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
>  {
>         struct pci_host_bridge *host;
>  
> -       host = pci_create_host_bridge(parent, db, resources);
> +       host = pci_create_host_bridge(parent, db, resources, sysdata);
>         if (!host)
>                 return NULL;
>  
> -       return __pci_scan_root_bus(host, ops, sysdata);
> +       return __pci_scan_root_bus(host, ops);
>  }
>  EXPORT_SYMBOL(pci_scan_root_bus);
> 

How about keeping the sysdata out of the pci_create_host_bridge interface, and
refactoring it so that the call sequence becomes

	host = pci_create_host_bridge(parent, db, resources);
	host->sysdata = sysdata;
	__pci_scan_root_bus(host, ops);

This way, we can make sysdata completely option. I assume that more of the
fields we have in sysdata today can get moved into pci_host_bridge
over time, so a host bridge driver can just assign those members individually
between pci_create_host_bridge and __pci_scan_root_bus.

	Arnd

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

* [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
@ 2015-01-16  9:18     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:18 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 16 January 2015 09:44:08 Yijing Wang wrote:
> @@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
>  {
>         struct pci_host_bridge *host;
>  
> -       host = pci_create_host_bridge(parent, db, resources);
> +       host = pci_create_host_bridge(parent, db, resources, sysdata);
>         if (!host)
>                 return NULL;
>  
> -       return __pci_scan_root_bus(host, ops, sysdata);
> +       return __pci_scan_root_bus(host, ops);
>  }
>  EXPORT_SYMBOL(pci_scan_root_bus);
> 

How about keeping the sysdata out of the pci_create_host_bridge interface, and
refactoring it so that the call sequence becomes

	host = pci_create_host_bridge(parent, db, resources);
	host->sysdata = sysdata;
	__pci_scan_root_bus(host, ops);

This way, we can make sysdata completely option. I assume that more of the
fields we have in sysdata today can get moved into pci_host_bridge
over time, so a host bridge driver can just assign those members individually
between pci_create_host_bridge and __pci_scan_root_bus.

	Arnd

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

* Re: [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
@ 2015-01-16  9:18     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:18 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Friday 16 January 2015 09:44:08 Yijing Wang wrote:
> @@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
>  {
>         struct pci_host_bridge *host;
>  
> -       host = pci_create_host_bridge(parent, db, resources);
> +       host = pci_create_host_bridge(parent, db, resources, sysdata);
>         if (!host)
>                 return NULL;
>  
> -       return __pci_scan_root_bus(host, ops, sysdata);
> +       return __pci_scan_root_bus(host, ops);
>  }
>  EXPORT_SYMBOL(pci_scan_root_bus);
> 

How about keeping the sysdata out of the pci_create_host_bridge interface, and
refactoring it so that the call sequence becomes

	host = pci_create_host_bridge(parent, db, resources);
	host->sysdata = sysdata;
	__pci_scan_root_bus(host, ops);

This way, we can make sysdata completely option. I assume that more of the
fields we have in sysdata today can get moved into pci_host_bridge
over time, so a host bridge driver can just assign those members individually
between pci_create_host_bridge and __pci_scan_root_bus.

	Arnd

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

* Re: [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge
  2015-01-16  1:44   ` Yijing Wang
  (?)
  (?)
@ 2015-01-16  9:23     ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:23 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On Friday 16 January 2015 09:44:09 Yijing Wang wrote:
> @@ -2064,7 +2073,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
>  {
>         struct pci_host_bridge *host;
>  
> -       host = pci_create_host_bridge(parent, db, resources, sysdata);
> +       host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
>         if (!host)
>                 return NULL;
>  
> 

Same comment as for patch 10: If we leave this out of the pci_create_host_bridge
argument but set it later, þe interface becomes simpler for callers that
don't have custom pci_host_bridge_ops.

This would break your phb_prepare() callback, but I assume a host driver
can just make a direct function call before entering pci_create_host_bridge
for this. Let me know if I'm missing something here.

	Arnd

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

* Re: [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge
  2015-01-16  1:44   ` Yijing Wang
                     ` (4 preceding siblings ...)
  (?)
@ 2015-01-16  9:23   ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:23 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On Friday 16 January 2015 09:44:09 Yijing Wang wrote:
> @@ -2064,7 +2073,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
>  {
>         struct pci_host_bridge *host;
>  
> -       host = pci_create_host_bridge(parent, db, resources, sysdata);
> +       host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
>         if (!host)
>                 return NULL;
>  
> 

Same comment as for patch 10: If we leave this out of the pci_create_host_bridge
argument but set it later, þe interface becomes simpler for callers that
don't have custom pci_host_bridge_ops.

This would break your phb_prepare() callback, but I assume a host driver
can just make a direct function call before entering pci_create_host_bridge
for this. Let me know if I'm missing something here.

	Arnd

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

* Re: [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge
@ 2015-01-16  9:23     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:23 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On Friday 16 January 2015 09:44:09 Yijing Wang wrote:
> @@ -2064,7 +2073,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
>  {
>         struct pci_host_bridge *host;
>  
> -       host = pci_create_host_bridge(parent, db, resources, sysdata);
> +       host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
>         if (!host)
>                 return NULL;
>  
> 

Same comment as for patch 10: If we leave this out of the pci_create_host_bridge
argument but set it later, þe interface becomes simpler for callers that
don't have custom pci_host_bridge_ops.

This would break your phb_prepare() callback, but I assume a host driver
can just make a direct function call before entering pci_create_host_bridge
for this. Let me know if I'm missing something here.

	Arnd

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

* [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge
@ 2015-01-16  9:23     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 16 January 2015 09:44:09 Yijing Wang wrote:
> @@ -2064,7 +2073,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
>  {
>         struct pci_host_bridge *host;
>  
> -       host = pci_create_host_bridge(parent, db, resources, sysdata);
> +       host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
>         if (!host)
>                 return NULL;
>  
> 

Same comment as for patch 10: If we leave this out of the pci_create_host_bridge
argument but set it later, ?e interface becomes simpler for callers that
don't have custom pci_host_bridge_ops.

This would break your phb_prepare() callback, but I assume a host driver
can just make a direct function call before entering pci_create_host_bridge
for this. Let me know if I'm missing something here.

	Arnd

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

* Re: [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge
@ 2015-01-16  9:23     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:23 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On Friday 16 January 2015 09:44:09 Yijing Wang wrote:
> @@ -2064,7 +2073,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
>  {
>         struct pci_host_bridge *host;
>  
> -       host = pci_create_host_bridge(parent, db, resources, sysdata);
> +       host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
>         if (!host)
>                 return NULL;
>  
> 

Same comment as for patch 10: If we leave this out of the pci_create_host_bridge
argument but set it later, þe interface becomes simpler for callers that
don't have custom pci_host_bridge_ops.

This would break your phb_prepare() callback, but I assume a host driver
can just make a direct function call before entering pci_create_host_bridge
for this. Let me know if I'm missing something here.

	Arnd

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

* Re: [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
  2015-01-16  1:44   ` Yijing Wang
  (?)
  (?)
@ 2015-01-16  9:34     ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:34 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Friday 16 January 2015 09:44:07 Yijing Wang wrote:
> We want to make a generic pci_host_bridge, then we could
> place common PCI infos like domain number in it. Ripping
> out pci_host_bridge creation from pci_create_root_bus()
> make code more better readability. Further more, we could
> use the generic pci_host_bridge to hold host bridge specific
> operations like pcibios_root_bridge_prepare().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 

I assume this patch is doing the right thing, but the description
above doesn't really tell me enough to be sure.

This is supposed to be transparent to the callers, right? If
so, please mention it explicitly in the text.

Also you don't explain what the list of host bridges is
used for. Maybe you can split this out into a separate patch
so you have one patch that just moves code from one file
to the other but no functional changes, and a second patch
that exports pci_create_host_bridge and introduces the list,
with an explanation of what it is used for.

	Arnd

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

* Re: [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
  2015-01-16  1:44   ` Yijing Wang
                     ` (5 preceding siblings ...)
  (?)
@ 2015-01-16  9:34   ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:34 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Friday 16 January 2015 09:44:07 Yijing Wang wrote:
> We want to make a generic pci_host_bridge, then we could
> place common PCI infos like domain number in it. Ripping
> out pci_host_bridge creation from pci_create_root_bus()
> make code more better readability. Further more, we could
> use the generic pci_host_bridge to hold host bridge specific
> operations like pcibios_root_bridge_prepare().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 

I assume this patch is doing the right thing, but the description
above doesn't really tell me enough to be sure.

This is supposed to be transparent to the callers, right? If
so, please mention it explicitly in the text.

Also you don't explain what the list of host bridges is
used for. Maybe you can split this out into a separate patch
so you have one patch that just moves code from one file
to the other but no functional changes, and a second patch
that exports pci_create_host_bridge and introduces the list,
with an explanation of what it is used for.

	Arnd

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

* Re: [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
@ 2015-01-16  9:34     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:34 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Friday 16 January 2015 09:44:07 Yijing Wang wrote:
> We want to make a generic pci_host_bridge, then we could
> place common PCI infos like domain number in it. Ripping
> out pci_host_bridge creation from pci_create_root_bus()
> make code more better readability. Further more, we could
> use the generic pci_host_bridge to hold host bridge specific
> operations like pcibios_root_bridge_prepare().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 

I assume this patch is doing the right thing, but the description
above doesn't really tell me enough to be sure.

This is supposed to be transparent to the callers, right? If
so, please mention it explicitly in the text.

Also you don't explain what the list of host bridges is
used for. Maybe you can split this out into a separate patch
so you have one patch that just moves code from one file
to the other but no functional changes, and a second patch
that exports pci_create_host_bridge and introduces the list,
with an explanation of what it is used for.

	Arnd

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

* [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
@ 2015-01-16  9:34     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 16 January 2015 09:44:07 Yijing Wang wrote:
> We want to make a generic pci_host_bridge, then we could
> place common PCI infos like domain number in it. Ripping
> out pci_host_bridge creation from pci_create_root_bus()
> make code more better readability. Further more, we could
> use the generic pci_host_bridge to hold host bridge specific
> operations like pcibios_root_bridge_prepare().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 

I assume this patch is doing the right thing, but the description
above doesn't really tell me enough to be sure.

This is supposed to be transparent to the callers, right? If
so, please mention it explicitly in the text.

Also you don't explain what the list of host bridges is
used for. Maybe you can split this out into a separate patch
so you have one patch that just moves code from one file
to the other but no functional changes, and a second patch
that exports pci_create_host_bridge and introduces the list,
with an explanation of what it is used for.

	Arnd

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

* Re: [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
@ 2015-01-16  9:34     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:34 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Friday 16 January 2015 09:44:07 Yijing Wang wrote:
> We want to make a generic pci_host_bridge, then we could
> place common PCI infos like domain number in it. Ripping
> out pci_host_bridge creation from pci_create_root_bus()
> make code more better readability. Further more, we could
> use the generic pci_host_bridge to hold host bridge specific
> operations like pcibios_root_bridge_prepare().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 

I assume this patch is doing the right thing, but the description
above doesn't really tell me enough to be sure.

This is supposed to be transparent to the callers, right? If
so, please mention it explicitly in the text.

Also you don't explain what the list of host bridges is
used for. Maybe you can split this out into a separate patch
so you have one patch that just moves code from one file
to the other but no functional changes, and a second patch
that exports pci_create_host_bridge and introduces the list,
with an explanation of what it is used for.

	Arnd

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

* Re: [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge
  2015-01-16  9:23     ` Arnd Bergmann
  (?)
  (?)
@ 2015-01-16  9:35       ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:35 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On Friday 16 January 2015 10:23:11 Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:09 Yijing Wang wrote:
> > @@ -2064,7 +2073,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
> >  {
> >         struct pci_host_bridge *host;
> >  
> > -       host = pci_create_host_bridge(parent, db, resources, sysdata);
> > +       host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
> >         if (!host)
> >                 return NULL;
> >  
> > 
> 
> Same comment as for patch 10: If we leave this out of the pci_create_host_bridge
> argument but set it later, þe interface becomes simpler for callers that
> don't have custom pci_host_bridge_ops.
> 
> This would break your phb_prepare() callback, but I assume a host driver
> can just make a direct function call before entering pci_create_host_bridge
> for this. Let me know if I'm missing something here.

I've read the later patches now that explain why it's needed, so nevermind
my comment above.

	Arnd

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

* Re: [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge
  2015-01-16  9:23     ` Arnd Bergmann
                       ` (2 preceding siblings ...)
  (?)
@ 2015-01-16  9:35     ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:35 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On Friday 16 January 2015 10:23:11 Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:09 Yijing Wang wrote:
> > @@ -2064,7 +2073,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
> >  {
> >         struct pci_host_bridge *host;
> >  
> > -       host = pci_create_host_bridge(parent, db, resources, sysdata);
> > +       host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
> >         if (!host)
> >                 return NULL;
> >  
> > 
> 
> Same comment as for patch 10: If we leave this out of the pci_create_host_bridge
> argument but set it later, þe interface becomes simpler for callers that
> don't have custom pci_host_bridge_ops.
> 
> This would break your phb_prepare() callback, but I assume a host driver
> can just make a direct function call before entering pci_create_host_bridge
> for this. Let me know if I'm missing something here.

I've read the later patches now that explain why it's needed, so nevermind
my comment above.

	Arnd

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

* Re: [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge
@ 2015-01-16  9:35       ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:35 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On Friday 16 January 2015 10:23:11 Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:09 Yijing Wang wrote:
> > @@ -2064,7 +2073,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
> >  {
> >         struct pci_host_bridge *host;
> >  
> > -       host = pci_create_host_bridge(parent, db, resources, sysdata);
> > +       host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
> >         if (!host)
> >                 return NULL;
> >  
> > 
> 
> Same comment as for patch 10: If we leave this out of the pci_create_host_bridge
> argument but set it later, þe interface becomes simpler for callers that
> don't have custom pci_host_bridge_ops.
> 
> This would break your phb_prepare() callback, but I assume a host driver
> can just make a direct function call before entering pci_create_host_bridge
> for this. Let me know if I'm missing something here.

I've read the later patches now that explain why it's needed, so nevermind
my comment above.

	Arnd

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

* [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge
@ 2015-01-16  9:35       ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 16 January 2015 10:23:11 Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:09 Yijing Wang wrote:
> > @@ -2064,7 +2073,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
> >  {
> >         struct pci_host_bridge *host;
> >  
> > -       host = pci_create_host_bridge(parent, db, resources, sysdata);
> > +       host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
> >         if (!host)
> >                 return NULL;
> >  
> > 
> 
> Same comment as for patch 10: If we leave this out of the pci_create_host_bridge
> argument but set it later, ?e interface becomes simpler for callers that
> don't have custom pci_host_bridge_ops.
> 
> This would break your phb_prepare() callback, but I assume a host driver
> can just make a direct function call before entering pci_create_host_bridge
> for this. Let me know if I'm missing something here.

I've read the later patches now that explain why it's needed, so nevermind
my comment above.

	Arnd

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

* Re: [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge
@ 2015-01-16  9:35       ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:35 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On Friday 16 January 2015 10:23:11 Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:09 Yijing Wang wrote:
> > @@ -2064,7 +2073,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
> >  {
> >         struct pci_host_bridge *host;
> >  
> > -       host = pci_create_host_bridge(parent, db, resources, sysdata);
> > +       host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
> >         if (!host)
> >                 return NULL;
> >  
> > 
> 
> Same comment as for patch 10: If we leave this out of the pci_create_host_bridge
> argument but set it later, þe interface becomes simpler for callers that
> don't have custom pci_host_bridge_ops.
> 
> This would break your phb_prepare() callback, but I assume a host driver
> can just make a direct function call before entering pci_create_host_bridge
> for this. Let me know if I'm missing something here.

I've read the later patches now that explain why it's needed, so nevermind
my comment above.

	Arnd

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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
  2015-01-16  9:08     ` Arnd Bergmann
  (?)
  (?)
@ 2015-01-16  9:40       ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:40 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

On Friday 16 January 2015 10:08:45 Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:06 Yijing Wang wrote:
> > Introduce pci_host_assign_domain_nr() to assign domain
> > number for pci_host_bridge. Later we will remove
> > pci_bus_assign_domain_nr().
> > 
> > Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 
> I'm confused: the same code is already part of the PCI tree, but with
> Lorenzo Pieralisi listed as the patch author. The code is good,
> and I acked it in the past, but one of you is (probably by accident)
> misattributing the patch.
> 
> Assuming that the patch that is already merged in next is the right
> one, I think you should rebase your series on top of
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
> 
> to avoid conflicts like this one.
>

I think I just got confused because the code duplicates most of
pci_bus_assign_domain_nr(). Maybe this can be done in a better way
by splitting the existing function into 

static int pci_assign_domain_nr(struct device *)
{
	... /* most of pci_bus_assign_domain_nr */

	return domain;
}

void pci_host_assign_domain_nr(struct pci_host_bridge *host)
{
	host->domain = pci_assign_domain_nr(host->dev.parent);
}

void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
{
	bus->domain_nr = pci_assign_domain_nr(parent);
}

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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
  2015-01-16  9:08     ` Arnd Bergmann
                       ` (3 preceding siblings ...)
  (?)
@ 2015-01-16  9:40     ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:40 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

On Friday 16 January 2015 10:08:45 Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:06 Yijing Wang wrote:
> > Introduce pci_host_assign_domain_nr() to assign domain
> > number for pci_host_bridge. Later we will remove
> > pci_bus_assign_domain_nr().
> > 
> > Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 
> I'm confused: the same code is already part of the PCI tree, but with
> Lorenzo Pieralisi listed as the patch author. The code is good,
> and I acked it in the past, but one of you is (probably by accident)
> misattributing the patch.
> 
> Assuming that the patch that is already merged in next is the right
> one, I think you should rebase your series on top of
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
> 
> to avoid conflicts like this one.
>

I think I just got confused because the code duplicates most of
pci_bus_assign_domain_nr(). Maybe this can be done in a better way
by splitting the existing function into 

static int pci_assign_domain_nr(struct device *)
{
	... /* most of pci_bus_assign_domain_nr */

	return domain;
}

void pci_host_assign_domain_nr(struct pci_host_bridge *host)
{
	host->domain = pci_assign_domain_nr(host->dev.parent);
}

void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
{
	bus->domain_nr = pci_assign_domain_nr(parent);
}

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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-16  9:40       ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:40 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

On Friday 16 January 2015 10:08:45 Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:06 Yijing Wang wrote:
> > Introduce pci_host_assign_domain_nr() to assign domain
> > number for pci_host_bridge. Later we will remove
> > pci_bus_assign_domain_nr().
> > 
> > Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 
> I'm confused: the same code is already part of the PCI tree, but with
> Lorenzo Pieralisi listed as the patch author. The code is good,
> and I acked it in the past, but one of you is (probably by accident)
> misattributing the patch.
> 
> Assuming that the patch that is already merged in next is the right
> one, I think you should rebase your series on top of
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
> 
> to avoid conflicts like this one.
>

I think I just got confused because the code duplicates most of
pci_bus_assign_domain_nr(). Maybe this can be done in a better way
by splitting the existing function into 

static int pci_assign_domain_nr(struct device *)
{
	... /* most of pci_bus_assign_domain_nr */

	return domain;
}

void pci_host_assign_domain_nr(struct pci_host_bridge *host)
{
	host->domain = pci_assign_domain_nr(host->dev.parent);
}

void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
{
	bus->domain_nr = pci_assign_domain_nr(parent);
}

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

* [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-16  9:40       ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 16 January 2015 10:08:45 Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:06 Yijing Wang wrote:
> > Introduce pci_host_assign_domain_nr() to assign domain
> > number for pci_host_bridge. Later we will remove
> > pci_bus_assign_domain_nr().
> > 
> > Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 
> I'm confused: the same code is already part of the PCI tree, but with
> Lorenzo Pieralisi listed as the patch author. The code is good,
> and I acked it in the past, but one of you is (probably by accident)
> misattributing the patch.
> 
> Assuming that the patch that is already merged in next is the right
> one, I think you should rebase your series on top of
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
> 
> to avoid conflicts like this one.
>

I think I just got confused because the code duplicates most of
pci_bus_assign_domain_nr(). Maybe this can be done in a better way
by splitting the existing function into 

static int pci_assign_domain_nr(struct device *)
{
	... /* most of pci_bus_assign_domain_nr */

	return domain;
}

void pci_host_assign_domain_nr(struct pci_host_bridge *host)
{
	host->domain = pci_assign_domain_nr(host->dev.parent);
}

void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
{
	bus->domain_nr = pci_assign_domain_nr(parent);
}

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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-16  9:40       ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:40 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

On Friday 16 January 2015 10:08:45 Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:06 Yijing Wang wrote:
> > Introduce pci_host_assign_domain_nr() to assign domain
> > number for pci_host_bridge. Later we will remove
> > pci_bus_assign_domain_nr().
> > 
> > Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 
> I'm confused: the same code is already part of the PCI tree, but with
> Lorenzo Pieralisi listed as the patch author. The code is good,
> and I acked it in the past, but one of you is (probably by accident)
> misattributing the patch.
> 
> Assuming that the patch that is already merged in next is the right
> one, I think you should rebase your series on top of
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
> 
> to avoid conflicts like this one.
>

I think I just got confused because the code duplicates most of
pci_bus_assign_domain_nr(). Maybe this can be done in a better way
by splitting the existing function into 

static int pci_assign_domain_nr(struct device *)
{
	... /* most of pci_bus_assign_domain_nr */

	return domain;
}

void pci_host_assign_domain_nr(struct pci_host_bridge *host)
{
	host->domain = pci_assign_domain_nr(host->dev.parent);
}

void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
{
	bus->domain_nr = pci_assign_domain_nr(parent);
}

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

* Re: [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
  2015-01-16  1:44   ` Yijing Wang
  (?)
  (?)
@ 2015-01-16  9:44     ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:44 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On Friday 16 January 2015 09:44:25 Yijing Wang wrote:
> 
> +int pci_domain_nr(struct pci_bus *bus)
> +{
> +       struct pci_host_bridge *host = find_pci_host_bridge(bus);
> +
> +       return host->domain;
> +}
> +EXPORT_SYMBOL_GPL(pci_domain_nr);
> +

Since most of the existing functions are exported as EXPORT_SYMBOL
rather than EXPORT_SYMBOL_GPL, I think the new version should do
the same.

	Arnd

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

* Re: [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
  2015-01-16  1:44   ` Yijing Wang
                     ` (3 preceding siblings ...)
  (?)
@ 2015-01-16  9:44   ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:44 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On Friday 16 January 2015 09:44:25 Yijing Wang wrote:
> 
> +int pci_domain_nr(struct pci_bus *bus)
> +{
> +       struct pci_host_bridge *host = find_pci_host_bridge(bus);
> +
> +       return host->domain;
> +}
> +EXPORT_SYMBOL_GPL(pci_domain_nr);
> +

Since most of the existing functions are exported as EXPORT_SYMBOL
rather than EXPORT_SYMBOL_GPL, I think the new version should do
the same.

	Arnd

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

* Re: [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
@ 2015-01-16  9:44     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:44 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On Friday 16 January 2015 09:44:25 Yijing Wang wrote:
> 
> +int pci_domain_nr(struct pci_bus *bus)
> +{
> +       struct pci_host_bridge *host = find_pci_host_bridge(bus);
> +
> +       return host->domain;
> +}
> +EXPORT_SYMBOL_GPL(pci_domain_nr);
> +

Since most of the existing functions are exported as EXPORT_SYMBOL
rather than EXPORT_SYMBOL_GPL, I think the new version should do
the same.

	Arnd

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

* [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
@ 2015-01-16  9:44     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 16 January 2015 09:44:25 Yijing Wang wrote:
> 
> +int pci_domain_nr(struct pci_bus *bus)
> +{
> +       struct pci_host_bridge *host = find_pci_host_bridge(bus);
> +
> +       return host->domain;
> +}
> +EXPORT_SYMBOL_GPL(pci_domain_nr);
> +

Since most of the existing functions are exported as EXPORT_SYMBOL
rather than EXPORT_SYMBOL_GPL, I think the new version should do
the same.

	Arnd

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

* Re: [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
@ 2015-01-16  9:44     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16  9:44 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On Friday 16 January 2015 09:44:25 Yijing Wang wrote:
> 
> +int pci_domain_nr(struct pci_bus *bus)
> +{
> +       struct pci_host_bridge *host = find_pci_host_bridge(bus);
> +
> +       return host->domain;
> +}
> +EXPORT_SYMBOL_GPL(pci_domain_nr);
> +

Since most of the existing functions are exported as EXPORT_SYMBOL
rather than EXPORT_SYMBOL_GPL, I think the new version should do
the same.

	Arnd

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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
  2015-01-16  1:44   ` Yijing Wang
  (?)
  (?)
@ 2015-01-16 10:01     ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16 10:01 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
> +static void pci_host_bridge_probe_mode(
> +               struct pci_host_bridge *host)
> +{
> +       host->of_scan = true;
> +}
> 

I probably missed something here, but where does host->of_scan
get used?

	Arnd

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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
  2015-01-16  1:44   ` Yijing Wang
                     ` (3 preceding siblings ...)
  (?)
@ 2015-01-16 10:01   ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16 10:01 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
> +static void pci_host_bridge_probe_mode(
> +               struct pci_host_bridge *host)
> +{
> +       host->of_scan = true;
> +}
> 

I probably missed something here, but where does host->of_scan
get used?

	Arnd

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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-16 10:01     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16 10:01 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
> +static void pci_host_bridge_probe_mode(
> +               struct pci_host_bridge *host)
> +{
> +       host->of_scan = true;
> +}
> 

I probably missed something here, but where does host->of_scan
get used?

	Arnd

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

* [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-16 10:01     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16 10:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
> +static void pci_host_bridge_probe_mode(
> +               struct pci_host_bridge *host)
> +{
> +       host->of_scan = true;
> +}
> 

I probably missed something here, but where does host->of_scan
get used?

	Arnd

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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-16 10:01     ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16 10:01 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
> +static void pci_host_bridge_probe_mode(
> +               struct pci_host_bridge *host)
> +{
> +       host->of_scan = true;
> +}
> 

I probably missed something here, but where does host->of_scan
get used?

	Arnd

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

* Re: [PATCH 00/28] Refine PCI scan interfaces and make generic pci host bridge
  2015-01-16  1:43 ` Yijing Wang
  (?)
  (?)
@ 2015-01-16 10:12   ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16 10:12 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On Friday 16 January 2015 09:43:58 Yijing Wang wrote:
> This series is based on Bjorn's pci-next branch.

I think this is a very nice series, hope we can get this into 3.20.

I've replied with a few specific comments, but I see no show-stoppers
and I've already retracted a few comments after seeing the bigger
picture.

> After applied this series, we have following scan interfaces:
> 
> 1. pci_scan_bus_legacy() 
>    parent = NULL, default io/mem/bus resources.
>    for legacy pci scan
> 
> 2. pci_scan_root_bus()
>    for callers provide its own parent and io/mem/bus resources
>    but no platform specific pci_host_bridge operations
> 
> 3. pci_scan_root_bridge()
>    for callers provide its own parent and io/mem/bus resources
>    and pci_host_bridge_ops.

I still think we will need a split interface for drivers to use
that want to call pci_create_host_bridge() manually, but that can
come later as we try to migrate the arm32 host bridge drivers to
a generic interface away from pci_common_init_dev().

Another follow-up would be to move more of the pcibios_*() functions
into pci_host_bridge_ops.

	Arnd

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

* Re: [PATCH 00/28] Refine PCI scan interfaces and make generic pci host bridge
  2015-01-16  1:43 ` Yijing Wang
                   ` (59 preceding siblings ...)
  (?)
@ 2015-01-16 10:12 ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16 10:12 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On Friday 16 January 2015 09:43:58 Yijing Wang wrote:
> This series is based on Bjorn's pci-next branch.

I think this is a very nice series, hope we can get this into 3.20.

I've replied with a few specific comments, but I see no show-stoppers
and I've already retracted a few comments after seeing the bigger
picture.

> After applied this series, we have following scan interfaces:
> 
> 1. pci_scan_bus_legacy() 
>    parent = NULL, default io/mem/bus resources.
>    for legacy pci scan
> 
> 2. pci_scan_root_bus()
>    for callers provide its own parent and io/mem/bus resources
>    but no platform specific pci_host_bridge operations
> 
> 3. pci_scan_root_bridge()
>    for callers provide its own parent and io/mem/bus resources
>    and pci_host_bridge_ops.

I still think we will need a split interface for drivers to use
that want to call pci_create_host_bridge() manually, but that can
come later as we try to migrate the arm32 host bridge drivers to
a generic interface away from pci_common_init_dev().

Another follow-up would be to move more of the pcibios_*() functions
into pci_host_bridge_ops.

	Arnd

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

* Re: [PATCH 00/28] Refine PCI scan interfaces and make generic pci host bridge
@ 2015-01-16 10:12   ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16 10:12 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On Friday 16 January 2015 09:43:58 Yijing Wang wrote:
> This series is based on Bjorn's pci-next branch.

I think this is a very nice series, hope we can get this into 3.20.

I've replied with a few specific comments, but I see no show-stoppers
and I've already retracted a few comments after seeing the bigger
picture.

> After applied this series, we have following scan interfaces:
> 
> 1. pci_scan_bus_legacy() 
>    parent = NULL, default io/mem/bus resources.
>    for legacy pci scan
> 
> 2. pci_scan_root_bus()
>    for callers provide its own parent and io/mem/bus resources
>    but no platform specific pci_host_bridge operations
> 
> 3. pci_scan_root_bridge()
>    for callers provide its own parent and io/mem/bus resources
>    and pci_host_bridge_ops.

I still think we will need a split interface for drivers to use
that want to call pci_create_host_bridge() manually, but that can
come later as we try to migrate the arm32 host bridge drivers to
a generic interface away from pci_common_init_dev().

Another follow-up would be to move more of the pcibios_*() functions
into pci_host_bridge_ops.

	Arnd

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

* [PATCH 00/28] Refine PCI scan interfaces and make generic pci host bridge
@ 2015-01-16 10:12   ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16 10:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 16 January 2015 09:43:58 Yijing Wang wrote:
> This series is based on Bjorn's pci-next branch.

I think this is a very nice series, hope we can get this into 3.20.

I've replied with a few specific comments, but I see no show-stoppers
and I've already retracted a few comments after seeing the bigger
picture.

> After applied this series, we have following scan interfaces:
> 
> 1. pci_scan_bus_legacy() 
>    parent = NULL, default io/mem/bus resources.
>    for legacy pci scan
> 
> 2. pci_scan_root_bus()
>    for callers provide its own parent and io/mem/bus resources
>    but no platform specific pci_host_bridge operations
> 
> 3. pci_scan_root_bridge()
>    for callers provide its own parent and io/mem/bus resources
>    and pci_host_bridge_ops.

I still think we will need a split interface for drivers to use
that want to call pci_create_host_bridge() manually, but that can
come later as we try to migrate the arm32 host bridge drivers to
a generic interface away from pci_common_init_dev().

Another follow-up would be to move more of the pcibios_*() functions
into pci_host_bridge_ops.

	Arnd

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

* Re: [PATCH 00/28] Refine PCI scan interfaces and make generic pci host bridge
@ 2015-01-16 10:12   ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-16 10:12 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On Friday 16 January 2015 09:43:58 Yijing Wang wrote:
> This series is based on Bjorn's pci-next branch.

I think this is a very nice series, hope we can get this into 3.20.

I've replied with a few specific comments, but I see no show-stoppers
and I've already retracted a few comments after seeing the bigger
picture.

> After applied this series, we have following scan interfaces:
> 
> 1. pci_scan_bus_legacy() 
>    parent = NULL, default io/mem/bus resources.
>    for legacy pci scan
> 
> 2. pci_scan_root_bus()
>    for callers provide its own parent and io/mem/bus resources
>    but no platform specific pci_host_bridge operations
> 
> 3. pci_scan_root_bridge()
>    for callers provide its own parent and io/mem/bus resources
>    and pci_host_bridge_ops.

I still think we will need a split interface for drivers to use
that want to call pci_create_host_bridge() manually, but that can
come later as we try to migrate the arm32 host bridge drivers to
a generic interface away from pci_common_init_dev().

Another follow-up would be to move more of the pcibios_*() functions
into pci_host_bridge_ops.

	Arnd

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
  2015-01-16  1:43   ` Yijing Wang
                       ` (2 preceding siblings ...)
  (?)
@ 2015-01-16 23:15     ` Yinghai Lu
  -1 siblings, 0 replies; 320+ messages in thread
From: Yinghai Lu @ 2015-01-16 23:15 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Linux Kernel Mailing List,
	Marc Zyngier, linux-arm-kernel, Russell King,
	the arch/x86 maintainers, Thomas Gleixner, Tony Luck, linux-ia64,
	David S. Miller, Guan Xuetao, linux-alpha, linux-m68k,
	Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven, sparclinux

On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> Pci_bus_add_devices() should not be placed in pci_scan_bus().
> Now pci device will be added to driver core once its
> creation. All things left in pci_bus_add_devices() are
> driver attachment and other trivial sysfs things.
> Pci_scan_bus() should be the function responsible for
> scanning PCI devices, not including driver attachment.
> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
> will call pci_bus_size_bridges() and pci_bus_assign_resources()
> after pci_scan_bus().
>
> E.g.
> In m68k
> mcf_pci_init()
>         pci_scan_bus()
>                 ...
>                 pci_bus_add_devices() --- try to attach driver
>         pci_fixup_irqs()
>         pci_bus_size_bridges()
>         pci_bus_assign_resources()
>
> It is not correct, resources should be assigned correctly
> before attaching driver.

No, at that time pci drivers are loaded yet.

Thanks

Yinghai

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
  2015-01-16  1:43   ` Yijing Wang
                     ` (5 preceding siblings ...)
  (?)
@ 2015-01-16 23:15   ` Yinghai Lu
  -1 siblings, 0 replies; 320+ messages in thread
From: Yinghai Lu @ 2015-01-16 23:15 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Linux Kernel Mailing List,
	Marc Zyngier, linux-arm-kernel, Russell King,
	the arch/x86 maintainers, Thomas Gleixner, Tony Luck, linux-ia64,
	David S. Miller, Guan Xuetao, linux-alpha, linux-m68k,
	Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven, sparclinux

On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> Pci_bus_add_devices() should not be placed in pci_scan_bus().
> Now pci device will be added to driver core once its
> creation. All things left in pci_bus_add_devices() are
> driver attachment and other trivial sysfs things.
> Pci_scan_bus() should be the function responsible for
> scanning PCI devices, not including driver attachment.
> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
> will call pci_bus_size_bridges() and pci_bus_assign_resources()
> after pci_scan_bus().
>
> E.g.
> In m68k
> mcf_pci_init()
>         pci_scan_bus()
>                 ...
>                 pci_bus_add_devices() --- try to attach driver
>         pci_fixup_irqs()
>         pci_bus_size_bridges()
>         pci_bus_assign_resources()
>
> It is not correct, resources should be assigned correctly
> before attaching driver.

No, at that time pci drivers are loaded yet.

Thanks

Yinghai

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-16 23:15     ` Yinghai Lu
  0 siblings, 0 replies; 320+ messages in thread
From: Yinghai Lu @ 2015-01-16 23:15 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Linux Kernel Mailing List,
	Marc Zyngier, linux-arm-kernel, Russell King,
	the arch/x86 maintainers, Thomas Gleixner, Tony Luck, linux-ia64,
	David S. Miller, Guan Xuetao, linux-alpha, linux-m68k,
	Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven, sparclinux

On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> Pci_bus_add_devices() should not be placed in pci_scan_bus().
> Now pci device will be added to driver core once its
> creation. All things left in pci_bus_add_devices() are
> driver attachment and other trivial sysfs things.
> Pci_scan_bus() should be the function responsible for
> scanning PCI devices, not including driver attachment.
> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
> will call pci_bus_size_bridges() and pci_bus_assign_resources()
> after pci_scan_bus().
>
> E.g.
> In m68k
> mcf_pci_init()
>         pci_scan_bus()
>                 ...
>                 pci_bus_add_devices() --- try to attach driver
>         pci_fixup_irqs()
>         pci_bus_size_bridges()
>         pci_bus_assign_resources()
>
> It is not correct, resources should be assigned correctly
> before attaching driver.

No, at that time pci drivers are loaded yet.

Thanks

Yinghai

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-16 23:15     ` Yinghai Lu
  0 siblings, 0 replies; 320+ messages in thread
From: Yinghai Lu @ 2015-01-16 23:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> Pci_bus_add_devices() should not be placed in pci_scan_bus().
> Now pci device will be added to driver core once its
> creation. All things left in pci_bus_add_devices() are
> driver attachment and other trivial sysfs things.
> Pci_scan_bus() should be the function responsible for
> scanning PCI devices, not including driver attachment.
> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
> will call pci_bus_size_bridges() and pci_bus_assign_resources()
> after pci_scan_bus().
>
> E.g.
> In m68k
> mcf_pci_init()
>         pci_scan_bus()
>                 ...
>                 pci_bus_add_devices() --- try to attach driver
>         pci_fixup_irqs()
>         pci_bus_size_bridges()
>         pci_bus_assign_resources()
>
> It is not correct, resources should be assigned correctly
> before attaching driver.

No, at that time pci drivers are loaded yet.

Thanks

Yinghai

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

* [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-16 23:15     ` Yinghai Lu
  0 siblings, 0 replies; 320+ messages in thread
From: Yinghai Lu @ 2015-01-16 23:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> Pci_bus_add_devices() should not be placed in pci_scan_bus().
> Now pci device will be added to driver core once its
> creation. All things left in pci_bus_add_devices() are
> driver attachment and other trivial sysfs things.
> Pci_scan_bus() should be the function responsible for
> scanning PCI devices, not including driver attachment.
> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
> will call pci_bus_size_bridges() and pci_bus_assign_resources()
> after pci_scan_bus().
>
> E.g.
> In m68k
> mcf_pci_init()
>         pci_scan_bus()
>                 ...
>                 pci_bus_add_devices() --- try to attach driver
>         pci_fixup_irqs()
>         pci_bus_size_bridges()
>         pci_bus_assign_resources()
>
> It is not correct, resources should be assigned correctly
> before attaching driver.

No, at that time pci drivers are loaded yet.

Thanks

Yinghai

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-16 23:15     ` Yinghai Lu
  0 siblings, 0 replies; 320+ messages in thread
From: Yinghai Lu @ 2015-01-16 23:15 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Linux Kernel Mailing List,
	Marc Zyngier, linux-arm-kernel, Russell King,
	the arch/x86 maintainers, Thomas Gleixner, Tony Luck, linux-ia64,
	David S. Miller, Guan Xuetao, linux-alpha, linux-m68k,
	Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven, sparclinux

On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> Pci_bus_add_devices() should not be placed in pci_scan_bus().
> Now pci device will be added to driver core once its
> creation. All things left in pci_bus_add_devices() are
> driver attachment and other trivial sysfs things.
> Pci_scan_bus() should be the function responsible for
> scanning PCI devices, not including driver attachment.
> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
> will call pci_bus_size_bridges() and pci_bus_assign_resources()
> after pci_scan_bus().
>
> E.g.
> In m68k
> mcf_pci_init()
>         pci_scan_bus()
>                 ...
>                 pci_bus_add_devices() --- try to attach driver
>         pci_fixup_irqs()
>         pci_bus_size_bridges()
>         pci_bus_assign_resources()
>
> It is not correct, resources should be assigned correctly
> before attaching driver.

No, at that time pci drivers are loaded yet.

Thanks

Yinghai

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
  2015-01-16 23:15     ` Yinghai Lu
                         ` (2 preceding siblings ...)
  (?)
@ 2015-01-16 23:16       ` Yinghai Lu
  -1 siblings, 0 replies; 320+ messages in thread
From: Yinghai Lu @ 2015-01-16 23:16 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Linux Kernel Mailing List,
	Marc Zyngier, linux-arm-kernel, Russell King,
	the arch/x86 maintainers, Thomas Gleixner, Tony Luck, linux-ia64,
	David S. Miller, Guan Xuetao, linux-alpha, linux-m68k,
	Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven, sparclinux

On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>> Now pci device will be added to driver core once its
>> creation. All things left in pci_bus_add_devices() are
>> driver attachment and other trivial sysfs things.
>> Pci_scan_bus() should be the function responsible for
>> scanning PCI devices, not including driver attachment.
>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>> after pci_scan_bus().
>>
>> E.g.
>> In m68k
>> mcf_pci_init()
>>         pci_scan_bus()
>>                 ...
>>                 pci_bus_add_devices() --- try to attach driver
>>         pci_fixup_irqs()
>>         pci_bus_size_bridges()
>>         pci_bus_assign_resources()
>>
>> It is not correct, resources should be assigned correctly
>> before attaching driver.
>
No, for booting path, at that time pci drivers are *NOT* loaded yet.

Thanks

Yinghai

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-16 23:16       ` Yinghai Lu
  0 siblings, 0 replies; 320+ messages in thread
From: Yinghai Lu @ 2015-01-16 23:16 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Linux Kernel Mailing List,
	Marc Zyngier, linux-arm-kernel, Russell King,
	the arch/x86 maintainers, Thomas Gleixner, Tony Luck, linux-ia64,
	David S. Miller, Guan Xuetao, linux-alpha, linux-m68k,
	Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven, sparclinux

On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>> Now pci device will be added to driver core once its
>> creation. All things left in pci_bus_add_devices() are
>> driver attachment and other trivial sysfs things.
>> Pci_scan_bus() should be the function responsible for
>> scanning PCI devices, not including driver attachment.
>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>> after pci_scan_bus().
>>
>> E.g.
>> In m68k
>> mcf_pci_init()
>>         pci_scan_bus()
>>                 ...
>>                 pci_bus_add_devices() --- try to attach driver
>>         pci_fixup_irqs()
>>         pci_bus_size_bridges()
>>         pci_bus_assign_resources()
>>
>> It is not correct, resources should be assigned correctly
>> before attaching driver.
>
No, for booting path, at that time pci drivers are *NOT* loaded yet.

Thanks

Yinghai

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-16 23:16       ` Yinghai Lu
  0 siblings, 0 replies; 320+ messages in thread
From: Yinghai Lu @ 2015-01-16 23:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>> Now pci device will be added to driver core once its
>> creation. All things left in pci_bus_add_devices() are
>> driver attachment and other trivial sysfs things.
>> Pci_scan_bus() should be the function responsible for
>> scanning PCI devices, not including driver attachment.
>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>> after pci_scan_bus().
>>
>> E.g.
>> In m68k
>> mcf_pci_init()
>>         pci_scan_bus()
>>                 ...
>>                 pci_bus_add_devices() --- try to attach driver
>>         pci_fixup_irqs()
>>         pci_bus_size_bridges()
>>         pci_bus_assign_resources()
>>
>> It is not correct, resources should be assigned correctly
>> before attaching driver.
>
No, for booting path, at that time pci drivers are *NOT* loaded yet.

Thanks

Yinghai

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

* [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-16 23:16       ` Yinghai Lu
  0 siblings, 0 replies; 320+ messages in thread
From: Yinghai Lu @ 2015-01-16 23:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>> Now pci device will be added to driver core once its
>> creation. All things left in pci_bus_add_devices() are
>> driver attachment and other trivial sysfs things.
>> Pci_scan_bus() should be the function responsible for
>> scanning PCI devices, not including driver attachment.
>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>> after pci_scan_bus().
>>
>> E.g.
>> In m68k
>> mcf_pci_init()
>>         pci_scan_bus()
>>                 ...
>>                 pci_bus_add_devices() --- try to attach driver
>>         pci_fixup_irqs()
>>         pci_bus_size_bridges()
>>         pci_bus_assign_resources()
>>
>> It is not correct, resources should be assigned correctly
>> before attaching driver.
>
No, for booting path, at that time pci drivers are *NOT* loaded yet.

Thanks

Yinghai

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-16 23:16       ` Yinghai Lu
  0 siblings, 0 replies; 320+ messages in thread
From: Yinghai Lu @ 2015-01-16 23:16 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Linux Kernel Mailing List,
	Marc Zyngier, linux-arm-kernel, Russell King,
	the arch/x86 maintainers, Thomas Gleixner, Tony Luck, linux-ia64,
	David S. Miller, Guan Xuetao, linux-alpha, linux-m68k,
	Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven, sparclinux

On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>> Now pci device will be added to driver core once its
>> creation. All things left in pci_bus_add_devices() are
>> driver attachment and other trivial sysfs things.
>> Pci_scan_bus() should be the function responsible for
>> scanning PCI devices, not including driver attachment.
>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>> after pci_scan_bus().
>>
>> E.g.
>> In m68k
>> mcf_pci_init()
>>         pci_scan_bus()
>>                 ...
>>                 pci_bus_add_devices() --- try to attach driver
>>         pci_fixup_irqs()
>>         pci_bus_size_bridges()
>>         pci_bus_assign_resources()
>>
>> It is not correct, resources should be assigned correctly
>> before attaching driver.
>
No, for booting path, at that time pci drivers are *NOT* loaded yet.

Thanks

Yinghai

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

* Re: [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
  2015-01-16  1:44   ` Yijing Wang
  (?)
  (?)
@ 2015-01-17 16:39     ` Sergei Shtylyov
  -1 siblings, 0 replies; 320+ messages in thread
From: Sergei Shtylyov @ 2015-01-17 16:39 UTC (permalink / raw)
  To: Yijing Wang, Bjorn Helgaas
  Cc: Liviu Dudau, Tony Luck, Russell King, Arnd Bergmann,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	linux-arm-kernel

Hello.

On 1/16/2015 4:44 AM, Yijing Wang wrote:

> Use pci_scan_root_bus() instead of pci_create_root_bus() +
> pci_scan_child_bus() for simplicity.

> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> ---
>   drivers/pci/host/pcie-designware.c |    4 +---
>   1 files changed, 1 insertions(+), 3 deletions(-)

> diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
> index eef3111..d37fe27 100644
> --- a/drivers/pci/host/pcie-designware.c
> +++ b/drivers/pci/host/pcie-designware.c
> @@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
>   	struct pcie_port *pp = sys_to_pcie(sys);
>
>   	pp->root_bus_nr = sys->busnr;
> -	bus = pci_create_root_bus(pp->dev, sys->busnr,
> +	bus = pci_scan_root_bus(pp->dev, sys->busnr,
>   				  &dw_pcie_ops, sys, &sys->resources);

    Please realign this line, so that it still starts under 'pp'.

WBR, Sergei


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

* Re: [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
  2015-01-16  1:44   ` Yijing Wang
                     ` (3 preceding siblings ...)
  (?)
@ 2015-01-17 16:39   ` Sergei Shtylyov
  -1 siblings, 0 replies; 320+ messages in thread
From: Sergei Shtylyov @ 2015-01-17 16:39 UTC (permalink / raw)
  To: Yijing Wang, Bjorn Helgaas
  Cc: Liviu Dudau, Tony Luck, Russell King, Arnd Bergmann,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	linux-arm-kernel

Hello.

On 1/16/2015 4:44 AM, Yijing Wang wrote:

> Use pci_scan_root_bus() instead of pci_create_root_bus() +
> pci_scan_child_bus() for simplicity.

> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> ---
>   drivers/pci/host/pcie-designware.c |    4 +---
>   1 files changed, 1 insertions(+), 3 deletions(-)

> diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
> index eef3111..d37fe27 100644
> --- a/drivers/pci/host/pcie-designware.c
> +++ b/drivers/pci/host/pcie-designware.c
> @@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
>   	struct pcie_port *pp = sys_to_pcie(sys);
>
>   	pp->root_bus_nr = sys->busnr;
> -	bus = pci_create_root_bus(pp->dev, sys->busnr,
> +	bus = pci_scan_root_bus(pp->dev, sys->busnr,
>   				  &dw_pcie_ops, sys, &sys->resources);

    Please realign this line, so that it still starts under 'pp'.

WBR, Sergei

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

* Re: [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
@ 2015-01-17 16:39     ` Sergei Shtylyov
  0 siblings, 0 replies; 320+ messages in thread
From: Sergei Shtylyov @ 2015-01-17 16:39 UTC (permalink / raw)
  To: Yijing Wang, Bjorn Helgaas
  Cc: Liviu Dudau, Tony Luck, Russell King, Arnd Bergmann,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	linux-arm-kernel

Hello.

On 1/16/2015 4:44 AM, Yijing Wang wrote:

> Use pci_scan_root_bus() instead of pci_create_root_bus() +
> pci_scan_child_bus() for simplicity.

> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> ---
>   drivers/pci/host/pcie-designware.c |    4 +---
>   1 files changed, 1 insertions(+), 3 deletions(-)

> diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
> index eef3111..d37fe27 100644
> --- a/drivers/pci/host/pcie-designware.c
> +++ b/drivers/pci/host/pcie-designware.c
> @@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
>   	struct pcie_port *pp = sys_to_pcie(sys);
>
>   	pp->root_bus_nr = sys->busnr;
> -	bus = pci_create_root_bus(pp->dev, sys->busnr,
> +	bus = pci_scan_root_bus(pp->dev, sys->busnr,
>   				  &dw_pcie_ops, sys, &sys->resources);

    Please realign this line, so that it still starts under 'pp'.

WBR, Sergei


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

* [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
@ 2015-01-17 16:39     ` Sergei Shtylyov
  0 siblings, 0 replies; 320+ messages in thread
From: Sergei Shtylyov @ 2015-01-17 16:39 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 1/16/2015 4:44 AM, Yijing Wang wrote:

> Use pci_scan_root_bus() instead of pci_create_root_bus() +
> pci_scan_child_bus() for simplicity.

> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> ---
>   drivers/pci/host/pcie-designware.c |    4 +---
>   1 files changed, 1 insertions(+), 3 deletions(-)

> diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
> index eef3111..d37fe27 100644
> --- a/drivers/pci/host/pcie-designware.c
> +++ b/drivers/pci/host/pcie-designware.c
> @@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
>   	struct pcie_port *pp = sys_to_pcie(sys);
>
>   	pp->root_bus_nr = sys->busnr;
> -	bus = pci_create_root_bus(pp->dev, sys->busnr,
> +	bus = pci_scan_root_bus(pp->dev, sys->busnr,
>   				  &dw_pcie_ops, sys, &sys->resources);

    Please realign this line, so that it still starts under 'pp'.

WBR, Sergei

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

* Re: [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
@ 2015-01-17 16:39     ` Sergei Shtylyov
  0 siblings, 0 replies; 320+ messages in thread
From: Sergei Shtylyov @ 2015-01-17 16:39 UTC (permalink / raw)
  To: Yijing Wang, Bjorn Helgaas
  Cc: Liviu Dudau, Tony Luck, Russell King, Arnd Bergmann,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	linux-arm-kernel

Hello.

On 1/16/2015 4:44 AM, Yijing Wang wrote:

> Use pci_scan_root_bus() instead of pci_create_root_bus() +
> pci_scan_child_bus() for simplicity.

> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> ---
>   drivers/pci/host/pcie-designware.c |    4 +---
>   1 files changed, 1 insertions(+), 3 deletions(-)

> diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
> index eef3111..d37fe27 100644
> --- a/drivers/pci/host/pcie-designware.c
> +++ b/drivers/pci/host/pcie-designware.c
> @@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
>   	struct pcie_port *pp = sys_to_pcie(sys);
>
>   	pp->root_bus_nr = sys->busnr;
> -	bus = pci_create_root_bus(pp->dev, sys->busnr,
> +	bus = pci_scan_root_bus(pp->dev, sys->busnr,
>   				  &dw_pcie_ops, sys, &sys->resources);

    Please realign this line, so that it still starts under 'pp'.

WBR, Sergei


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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
  2015-01-16 23:16       ` Yinghai Lu
                           ` (3 preceding siblings ...)
  (?)
@ 2015-01-19  2:04         ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:04 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Linux Kernel Mailing List,
	Marc Zyngier, linux-arm-kernel, Russell King,
	the arch/x86 maintainers, Thomas Gleixner, Tony Luck, linux-ia64,
	David S. Miller, Guan Xuetao, linux-alpha, linux-m68k,
	Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven, sparclinux

On 2015/1/17 7:16, Yinghai Lu wrote:
> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>>> Now pci device will be added to driver core once its
>>> creation. All things left in pci_bus_add_devices() are
>>> driver attachment and other trivial sysfs things.
>>> Pci_scan_bus() should be the function responsible for
>>> scanning PCI devices, not including driver attachment.
>>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>>> after pci_scan_bus().
>>>
>>> E.g.
>>> In m68k
>>> mcf_pci_init()
>>>         pci_scan_bus()
>>>                 ...
>>>                 pci_bus_add_devices() --- try to attach driver
>>>         pci_fixup_irqs()
>>>         pci_bus_size_bridges()
>>>         pci_bus_assign_resources()
>>>
>>> It is not correct, resources should be assigned correctly
>>> before attaching driver.
>>
> No, for booting path, at that time pci drivers are *NOT* loaded yet.

Hi Yinghai, I knew code flow here would not cause problems, sorry the log
confused you, I will refresh it. But I think pci_scan_bus()/pci_scan_root_bus()
which could only be used during system boot up(before module_init) make
the pci scan logic obscure. Because most callers additionally call
pci_bus_size_bridges() and pci_bus_assign_resources() later,
so rip out pci_bus_add_devices() from pci_scan_bus()/pci_scan_root_bus()
make code have better readability.

Thanks!
Yijing.

> 
> Thanks
> 
> Yinghai
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
  2015-01-16 23:16       ` Yinghai Lu
                         ` (4 preceding siblings ...)
  (?)
@ 2015-01-19  2:04       ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:04 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Linux Kernel Mailing List,
	Marc Zyngier, linux-arm-kernel, Russell King,
	the arch/x86 maintainers, Thomas Gleixner, Tony Luck, linux-ia64,
	David S. Miller, Guan Xuetao, linux-alpha, linux-m68k,
	Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven, sparclinux

On 2015/1/17 7:16, Yinghai Lu wrote:
> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>>> Now pci device will be added to driver core once its
>>> creation. All things left in pci_bus_add_devices() are
>>> driver attachment and other trivial sysfs things.
>>> Pci_scan_bus() should be the function responsible for
>>> scanning PCI devices, not including driver attachment.
>>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>>> after pci_scan_bus().
>>>
>>> E.g.
>>> In m68k
>>> mcf_pci_init()
>>>         pci_scan_bus()
>>>                 ...
>>>                 pci_bus_add_devices() --- try to attach driver
>>>         pci_fixup_irqs()
>>>         pci_bus_size_bridges()
>>>         pci_bus_assign_resources()
>>>
>>> It is not correct, resources should be assigned correctly
>>> before attaching driver.
>>
> No, for booting path, at that time pci drivers are *NOT* loaded yet.

Hi Yinghai, I knew code flow here would not cause problems, sorry the log
confused you, I will refresh it. But I think pci_scan_bus()/pci_scan_root_bus()
which could only be used during system boot up(before module_init) make
the pci scan logic obscure. Because most callers additionally call
pci_bus_size_bridges() and pci_bus_assign_resources() later,
so rip out pci_bus_add_devices() from pci_scan_bus()/pci_scan_root_bus()
make code have better readability.

Thanks!
Yijing.

> 
> Thanks
> 
> Yinghai
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-19  2:04         ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:04 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Linux Kernel Mailing List,
	Marc Zyngier, linux-arm-kernel, Russell King,
	the arch/x86 maintainers, Thomas Gleixner, Tony Luck, linux-ia64,
	David S. Miller, Guan Xuetao, linux-alpha, linux-m68k,
	Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven, sparclinux

On 2015/1/17 7:16, Yinghai Lu wrote:
> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>>> Now pci device will be added to driver core once its
>>> creation. All things left in pci_bus_add_devices() are
>>> driver attachment and other trivial sysfs things.
>>> Pci_scan_bus() should be the function responsible for
>>> scanning PCI devices, not including driver attachment.
>>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>>> after pci_scan_bus().
>>>
>>> E.g.
>>> In m68k
>>> mcf_pci_init()
>>>         pci_scan_bus()
>>>                 ...
>>>                 pci_bus_add_devices() --- try to attach driver
>>>         pci_fixup_irqs()
>>>         pci_bus_size_bridges()
>>>         pci_bus_assign_resources()
>>>
>>> It is not correct, resources should be assigned correctly
>>> before attaching driver.
>>
> No, for booting path, at that time pci drivers are *NOT* loaded yet.

Hi Yinghai, I knew code flow here would not cause problems, sorry the log
confused you, I will refresh it. But I think pci_scan_bus()/pci_scan_root_bus()
which could only be used during system boot up(before module_init) make
the pci scan logic obscure. Because most callers additionally call
pci_bus_size_bridges() and pci_bus_assign_resources() later,
so rip out pci_bus_add_devices() from pci_scan_bus()/pci_scan_root_bus()
make code have better readability.

Thanks!
Yijing.

> 
> Thanks
> 
> Yinghai
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-19  2:04         ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:04 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015/1/17 7:16, Yinghai Lu wrote:
> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>>> Now pci device will be added to driver core once its
>>> creation. All things left in pci_bus_add_devices() are
>>> driver attachment and other trivial sysfs things.
>>> Pci_scan_bus() should be the function responsible for
>>> scanning PCI devices, not including driver attachment.
>>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>>> after pci_scan_bus().
>>>
>>> E.g.
>>> In m68k
>>> mcf_pci_init()
>>>         pci_scan_bus()
>>>                 ...
>>>                 pci_bus_add_devices() --- try to attach driver
>>>         pci_fixup_irqs()
>>>         pci_bus_size_bridges()
>>>         pci_bus_assign_resources()
>>>
>>> It is not correct, resources should be assigned correctly
>>> before attaching driver.
>>
> No, for booting path, at that time pci drivers are *NOT* loaded yet.

Hi Yinghai, I knew code flow here would not cause problems, sorry the log
confused you, I will refresh it. But I think pci_scan_bus()/pci_scan_root_bus()
which could only be used during system boot up(before module_init) make
the pci scan logic obscure. Because most callers additionally call
pci_bus_size_bridges() and pci_bus_assign_resources() later,
so rip out pci_bus_add_devices() from pci_scan_bus()/pci_scan_root_bus()
make code have better readability.

Thanks!
Yijing.

> 
> Thanks
> 
> Yinghai
> 
> .
> 


-- 
Thanks!
Yijing


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

* [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-19  2:04         ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:04 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015/1/17 7:16, Yinghai Lu wrote:
> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>>> Now pci device will be added to driver core once its
>>> creation. All things left in pci_bus_add_devices() are
>>> driver attachment and other trivial sysfs things.
>>> Pci_scan_bus() should be the function responsible for
>>> scanning PCI devices, not including driver attachment.
>>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>>> after pci_scan_bus().
>>>
>>> E.g.
>>> In m68k
>>> mcf_pci_init()
>>>         pci_scan_bus()
>>>                 ...
>>>                 pci_bus_add_devices() --- try to attach driver
>>>         pci_fixup_irqs()
>>>         pci_bus_size_bridges()
>>>         pci_bus_assign_resources()
>>>
>>> It is not correct, resources should be assigned correctly
>>> before attaching driver.
>>
> No, for booting path, at that time pci drivers are *NOT* loaded yet.

Hi Yinghai, I knew code flow here would not cause problems, sorry the log
confused you, I will refresh it. But I think pci_scan_bus()/pci_scan_root_bus()
which could only be used during system boot up(before module_init) make
the pci scan logic obscure. Because most callers additionally call
pci_bus_size_bridges() and pci_bus_assign_resources() later,
so rip out pci_bus_add_devices() from pci_scan_bus()/pci_scan_root_bus()
make code have better readability.

Thanks!
Yijing.

> 
> Thanks
> 
> Yinghai
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-19  2:04         ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:04 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Linux Kernel Mailing List,
	Marc Zyngier, linux-arm-kernel, Russell King,
	the arch/x86 maintainers, Thomas Gleixner, Tony Luck, linux-ia64,
	David S. Miller, Guan Xuetao, linux-alpha, linux-m68k,
	Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven, sparclinux

On 2015/1/17 7:16, Yinghai Lu wrote:
> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>>> Now pci device will be added to driver core once its
>>> creation. All things left in pci_bus_add_devices() are
>>> driver attachment and other trivial sysfs things.
>>> Pci_scan_bus() should be the function responsible for
>>> scanning PCI devices, not including driver attachment.
>>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>>> after pci_scan_bus().
>>>
>>> E.g.
>>> In m68k
>>> mcf_pci_init()
>>>         pci_scan_bus()
>>>                 ...
>>>                 pci_bus_add_devices() --- try to attach driver
>>>         pci_fixup_irqs()
>>>         pci_bus_size_bridges()
>>>         pci_bus_assign_resources()
>>>
>>> It is not correct, resources should be assigned correctly
>>> before attaching driver.
>>
> No, for booting path, at that time pci drivers are *NOT* loaded yet.

Hi Yinghai, I knew code flow here would not cause problems, sorry the log
confused you, I will refresh it. But I think pci_scan_bus()/pci_scan_root_bus()
which could only be used during system boot up(before module_init) make
the pci scan logic obscure. Because most callers additionally call
pci_bus_size_bridges() and pci_bus_assign_resources() later,
so rip out pci_bus_add_devices() from pci_scan_bus()/pci_scan_root_bus()
make code have better readability.

Thanks!
Yijing.

> 
> Thanks
> 
> Yinghai
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-19  2:04         ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:04 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Linux Kernel Mailing List,
	Marc Zyngier, linux-arm-kernel, Russell King,
	the arch/x86 maintainers, Thomas Gleixner, Tony Luck, linux-ia64,
	David S. Miller, Guan Xuetao, linux-alpha, linux-m68k,
	Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven, sparclinux

On 2015/1/17 7:16, Yinghai Lu wrote:
> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>>> Now pci device will be added to driver core once its
>>> creation. All things left in pci_bus_add_devices() are
>>> driver attachment and other trivial sysfs things.
>>> Pci_scan_bus() should be the function responsible for
>>> scanning PCI devices, not including driver attachment.
>>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>>> after pci_scan_bus().
>>>
>>> E.g.
>>> In m68k
>>> mcf_pci_init()
>>>         pci_scan_bus()
>>>                 ...
>>>                 pci_bus_add_devices() --- try to attach driver
>>>         pci_fixup_irqs()
>>>         pci_bus_size_bridges()
>>>         pci_bus_assign_resources()
>>>
>>> It is not correct, resources should be assigned correctly
>>> before attaching driver.
>>
> No, for booting path, at that time pci drivers are *NOT* loaded yet.

Hi Yinghai, I knew code flow here would not cause problems, sorry the log
confused you, I will refresh it. But I think pci_scan_bus()/pci_scan_root_bus()
which could only be used during system boot up(before module_init) make
the pci scan logic obscure. Because most callers additionally call
pci_bus_size_bridges() and pci_bus_assign_resources() later,
so rip out pci_bus_add_devices() from pci_scan_bus()/pci_scan_root_bus()
make code have better readability.

Thanks!
Yijing.

> 
> Thanks
> 
> Yinghai
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
  2015-01-16  9:40       ` Arnd Bergmann
                           ` (2 preceding siblings ...)
  (?)
@ 2015-01-19  2:14         ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:14 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

>> I'm confused: the same code is already part of the PCI tree, but with
>> Lorenzo Pieralisi listed as the patch author. The code is good,
>> and I acked it in the past, but one of you is (probably by accident)
>> misattributing the patch.
>>
>> Assuming that the patch that is already merged in next is the right
>> one, I think you should rebase your series on top of
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
>>
>> to avoid conflicts like this one.
>>
> 
> I think I just got confused because the code duplicates most of
> pci_bus_assign_domain_nr(). Maybe this can be done in a better way
> by splitting the existing function into 
> 
> static int pci_assign_domain_nr(struct device *)
> {
> 	... /* most of pci_bus_assign_domain_nr */
> 
> 	return domain;
> }
> 
> void pci_host_assign_domain_nr(struct pci_host_bridge *host)
> {
> 	host->domain = pci_assign_domain_nr(host->dev.parent);
> }
> 
> void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
> {
> 	bus->domain_nr = pci_assign_domain_nr(parent);
> }
> 

Hi Arnd,
   I kept the almost duplicated pci_host_assign_domain_nr() and
pci_bus_assign_domain_nr() here for building happy, because now
platform specific pci_domain_nr() still exists which may get domain
number from pci_bus. pci_bus_assign_domain_nr() will be removed in
the last patch.

Thanks!
Yijing.

> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
  2015-01-16  9:40       ` Arnd Bergmann
                         ` (2 preceding siblings ...)
  (?)
@ 2015-01-19  2:14       ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:14 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

>> I'm confused: the same code is already part of the PCI tree, but with
>> Lorenzo Pieralisi listed as the patch author. The code is good,
>> and I acked it in the past, but one of you is (probably by accident)
>> misattributing the patch.
>>
>> Assuming that the patch that is already merged in next is the right
>> one, I think you should rebase your series on top of
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
>>
>> to avoid conflicts like this one.
>>
> 
> I think I just got confused because the code duplicates most of
> pci_bus_assign_domain_nr(). Maybe this can be done in a better way
> by splitting the existing function into 
> 
> static int pci_assign_domain_nr(struct device *)
> {
> 	... /* most of pci_bus_assign_domain_nr */
> 
> 	return domain;
> }
> 
> void pci_host_assign_domain_nr(struct pci_host_bridge *host)
> {
> 	host->domain = pci_assign_domain_nr(host->dev.parent);
> }
> 
> void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
> {
> 	bus->domain_nr = pci_assign_domain_nr(parent);
> }
> 

Hi Arnd,
   I kept the almost duplicated pci_host_assign_domain_nr() and
pci_bus_assign_domain_nr() here for building happy, because now
platform specific pci_domain_nr() still exists which may get domain
number from pci_bus. pci_bus_assign_domain_nr() will be removed in
the last patch.

Thanks!
Yijing.

> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-19  2:14         ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:14 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

>> I'm confused: the same code is already part of the PCI tree, but with
>> Lorenzo Pieralisi listed as the patch author. The code is good,
>> and I acked it in the past, but one of you is (probably by accident)
>> misattributing the patch.
>>
>> Assuming that the patch that is already merged in next is the right
>> one, I think you should rebase your series on top of
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
>>
>> to avoid conflicts like this one.
>>
> 
> I think I just got confused because the code duplicates most of
> pci_bus_assign_domain_nr(). Maybe this can be done in a better way
> by splitting the existing function into 
> 
> static int pci_assign_domain_nr(struct device *)
> {
> 	... /* most of pci_bus_assign_domain_nr */
> 
> 	return domain;
> }
> 
> void pci_host_assign_domain_nr(struct pci_host_bridge *host)
> {
> 	host->domain = pci_assign_domain_nr(host->dev.parent);
> }
> 
> void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
> {
> 	bus->domain_nr = pci_assign_domain_nr(parent);
> }
> 

Hi Arnd,
   I kept the almost duplicated pci_host_assign_domain_nr() and
pci_bus_assign_domain_nr() here for building happy, because now
platform specific pci_domain_nr() still exists which may get domain
number from pci_bus. pci_bus_assign_domain_nr() will be removed in
the last patch.

Thanks!
Yijing.

> .
> 


-- 
Thanks!
Yijing


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

* [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-19  2:14         ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:14 UTC (permalink / raw)
  To: linux-arm-kernel

>> I'm confused: the same code is already part of the PCI tree, but with
>> Lorenzo Pieralisi listed as the patch author. The code is good,
>> and I acked it in the past, but one of you is (probably by accident)
>> misattributing the patch.
>>
>> Assuming that the patch that is already merged in next is the right
>> one, I think you should rebase your series on top of
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
>>
>> to avoid conflicts like this one.
>>
> 
> I think I just got confused because the code duplicates most of
> pci_bus_assign_domain_nr(). Maybe this can be done in a better way
> by splitting the existing function into 
> 
> static int pci_assign_domain_nr(struct device *)
> {
> 	... /* most of pci_bus_assign_domain_nr */
> 
> 	return domain;
> }
> 
> void pci_host_assign_domain_nr(struct pci_host_bridge *host)
> {
> 	host->domain = pci_assign_domain_nr(host->dev.parent);
> }
> 
> void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
> {
> 	bus->domain_nr = pci_assign_domain_nr(parent);
> }
> 

Hi Arnd,
   I kept the almost duplicated pci_host_assign_domain_nr() and
pci_bus_assign_domain_nr() here for building happy, because now
platform specific pci_domain_nr() still exists which may get domain
number from pci_bus. pci_bus_assign_domain_nr() will be removed in
the last patch.

Thanks!
Yijing.

> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-19  2:14         ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:14 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

>> I'm confused: the same code is already part of the PCI tree, but with
>> Lorenzo Pieralisi listed as the patch author. The code is good,
>> and I acked it in the past, but one of you is (probably by accident)
>> misattributing the patch.
>>
>> Assuming that the patch that is already merged in next is the right
>> one, I think you should rebase your series on top of
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
>>
>> to avoid conflicts like this one.
>>
> 
> I think I just got confused because the code duplicates most of
> pci_bus_assign_domain_nr(). Maybe this can be done in a better way
> by splitting the existing function into 
> 
> static int pci_assign_domain_nr(struct device *)
> {
> 	... /* most of pci_bus_assign_domain_nr */
> 
> 	return domain;
> }
> 
> void pci_host_assign_domain_nr(struct pci_host_bridge *host)
> {
> 	host->domain = pci_assign_domain_nr(host->dev.parent);
> }
> 
> void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
> {
> 	bus->domain_nr = pci_assign_domain_nr(parent);
> }
> 

Hi Arnd,
   I kept the almost duplicated pci_host_assign_domain_nr() and
pci_bus_assign_domain_nr() here for building happy, because now
platform specific pci_domain_nr() still exists which may get domain
number from pci_bus. pci_bus_assign_domain_nr() will be removed in
the last patch.

Thanks!
Yijing.

> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-19  2:14         ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:14 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

>> I'm confused: the same code is already part of the PCI tree, but with
>> Lorenzo Pieralisi listed as the patch author. The code is good,
>> and I acked it in the past, but one of you is (probably by accident)
>> misattributing the patch.
>>
>> Assuming that the patch that is already merged in next is the right
>> one, I think you should rebase your series on top of
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
>>
>> to avoid conflicts like this one.
>>
> 
> I think I just got confused because the code duplicates most of
> pci_bus_assign_domain_nr(). Maybe this can be done in a better way
> by splitting the existing function into 
> 
> static int pci_assign_domain_nr(struct device *)
> {
> 	... /* most of pci_bus_assign_domain_nr */
> 
> 	return domain;
> }
> 
> void pci_host_assign_domain_nr(struct pci_host_bridge *host)
> {
> 	host->domain = pci_assign_domain_nr(host->dev.parent);
> }
> 
> void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
> {
> 	bus->domain_nr = pci_assign_domain_nr(parent);
> }
> 

Hi Arnd,
   I kept the almost duplicated pci_host_assign_domain_nr() and
pci_bus_assign_domain_nr() here for building happy, because now
platform specific pci_domain_nr() still exists which may get domain
number from pci_bus. pci_bus_assign_domain_nr() will be removed in
the last patch.

Thanks!
Yijing.

> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
  2015-01-16  9:34     ` Arnd Bergmann
                         ` (2 preceding siblings ...)
  (?)
@ 2015-01-19  2:39       ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:39 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On 2015/1/16 17:34, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:07 Yijing Wang wrote:
>> We want to make a generic pci_host_bridge, then we could
>> place common PCI infos like domain number in it. Ripping
>> out pci_host_bridge creation from pci_create_root_bus()
>> make code more better readability. Further more, we could
>> use the generic pci_host_bridge to hold host bridge specific
>> operations like pcibios_root_bridge_prepare().
>>
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>>
> 
> I assume this patch is doing the right thing, but the description
> above doesn't really tell me enough to be sure.
> 
> This is supposed to be transparent to the callers, right? If
> so, please mention it explicitly in the text.

Sorry, I will refresh the patch log for better description.

In this series I have no plan to export the pci_create_host_bridge()
to callers, because I think pci_host_bridge_ops could make callers
have the ability to setup the platform specific operations. But if this
is needed, we could introduce another patches to export it.

> 
> Also you don't explain what the list of host bridges is
> used for. Maybe you can split this out into a separate patch
> so you have one patch that just moves code from one file
> to the other but no functional changes, and a second patch
> that exports pci_create_host_bridge and introduces the list,
> with an explanation of what it is used for.
> 

pci_host_bridge_list is used to find out whether the pci_host_bridge
in domain:bus is already existed, I will split the related code
to another patch, thanks.


> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
@ 2015-01-19  2:39       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:39 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On 2015/1/16 17:34, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:07 Yijing Wang wrote:
>> We want to make a generic pci_host_bridge, then we could
>> place common PCI infos like domain number in it. Ripping
>> out pci_host_bridge creation from pci_create_root_bus()
>> make code more better readability. Further more, we could
>> use the generic pci_host_bridge to hold host bridge specific
>> operations like pcibios_root_bridge_prepare().
>>
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>>
> 
> I assume this patch is doing the right thing, but the description
> above doesn't really tell me enough to be sure.
> 
> This is supposed to be transparent to the callers, right? If
> so, please mention it explicitly in the text.

Sorry, I will refresh the patch log for better description.

In this series I have no plan to export the pci_create_host_bridge()
to callers, because I think pci_host_bridge_ops could make callers
have the ability to setup the platform specific operations. But if this
is needed, we could introduce another patches to export it.

> 
> Also you don't explain what the list of host bridges is
> used for. Maybe you can split this out into a separate patch
> so you have one patch that just moves code from one file
> to the other but no functional changes, and a second patch
> that exports pci_create_host_bridge and introduces the list,
> with an explanation of what it is used for.
> 

pci_host_bridge_list is used to find out whether the pci_host_bridge
in domain:bus is already existed, I will split the related code
to another patch, thanks.


> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
@ 2015-01-19  2:39       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:39 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On 2015/1/16 17:34, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:07 Yijing Wang wrote:
>> We want to make a generic pci_host_bridge, then we could
>> place common PCI infos like domain number in it. Ripping
>> out pci_host_bridge creation from pci_create_root_bus()
>> make code more better readability. Further more, we could
>> use the generic pci_host_bridge to hold host bridge specific
>> operations like pcibios_root_bridge_prepare().
>>
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>>
> 
> I assume this patch is doing the right thing, but the description
> above doesn't really tell me enough to be sure.
> 
> This is supposed to be transparent to the callers, right? If
> so, please mention it explicitly in the text.

Sorry, I will refresh the patch log for better description.

In this series I have no plan to export the pci_create_host_bridge()
to callers, because I think pci_host_bridge_ops could make callers
have the ability to setup the platform specific operations. But if this
is needed, we could introduce another patches to export it.

> 
> Also you don't explain what the list of host bridges is
> used for. Maybe you can split this out into a separate patch
> so you have one patch that just moves code from one file
> to the other but no functional changes, and a second patch
> that exports pci_create_host_bridge and introduces the list,
> with an explanation of what it is used for.
> 

pci_host_bridge_list is used to find out whether the pci_host_bridge
in domain:bus is already existed, I will split the related code
to another patch, thanks.


> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
@ 2015-01-19  2:39       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:39 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015/1/16 17:34, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:07 Yijing Wang wrote:
>> We want to make a generic pci_host_bridge, then we could
>> place common PCI infos like domain number in it. Ripping
>> out pci_host_bridge creation from pci_create_root_bus()
>> make code more better readability. Further more, we could
>> use the generic pci_host_bridge to hold host bridge specific
>> operations like pcibios_root_bridge_prepare().
>>
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>>
> 
> I assume this patch is doing the right thing, but the description
> above doesn't really tell me enough to be sure.
> 
> This is supposed to be transparent to the callers, right? If
> so, please mention it explicitly in the text.

Sorry, I will refresh the patch log for better description.

In this series I have no plan to export the pci_create_host_bridge()
to callers, because I think pci_host_bridge_ops could make callers
have the ability to setup the platform specific operations. But if this
is needed, we could introduce another patches to export it.

> 
> Also you don't explain what the list of host bridges is
> used for. Maybe you can split this out into a separate patch
> so you have one patch that just moves code from one file
> to the other but no functional changes, and a second patch
> that exports pci_create_host_bridge and introduces the list,
> with an explanation of what it is used for.
> 

pci_host_bridge_list is used to find out whether the pci_host_bridge
in domain:bus is already existed, I will split the related code
to another patch, thanks.


> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
@ 2015-01-19  2:39       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  2:39 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On 2015/1/16 17:34, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:07 Yijing Wang wrote:
>> We want to make a generic pci_host_bridge, then we could
>> place common PCI infos like domain number in it. Ripping
>> out pci_host_bridge creation from pci_create_root_bus()
>> make code more better readability. Further more, we could
>> use the generic pci_host_bridge to hold host bridge specific
>> operations like pcibios_root_bridge_prepare().
>>
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>>
> 
> I assume this patch is doing the right thing, but the description
> above doesn't really tell me enough to be sure.
> 
> This is supposed to be transparent to the callers, right? If
> so, please mention it explicitly in the text.

Sorry, I will refresh the patch log for better description.

In this series I have no plan to export the pci_create_host_bridge()
to callers, because I think pci_host_bridge_ops could make callers
have the ability to setup the platform specific operations. But if this
is needed, we could introduce another patches to export it.

> 
> Also you don't explain what the list of host bridges is
> used for. Maybe you can split this out into a separate patch
> so you have one patch that just moves code from one file
> to the other but no functional changes, and a second patch
> that exports pci_create_host_bridge and introduces the list,
> with an explanation of what it is used for.
> 

pci_host_bridge_list is used to find out whether the pci_host_bridge
in domain:bus is already existed, I will split the related code
to another patch, thanks.


> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
  2015-01-16  9:18     ` Arnd Bergmann
                         ` (2 preceding siblings ...)
  (?)
@ 2015-01-19  3:12       ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:12 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On 2015/1/16 17:18, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:08 Yijing Wang wrote:
>> @@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
>>  {
>>         struct pci_host_bridge *host;
>>  
>> -       host = pci_create_host_bridge(parent, db, resources);
>> +       host = pci_create_host_bridge(parent, db, resources, sysdata);
>>         if (!host)
>>                 return NULL;
>>  
>> -       return __pci_scan_root_bus(host, ops, sysdata);
>> +       return __pci_scan_root_bus(host, ops);
>>  }
>>  EXPORT_SYMBOL(pci_scan_root_bus);
>>
> 
> How about keeping the sysdata out of the pci_create_host_bridge interface, and
> refactoring it so that the call sequence becomes
> 
> 	host = pci_create_host_bridge(parent, db, resources);
> 	host->sysdata = sysdata;
> 	__pci_scan_root_bus(host, ops);
> 
> This way, we can make sysdata completely option. I assume that more of the
> fields we have in sysdata today can get moved into pci_host_bridge
> over time, so a host bridge driver can just assign those members individually
> between pci_create_host_bridge and __pci_scan_root_bus.

I put the sysdata in pci_host_bridge, because some platforms x86/ia64
need to call pcibios_root_bridge_prepare() before pci_host_bridge registration
in pci_create_host_bridge(), and pcibios_root_bridge_prepare() need the companion
acpi device pointer which is stored in sysdata.

I like you idea, but I haven't find a better way yet.

Thanks!
Yijing.

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
  2015-01-16  9:18     ` Arnd Bergmann
                       ` (3 preceding siblings ...)
  (?)
@ 2015-01-19  3:12     ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:12 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On 2015/1/16 17:18, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:08 Yijing Wang wrote:
>> @@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
>>  {
>>         struct pci_host_bridge *host;
>>  
>> -       host = pci_create_host_bridge(parent, db, resources);
>> +       host = pci_create_host_bridge(parent, db, resources, sysdata);
>>         if (!host)
>>                 return NULL;
>>  
>> -       return __pci_scan_root_bus(host, ops, sysdata);
>> +       return __pci_scan_root_bus(host, ops);
>>  }
>>  EXPORT_SYMBOL(pci_scan_root_bus);
>>
> 
> How about keeping the sysdata out of the pci_create_host_bridge interface, and
> refactoring it so that the call sequence becomes
> 
> 	host = pci_create_host_bridge(parent, db, resources);
> 	host->sysdata = sysdata;
> 	__pci_scan_root_bus(host, ops);
> 
> This way, we can make sysdata completely option. I assume that more of the
> fields we have in sysdata today can get moved into pci_host_bridge
> over time, so a host bridge driver can just assign those members individually
> between pci_create_host_bridge and __pci_scan_root_bus.

I put the sysdata in pci_host_bridge, because some platforms x86/ia64
need to call pcibios_root_bridge_prepare() before pci_host_bridge registration
in pci_create_host_bridge(), and pcibios_root_bridge_prepare() need the companion
acpi device pointer which is stored in sysdata.

I like you idea, but I haven't find a better way yet.

Thanks!
Yijing.

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
@ 2015-01-19  3:12       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:12 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On 2015/1/16 17:18, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:08 Yijing Wang wrote:
>> @@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
>>  {
>>         struct pci_host_bridge *host;
>>  
>> -       host = pci_create_host_bridge(parent, db, resources);
>> +       host = pci_create_host_bridge(parent, db, resources, sysdata);
>>         if (!host)
>>                 return NULL;
>>  
>> -       return __pci_scan_root_bus(host, ops, sysdata);
>> +       return __pci_scan_root_bus(host, ops);
>>  }
>>  EXPORT_SYMBOL(pci_scan_root_bus);
>>
> 
> How about keeping the sysdata out of the pci_create_host_bridge interface, and
> refactoring it so that the call sequence becomes
> 
> 	host = pci_create_host_bridge(parent, db, resources);
> 	host->sysdata = sysdata;
> 	__pci_scan_root_bus(host, ops);
> 
> This way, we can make sysdata completely option. I assume that more of the
> fields we have in sysdata today can get moved into pci_host_bridge
> over time, so a host bridge driver can just assign those members individually
> between pci_create_host_bridge and __pci_scan_root_bus.

I put the sysdata in pci_host_bridge, because some platforms x86/ia64
need to call pcibios_root_bridge_prepare() before pci_host_bridge registration
in pci_create_host_bridge(), and pcibios_root_bridge_prepare() need the companion
acpi device pointer which is stored in sysdata.

I like you idea, but I haven't find a better way yet.

Thanks!
Yijing.

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
@ 2015-01-19  3:12       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:12 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015/1/16 17:18, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:08 Yijing Wang wrote:
>> @@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
>>  {
>>         struct pci_host_bridge *host;
>>  
>> -       host = pci_create_host_bridge(parent, db, resources);
>> +       host = pci_create_host_bridge(parent, db, resources, sysdata);
>>         if (!host)
>>                 return NULL;
>>  
>> -       return __pci_scan_root_bus(host, ops, sysdata);
>> +       return __pci_scan_root_bus(host, ops);
>>  }
>>  EXPORT_SYMBOL(pci_scan_root_bus);
>>
> 
> How about keeping the sysdata out of the pci_create_host_bridge interface, and
> refactoring it so that the call sequence becomes
> 
> 	host = pci_create_host_bridge(parent, db, resources);
> 	host->sysdata = sysdata;
> 	__pci_scan_root_bus(host, ops);
> 
> This way, we can make sysdata completely option. I assume that more of the
> fields we have in sysdata today can get moved into pci_host_bridge
> over time, so a host bridge driver can just assign those members individually
> between pci_create_host_bridge and __pci_scan_root_bus.

I put the sysdata in pci_host_bridge, because some platforms x86/ia64
need to call pcibios_root_bridge_prepare() before pci_host_bridge registration
in pci_create_host_bridge(), and pcibios_root_bridge_prepare() need the companion
acpi device pointer which is stored in sysdata.

I like you idea, but I haven't find a better way yet.

Thanks!
Yijing.

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
@ 2015-01-19  3:12       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:12 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On 2015/1/16 17:18, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:08 Yijing Wang wrote:
>> @@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
>>  {
>>         struct pci_host_bridge *host;
>>  
>> -       host = pci_create_host_bridge(parent, db, resources);
>> +       host = pci_create_host_bridge(parent, db, resources, sysdata);
>>         if (!host)
>>                 return NULL;
>>  
>> -       return __pci_scan_root_bus(host, ops, sysdata);
>> +       return __pci_scan_root_bus(host, ops);
>>  }
>>  EXPORT_SYMBOL(pci_scan_root_bus);
>>
> 
> How about keeping the sysdata out of the pci_create_host_bridge interface, and
> refactoring it so that the call sequence becomes
> 
> 	host = pci_create_host_bridge(parent, db, resources);
> 	host->sysdata = sysdata;
> 	__pci_scan_root_bus(host, ops);
> 
> This way, we can make sysdata completely option. I assume that more of the
> fields we have in sysdata today can get moved into pci_host_bridge
> over time, so a host bridge driver can just assign those members individually
> between pci_create_host_bridge and __pci_scan_root_bus.

I put the sysdata in pci_host_bridge, because some platforms x86/ia64
need to call pcibios_root_bridge_prepare() before pci_host_bridge registration
in pci_create_host_bridge(), and pcibios_root_bridge_prepare() need the companion
acpi device pointer which is stored in sysdata.

I like you idea, but I haven't find a better way yet.

Thanks!
Yijing.

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
@ 2015-01-19  3:12       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:12 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Bjorn Helgaas, Liviu Dudau, Tony Luck, Russell King,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On 2015/1/16 17:18, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:08 Yijing Wang wrote:
>> @@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
>>  {
>>         struct pci_host_bridge *host;
>>  
>> -       host = pci_create_host_bridge(parent, db, resources);
>> +       host = pci_create_host_bridge(parent, db, resources, sysdata);
>>         if (!host)
>>                 return NULL;
>>  
>> -       return __pci_scan_root_bus(host, ops, sysdata);
>> +       return __pci_scan_root_bus(host, ops);
>>  }
>>  EXPORT_SYMBOL(pci_scan_root_bus);
>>
> 
> How about keeping the sysdata out of the pci_create_host_bridge interface, and
> refactoring it so that the call sequence becomes
> 
> 	host = pci_create_host_bridge(parent, db, resources);
> 	host->sysdata = sysdata;
> 	__pci_scan_root_bus(host, ops);
> 
> This way, we can make sysdata completely option. I assume that more of the
> fields we have in sysdata today can get moved into pci_host_bridge
> over time, so a host bridge driver can just assign those members individually
> between pci_create_host_bridge and __pci_scan_root_bus.

I put the sysdata in pci_host_bridge, because some platforms x86/ia64
need to call pcibios_root_bridge_prepare() before pci_host_bridge registration
in pci_create_host_bridge(), and pcibios_root_bridge_prepare() need the companion
acpi device pointer which is stored in sysdata.

I like you idea, but I haven't find a better way yet.

Thanks!
Yijing.

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
  2015-01-16 10:01     ` Arnd Bergmann
                         ` (2 preceding siblings ...)
  (?)
@ 2015-01-19  3:17       ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:17 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Liviu Dudau, Tony Luck, Russell King, Marc Zyngier, linux-pci,
	x86, linux-kernel, Jiang Liu, Bjorn Helgaas, linux-m68k,
	Geert Uytterhoeven, linux-alpha, linux-ia64, Thomas Gleixner,
	Guan Xuetao, Yinghai Lu, David S. Miller

On 2015/1/16 18:01, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
>> +static void pci_host_bridge_probe_mode(
>> +               struct pci_host_bridge *host)
>> +{
>> +       host->of_scan = true;
>> +}
>>
> 
> I probably missed something here, but where does host->of_scan
> get used?
> 

It is used in __pci_scan_root_bus() to detect whether of scan bus is needed in patch 11.


@@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
 		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}

-	max = pci_scan_child_bus(b);
+	if (host->ops && host->ops->phb_probe_mode)
+		host->ops->phb_probe_mode(host);

-	if (!found)
-		pci_bus_update_busn_res_end(b, max);
+	if (host->of_scan) {
+		if (host->ops &&host->ops->phb_of_scan_bus)
+			host->ops->phb_of_scan_bus(host);
+	} else {
+		max = pci_scan_child_bus(b);
+		if (!found)
+			pci_bus_update_busn_res_end(b, max);
+	}

 	return b;

Thanks!
Yijing.


> 	Arnd
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
  2015-01-16 10:01     ` Arnd Bergmann
                       ` (2 preceding siblings ...)
  (?)
@ 2015-01-19  3:17     ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:17 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Liviu Dudau, Tony Luck, Russell King, Marc Zyngier, linux-pci,
	x86, linux-kernel, Jiang Liu, Bjorn Helgaas, linux-m68k,
	Geert Uytterhoeven, linux-alpha, linux-ia64, Thomas Gleixner,
	Guan Xuetao, Yinghai Lu, David S. Miller

On 2015/1/16 18:01, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
>> +static void pci_host_bridge_probe_mode(
>> +               struct pci_host_bridge *host)
>> +{
>> +       host->of_scan = true;
>> +}
>>
> 
> I probably missed something here, but where does host->of_scan
> get used?
> 

It is used in __pci_scan_root_bus() to detect whether of scan bus is needed in patch 11.


@@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
 		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}

-	max = pci_scan_child_bus(b);
+	if (host->ops && host->ops->phb_probe_mode)
+		host->ops->phb_probe_mode(host);

-	if (!found)
-		pci_bus_update_busn_res_end(b, max);
+	if (host->of_scan) {
+		if (host->ops &&host->ops->phb_of_scan_bus)
+			host->ops->phb_of_scan_bus(host);
+	} else {
+		max = pci_scan_child_bus(b);
+		if (!found)
+			pci_bus_update_busn_res_end(b, max);
+	}

 	return b;

Thanks!
Yijing.


> 	Arnd
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-19  3:17       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:17 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Liviu Dudau, Tony Luck, Russell King, Marc Zyngier, linux-pci,
	x86, linux-kernel, Jiang Liu, Bjorn Helgaas, linux-m68k,
	Geert Uytterhoeven, linux-alpha, linux-ia64, Thomas Gleixner,
	Guan Xuetao, Yinghai Lu, David S. Miller

On 2015/1/16 18:01, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
>> +static void pci_host_bridge_probe_mode(
>> +               struct pci_host_bridge *host)
>> +{
>> +       host->of_scan = true;
>> +}
>>
> 
> I probably missed something here, but where does host->of_scan
> get used?
> 

It is used in __pci_scan_root_bus() to detect whether of scan bus is needed in patch 11.


@@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
 		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}

-	max = pci_scan_child_bus(b);
+	if (host->ops && host->ops->phb_probe_mode)
+		host->ops->phb_probe_mode(host);

-	if (!found)
-		pci_bus_update_busn_res_end(b, max);
+	if (host->of_scan) {
+		if (host->ops &&host->ops->phb_of_scan_bus)
+			host->ops->phb_of_scan_bus(host);
+	} else {
+		max = pci_scan_child_bus(b);
+		if (!found)
+			pci_bus_update_busn_res_end(b, max);
+	}

 	return b;

Thanks!
Yijing.


> 	Arnd
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
> .
> 


-- 
Thanks!
Yijing


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

* [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-19  3:17       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:17 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015/1/16 18:01, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
>> +static void pci_host_bridge_probe_mode(
>> +               struct pci_host_bridge *host)
>> +{
>> +       host->of_scan = true;
>> +}
>>
> 
> I probably missed something here, but where does host->of_scan
> get used?
> 

It is used in __pci_scan_root_bus() to detect whether of scan bus is needed in patch 11.


@@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
 		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}

-	max = pci_scan_child_bus(b);
+	if (host->ops && host->ops->phb_probe_mode)
+		host->ops->phb_probe_mode(host);

-	if (!found)
-		pci_bus_update_busn_res_end(b, max);
+	if (host->of_scan) {
+		if (host->ops &&host->ops->phb_of_scan_bus)
+			host->ops->phb_of_scan_bus(host);
+	} else {
+		max = pci_scan_child_bus(b);
+		if (!found)
+			pci_bus_update_busn_res_end(b, max);
+	}

 	return b;

Thanks!
Yijing.


> 	Arnd
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-19  3:17       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:17 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Liviu Dudau, Tony Luck, Russell King, Marc Zyngier, linux-pci,
	x86, linux-kernel, Jiang Liu, Bjorn Helgaas, linux-m68k,
	Geert Uytterhoeven, linux-alpha, linux-ia64, Thomas Gleixner,
	Guan Xuetao, Yinghai Lu, David S. Miller

On 2015/1/16 18:01, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
>> +static void pci_host_bridge_probe_mode(
>> +               struct pci_host_bridge *host)
>> +{
>> +       host->of_scan = true;
>> +}
>>
> 
> I probably missed something here, but where does host->of_scan
> get used?
> 

It is used in __pci_scan_root_bus() to detect whether of scan bus is needed in patch 11.


@@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
 		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}

-	max = pci_scan_child_bus(b);
+	if (host->ops && host->ops->phb_probe_mode)
+		host->ops->phb_probe_mode(host);

-	if (!found)
-		pci_bus_update_busn_res_end(b, max);
+	if (host->of_scan) {
+		if (host->ops &&host->ops->phb_of_scan_bus)
+			host->ops->phb_of_scan_bus(host);
+	} else {
+		max = pci_scan_child_bus(b);
+		if (!found)
+			pci_bus_update_busn_res_end(b, max);
+	}

 	return b;

Thanks!
Yijing.


> 	Arnd
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-19  3:17       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:17 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Liviu Dudau, Tony Luck, Russell King, Marc Zyngier, linux-pci,
	x86, linux-kernel, Jiang Liu, Bjorn Helgaas, linux-m68k,
	Geert Uytterhoeven, linux-alpha, linux-ia64, Thomas Gleixner,
	Guan Xuetao, Yinghai Lu, David S. Miller

On 2015/1/16 18:01, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
>> +static void pci_host_bridge_probe_mode(
>> +               struct pci_host_bridge *host)
>> +{
>> +       host->of_scan = true;
>> +}
>>
> 
> I probably missed something here, but where does host->of_scan
> get used?
> 

It is used in __pci_scan_root_bus() to detect whether of scan bus is needed in patch 11.


@@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
 		pci_bus_insert_busn_res(b, host->busnum, 255);
 	}

-	max = pci_scan_child_bus(b);
+	if (host->ops && host->ops->phb_probe_mode)
+		host->ops->phb_probe_mode(host);

-	if (!found)
-		pci_bus_update_busn_res_end(b, max);
+	if (host->of_scan) {
+		if (host->ops &&host->ops->phb_of_scan_bus)
+			host->ops->phb_of_scan_bus(host);
+	} else {
+		max = pci_scan_child_bus(b);
+		if (!found)
+			pci_bus_update_busn_res_end(b, max);
+	}

 	return b;

Thanks!
Yijing.


> 	Arnd
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
  2015-01-17 16:39     ` Sergei Shtylyov
                         ` (2 preceding siblings ...)
  (?)
@ 2015-01-19  3:17       ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:17 UTC (permalink / raw)
  To: Sergei Shtylyov, Bjorn Helgaas
  Cc: Liviu Dudau, Tony Luck, Russell King, Arnd Bergmann,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	linux-arm-kernel

On 2015/1/18 0:39, Sergei Shtylyov wrote:
> Hello.
> 
> On 1/16/2015 4:44 AM, Yijing Wang wrote:
> 
>> Use pci_scan_root_bus() instead of pci_create_root_bus() +
>> pci_scan_child_bus() for simplicity.
> 
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>> ---
>>   drivers/pci/host/pcie-designware.c |    4 +---
>>   1 files changed, 1 insertions(+), 3 deletions(-)
> 
>> diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
>> index eef3111..d37fe27 100644
>> --- a/drivers/pci/host/pcie-designware.c
>> +++ b/drivers/pci/host/pcie-designware.c
>> @@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
>>       struct pcie_port *pp = sys_to_pcie(sys);
>>
>>       pp->root_bus_nr = sys->busnr;
>> -    bus = pci_create_root_bus(pp->dev, sys->busnr,
>> +    bus = pci_scan_root_bus(pp->dev, sys->busnr,
>>                     &dw_pcie_ops, sys, &sys->resources);
> 
>    Please realign this line, so that it still starts under 'pp'.

ok.

> 
> WBR, Sergei
> 
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
  2015-01-17 16:39     ` Sergei Shtylyov
                       ` (3 preceding siblings ...)
  (?)
@ 2015-01-19  3:17     ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:17 UTC (permalink / raw)
  To: Sergei Shtylyov, Bjorn Helgaas
  Cc: Liviu Dudau, Tony Luck, Russell King, Arnd Bergmann,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	linux-arm-kernel

On 2015/1/18 0:39, Sergei Shtylyov wrote:
> Hello.
> 
> On 1/16/2015 4:44 AM, Yijing Wang wrote:
> 
>> Use pci_scan_root_bus() instead of pci_create_root_bus() +
>> pci_scan_child_bus() for simplicity.
> 
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>> ---
>>   drivers/pci/host/pcie-designware.c |    4 +---
>>   1 files changed, 1 insertions(+), 3 deletions(-)
> 
>> diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
>> index eef3111..d37fe27 100644
>> --- a/drivers/pci/host/pcie-designware.c
>> +++ b/drivers/pci/host/pcie-designware.c
>> @@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
>>       struct pcie_port *pp = sys_to_pcie(sys);
>>
>>       pp->root_bus_nr = sys->busnr;
>> -    bus = pci_create_root_bus(pp->dev, sys->busnr,
>> +    bus = pci_scan_root_bus(pp->dev, sys->busnr,
>>                     &dw_pcie_ops, sys, &sys->resources);
> 
>    Please realign this line, so that it still starts under 'pp'.

ok.

> 
> WBR, Sergei
> 
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
@ 2015-01-19  3:17       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:17 UTC (permalink / raw)
  To: Sergei Shtylyov, Bjorn Helgaas
  Cc: Liviu Dudau, Tony Luck, Russell King, Arnd Bergmann,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	linux-arm-kernel

On 2015/1/18 0:39, Sergei Shtylyov wrote:
> Hello.
> 
> On 1/16/2015 4:44 AM, Yijing Wang wrote:
> 
>> Use pci_scan_root_bus() instead of pci_create_root_bus() +
>> pci_scan_child_bus() for simplicity.
> 
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>> ---
>>   drivers/pci/host/pcie-designware.c |    4 +---
>>   1 files changed, 1 insertions(+), 3 deletions(-)
> 
>> diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
>> index eef3111..d37fe27 100644
>> --- a/drivers/pci/host/pcie-designware.c
>> +++ b/drivers/pci/host/pcie-designware.c
>> @@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
>>       struct pcie_port *pp = sys_to_pcie(sys);
>>
>>       pp->root_bus_nr = sys->busnr;
>> -    bus = pci_create_root_bus(pp->dev, sys->busnr,
>> +    bus = pci_scan_root_bus(pp->dev, sys->busnr,
>>                     &dw_pcie_ops, sys, &sys->resources);
> 
>    Please realign this line, so that it still starts under 'pp'.

ok.

> 
> WBR, Sergei
> 
> 
> .
> 


-- 
Thanks!
Yijing


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

* [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
@ 2015-01-19  3:17       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:17 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015/1/18 0:39, Sergei Shtylyov wrote:
> Hello.
> 
> On 1/16/2015 4:44 AM, Yijing Wang wrote:
> 
>> Use pci_scan_root_bus() instead of pci_create_root_bus() +
>> pci_scan_child_bus() for simplicity.
> 
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>> ---
>>   drivers/pci/host/pcie-designware.c |    4 +---
>>   1 files changed, 1 insertions(+), 3 deletions(-)
> 
>> diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
>> index eef3111..d37fe27 100644
>> --- a/drivers/pci/host/pcie-designware.c
>> +++ b/drivers/pci/host/pcie-designware.c
>> @@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
>>       struct pcie_port *pp = sys_to_pcie(sys);
>>
>>       pp->root_bus_nr = sys->busnr;
>> -    bus = pci_create_root_bus(pp->dev, sys->busnr,
>> +    bus = pci_scan_root_bus(pp->dev, sys->busnr,
>>                     &dw_pcie_ops, sys, &sys->resources);
> 
>    Please realign this line, so that it still starts under 'pp'.

ok.

> 
> WBR, Sergei
> 
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
@ 2015-01-19  3:17       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:17 UTC (permalink / raw)
  To: Sergei Shtylyov, Bjorn Helgaas
  Cc: Liviu Dudau, Tony Luck, Russell King, Arnd Bergmann,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	linux-arm-kernel

On 2015/1/18 0:39, Sergei Shtylyov wrote:
> Hello.
> 
> On 1/16/2015 4:44 AM, Yijing Wang wrote:
> 
>> Use pci_scan_root_bus() instead of pci_create_root_bus() +
>> pci_scan_child_bus() for simplicity.
> 
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>> ---
>>   drivers/pci/host/pcie-designware.c |    4 +---
>>   1 files changed, 1 insertions(+), 3 deletions(-)
> 
>> diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
>> index eef3111..d37fe27 100644
>> --- a/drivers/pci/host/pcie-designware.c
>> +++ b/drivers/pci/host/pcie-designware.c
>> @@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
>>       struct pcie_port *pp = sys_to_pcie(sys);
>>
>>       pp->root_bus_nr = sys->busnr;
>> -    bus = pci_create_root_bus(pp->dev, sys->busnr,
>> +    bus = pci_scan_root_bus(pp->dev, sys->busnr,
>>                     &dw_pcie_ops, sys, &sys->resources);
> 
>    Please realign this line, so that it still starts under 'pp'.

ok.

> 
> WBR, Sergei
> 
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity
@ 2015-01-19  3:17       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:17 UTC (permalink / raw)
  To: Sergei Shtylyov, Bjorn Helgaas
  Cc: Liviu Dudau, Tony Luck, Russell King, Arnd Bergmann,
	Marc Zyngier, linux-pci, x86, linux-kernel, David S. Miller,
	linux-m68k, Geert Uytterhoeven, linux-alpha, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	linux-arm-kernel

On 2015/1/18 0:39, Sergei Shtylyov wrote:
> Hello.
> 
> On 1/16/2015 4:44 AM, Yijing Wang wrote:
> 
>> Use pci_scan_root_bus() instead of pci_create_root_bus() +
>> pci_scan_child_bus() for simplicity.
> 
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>> ---
>>   drivers/pci/host/pcie-designware.c |    4 +---
>>   1 files changed, 1 insertions(+), 3 deletions(-)
> 
>> diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
>> index eef3111..d37fe27 100644
>> --- a/drivers/pci/host/pcie-designware.c
>> +++ b/drivers/pci/host/pcie-designware.c
>> @@ -725,13 +725,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
>>       struct pcie_port *pp = sys_to_pcie(sys);
>>
>>       pp->root_bus_nr = sys->busnr;
>> -    bus = pci_create_root_bus(pp->dev, sys->busnr,
>> +    bus = pci_scan_root_bus(pp->dev, sys->busnr,
>>                     &dw_pcie_ops, sys, &sys->resources);
> 
>    Please realign this line, so that it still starts under 'pp'.

ok.

> 
> WBR, Sergei
> 
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
  2015-01-16  9:44     ` Arnd Bergmann
                         ` (2 preceding siblings ...)
  (?)
@ 2015-01-19  3:19       ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:19 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On 2015/1/16 17:44, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:25 Yijing Wang wrote:
>>
>> +int pci_domain_nr(struct pci_bus *bus)
>> +{
>> +       struct pci_host_bridge *host = find_pci_host_bridge(bus);
>> +
>> +       return host->domain;
>> +}
>> +EXPORT_SYMBOL_GPL(pci_domain_nr);
>> +
> 
> Since most of the existing functions are exported as EXPORT_SYMBOL
> rather than EXPORT_SYMBOL_GPL, I think the new version should do
> the same.

Good catch. Thanks!

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
  2015-01-16  9:44     ` Arnd Bergmann
                       ` (3 preceding siblings ...)
  (?)
@ 2015-01-19  3:19     ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:19 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On 2015/1/16 17:44, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:25 Yijing Wang wrote:
>>
>> +int pci_domain_nr(struct pci_bus *bus)
>> +{
>> +       struct pci_host_bridge *host = find_pci_host_bridge(bus);
>> +
>> +       return host->domain;
>> +}
>> +EXPORT_SYMBOL_GPL(pci_domain_nr);
>> +
> 
> Since most of the existing functions are exported as EXPORT_SYMBOL
> rather than EXPORT_SYMBOL_GPL, I think the new version should do
> the same.

Good catch. Thanks!

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
@ 2015-01-19  3:19       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:19 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On 2015/1/16 17:44, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:25 Yijing Wang wrote:
>>
>> +int pci_domain_nr(struct pci_bus *bus)
>> +{
>> +       struct pci_host_bridge *host = find_pci_host_bridge(bus);
>> +
>> +       return host->domain;
>> +}
>> +EXPORT_SYMBOL_GPL(pci_domain_nr);
>> +
> 
> Since most of the existing functions are exported as EXPORT_SYMBOL
> rather than EXPORT_SYMBOL_GPL, I think the new version should do
> the same.

Good catch. Thanks!

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
@ 2015-01-19  3:19       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:19 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015/1/16 17:44, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:25 Yijing Wang wrote:
>>
>> +int pci_domain_nr(struct pci_bus *bus)
>> +{
>> +       struct pci_host_bridge *host = find_pci_host_bridge(bus);
>> +
>> +       return host->domain;
>> +}
>> +EXPORT_SYMBOL_GPL(pci_domain_nr);
>> +
> 
> Since most of the existing functions are exported as EXPORT_SYMBOL
> rather than EXPORT_SYMBOL_GPL, I think the new version should do
> the same.

Good catch. Thanks!

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
@ 2015-01-19  3:19       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:19 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On 2015/1/16 17:44, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:25 Yijing Wang wrote:
>>
>> +int pci_domain_nr(struct pci_bus *bus)
>> +{
>> +       struct pci_host_bridge *host = find_pci_host_bridge(bus);
>> +
>> +       return host->domain;
>> +}
>> +EXPORT_SYMBOL_GPL(pci_domain_nr);
>> +
> 
> Since most of the existing functions are exported as EXPORT_SYMBOL
> rather than EXPORT_SYMBOL_GPL, I think the new version should do
> the same.

Good catch. Thanks!

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 27/28] PCI: Remove platform specific pci_domain_nr()
@ 2015-01-19  3:19       ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19  3:19 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Yinghai Lu, linux-kernel,
	Marc Zyngier, linux-arm-kernel, Russell King, x86,
	Thomas Gleixner, Tony Luck, linux-ia64, David S. Miller,
	Guan Xuetao, linux-alpha, linux-m68k, Liviu Dudau,
	Geert Uytterhoeven

On 2015/1/16 17:44, Arnd Bergmann wrote:
> On Friday 16 January 2015 09:44:25 Yijing Wang wrote:
>>
>> +int pci_domain_nr(struct pci_bus *bus)
>> +{
>> +       struct pci_host_bridge *host = find_pci_host_bridge(bus);
>> +
>> +       return host->domain;
>> +}
>> +EXPORT_SYMBOL_GPL(pci_domain_nr);
>> +
> 
> Since most of the existing functions are exported as EXPORT_SYMBOL
> rather than EXPORT_SYMBOL_GPL, I think the new version should do
> the same.

Good catch. Thanks!

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
  2015-01-19  2:04         ` Yijing Wang
                             ` (3 preceding siblings ...)
  (?)
@ 2015-01-19  4:59           ` Greg Ungerer
  -1 siblings, 0 replies; 320+ messages in thread
From: Greg Ungerer @ 2015-01-19  4:59 UTC (permalink / raw)
  To: Yijing Wang, Yinghai Lu
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Linux Kernel Mailing List,
	Marc Zyngier, linux-arm-kernel, Russell King,
	the arch/x86 maintainers, Thomas Gleixner, Tony Luck, linux-ia64,
	David S. Miller, Guan Xuetao, linux-alpha, linux-m68k,
	Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven, sparclinux

On 19/01/15 12:04, Yijing Wang wrote:
> On 2015/1/17 7:16, Yinghai Lu wrote:
>> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>>> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>>>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>>>> Now pci device will be added to driver core once its
>>>> creation. All things left in pci_bus_add_devices() are
>>>> driver attachment and other trivial sysfs things.
>>>> Pci_scan_bus() should be the function responsible for
>>>> scanning PCI devices, not including driver attachment.
>>>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>>>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>>>> after pci_scan_bus().
>>>>
>>>> E.g.
>>>> In m68k
>>>> mcf_pci_init()
>>>>         pci_scan_bus()
>>>>                 ...
>>>>                 pci_bus_add_devices() --- try to attach driver
>>>>         pci_fixup_irqs()
>>>>         pci_bus_size_bridges()
>>>>         pci_bus_assign_resources()
>>>>
>>>> It is not correct, resources should be assigned correctly
>>>> before attaching driver.
>>>
>> No, for booting path, at that time pci drivers are *NOT* loaded yet.
> 
> Hi Yinghai, I knew code flow here would not cause problems, sorry the log
> confused you, I will refresh it. But I think pci_scan_bus()/pci_scan_root_bus()
> which could only be used during system boot up(before module_init) make
> the pci scan logic obscure. Because most callers additionally call
> pci_bus_size_bridges() and pci_bus_assign_resources() later,
> so rip out pci_bus_add_devices() from pci_scan_bus()/pci_scan_root_bus()
> make code have better readability.

I agree that ordering seems odd. I recall there was a reason I had
to put it in that order (at that time - which is a few years back now).
I can't remember exactly now, but it was something like bridges
didn't get resourced properly without a pci scan first.

Regards
Greg




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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
  2015-01-19  2:04         ` Yijing Wang
                           ` (4 preceding siblings ...)
  (?)
@ 2015-01-19  4:59         ` Greg Ungerer
  -1 siblings, 0 replies; 320+ messages in thread
From: Greg Ungerer @ 2015-01-19  4:59 UTC (permalink / raw)
  To: Yijing Wang, Yinghai Lu
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Linux Kernel Mailing List,
	Marc Zyngier, linux-arm-kernel, Russell King,
	the arch/x86 maintainers, Thomas Gleixner, Tony Luck, linux-ia64,
	David S. Miller, Guan Xuetao, linux-alpha, linux-m68k,
	Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven, sparclinux

On 19/01/15 12:04, Yijing Wang wrote:
> On 2015/1/17 7:16, Yinghai Lu wrote:
>> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>>> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>>>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>>>> Now pci device will be added to driver core once its
>>>> creation. All things left in pci_bus_add_devices() are
>>>> driver attachment and other trivial sysfs things.
>>>> Pci_scan_bus() should be the function responsible for
>>>> scanning PCI devices, not including driver attachment.
>>>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>>>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>>>> after pci_scan_bus().
>>>>
>>>> E.g.
>>>> In m68k
>>>> mcf_pci_init()
>>>>         pci_scan_bus()
>>>>                 ...
>>>>                 pci_bus_add_devices() --- try to attach driver
>>>>         pci_fixup_irqs()
>>>>         pci_bus_size_bridges()
>>>>         pci_bus_assign_resources()
>>>>
>>>> It is not correct, resources should be assigned correctly
>>>> before attaching driver.
>>>
>> No, for booting path, at that time pci drivers are *NOT* loaded yet.
> 
> Hi Yinghai, I knew code flow here would not cause problems, sorry the log
> confused you, I will refresh it. But I think pci_scan_bus()/pci_scan_root_bus()
> which could only be used during system boot up(before module_init) make
> the pci scan logic obscure. Because most callers additionally call
> pci_bus_size_bridges() and pci_bus_assign_resources() later,
> so rip out pci_bus_add_devices() from pci_scan_bus()/pci_scan_root_bus()
> make code have better readability.

I agree that ordering seems odd. I recall there was a reason I had
to put it in that order (at that time - which is a few years back now).
I can't remember exactly now, but it was something like bridges
didn't get resourced properly without a pci scan first.

Regards
Greg

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-19  4:59           ` Greg Ungerer
  0 siblings, 0 replies; 320+ messages in thread
From: Greg Ungerer @ 2015-01-19  4:59 UTC (permalink / raw)
  To: Yijing Wang, Yinghai Lu
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Linux Kernel Mailing List,
	Marc Zyngier, linux-arm-kernel, Russell King,
	the arch/x86 maintainers, Thomas Gleixner, Tony Luck, linux-ia64,
	David S. Miller, Guan Xuetao, linux-alpha, linux-m68k,
	Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven, sparclinux

On 19/01/15 12:04, Yijing Wang wrote:
> On 2015/1/17 7:16, Yinghai Lu wrote:
>> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>>> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>>>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>>>> Now pci device will be added to driver core once its
>>>> creation. All things left in pci_bus_add_devices() are
>>>> driver attachment and other trivial sysfs things.
>>>> Pci_scan_bus() should be the function responsible for
>>>> scanning PCI devices, not including driver attachment.
>>>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>>>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>>>> after pci_scan_bus().
>>>>
>>>> E.g.
>>>> In m68k
>>>> mcf_pci_init()
>>>>         pci_scan_bus()
>>>>                 ...
>>>>                 pci_bus_add_devices() --- try to attach driver
>>>>         pci_fixup_irqs()
>>>>         pci_bus_size_bridges()
>>>>         pci_bus_assign_resources()
>>>>
>>>> It is not correct, resources should be assigned correctly
>>>> before attaching driver.
>>>
>> No, for booting path, at that time pci drivers are *NOT* loaded yet.
> 
> Hi Yinghai, I knew code flow here would not cause problems, sorry the log
> confused you, I will refresh it. But I think pci_scan_bus()/pci_scan_root_bus()
> which could only be used during system boot up(before module_init) make
> the pci scan logic obscure. Because most callers additionally call
> pci_bus_size_bridges() and pci_bus_assign_resources() later,
> so rip out pci_bus_add_devices() from pci_scan_bus()/pci_scan_root_bus()
> make code have better readability.

I agree that ordering seems odd. I recall there was a reason I had
to put it in that order (at that time - which is a few years back now).
I can't remember exactly now, but it was something like bridges
didn't get resourced properly without a pci scan first.

Regards
Greg




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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-19  4:59           ` Greg Ungerer
  0 siblings, 0 replies; 320+ messages in thread
From: Greg Ungerer @ 2015-01-19  4:59 UTC (permalink / raw)
  To: linux-arm-kernel

On 19/01/15 12:04, Yijing Wang wrote:
> On 2015/1/17 7:16, Yinghai Lu wrote:
>> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>>> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>>>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>>>> Now pci device will be added to driver core once its
>>>> creation. All things left in pci_bus_add_devices() are
>>>> driver attachment and other trivial sysfs things.
>>>> Pci_scan_bus() should be the function responsible for
>>>> scanning PCI devices, not including driver attachment.
>>>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>>>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>>>> after pci_scan_bus().
>>>>
>>>> E.g.
>>>> In m68k
>>>> mcf_pci_init()
>>>>         pci_scan_bus()
>>>>                 ...
>>>>                 pci_bus_add_devices() --- try to attach driver
>>>>         pci_fixup_irqs()
>>>>         pci_bus_size_bridges()
>>>>         pci_bus_assign_resources()
>>>>
>>>> It is not correct, resources should be assigned correctly
>>>> before attaching driver.
>>>
>> No, for booting path, at that time pci drivers are *NOT* loaded yet.
> 
> Hi Yinghai, I knew code flow here would not cause problems, sorry the log
> confused you, I will refresh it. But I think pci_scan_bus()/pci_scan_root_bus()
> which could only be used during system boot up(before module_init) make
> the pci scan logic obscure. Because most callers additionally call
> pci_bus_size_bridges() and pci_bus_assign_resources() later,
> so rip out pci_bus_add_devices() from pci_scan_bus()/pci_scan_root_bus()
> make code have better readability.

I agree that ordering seems odd. I recall there was a reason I had
to put it in that order (at that time - which is a few years back now).
I can't remember exactly now, but it was something like bridges
didn't get resourced properly without a pci scan first.

Regards
Greg




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

* [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-19  4:59           ` Greg Ungerer
  0 siblings, 0 replies; 320+ messages in thread
From: Greg Ungerer @ 2015-01-19  4:59 UTC (permalink / raw)
  To: linux-arm-kernel

On 19/01/15 12:04, Yijing Wang wrote:
> On 2015/1/17 7:16, Yinghai Lu wrote:
>> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>>> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>>>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>>>> Now pci device will be added to driver core once its
>>>> creation. All things left in pci_bus_add_devices() are
>>>> driver attachment and other trivial sysfs things.
>>>> Pci_scan_bus() should be the function responsible for
>>>> scanning PCI devices, not including driver attachment.
>>>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>>>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>>>> after pci_scan_bus().
>>>>
>>>> E.g.
>>>> In m68k
>>>> mcf_pci_init()
>>>>         pci_scan_bus()
>>>>                 ...
>>>>                 pci_bus_add_devices() --- try to attach driver
>>>>         pci_fixup_irqs()
>>>>         pci_bus_size_bridges()
>>>>         pci_bus_assign_resources()
>>>>
>>>> It is not correct, resources should be assigned correctly
>>>> before attaching driver.
>>>
>> No, for booting path, at that time pci drivers are *NOT* loaded yet.
> 
> Hi Yinghai, I knew code flow here would not cause problems, sorry the log
> confused you, I will refresh it. But I think pci_scan_bus()/pci_scan_root_bus()
> which could only be used during system boot up(before module_init) make
> the pci scan logic obscure. Because most callers additionally call
> pci_bus_size_bridges() and pci_bus_assign_resources() later,
> so rip out pci_bus_add_devices() from pci_scan_bus()/pci_scan_root_bus()
> make code have better readability.

I agree that ordering seems odd. I recall there was a reason I had
to put it in that order (at that time - which is a few years back now).
I can't remember exactly now, but it was something like bridges
didn't get resourced properly without a pci scan first.

Regards
Greg

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-19  4:59           ` Greg Ungerer
  0 siblings, 0 replies; 320+ messages in thread
From: Greg Ungerer @ 2015-01-19  4:59 UTC (permalink / raw)
  To: Yijing Wang, Yinghai Lu
  Cc: Bjorn Helgaas, Jiang Liu, linux-pci, Linux Kernel Mailing List,
	Marc Zyngier, linux-arm-kernel, Russell King,
	the arch/x86 maintainers, Thomas Gleixner, Tony Luck, linux-ia64,
	David S. Miller, Guan Xuetao, linux-alpha, linux-m68k,
	Liviu Dudau, Arnd Bergmann, Geert Uytterhoeven, sparclinux

On 19/01/15 12:04, Yijing Wang wrote:
> On 2015/1/17 7:16, Yinghai Lu wrote:
>> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>>> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>>>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>>>> Now pci device will be added to driver core once its
>>>> creation. All things left in pci_bus_add_devices() are
>>>> driver attachment and other trivial sysfs things.
>>>> Pci_scan_bus() should be the function responsible for
>>>> scanning PCI devices, not including driver attachment.
>>>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>>>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>>>> after pci_scan_bus().
>>>>
>>>> E.g.
>>>> In m68k
>>>> mcf_pci_init()
>>>>         pci_scan_bus()
>>>>                 ...
>>>>                 pci_bus_add_devices() --- try to attach driver
>>>>         pci_fixup_irqs()
>>>>         pci_bus_size_bridges()
>>>>         pci_bus_assign_resources()
>>>>
>>>> It is not correct, resources should be assigned correctly
>>>> before attaching driver.
>>>
>> No, for booting path, at that time pci drivers are *NOT* loaded yet.
> 
> Hi Yinghai, I knew code flow here would not cause problems, sorry the log
> confused you, I will refresh it. But I think pci_scan_bus()/pci_scan_root_bus()
> which could only be used during system boot up(before module_init) make
> the pci scan logic obscure. Because most callers additionally call
> pci_bus_size_bridges() and pci_bus_assign_resources() later,
> so rip out pci_bus_add_devices() from pci_scan_bus()/pci_scan_root_bus()
> make code have better readability.

I agree that ordering seems odd. I recall there was a reason I had
to put it in that order (at that time - which is a few years back now).
I can't remember exactly now, but it was something like bridges
didn't get resourced properly without a pci scan first.

Regards
Greg




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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-19  4:59           ` Greg Ungerer
  0 siblings, 0 replies; 320+ messages in thread
From: Greg Ungerer @ 2015-01-19  4:59 UTC (permalink / raw)
  To: Yijing Wang, Yinghai Lu
  Cc: Liviu Dudau, Tony Luck, Russell King, Arnd Bergmann,
	Marc Zyngier, linux-pci, the arch/x86 maintainers,
	Linux Kernel Mailing List, David S. Miller, sparclinux,
	linux-m68k, Geert Uytterhoeven, linux-alpha, Bjorn Helgaas,
	linux-ia64, Thomas Gleixner, Guan Xuetao, Jiang Liu,
	linux-arm-kernel

On 19/01/15 12:04, Yijing Wang wrote:
> On 2015/1/17 7:16, Yinghai Lu wrote:
>> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>>> On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>>>> Pci_bus_add_devices() should not be placed in pci_scan_bus().
>>>> Now pci device will be added to driver core once its
>>>> creation. All things left in pci_bus_add_devices() are
>>>> driver attachment and other trivial sysfs things.
>>>> Pci_scan_bus() should be the function responsible for
>>>> scanning PCI devices, not including driver attachment.
>>>> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
>>>> will call pci_bus_size_bridges() and pci_bus_assign_resources()
>>>> after pci_scan_bus().
>>>>
>>>> E.g.
>>>> In m68k
>>>> mcf_pci_init()
>>>>         pci_scan_bus()
>>>>                 ...
>>>>                 pci_bus_add_devices() --- try to attach driver
>>>>         pci_fixup_irqs()
>>>>         pci_bus_size_bridges()
>>>>         pci_bus_assign_resources()
>>>>
>>>> It is not correct, resources should be assigned correctly
>>>> before attaching driver.
>>>
>> No, for booting path, at that time pci drivers are *NOT* loaded yet.
> 
> Hi Yinghai, I knew code flow here would not cause problems, sorry the log
> confused you, I will refresh it. But I think pci_scan_bus()/pci_scan_root_bus()
> which could only be used during system boot up(before module_init) make
> the pci scan logic obscure. Because most callers additionally call
> pci_bus_size_bridges() and pci_bus_assign_resources() later,
> so rip out pci_bus_add_devices() from pci_scan_bus()/pci_scan_root_bus()
> make code have better readability.

I agree that ordering seems odd. I recall there was a reason I had
to put it in that order (at that time - which is a few years back now).
I can't remember exactly now, but it was something like bridges
didn't get resourced properly without a pci scan first.

Regards
Greg

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
  2015-01-16 23:16       ` Yinghai Lu
                           ` (2 preceding siblings ...)
  (?)
@ 2015-01-19  8:23         ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  8:23 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Yijing Wang, Bjorn Helgaas, Jiang Liu, linux-pci,
	Linux Kernel Mailing List, Marc Zyngier, linux-arm-kernel,
	Russell King, the arch/x86 maintainers, Thomas Gleixner,
	Tony Luck, linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Geert Uytterhoeven, sparclinux

On Friday 16 January 2015 15:16:28 Yinghai Lu wrote:
> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> > On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> >> Pci_bus_add_devices() should not be placed in pci_scan_bus().
> >> Now pci device will be added to driver core once its
> >> creation. All things left in pci_bus_add_devices() are
> >> driver attachment and other trivial sysfs things.
> >> Pci_scan_bus() should be the function responsible for
> >> scanning PCI devices, not including driver attachment.
> >> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
> >> will call pci_bus_size_bridges() and pci_bus_assign_resources()
> >> after pci_scan_bus().
> >>
> >> E.g.
> >> In m68k
> >> mcf_pci_init()
> >>         pci_scan_bus()
> >>                 ...
> >>                 pci_bus_add_devices() --- try to attach driver
> >>         pci_fixup_irqs()
> >>         pci_bus_size_bridges()
> >>         pci_bus_assign_resources()
> >>
> >> It is not correct, resources should be assigned correctly
> >> before attaching driver.
> >
> No, for booting path, at that time pci drivers are *NOT* loaded yet.

This may be true for the m68k example, and traditionally for all
PCI hosts, but as we move to a more modular architecture with
drivers/pci/hosts, you can have PCI host drivers that are loadable
modules and get loaded after the built-in drivers are initialized,
or you can have host drivers that depend on a resource (clock,
regulator, reset, gpio, ...) that in turn comes from a driver
that gets initialized later.

	Arnd

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
  2015-01-16 23:16       ` Yinghai Lu
                         ` (6 preceding siblings ...)
  (?)
@ 2015-01-19  8:23       ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  8:23 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Yijing Wang, Bjorn Helgaas, Jiang Liu, linux-pci,
	Linux Kernel Mailing List, Marc Zyngier, linux-arm-kernel,
	Russell King, the arch/x86 maintainers, Thomas Gleixner,
	Tony Luck, linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Geert Uytterhoeven, sparclinux

On Friday 16 January 2015 15:16:28 Yinghai Lu wrote:
> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> > On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> >> Pci_bus_add_devices() should not be placed in pci_scan_bus().
> >> Now pci device will be added to driver core once its
> >> creation. All things left in pci_bus_add_devices() are
> >> driver attachment and other trivial sysfs things.
> >> Pci_scan_bus() should be the function responsible for
> >> scanning PCI devices, not including driver attachment.
> >> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
> >> will call pci_bus_size_bridges() and pci_bus_assign_resources()
> >> after pci_scan_bus().
> >>
> >> E.g.
> >> In m68k
> >> mcf_pci_init()
> >>         pci_scan_bus()
> >>                 ...
> >>                 pci_bus_add_devices() --- try to attach driver
> >>         pci_fixup_irqs()
> >>         pci_bus_size_bridges()
> >>         pci_bus_assign_resources()
> >>
> >> It is not correct, resources should be assigned correctly
> >> before attaching driver.
> >
> No, for booting path, at that time pci drivers are *NOT* loaded yet.

This may be true for the m68k example, and traditionally for all
PCI hosts, but as we move to a more modular architecture with
drivers/pci/hosts, you can have PCI host drivers that are loadable
modules and get loaded after the built-in drivers are initialized,
or you can have host drivers that depend on a resource (clock,
regulator, reset, gpio, ...) that in turn comes from a driver
that gets initialized later.

	Arnd

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-19  8:23         ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  8:23 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Yijing Wang, Bjorn Helgaas, Jiang Liu, linux-pci,
	Linux Kernel Mailing List, Marc Zyngier, linux-arm-kernel,
	Russell King, the arch/x86 maintainers, Thomas Gleixner,
	Tony Luck, linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Geert Uytterhoeven, sparclinux

On Friday 16 January 2015 15:16:28 Yinghai Lu wrote:
> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> > On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> >> Pci_bus_add_devices() should not be placed in pci_scan_bus().
> >> Now pci device will be added to driver core once its
> >> creation. All things left in pci_bus_add_devices() are
> >> driver attachment and other trivial sysfs things.
> >> Pci_scan_bus() should be the function responsible for
> >> scanning PCI devices, not including driver attachment.
> >> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
> >> will call pci_bus_size_bridges() and pci_bus_assign_resources()
> >> after pci_scan_bus().
> >>
> >> E.g.
> >> In m68k
> >> mcf_pci_init()
> >>         pci_scan_bus()
> >>                 ...
> >>                 pci_bus_add_devices() --- try to attach driver
> >>         pci_fixup_irqs()
> >>         pci_bus_size_bridges()
> >>         pci_bus_assign_resources()
> >>
> >> It is not correct, resources should be assigned correctly
> >> before attaching driver.
> >
> No, for booting path, at that time pci drivers are *NOT* loaded yet.

This may be true for the m68k example, and traditionally for all
PCI hosts, but as we move to a more modular architecture with
drivers/pci/hosts, you can have PCI host drivers that are loadable
modules and get loaded after the built-in drivers are initialized,
or you can have host drivers that depend on a resource (clock,
regulator, reset, gpio, ...) that in turn comes from a driver
that gets initialized later.

	Arnd

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-19  8:23         ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  8:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 16 January 2015 15:16:28 Yinghai Lu wrote:
> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> > On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> >> Pci_bus_add_devices() should not be placed in pci_scan_bus().
> >> Now pci device will be added to driver core once its
> >> creation. All things left in pci_bus_add_devices() are
> >> driver attachment and other trivial sysfs things.
> >> Pci_scan_bus() should be the function responsible for
> >> scanning PCI devices, not including driver attachment.
> >> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
> >> will call pci_bus_size_bridges() and pci_bus_assign_resources()
> >> after pci_scan_bus().
> >>
> >> E.g.
> >> In m68k
> >> mcf_pci_init()
> >>         pci_scan_bus()
> >>                 ...
> >>                 pci_bus_add_devices() --- try to attach driver
> >>         pci_fixup_irqs()
> >>         pci_bus_size_bridges()
> >>         pci_bus_assign_resources()
> >>
> >> It is not correct, resources should be assigned correctly
> >> before attaching driver.
> >
> No, for booting path, at that time pci drivers are *NOT* loaded yet.

This may be true for the m68k example, and traditionally for all
PCI hosts, but as we move to a more modular architecture with
drivers/pci/hosts, you can have PCI host drivers that are loadable
modules and get loaded after the built-in drivers are initialized,
or you can have host drivers that depend on a resource (clock,
regulator, reset, gpio, ...) that in turn comes from a driver
that gets initialized later.

	Arnd

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

* [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-19  8:23         ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  8:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 16 January 2015 15:16:28 Yinghai Lu wrote:
> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> > On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> >> Pci_bus_add_devices() should not be placed in pci_scan_bus().
> >> Now pci device will be added to driver core once its
> >> creation. All things left in pci_bus_add_devices() are
> >> driver attachment and other trivial sysfs things.
> >> Pci_scan_bus() should be the function responsible for
> >> scanning PCI devices, not including driver attachment.
> >> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
> >> will call pci_bus_size_bridges() and pci_bus_assign_resources()
> >> after pci_scan_bus().
> >>
> >> E.g.
> >> In m68k
> >> mcf_pci_init()
> >>         pci_scan_bus()
> >>                 ...
> >>                 pci_bus_add_devices() --- try to attach driver
> >>         pci_fixup_irqs()
> >>         pci_bus_size_bridges()
> >>         pci_bus_assign_resources()
> >>
> >> It is not correct, resources should be assigned correctly
> >> before attaching driver.
> >
> No, for booting path, at that time pci drivers are *NOT* loaded yet.

This may be true for the m68k example, and traditionally for all
PCI hosts, but as we move to a more modular architecture with
drivers/pci/hosts, you can have PCI host drivers that are loadable
modules and get loaded after the built-in drivers are initialized,
or you can have host drivers that depend on a resource (clock,
regulator, reset, gpio, ...) that in turn comes from a driver
that gets initialized later.

	Arnd

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

* Re: [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
@ 2015-01-19  8:23         ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  8:23 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Yijing Wang, Bjorn Helgaas, Jiang Liu, linux-pci,
	Linux Kernel Mailing List, Marc Zyngier, linux-arm-kernel,
	Russell King, the arch/x86 maintainers, Thomas Gleixner,
	Tony Luck, linux-ia64, David S. Miller, Guan Xuetao, linux-alpha,
	linux-m68k, Liviu Dudau, Geert Uytterhoeven, sparclinux

On Friday 16 January 2015 15:16:28 Yinghai Lu wrote:
> On Fri, Jan 16, 2015 at 3:15 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> > On Thu, Jan 15, 2015 at 5:43 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> >> Pci_bus_add_devices() should not be placed in pci_scan_bus().
> >> Now pci device will be added to driver core once its
> >> creation. All things left in pci_bus_add_devices() are
> >> driver attachment and other trivial sysfs things.
> >> Pci_scan_bus() should be the function responsible for
> >> scanning PCI devices, not including driver attachment.
> >> Other, some callers(m68k,unicore32,alpha) of pci_scan_bus()
> >> will call pci_bus_size_bridges() and pci_bus_assign_resources()
> >> after pci_scan_bus().
> >>
> >> E.g.
> >> In m68k
> >> mcf_pci_init()
> >>         pci_scan_bus()
> >>                 ...
> >>                 pci_bus_add_devices() --- try to attach driver
> >>         pci_fixup_irqs()
> >>         pci_bus_size_bridges()
> >>         pci_bus_assign_resources()
> >>
> >> It is not correct, resources should be assigned correctly
> >> before attaching driver.
> >
> No, for booting path, at that time pci drivers are *NOT* loaded yet.

This may be true for the m68k example, and traditionally for all
PCI hosts, but as we move to a more modular architecture with
drivers/pci/hosts, you can have PCI host drivers that are loadable
modules and get loaded after the built-in drivers are initialized,
or you can have host drivers that depend on a resource (clock,
regulator, reset, gpio, ...) that in turn comes from a driver
that gets initialized later.

	Arnd

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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
  2015-01-19  3:17       ` Yijing Wang
  (?)
  (?)
@ 2015-01-19  8:44         ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  8:44 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Liviu Dudau, Tony Luck, Russell King, Marc Zyngier,
	linux-pci, x86, linux-kernel, David S. Miller, linux-m68k,
	Geert Uytterhoeven, linux-alpha, Bjorn Helgaas, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Monday 19 January 2015 11:17:02 Yijing Wang wrote:
> On 2015/1/16 18:01, Arnd Bergmann wrote:
> > On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
> >> +static void pci_host_bridge_probe_mode(
> >> +               struct pci_host_bridge *host)
> >> +{
> >> +       host->of_scan = true;
> >> +}
> >>
> > 
> > I probably missed something here, but where does host->of_scan
> > get used?
> > 
> 
> It is used in __pci_scan_root_bus() to detect whether of scan bus is needed in patch 11.

Ok, I see it now.

> @@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
>  		pci_bus_insert_busn_res(b, host->busnum, 255);
>  	}
> 
> -	max = pci_scan_child_bus(b);
> +	if (host->ops && host->ops->phb_probe_mode)
> +		host->ops->phb_probe_mode(host);
> 
> -	if (!found)
> -		pci_bus_update_busn_res_end(b, max);
> +	if (host->of_scan) {
> +		if (host->ops &&host->ops->phb_of_scan_bus)
> +			host->ops->phb_of_scan_bus(host);
> +	} else {
> +		max = pci_scan_child_bus(b);
> +		if (!found)
> +			pci_bus_update_busn_res_end(b, max);
> +	}
> 

I think we can simplify this based on the knowledge that this code
will remain powerpc specific. How about removing the phb_probe_mode()
callback and replacing it with just a phb_scan_bus() callback that
will always get set on sparc, and do this on powerpc:

+static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host)
+{
+       int mode = PCI_PROBE_NORMAL;
+       struct pci_bus *bus = host->bus;
+       struct pci_controller *hose = dev_get_drvdata(&host->dev);
+
+       /* Get probe mode and perform scan */
+       if (hose->dn && ppc_md.pci_probe_mode)
+               mode = ppc_md.pci_probe_mode(bus);
+
+       pr_debug("    probe mode: %d\n", mode);
+       if (mode == PCI_PROBE_DEVTREE) {
+               of_scan_bus(host->dn, bus);
+		return max; // XXX need to get this from somewhere
+	}
+	return pci_scan_child_bus(b);
+}

Would that work?

	Arnd

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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-19  8:44         ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  8:44 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Liviu Dudau, Tony Luck, Russell King, Marc Zyngier,
	linux-pci, x86, linux-kernel, David S. Miller, linux-m68k,
	Geert Uytterhoeven, linux-alpha, Bjorn Helgaas, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Monday 19 January 2015 11:17:02 Yijing Wang wrote:
> On 2015/1/16 18:01, Arnd Bergmann wrote:
> > On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
> >> +static void pci_host_bridge_probe_mode(
> >> +               struct pci_host_bridge *host)
> >> +{
> >> +       host->of_scan = true;
> >> +}
> >>
> > 
> > I probably missed something here, but where does host->of_scan
> > get used?
> > 
> 
> It is used in __pci_scan_root_bus() to detect whether of scan bus is needed in patch 11.

Ok, I see it now.

> @@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
>  		pci_bus_insert_busn_res(b, host->busnum, 255);
>  	}
> 
> -	max = pci_scan_child_bus(b);
> +	if (host->ops && host->ops->phb_probe_mode)
> +		host->ops->phb_probe_mode(host);
> 
> -	if (!found)
> -		pci_bus_update_busn_res_end(b, max);
> +	if (host->of_scan) {
> +		if (host->ops &&host->ops->phb_of_scan_bus)
> +			host->ops->phb_of_scan_bus(host);
> +	} else {
> +		max = pci_scan_child_bus(b);
> +		if (!found)
> +			pci_bus_update_busn_res_end(b, max);
> +	}
> 

I think we can simplify this based on the knowledge that this code
will remain powerpc specific. How about removing the phb_probe_mode()
callback and replacing it with just a phb_scan_bus() callback that
will always get set on sparc, and do this on powerpc:

+static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host)
+{
+       int mode = PCI_PROBE_NORMAL;
+       struct pci_bus *bus = host->bus;
+       struct pci_controller *hose = dev_get_drvdata(&host->dev);
+
+       /* Get probe mode and perform scan */
+       if (hose->dn && ppc_md.pci_probe_mode)
+               mode = ppc_md.pci_probe_mode(bus);
+
+       pr_debug("    probe mode: %d\n", mode);
+       if (mode == PCI_PROBE_DEVTREE) {
+               of_scan_bus(host->dn, bus);
+		return max; // XXX need to get this from somewhere
+	}
+	return pci_scan_child_bus(b);
+}

Would that work?

	Arnd

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

* [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-19  8:44         ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  8:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 19 January 2015 11:17:02 Yijing Wang wrote:
> On 2015/1/16 18:01, Arnd Bergmann wrote:
> > On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
> >> +static void pci_host_bridge_probe_mode(
> >> +               struct pci_host_bridge *host)
> >> +{
> >> +       host->of_scan = true;
> >> +}
> >>
> > 
> > I probably missed something here, but where does host->of_scan
> > get used?
> > 
> 
> It is used in __pci_scan_root_bus() to detect whether of scan bus is needed in patch 11.

Ok, I see it now.

> @@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
>  		pci_bus_insert_busn_res(b, host->busnum, 255);
>  	}
> 
> -	max = pci_scan_child_bus(b);
> +	if (host->ops && host->ops->phb_probe_mode)
> +		host->ops->phb_probe_mode(host);
> 
> -	if (!found)
> -		pci_bus_update_busn_res_end(b, max);
> +	if (host->of_scan) {
> +		if (host->ops &&host->ops->phb_of_scan_bus)
> +			host->ops->phb_of_scan_bus(host);
> +	} else {
> +		max = pci_scan_child_bus(b);
> +		if (!found)
> +			pci_bus_update_busn_res_end(b, max);
> +	}
> 

I think we can simplify this based on the knowledge that this code
will remain powerpc specific. How about removing the phb_probe_mode()
callback and replacing it with just a phb_scan_bus() callback that
will always get set on sparc, and do this on powerpc:

+static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host)
+{
+       int mode = PCI_PROBE_NORMAL;
+       struct pci_bus *bus = host->bus;
+       struct pci_controller *hose = dev_get_drvdata(&host->dev);
+
+       /* Get probe mode and perform scan */
+       if (hose->dn && ppc_md.pci_probe_mode)
+               mode = ppc_md.pci_probe_mode(bus);
+
+       pr_debug("    probe mode: %d\n", mode);
+       if (mode == PCI_PROBE_DEVTREE) {
+               of_scan_bus(host->dn, bus);
+		return max; // XXX need to get this from somewhere
+	}
+	return pci_scan_child_bus(b);
+}

Would that work?

	Arnd

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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-19  8:44         ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  8:44 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Liviu Dudau, Tony Luck, Russell King, Marc Zyngier,
	linux-pci, x86, linux-kernel, David S. Miller, linux-m68k,
	Geert Uytterhoeven, linux-alpha, Bjorn Helgaas, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On Monday 19 January 2015 11:17:02 Yijing Wang wrote:
> On 2015/1/16 18:01, Arnd Bergmann wrote:
> > On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
> >> +static void pci_host_bridge_probe_mode(
> >> +               struct pci_host_bridge *host)
> >> +{
> >> +       host->of_scan = true;
> >> +}
> >>
> > 
> > I probably missed something here, but where does host->of_scan
> > get used?
> > 
> 
> It is used in __pci_scan_root_bus() to detect whether of scan bus is needed in patch 11.

Ok, I see it now.

> @@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
>  		pci_bus_insert_busn_res(b, host->busnum, 255);
>  	}
> 
> -	max = pci_scan_child_bus(b);
> +	if (host->ops && host->ops->phb_probe_mode)
> +		host->ops->phb_probe_mode(host);
> 
> -	if (!found)
> -		pci_bus_update_busn_res_end(b, max);
> +	if (host->of_scan) {
> +		if (host->ops &&host->ops->phb_of_scan_bus)
> +			host->ops->phb_of_scan_bus(host);
> +	} else {
> +		max = pci_scan_child_bus(b);
> +		if (!found)
> +			pci_bus_update_busn_res_end(b, max);
> +	}
> 

I think we can simplify this based on the knowledge that this code
will remain powerpc specific. How about removing the phb_probe_mode()
callback and replacing it with just a phb_scan_bus() callback that
will always get set on sparc, and do this on powerpc:

+static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host)
+{
+       int mode = PCI_PROBE_NORMAL;
+       struct pci_bus *bus = host->bus;
+       struct pci_controller *hose = dev_get_drvdata(&host->dev);
+
+       /* Get probe mode and perform scan */
+       if (hose->dn && ppc_md.pci_probe_mode)
+               mode = ppc_md.pci_probe_mode(bus);
+
+       pr_debug("    probe mode: %d\n", mode);
+       if (mode = PCI_PROBE_DEVTREE) {
+               of_scan_bus(host->dn, bus);
+		return max; // XXX need to get this from somewhere
+	}
+	return pci_scan_child_bus(b);
+}

Would that work?

	Arnd

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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
  2015-01-19  2:14         ` Yijing Wang
  (?)
  (?)
@ 2015-01-19  9:50           ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  9:50 UTC (permalink / raw)
  To: Yijing Wang
  Cc: linux-arm-kernel, Bjorn Helgaas, Liviu Dudau, Tony Luck,
	Russell King, Marc Zyngier, linux-pci, x86, linux-kernel,
	David S. Miller, linux-m68k, Geert Uytterhoeven, linux-alpha,
	linux-ia64, Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

On Monday 19 January 2015 10:14:44 Yijing Wang wrote:
> >> I'm confused: the same code is already part of the PCI tree, but with
> >> Lorenzo Pieralisi listed as the patch author. The code is good,
> >> and I acked it in the past, but one of you is (probably by accident)
> >> misattributing the patch.
> >>
> >> Assuming that the patch that is already merged in next is the right
> >> one, I think you should rebase your series on top of
> >>
> >> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
> >>
> >> to avoid conflicts like this one.
> >>
> > 
> > I think I just got confused because the code duplicates most of
> > pci_bus_assign_domain_nr(). Maybe this can be done in a better way
> > by splitting the existing function into 
> > 
> > static int pci_assign_domain_nr(struct device *)
> > {
> >       ... /* most of pci_bus_assign_domain_nr */
> > 
> >       return domain;
> > }
> > 
> > void pci_host_assign_domain_nr(struct pci_host_bridge *host)
> > {
> >       host->domain = pci_assign_domain_nr(host->dev.parent);
> > }
> > 
> > void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
> > {
> >       bus->domain_nr = pci_assign_domain_nr(parent);
> > }
> > 
> 
> Hi Arnd,
>    I kept the almost duplicated pci_host_assign_domain_nr() and
> pci_bus_assign_domain_nr() here for building happy, because now
> platform specific pci_domain_nr() still exists which may get domain
> number from pci_bus. pci_bus_assign_domain_nr() will be removed in
> the last patch.
> 

I'm not sure I get your point: the approach I showed above seems to have
the same effect, except it doesn't duplicate code temporarily, which
makes it less error-prone in case your patch gets merged at the
same time as another patch that modifies pci_bus_assign_domain_nr.

	Arnd

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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-19  9:50           ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  9:50 UTC (permalink / raw)
  To: Yijing Wang
  Cc: linux-arm-kernel, Bjorn Helgaas, Liviu Dudau, Tony Luck,
	Russell King, Marc Zyngier, linux-pci, x86, linux-kernel,
	David S. Miller, linux-m68k, Geert Uytterhoeven, linux-alpha,
	linux-ia64, Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

On Monday 19 January 2015 10:14:44 Yijing Wang wrote:
> >> I'm confused: the same code is already part of the PCI tree, but with
> >> Lorenzo Pieralisi listed as the patch author. The code is good,
> >> and I acked it in the past, but one of you is (probably by accident)
> >> misattributing the patch.
> >>
> >> Assuming that the patch that is already merged in next is the right
> >> one, I think you should rebase your series on top of
> >>
> >> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
> >>
> >> to avoid conflicts like this one.
> >>
> > 
> > I think I just got confused because the code duplicates most of
> > pci_bus_assign_domain_nr(). Maybe this can be done in a better way
> > by splitting the existing function into 
> > 
> > static int pci_assign_domain_nr(struct device *)
> > {
> >       ... /* most of pci_bus_assign_domain_nr */
> > 
> >       return domain;
> > }
> > 
> > void pci_host_assign_domain_nr(struct pci_host_bridge *host)
> > {
> >       host->domain = pci_assign_domain_nr(host->dev.parent);
> > }
> > 
> > void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
> > {
> >       bus->domain_nr = pci_assign_domain_nr(parent);
> > }
> > 
> 
> Hi Arnd,
>    I kept the almost duplicated pci_host_assign_domain_nr() and
> pci_bus_assign_domain_nr() here for building happy, because now
> platform specific pci_domain_nr() still exists which may get domain
> number from pci_bus. pci_bus_assign_domain_nr() will be removed in
> the last patch.
> 

I'm not sure I get your point: the approach I showed above seems to have
the same effect, except it doesn't duplicate code temporarily, which
makes it less error-prone in case your patch gets merged at the
same time as another patch that modifies pci_bus_assign_domain_nr.

	Arnd

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

* [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-19  9:50           ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  9:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 19 January 2015 10:14:44 Yijing Wang wrote:
> >> I'm confused: the same code is already part of the PCI tree, but with
> >> Lorenzo Pieralisi listed as the patch author. The code is good,
> >> and I acked it in the past, but one of you is (probably by accident)
> >> misattributing the patch.
> >>
> >> Assuming that the patch that is already merged in next is the right
> >> one, I think you should rebase your series on top of
> >>
> >> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
> >>
> >> to avoid conflicts like this one.
> >>
> > 
> > I think I just got confused because the code duplicates most of
> > pci_bus_assign_domain_nr(). Maybe this can be done in a better way
> > by splitting the existing function into 
> > 
> > static int pci_assign_domain_nr(struct device *)
> > {
> >       ... /* most of pci_bus_assign_domain_nr */
> > 
> >       return domain;
> > }
> > 
> > void pci_host_assign_domain_nr(struct pci_host_bridge *host)
> > {
> >       host->domain = pci_assign_domain_nr(host->dev.parent);
> > }
> > 
> > void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
> > {
> >       bus->domain_nr = pci_assign_domain_nr(parent);
> > }
> > 
> 
> Hi Arnd,
>    I kept the almost duplicated pci_host_assign_domain_nr() and
> pci_bus_assign_domain_nr() here for building happy, because now
> platform specific pci_domain_nr() still exists which may get domain
> number from pci_bus. pci_bus_assign_domain_nr() will be removed in
> the last patch.
> 

I'm not sure I get your point: the approach I showed above seems to have
the same effect, except it doesn't duplicate code temporarily, which
makes it less error-prone in case your patch gets merged at the
same time as another patch that modifies pci_bus_assign_domain_nr.

	Arnd

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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-19  9:50           ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  9:50 UTC (permalink / raw)
  To: Yijing Wang
  Cc: linux-arm-kernel, Bjorn Helgaas, Liviu Dudau, Tony Luck,
	Russell King, Marc Zyngier, linux-pci, x86, linux-kernel,
	David S. Miller, linux-m68k, Geert Uytterhoeven, linux-alpha,
	linux-ia64, Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

On Monday 19 January 2015 10:14:44 Yijing Wang wrote:
> >> I'm confused: the same code is already part of the PCI tree, but with
> >> Lorenzo Pieralisi listed as the patch author. The code is good,
> >> and I acked it in the past, but one of you is (probably by accident)
> >> misattributing the patch.
> >>
> >> Assuming that the patch that is already merged in next is the right
> >> one, I think you should rebase your series on top of
> >>
> >> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
> >>
> >> to avoid conflicts like this one.
> >>
> > 
> > I think I just got confused because the code duplicates most of
> > pci_bus_assign_domain_nr(). Maybe this can be done in a better way
> > by splitting the existing function into 
> > 
> > static int pci_assign_domain_nr(struct device *)
> > {
> >       ... /* most of pci_bus_assign_domain_nr */
> > 
> >       return domain;
> > }
> > 
> > void pci_host_assign_domain_nr(struct pci_host_bridge *host)
> > {
> >       host->domain = pci_assign_domain_nr(host->dev.parent);
> > }
> > 
> > void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
> > {
> >       bus->domain_nr = pci_assign_domain_nr(parent);
> > }
> > 
> 
> Hi Arnd,
>    I kept the almost duplicated pci_host_assign_domain_nr() and
> pci_bus_assign_domain_nr() here for building happy, because now
> platform specific pci_domain_nr() still exists which may get domain
> number from pci_bus. pci_bus_assign_domain_nr() will be removed in
> the last patch.
> 

I'm not sure I get your point: the approach I showed above seems to have
the same effect, except it doesn't duplicate code temporarily, which
makes it less error-prone in case your patch gets merged at the
same time as another patch that modifies pci_bus_assign_domain_nr.

	Arnd

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

* Re: [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
  2015-01-19  3:12       ` Yijing Wang
  (?)
  (?)
@ 2015-01-19  9:52         ` Arnd Bergmann
  -1 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  9:52 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Liviu Dudau, Tony Luck, Russell King, Marc Zyngier,
	linux-pci, x86, linux-kernel, Jiang Liu, linux-m68k,
	Geert Uytterhoeven, linux-alpha, Bjorn Helgaas, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, David S. Miller

On Monday 19 January 2015 11:12:50 Yijing Wang wrote:
> On 2015/1/16 17:18, Arnd Bergmann wrote:
> > On Friday 16 January 2015 09:44:08 Yijing Wang wrote:
> >> @@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
> >>  {
> >>         struct pci_host_bridge *host;
> >>  
> >> -       host = pci_create_host_bridge(parent, db, resources);
> >> +       host = pci_create_host_bridge(parent, db, resources, sysdata);
> >>         if (!host)
> >>                 return NULL;
> >>  
> >> -       return __pci_scan_root_bus(host, ops, sysdata);
> >> +       return __pci_scan_root_bus(host, ops);
> >>  }
> >>  EXPORT_SYMBOL(pci_scan_root_bus);
> >>
> > 
> > How about keeping the sysdata out of the pci_create_host_bridge interface, and
> > refactoring it so that the call sequence becomes
> > 
> >       host = pci_create_host_bridge(parent, db, resources);
> >       host->sysdata = sysdata;
> >       __pci_scan_root_bus(host, ops);
> > 
> > This way, we can make sysdata completely option. I assume that more of the
> > fields we have in sysdata today can get moved into pci_host_bridge
> > over time, so a host bridge driver can just assign those members individually
> > between pci_create_host_bridge and __pci_scan_root_bus.
> 
> I put the sysdata in pci_host_bridge, because some platforms x86/ia64
> need to call pcibios_root_bridge_prepare() before pci_host_bridge registration
> in pci_create_host_bridge(), and pcibios_root_bridge_prepare() need the companion
> acpi device pointer which is stored in sysdata.
> 
> I like you idea, but I haven't find a better way yet.

Ok, fair enough. We can always try to find ways for getting rid of
pcibios_root_bridge_prepare() later, though I suspect as soon as we
have the callback, it will get used for other things as well ;-)

	Arnd

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

* Re: [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
@ 2015-01-19  9:52         ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  9:52 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Liviu Dudau, Tony Luck, Russell King, Marc Zyngier,
	linux-pci, x86, linux-kernel, Jiang Liu, linux-m68k,
	Geert Uytterhoeven, linux-alpha, Bjorn Helgaas, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, David S. Miller

On Monday 19 January 2015 11:12:50 Yijing Wang wrote:
> On 2015/1/16 17:18, Arnd Bergmann wrote:
> > On Friday 16 January 2015 09:44:08 Yijing Wang wrote:
> >> @@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
> >>  {
> >>         struct pci_host_bridge *host;
> >>  
> >> -       host = pci_create_host_bridge(parent, db, resources);
> >> +       host = pci_create_host_bridge(parent, db, resources, sysdata);
> >>         if (!host)
> >>                 return NULL;
> >>  
> >> -       return __pci_scan_root_bus(host, ops, sysdata);
> >> +       return __pci_scan_root_bus(host, ops);
> >>  }
> >>  EXPORT_SYMBOL(pci_scan_root_bus);
> >>
> > 
> > How about keeping the sysdata out of the pci_create_host_bridge interface, and
> > refactoring it so that the call sequence becomes
> > 
> >       host = pci_create_host_bridge(parent, db, resources);
> >       host->sysdata = sysdata;
> >       __pci_scan_root_bus(host, ops);
> > 
> > This way, we can make sysdata completely option. I assume that more of the
> > fields we have in sysdata today can get moved into pci_host_bridge
> > over time, so a host bridge driver can just assign those members individually
> > between pci_create_host_bridge and __pci_scan_root_bus.
> 
> I put the sysdata in pci_host_bridge, because some platforms x86/ia64
> need to call pcibios_root_bridge_prepare() before pci_host_bridge registration
> in pci_create_host_bridge(), and pcibios_root_bridge_prepare() need the companion
> acpi device pointer which is stored in sysdata.
> 
> I like you idea, but I haven't find a better way yet.

Ok, fair enough. We can always try to find ways for getting rid of
pcibios_root_bridge_prepare() later, though I suspect as soon as we
have the callback, it will get used for other things as well ;-)

	Arnd

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

* [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
@ 2015-01-19  9:52         ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  9:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 19 January 2015 11:12:50 Yijing Wang wrote:
> On 2015/1/16 17:18, Arnd Bergmann wrote:
> > On Friday 16 January 2015 09:44:08 Yijing Wang wrote:
> >> @@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
> >>  {
> >>         struct pci_host_bridge *host;
> >>  
> >> -       host = pci_create_host_bridge(parent, db, resources);
> >> +       host = pci_create_host_bridge(parent, db, resources, sysdata);
> >>         if (!host)
> >>                 return NULL;
> >>  
> >> -       return __pci_scan_root_bus(host, ops, sysdata);
> >> +       return __pci_scan_root_bus(host, ops);
> >>  }
> >>  EXPORT_SYMBOL(pci_scan_root_bus);
> >>
> > 
> > How about keeping the sysdata out of the pci_create_host_bridge interface, and
> > refactoring it so that the call sequence becomes
> > 
> >       host = pci_create_host_bridge(parent, db, resources);
> >       host->sysdata = sysdata;
> >       __pci_scan_root_bus(host, ops);
> > 
> > This way, we can make sysdata completely option. I assume that more of the
> > fields we have in sysdata today can get moved into pci_host_bridge
> > over time, so a host bridge driver can just assign those members individually
> > between pci_create_host_bridge and __pci_scan_root_bus.
> 
> I put the sysdata in pci_host_bridge, because some platforms x86/ia64
> need to call pcibios_root_bridge_prepare() before pci_host_bridge registration
> in pci_create_host_bridge(), and pcibios_root_bridge_prepare() need the companion
> acpi device pointer which is stored in sysdata.
> 
> I like you idea, but I haven't find a better way yet.

Ok, fair enough. We can always try to find ways for getting rid of
pcibios_root_bridge_prepare() later, though I suspect as soon as we
have the callback, it will get used for other things as well ;-)

	Arnd

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

* Re: [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata
@ 2015-01-19  9:52         ` Arnd Bergmann
  0 siblings, 0 replies; 320+ messages in thread
From: Arnd Bergmann @ 2015-01-19  9:52 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Yijing Wang, Liviu Dudau, Tony Luck, Russell King, Marc Zyngier,
	linux-pci, x86, linux-kernel, Jiang Liu, linux-m68k,
	Geert Uytterhoeven, linux-alpha, Bjorn Helgaas, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, David S. Miller

On Monday 19 January 2015 11:12:50 Yijing Wang wrote:
> On 2015/1/16 17:18, Arnd Bergmann wrote:
> > On Friday 16 January 2015 09:44:08 Yijing Wang wrote:
> >> @@ -2066,11 +2064,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
> >>  {
> >>         struct pci_host_bridge *host;
> >>  
> >> -       host = pci_create_host_bridge(parent, db, resources);
> >> +       host = pci_create_host_bridge(parent, db, resources, sysdata);
> >>         if (!host)
> >>                 return NULL;
> >>  
> >> -       return __pci_scan_root_bus(host, ops, sysdata);
> >> +       return __pci_scan_root_bus(host, ops);
> >>  }
> >>  EXPORT_SYMBOL(pci_scan_root_bus);
> >>
> > 
> > How about keeping the sysdata out of the pci_create_host_bridge interface, and
> > refactoring it so that the call sequence becomes
> > 
> >       host = pci_create_host_bridge(parent, db, resources);
> >       host->sysdata = sysdata;
> >       __pci_scan_root_bus(host, ops);
> > 
> > This way, we can make sysdata completely option. I assume that more of the
> > fields we have in sysdata today can get moved into pci_host_bridge
> > over time, so a host bridge driver can just assign those members individually
> > between pci_create_host_bridge and __pci_scan_root_bus.
> 
> I put the sysdata in pci_host_bridge, because some platforms x86/ia64
> need to call pcibios_root_bridge_prepare() before pci_host_bridge registration
> in pci_create_host_bridge(), and pcibios_root_bridge_prepare() need the companion
> acpi device pointer which is stored in sysdata.
> 
> I like you idea, but I haven't find a better way yet.

Ok, fair enough. We can always try to find ways for getting rid of
pcibios_root_bridge_prepare() later, though I suspect as soon as we
have the callback, it will get used for other things as well ;-)

	Arnd

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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
  2015-01-19  8:44         ` Arnd Bergmann
                             ` (2 preceding siblings ...)
  (?)
@ 2015-01-19 10:53           ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19 10:53 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Liviu Dudau, Tony Luck, Russell King, Marc Zyngier, linux-pci,
	x86, linux-kernel, David S. Miller, linux-m68k,
	Geert Uytterhoeven, linux-alpha, Bjorn Helgaas, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On 2015/1/19 16:44, Arnd Bergmann wrote:
> On Monday 19 January 2015 11:17:02 Yijing Wang wrote:
>> On 2015/1/16 18:01, Arnd Bergmann wrote:
>>> On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
>>>> +static void pci_host_bridge_probe_mode(
>>>> +               struct pci_host_bridge *host)
>>>> +{
>>>> +       host->of_scan = true;
>>>> +}
>>>>
>>>
>>> I probably missed something here, but where does host->of_scan
>>> get used?
>>>
>>
>> It is used in __pci_scan_root_bus() to detect whether of scan bus is needed in patch 11.
> 
> Ok, I see it now.
> 
>> @@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
>>  		pci_bus_insert_busn_res(b, host->busnum, 255);
>>  	}
>>
>> -	max = pci_scan_child_bus(b);
>> +	if (host->ops && host->ops->phb_probe_mode)
>> +		host->ops->phb_probe_mode(host);
>>
>> -	if (!found)
>> -		pci_bus_update_busn_res_end(b, max);
>> +	if (host->of_scan) {
>> +		if (host->ops &&host->ops->phb_of_scan_bus)
>> +			host->ops->phb_of_scan_bus(host);
>> +	} else {
>> +		max = pci_scan_child_bus(b);
>> +		if (!found)
>> +			pci_bus_update_busn_res_end(b, max);
>> +	}
>>
> 
> I think we can simplify this based on the knowledge that this code
> will remain powerpc specific. How about removing the phb_probe_mode()
> callback and replacing it with just a phb_scan_bus() callback that
> will always get set on sparc, and do this on powerpc:
> 
> +static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host)
> +{
> +       int mode = PCI_PROBE_NORMAL;
> +       struct pci_bus *bus = host->bus;
> +       struct pci_controller *hose = dev_get_drvdata(&host->dev);
> +
> +       /* Get probe mode and perform scan */
> +       if (hose->dn && ppc_md.pci_probe_mode)
> +               mode = ppc_md.pci_probe_mode(bus);
> +
> +       pr_debug("    probe mode: %d\n", mode);
> +       if (mode == PCI_PROBE_DEVTREE) {
> +               of_scan_bus(host->dn, bus);
> +		return max; // XXX need to get this from somewhere
> +	}
> +	return pci_scan_child_bus(b);
> +}
> 
> Would that work?

This looks good to me, it is more simple.

Thanks!
Yijing.


> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
  2015-01-19  8:44         ` Arnd Bergmann
                           ` (2 preceding siblings ...)
  (?)
@ 2015-01-19 10:53         ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19 10:53 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Liviu Dudau, Tony Luck, Russell King, Marc Zyngier, linux-pci,
	x86, linux-kernel, David S. Miller, linux-m68k,
	Geert Uytterhoeven, linux-alpha, Bjorn Helgaas, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On 2015/1/19 16:44, Arnd Bergmann wrote:
> On Monday 19 January 2015 11:17:02 Yijing Wang wrote:
>> On 2015/1/16 18:01, Arnd Bergmann wrote:
>>> On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
>>>> +static void pci_host_bridge_probe_mode(
>>>> +               struct pci_host_bridge *host)
>>>> +{
>>>> +       host->of_scan = true;
>>>> +}
>>>>
>>>
>>> I probably missed something here, but where does host->of_scan
>>> get used?
>>>
>>
>> It is used in __pci_scan_root_bus() to detect whether of scan bus is needed in patch 11.
> 
> Ok, I see it now.
> 
>> @@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
>>  		pci_bus_insert_busn_res(b, host->busnum, 255);
>>  	}
>>
>> -	max = pci_scan_child_bus(b);
>> +	if (host->ops && host->ops->phb_probe_mode)
>> +		host->ops->phb_probe_mode(host);
>>
>> -	if (!found)
>> -		pci_bus_update_busn_res_end(b, max);
>> +	if (host->of_scan) {
>> +		if (host->ops &&host->ops->phb_of_scan_bus)
>> +			host->ops->phb_of_scan_bus(host);
>> +	} else {
>> +		max = pci_scan_child_bus(b);
>> +		if (!found)
>> +			pci_bus_update_busn_res_end(b, max);
>> +	}
>>
> 
> I think we can simplify this based on the knowledge that this code
> will remain powerpc specific. How about removing the phb_probe_mode()
> callback and replacing it with just a phb_scan_bus() callback that
> will always get set on sparc, and do this on powerpc:
> 
> +static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host)
> +{
> +       int mode = PCI_PROBE_NORMAL;
> +       struct pci_bus *bus = host->bus;
> +       struct pci_controller *hose = dev_get_drvdata(&host->dev);
> +
> +       /* Get probe mode and perform scan */
> +       if (hose->dn && ppc_md.pci_probe_mode)
> +               mode = ppc_md.pci_probe_mode(bus);
> +
> +       pr_debug("    probe mode: %d\n", mode);
> +       if (mode == PCI_PROBE_DEVTREE) {
> +               of_scan_bus(host->dn, bus);
> +		return max; // XXX need to get this from somewhere
> +	}
> +	return pci_scan_child_bus(b);
> +}
> 
> Would that work?

This looks good to me, it is more simple.

Thanks!
Yijing.


> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-19 10:53           ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19 10:53 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Liviu Dudau, Tony Luck, Russell King, Marc Zyngier, linux-pci,
	x86, linux-kernel, David S. Miller, linux-m68k,
	Geert Uytterhoeven, linux-alpha, Bjorn Helgaas, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On 2015/1/19 16:44, Arnd Bergmann wrote:
> On Monday 19 January 2015 11:17:02 Yijing Wang wrote:
>> On 2015/1/16 18:01, Arnd Bergmann wrote:
>>> On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
>>>> +static void pci_host_bridge_probe_mode(
>>>> +               struct pci_host_bridge *host)
>>>> +{
>>>> +       host->of_scan = true;
>>>> +}
>>>>
>>>
>>> I probably missed something here, but where does host->of_scan
>>> get used?
>>>
>>
>> It is used in __pci_scan_root_bus() to detect whether of scan bus is needed in patch 11.
> 
> Ok, I see it now.
> 
>> @@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
>>  		pci_bus_insert_busn_res(b, host->busnum, 255);
>>  	}
>>
>> -	max = pci_scan_child_bus(b);
>> +	if (host->ops && host->ops->phb_probe_mode)
>> +		host->ops->phb_probe_mode(host);
>>
>> -	if (!found)
>> -		pci_bus_update_busn_res_end(b, max);
>> +	if (host->of_scan) {
>> +		if (host->ops &&host->ops->phb_of_scan_bus)
>> +			host->ops->phb_of_scan_bus(host);
>> +	} else {
>> +		max = pci_scan_child_bus(b);
>> +		if (!found)
>> +			pci_bus_update_busn_res_end(b, max);
>> +	}
>>
> 
> I think we can simplify this based on the knowledge that this code
> will remain powerpc specific. How about removing the phb_probe_mode()
> callback and replacing it with just a phb_scan_bus() callback that
> will always get set on sparc, and do this on powerpc:
> 
> +static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host)
> +{
> +       int mode = PCI_PROBE_NORMAL;
> +       struct pci_bus *bus = host->bus;
> +       struct pci_controller *hose = dev_get_drvdata(&host->dev);
> +
> +       /* Get probe mode and perform scan */
> +       if (hose->dn && ppc_md.pci_probe_mode)
> +               mode = ppc_md.pci_probe_mode(bus);
> +
> +       pr_debug("    probe mode: %d\n", mode);
> +       if (mode == PCI_PROBE_DEVTREE) {
> +               of_scan_bus(host->dn, bus);
> +		return max; // XXX need to get this from somewhere
> +	}
> +	return pci_scan_child_bus(b);
> +}
> 
> Would that work?

This looks good to me, it is more simple.

Thanks!
Yijing.


> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-19 10:53           ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19 10:53 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015/1/19 16:44, Arnd Bergmann wrote:
> On Monday 19 January 2015 11:17:02 Yijing Wang wrote:
>> On 2015/1/16 18:01, Arnd Bergmann wrote:
>>> On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
>>>> +static void pci_host_bridge_probe_mode(
>>>> +               struct pci_host_bridge *host)
>>>> +{
>>>> +       host->of_scan = true;
>>>> +}
>>>>
>>>
>>> I probably missed something here, but where does host->of_scan
>>> get used?
>>>
>>
>> It is used in __pci_scan_root_bus() to detect whether of scan bus is needed in patch 11.
> 
> Ok, I see it now.
> 
>> @@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
>>  		pci_bus_insert_busn_res(b, host->busnum, 255);
>>  	}
>>
>> -	max = pci_scan_child_bus(b);
>> +	if (host->ops && host->ops->phb_probe_mode)
>> +		host->ops->phb_probe_mode(host);
>>
>> -	if (!found)
>> -		pci_bus_update_busn_res_end(b, max);
>> +	if (host->of_scan) {
>> +		if (host->ops &&host->ops->phb_of_scan_bus)
>> +			host->ops->phb_of_scan_bus(host);
>> +	} else {
>> +		max = pci_scan_child_bus(b);
>> +		if (!found)
>> +			pci_bus_update_busn_res_end(b, max);
>> +	}
>>
> 
> I think we can simplify this based on the knowledge that this code
> will remain powerpc specific. How about removing the phb_probe_mode()
> callback and replacing it with just a phb_scan_bus() callback that
> will always get set on sparc, and do this on powerpc:
> 
> +static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host)
> +{
> +       int mode = PCI_PROBE_NORMAL;
> +       struct pci_bus *bus = host->bus;
> +       struct pci_controller *hose = dev_get_drvdata(&host->dev);
> +
> +       /* Get probe mode and perform scan */
> +       if (hose->dn && ppc_md.pci_probe_mode)
> +               mode = ppc_md.pci_probe_mode(bus);
> +
> +       pr_debug("    probe mode: %d\n", mode);
> +       if (mode == PCI_PROBE_DEVTREE) {
> +               of_scan_bus(host->dn, bus);
> +		return max; // XXX need to get this from somewhere
> +	}
> +	return pci_scan_child_bus(b);
> +}
> 
> Would that work?

This looks good to me, it is more simple.

Thanks!
Yijing.


> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-19 10:53           ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19 10:53 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Liviu Dudau, Tony Luck, Russell King, Marc Zyngier, linux-pci,
	x86, linux-kernel, David S. Miller, linux-m68k,
	Geert Uytterhoeven, linux-alpha, Bjorn Helgaas, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On 2015/1/19 16:44, Arnd Bergmann wrote:
> On Monday 19 January 2015 11:17:02 Yijing Wang wrote:
>> On 2015/1/16 18:01, Arnd Bergmann wrote:
>>> On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
>>>> +static void pci_host_bridge_probe_mode(
>>>> +               struct pci_host_bridge *host)
>>>> +{
>>>> +       host->of_scan = true;
>>>> +}
>>>>
>>>
>>> I probably missed something here, but where does host->of_scan
>>> get used?
>>>
>>
>> It is used in __pci_scan_root_bus() to detect whether of scan bus is needed in patch 11.
> 
> Ok, I see it now.
> 
>> @@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
>>  		pci_bus_insert_busn_res(b, host->busnum, 255);
>>  	}
>>
>> -	max = pci_scan_child_bus(b);
>> +	if (host->ops && host->ops->phb_probe_mode)
>> +		host->ops->phb_probe_mode(host);
>>
>> -	if (!found)
>> -		pci_bus_update_busn_res_end(b, max);
>> +	if (host->of_scan) {
>> +		if (host->ops &&host->ops->phb_of_scan_bus)
>> +			host->ops->phb_of_scan_bus(host);
>> +	} else {
>> +		max = pci_scan_child_bus(b);
>> +		if (!found)
>> +			pci_bus_update_busn_res_end(b, max);
>> +	}
>>
> 
> I think we can simplify this based on the knowledge that this code
> will remain powerpc specific. How about removing the phb_probe_mode()
> callback and replacing it with just a phb_scan_bus() callback that
> will always get set on sparc, and do this on powerpc:
> 
> +static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host)
> +{
> +       int mode = PCI_PROBE_NORMAL;
> +       struct pci_bus *bus = host->bus;
> +       struct pci_controller *hose = dev_get_drvdata(&host->dev);
> +
> +       /* Get probe mode and perform scan */
> +       if (hose->dn && ppc_md.pci_probe_mode)
> +               mode = ppc_md.pci_probe_mode(bus);
> +
> +       pr_debug("    probe mode: %d\n", mode);
> +       if (mode = PCI_PROBE_DEVTREE) {
> +               of_scan_bus(host->dn, bus);
> +		return max; // XXX need to get this from somewhere
> +	}
> +	return pci_scan_child_bus(b);
> +}
> 
> Would that work?

This looks good to me, it is more simple.

Thanks!
Yijing.


> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity
@ 2015-01-19 10:53           ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19 10:53 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Liviu Dudau, Tony Luck, Russell King, Marc Zyngier, linux-pci,
	x86, linux-kernel, David S. Miller, linux-m68k,
	Geert Uytterhoeven, linux-alpha, Bjorn Helgaas, linux-ia64,
	Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu

On 2015/1/19 16:44, Arnd Bergmann wrote:
> On Monday 19 January 2015 11:17:02 Yijing Wang wrote:
>> On 2015/1/16 18:01, Arnd Bergmann wrote:
>>> On Friday 16 January 2015 09:44:16 Yijing Wang wrote:
>>>> +static void pci_host_bridge_probe_mode(
>>>> +               struct pci_host_bridge *host)
>>>> +{
>>>> +       host->of_scan = true;
>>>> +}
>>>>
>>>
>>> I probably missed something here, but where does host->of_scan
>>> get used?
>>>
>>
>> It is used in __pci_scan_root_bus() to detect whether of scan bus is needed in patch 11.
> 
> Ok, I see it now.
> 
>> @@ -2051,10 +2053,17 @@ static struct pci_bus *__pci_scan_root_bus(
>>  		pci_bus_insert_busn_res(b, host->busnum, 255);
>>  	}
>>
>> -	max = pci_scan_child_bus(b);
>> +	if (host->ops && host->ops->phb_probe_mode)
>> +		host->ops->phb_probe_mode(host);
>>
>> -	if (!found)
>> -		pci_bus_update_busn_res_end(b, max);
>> +	if (host->of_scan) {
>> +		if (host->ops &&host->ops->phb_of_scan_bus)
>> +			host->ops->phb_of_scan_bus(host);
>> +	} else {
>> +		max = pci_scan_child_bus(b);
>> +		if (!found)
>> +			pci_bus_update_busn_res_end(b, max);
>> +	}
>>
> 
> I think we can simplify this based on the knowledge that this code
> will remain powerpc specific. How about removing the phb_probe_mode()
> callback and replacing it with just a phb_scan_bus() callback that
> will always get set on sparc, and do this on powerpc:
> 
> +static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host)
> +{
> +       int mode = PCI_PROBE_NORMAL;
> +       struct pci_bus *bus = host->bus;
> +       struct pci_controller *hose = dev_get_drvdata(&host->dev);
> +
> +       /* Get probe mode and perform scan */
> +       if (hose->dn && ppc_md.pci_probe_mode)
> +               mode = ppc_md.pci_probe_mode(bus);
> +
> +       pr_debug("    probe mode: %d\n", mode);
> +       if (mode == PCI_PROBE_DEVTREE) {
> +               of_scan_bus(host->dn, bus);
> +		return max; // XXX need to get this from somewhere
> +	}
> +	return pci_scan_child_bus(b);
> +}
> 
> Would that work?

This looks good to me, it is more simple.

Thanks!
Yijing.


> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
  2015-01-19  9:50           ` Arnd Bergmann
                               ` (2 preceding siblings ...)
  (?)
@ 2015-01-19 10:56             ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19 10:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Bjorn Helgaas, Liviu Dudau, Tony Luck,
	Russell King, Marc Zyngier, linux-pci, x86, linux-kernel,
	David S. Miller, linux-m68k, Geert Uytterhoeven, linux-alpha,
	linux-ia64, Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

On 2015/1/19 17:50, Arnd Bergmann wrote:
> On Monday 19 January 2015 10:14:44 Yijing Wang wrote:
>>>> I'm confused: the same code is already part of the PCI tree, but with
>>>> Lorenzo Pieralisi listed as the patch author. The code is good,
>>>> and I acked it in the past, but one of you is (probably by accident)
>>>> misattributing the patch.
>>>>
>>>> Assuming that the patch that is already merged in next is the right
>>>> one, I think you should rebase your series on top of
>>>>
>>>> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
>>>>
>>>> to avoid conflicts like this one.
>>>>
>>>
>>> I think I just got confused because the code duplicates most of
>>> pci_bus_assign_domain_nr(). Maybe this can be done in a better way
>>> by splitting the existing function into 
>>>
>>> static int pci_assign_domain_nr(struct device *)
>>> {
>>>       ... /* most of pci_bus_assign_domain_nr */
>>>
>>>       return domain;
>>> }
>>>
>>> void pci_host_assign_domain_nr(struct pci_host_bridge *host)
>>> {
>>>       host->domain = pci_assign_domain_nr(host->dev.parent);
>>> }
>>>
>>> void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
>>> {
>>>       bus->domain_nr = pci_assign_domain_nr(parent);
>>> }
>>>
>>
>> Hi Arnd,
>>    I kept the almost duplicated pci_host_assign_domain_nr() and
>> pci_bus_assign_domain_nr() here for building happy, because now
>> platform specific pci_domain_nr() still exists which may get domain
>> number from pci_bus. pci_bus_assign_domain_nr() will be removed in
>> the last patch.
>>
> 
> I'm not sure I get your point: the approach I showed above seems to have
> the same effect, except it doesn't duplicate code temporarily, which
> makes it less error-prone in case your patch gets merged at the
> same time as another patch that modifies pci_bus_assign_domain_nr.

OK, I got it, will update it, thanks!


Thanks!
Yijing.

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
  2015-01-19  9:50           ` Arnd Bergmann
                             ` (2 preceding siblings ...)
  (?)
@ 2015-01-19 10:56           ` Yijing Wang
  -1 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19 10:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Bjorn Helgaas, Liviu Dudau, Tony Luck,
	Russell King, Marc Zyngier, linux-pci, x86, linux-kernel,
	David S. Miller, linux-m68k, Geert Uytterhoeven, linux-alpha,
	linux-ia64, Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

On 2015/1/19 17:50, Arnd Bergmann wrote:
> On Monday 19 January 2015 10:14:44 Yijing Wang wrote:
>>>> I'm confused: the same code is already part of the PCI tree, but with
>>>> Lorenzo Pieralisi listed as the patch author. The code is good,
>>>> and I acked it in the past, but one of you is (probably by accident)
>>>> misattributing the patch.
>>>>
>>>> Assuming that the patch that is already merged in next is the right
>>>> one, I think you should rebase your series on top of
>>>>
>>>> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
>>>>
>>>> to avoid conflicts like this one.
>>>>
>>>
>>> I think I just got confused because the code duplicates most of
>>> pci_bus_assign_domain_nr(). Maybe this can be done in a better way
>>> by splitting the existing function into 
>>>
>>> static int pci_assign_domain_nr(struct device *)
>>> {
>>>       ... /* most of pci_bus_assign_domain_nr */
>>>
>>>       return domain;
>>> }
>>>
>>> void pci_host_assign_domain_nr(struct pci_host_bridge *host)
>>> {
>>>       host->domain = pci_assign_domain_nr(host->dev.parent);
>>> }
>>>
>>> void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
>>> {
>>>       bus->domain_nr = pci_assign_domain_nr(parent);
>>> }
>>>
>>
>> Hi Arnd,
>>    I kept the almost duplicated pci_host_assign_domain_nr() and
>> pci_bus_assign_domain_nr() here for building happy, because now
>> platform specific pci_domain_nr() still exists which may get domain
>> number from pci_bus. pci_bus_assign_domain_nr() will be removed in
>> the last patch.
>>
> 
> I'm not sure I get your point: the approach I showed above seems to have
> the same effect, except it doesn't duplicate code temporarily, which
> makes it less error-prone in case your patch gets merged at the
> same time as another patch that modifies pci_bus_assign_domain_nr.

OK, I got it, will update it, thanks!


Thanks!
Yijing.

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-19 10:56             ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19 10:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Bjorn Helgaas, Liviu Dudau, Tony Luck,
	Russell King, Marc Zyngier, linux-pci, x86, linux-kernel,
	David S. Miller, linux-m68k, Geert Uytterhoeven, linux-alpha,
	linux-ia64, Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

On 2015/1/19 17:50, Arnd Bergmann wrote:
> On Monday 19 January 2015 10:14:44 Yijing Wang wrote:
>>>> I'm confused: the same code is already part of the PCI tree, but with
>>>> Lorenzo Pieralisi listed as the patch author. The code is good,
>>>> and I acked it in the past, but one of you is (probably by accident)
>>>> misattributing the patch.
>>>>
>>>> Assuming that the patch that is already merged in next is the right
>>>> one, I think you should rebase your series on top of
>>>>
>>>> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
>>>>
>>>> to avoid conflicts like this one.
>>>>
>>>
>>> I think I just got confused because the code duplicates most of
>>> pci_bus_assign_domain_nr(). Maybe this can be done in a better way
>>> by splitting the existing function into 
>>>
>>> static int pci_assign_domain_nr(struct device *)
>>> {
>>>       ... /* most of pci_bus_assign_domain_nr */
>>>
>>>       return domain;
>>> }
>>>
>>> void pci_host_assign_domain_nr(struct pci_host_bridge *host)
>>> {
>>>       host->domain = pci_assign_domain_nr(host->dev.parent);
>>> }
>>>
>>> void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
>>> {
>>>       bus->domain_nr = pci_assign_domain_nr(parent);
>>> }
>>>
>>
>> Hi Arnd,
>>    I kept the almost duplicated pci_host_assign_domain_nr() and
>> pci_bus_assign_domain_nr() here for building happy, because now
>> platform specific pci_domain_nr() still exists which may get domain
>> number from pci_bus. pci_bus_assign_domain_nr() will be removed in
>> the last patch.
>>
> 
> I'm not sure I get your point: the approach I showed above seems to have
> the same effect, except it doesn't duplicate code temporarily, which
> makes it less error-prone in case your patch gets merged at the
> same time as another patch that modifies pci_bus_assign_domain_nr.

OK, I got it, will update it, thanks!


Thanks!
Yijing.

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-19 10:56             ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19 10:56 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015/1/19 17:50, Arnd Bergmann wrote:
> On Monday 19 January 2015 10:14:44 Yijing Wang wrote:
>>>> I'm confused: the same code is already part of the PCI tree, but with
>>>> Lorenzo Pieralisi listed as the patch author. The code is good,
>>>> and I acked it in the past, but one of you is (probably by accident)
>>>> misattributing the patch.
>>>>
>>>> Assuming that the patch that is already merged in next is the right
>>>> one, I think you should rebase your series on top of
>>>>
>>>> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
>>>>
>>>> to avoid conflicts like this one.
>>>>
>>>
>>> I think I just got confused because the code duplicates most of
>>> pci_bus_assign_domain_nr(). Maybe this can be done in a better way
>>> by splitting the existing function into 
>>>
>>> static int pci_assign_domain_nr(struct device *)
>>> {
>>>       ... /* most of pci_bus_assign_domain_nr */
>>>
>>>       return domain;
>>> }
>>>
>>> void pci_host_assign_domain_nr(struct pci_host_bridge *host)
>>> {
>>>       host->domain = pci_assign_domain_nr(host->dev.parent);
>>> }
>>>
>>> void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
>>> {
>>>       bus->domain_nr = pci_assign_domain_nr(parent);
>>> }
>>>
>>
>> Hi Arnd,
>>    I kept the almost duplicated pci_host_assign_domain_nr() and
>> pci_bus_assign_domain_nr() here for building happy, because now
>> platform specific pci_domain_nr() still exists which may get domain
>> number from pci_bus. pci_bus_assign_domain_nr() will be removed in
>> the last patch.
>>
> 
> I'm not sure I get your point: the approach I showed above seems to have
> the same effect, except it doesn't duplicate code temporarily, which
> makes it less error-prone in case your patch gets merged at the
> same time as another patch that modifies pci_bus_assign_domain_nr.

OK, I got it, will update it, thanks!


Thanks!
Yijing.

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing

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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-19 10:56             ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19 10:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Bjorn Helgaas, Liviu Dudau, Tony Luck,
	Russell King, Marc Zyngier, linux-pci, x86, linux-kernel,
	David S. Miller, linux-m68k, Geert Uytterhoeven, linux-alpha,
	linux-ia64, Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

On 2015/1/19 17:50, Arnd Bergmann wrote:
> On Monday 19 January 2015 10:14:44 Yijing Wang wrote:
>>>> I'm confused: the same code is already part of the PCI tree, but with
>>>> Lorenzo Pieralisi listed as the patch author. The code is good,
>>>> and I acked it in the past, but one of you is (probably by accident)
>>>> misattributing the patch.
>>>>
>>>> Assuming that the patch that is already merged in next is the right
>>>> one, I think you should rebase your series on top of
>>>>
>>>> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
>>>>
>>>> to avoid conflicts like this one.
>>>>
>>>
>>> I think I just got confused because the code duplicates most of
>>> pci_bus_assign_domain_nr(). Maybe this can be done in a better way
>>> by splitting the existing function into 
>>>
>>> static int pci_assign_domain_nr(struct device *)
>>> {
>>>       ... /* most of pci_bus_assign_domain_nr */
>>>
>>>       return domain;
>>> }
>>>
>>> void pci_host_assign_domain_nr(struct pci_host_bridge *host)
>>> {
>>>       host->domain = pci_assign_domain_nr(host->dev.parent);
>>> }
>>>
>>> void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
>>> {
>>>       bus->domain_nr = pci_assign_domain_nr(parent);
>>> }
>>>
>>
>> Hi Arnd,
>>    I kept the almost duplicated pci_host_assign_domain_nr() and
>> pci_bus_assign_domain_nr() here for building happy, because now
>> platform specific pci_domain_nr() still exists which may get domain
>> number from pci_bus. pci_bus_assign_domain_nr() will be removed in
>> the last patch.
>>
> 
> I'm not sure I get your point: the approach I showed above seems to have
> the same effect, except it doesn't duplicate code temporarily, which
> makes it less error-prone in case your patch gets merged at the
> same time as another patch that modifies pci_bus_assign_domain_nr.

OK, I got it, will update it, thanks!


Thanks!
Yijing.

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain
@ 2015-01-19 10:56             ` Yijing Wang
  0 siblings, 0 replies; 320+ messages in thread
From: Yijing Wang @ 2015-01-19 10:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Bjorn Helgaas, Liviu Dudau, Tony Luck,
	Russell King, Marc Zyngier, linux-pci, x86, linux-kernel,
	David S. Miller, linux-m68k, Geert Uytterhoeven, linux-alpha,
	linux-ia64, Thomas Gleixner, Guan Xuetao, Yinghai Lu, Jiang Liu,
	Lorenzo Pieralisi

On 2015/1/19 17:50, Arnd Bergmann wrote:
> On Monday 19 January 2015 10:14:44 Yijing Wang wrote:
>>>> I'm confused: the same code is already part of the PCI tree, but with
>>>> Lorenzo Pieralisi listed as the patch author. The code is good,
>>>> and I acked it in the past, but one of you is (probably by accident)
>>>> misattributing the patch.
>>>>
>>>> Assuming that the patch that is already merged in next is the right
>>>> one, I think you should rebase your series on top of
>>>>
>>>> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
>>>>
>>>> to avoid conflicts like this one.
>>>>
>>>
>>> I think I just got confused because the code duplicates most of
>>> pci_bus_assign_domain_nr(). Maybe this can be done in a better way
>>> by splitting the existing function into 
>>>
>>> static int pci_assign_domain_nr(struct device *)
>>> {
>>>       ... /* most of pci_bus_assign_domain_nr */
>>>
>>>       return domain;
>>> }
>>>
>>> void pci_host_assign_domain_nr(struct pci_host_bridge *host)
>>> {
>>>       host->domain = pci_assign_domain_nr(host->dev.parent);
>>> }
>>>
>>> void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
>>> {
>>>       bus->domain_nr = pci_assign_domain_nr(parent);
>>> }
>>>
>>
>> Hi Arnd,
>>    I kept the almost duplicated pci_host_assign_domain_nr() and
>> pci_bus_assign_domain_nr() here for building happy, because now
>> platform specific pci_domain_nr() still exists which may get domain
>> number from pci_bus. pci_bus_assign_domain_nr() will be removed in
>> the last patch.
>>
> 
> I'm not sure I get your point: the approach I showed above seems to have
> the same effect, except it doesn't duplicate code temporarily, which
> makes it less error-prone in case your patch gets merged at the
> same time as another patch that modifies pci_bus_assign_domain_nr.

OK, I got it, will update it, thanks!


Thanks!
Yijing.

> 
> 	Arnd
> 
> .
> 


-- 
Thanks!
Yijing


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

end of thread, other threads:[~2015-01-19 12:11 UTC | newest]

Thread overview: 320+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-16  1:43 [PATCH 00/28] Refine PCI scan interfaces and make generic pci host bridge Yijing Wang
2015-01-16  1:43 ` Yijing Wang
2015-01-16  1:43 ` Yijing Wang
2015-01-16  1:43 ` Yijing Wang
2015-01-16  1:43 ` Yijing Wang
2015-01-16  1:43 ` [PATCH 01/28] PCI: Rip out pci_bus_add_devices() from pci_scan_bus() Yijing Wang
2015-01-16  1:43 ` Yijing Wang
2015-01-16  1:43   ` Yijing Wang
2015-01-16  1:43   ` Yijing Wang
2015-01-16  1:43   ` Yijing Wang
2015-01-16  1:43   ` Yijing Wang
2015-01-16  1:43   ` Yijing Wang
2015-01-16 23:15   ` Yinghai Lu
2015-01-16 23:15     ` Yinghai Lu
2015-01-16 23:15     ` Yinghai Lu
2015-01-16 23:15     ` Yinghai Lu
2015-01-16 23:15     ` Yinghai Lu
2015-01-16 23:16     ` Yinghai Lu
2015-01-16 23:16       ` Yinghai Lu
2015-01-16 23:16       ` Yinghai Lu
2015-01-16 23:16       ` Yinghai Lu
2015-01-16 23:16       ` Yinghai Lu
2015-01-19  2:04       ` Yijing Wang
2015-01-19  2:04         ` Yijing Wang
2015-01-19  2:04         ` Yijing Wang
2015-01-19  2:04         ` Yijing Wang
2015-01-19  2:04         ` Yijing Wang
2015-01-19  2:04         ` Yijing Wang
2015-01-19  4:59         ` Greg Ungerer
2015-01-19  4:59         ` Greg Ungerer
2015-01-19  4:59           ` Greg Ungerer
2015-01-19  4:59           ` Greg Ungerer
2015-01-19  4:59           ` Greg Ungerer
2015-01-19  4:59           ` Greg Ungerer
2015-01-19  4:59           ` Greg Ungerer
2015-01-19  2:04       ` Yijing Wang
2015-01-19  8:23       ` Arnd Bergmann
2015-01-19  8:23         ` Arnd Bergmann
2015-01-19  8:23         ` Arnd Bergmann
2015-01-19  8:23         ` Arnd Bergmann
2015-01-19  8:23         ` Arnd Bergmann
2015-01-19  8:23       ` Arnd Bergmann
2015-01-16 23:15   ` Yinghai Lu
2015-01-16  1:44 ` [PATCH 02/28] PCI: Rip out pci_bus_add_devices() from pci_scan_root_bus() Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` [PATCH 03/28] xen/PCI: Don't use deprecated function pci_scan_bus_parented() Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 04/28] PCI: Remove deprecated pci_scan_bus_parented() Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 05/28] PCI: Rename pci_scan_bus() to pci_scan_bus_legacy() Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` [PATCH 06/28] PCI: Combine PCI domain and bus number in u32 arg Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 07/28] PCI: Pass PCI domain number combined with root bus number Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` [PATCH 08/28] PCI: Introduce pci_host_assign_domain_nr() to assign domain Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  9:08   ` Arnd Bergmann
2015-01-16  9:08   ` Arnd Bergmann
2015-01-16  9:08     ` Arnd Bergmann
2015-01-16  9:08     ` Arnd Bergmann
2015-01-16  9:08     ` Arnd Bergmann
2015-01-16  9:08     ` Arnd Bergmann
2015-01-16  9:40     ` Arnd Bergmann
2015-01-16  9:40     ` Arnd Bergmann
2015-01-16  9:40       ` Arnd Bergmann
2015-01-16  9:40       ` Arnd Bergmann
2015-01-16  9:40       ` Arnd Bergmann
2015-01-19  2:14       ` Yijing Wang
2015-01-19  2:14       ` Yijing Wang
2015-01-19  2:14         ` Yijing Wang
2015-01-19  2:14         ` Yijing Wang
2015-01-19  2:14         ` Yijing Wang
2015-01-19  2:14         ` Yijing Wang
2015-01-19  9:50         ` Arnd Bergmann
2015-01-19  9:50           ` Arnd Bergmann
2015-01-19  9:50           ` Arnd Bergmann
2015-01-19  9:50           ` Arnd Bergmann
2015-01-19 10:56           ` Yijing Wang
2015-01-19 10:56           ` Yijing Wang
2015-01-19 10:56             ` Yijing Wang
2015-01-19 10:56             ` Yijing Wang
2015-01-19 10:56             ` Yijing Wang
2015-01-19 10:56             ` Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 09/28] PCI: Separate pci_host_bridge creation out of pci_create_root_bus() Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  9:14   ` Arnd Bergmann
2015-01-16  9:14     ` Arnd Bergmann
2015-01-16  9:14     ` Arnd Bergmann
2015-01-16  9:14     ` Arnd Bergmann
2015-01-16  9:14   ` Arnd Bergmann
2015-01-16  9:34   ` Arnd Bergmann
2015-01-16  9:34   ` Arnd Bergmann
2015-01-16  9:34     ` Arnd Bergmann
2015-01-16  9:34     ` Arnd Bergmann
2015-01-16  9:34     ` Arnd Bergmann
2015-01-19  2:39     ` Yijing Wang
2015-01-19  2:39       ` Yijing Wang
2015-01-19  2:39       ` Yijing Wang
2015-01-19  2:39       ` Yijing Wang
2015-01-19  2:39       ` Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 10/28] PCI: Save sysdata in pci_host_bridge drvdata Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  9:18   ` Arnd Bergmann
2015-01-16  9:18     ` Arnd Bergmann
2015-01-16  9:18     ` Arnd Bergmann
2015-01-16  9:18     ` Arnd Bergmann
2015-01-19  3:12     ` Yijing Wang
2015-01-19  3:12       ` Yijing Wang
2015-01-19  3:12       ` Yijing Wang
2015-01-19  3:12       ` Yijing Wang
2015-01-19  3:12       ` Yijing Wang
2015-01-19  9:52       ` Arnd Bergmann
2015-01-19  9:52         ` Arnd Bergmann
2015-01-19  9:52         ` Arnd Bergmann
2015-01-19  9:52         ` Arnd Bergmann
2015-01-19  3:12     ` Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 11/28] PCI: Introduce pci_host_bridge_ops to setup host bridge Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  9:23   ` Arnd Bergmann
2015-01-16  9:23     ` Arnd Bergmann
2015-01-16  9:23     ` Arnd Bergmann
2015-01-16  9:23     ` Arnd Bergmann
2015-01-16  9:35     ` Arnd Bergmann
2015-01-16  9:35     ` Arnd Bergmann
2015-01-16  9:35       ` Arnd Bergmann
2015-01-16  9:35       ` Arnd Bergmann
2015-01-16  9:35       ` Arnd Bergmann
2015-01-16  9:23   ` Arnd Bergmann
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 12/28] PCI: Introduce new scan function pci_scan_root_bridge() Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 13/28] PCI/x86: Refine pci_acpi_scan_root() with generic pci_host_bridge Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 14/28] PCI/IA64: " Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 15/28] PCI/powerpc: Rename pcibios_root_bridge_prepare() for better readability Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 16/28] PCI/powerpc: Use pci_scan_root_bridge() for simplicity Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 17/28] PCI: Remove weak pcibios_root_bridge_prepare() Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` [PATCH 18/28] PCI/sparc: Use pci_scan_root_bridge() for simplicity Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16 10:01   ` Arnd Bergmann
2015-01-16 10:01   ` Arnd Bergmann
2015-01-16 10:01     ` Arnd Bergmann
2015-01-16 10:01     ` Arnd Bergmann
2015-01-16 10:01     ` Arnd Bergmann
2015-01-19  3:17     ` Yijing Wang
2015-01-19  3:17     ` Yijing Wang
2015-01-19  3:17       ` Yijing Wang
2015-01-19  3:17       ` Yijing Wang
2015-01-19  3:17       ` Yijing Wang
2015-01-19  3:17       ` Yijing Wang
2015-01-19  8:44       ` Arnd Bergmann
2015-01-19  8:44         ` Arnd Bergmann
2015-01-19  8:44         ` Arnd Bergmann
2015-01-19  8:44         ` Arnd Bergmann
2015-01-19 10:53         ` Yijing Wang
2015-01-19 10:53         ` Yijing Wang
2015-01-19 10:53           ` Yijing Wang
2015-01-19 10:53           ` Yijing Wang
2015-01-19 10:53           ` Yijing Wang
2015-01-19 10:53           ` Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 19/28] PCI: Introduce pci_bus_child_max_busnr() Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 20/28] PCI/Parisc: Use pci_scan_root_bus() for simplicity Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` [PATCH 21/28] PCI/mvebu: Use pci_common_init_dev() to simplify code Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` [PATCH 22/28] PCI/tegra: Remove redundant tegra_pcie_scan_bus() Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 23/28] PCI/designware: Use pci_scan_root_bus() for simplicity Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-17 16:39   ` Sergei Shtylyov
2015-01-17 16:39   ` Sergei Shtylyov
2015-01-17 16:39     ` Sergei Shtylyov
2015-01-17 16:39     ` Sergei Shtylyov
2015-01-17 16:39     ` Sergei Shtylyov
2015-01-19  3:17     ` Yijing Wang
2015-01-19  3:17       ` Yijing Wang
2015-01-19  3:17       ` Yijing Wang
2015-01-19  3:17       ` Yijing Wang
2015-01-19  3:17       ` Yijing Wang
2015-01-19  3:17     ` Yijing Wang
2015-01-16  1:44 ` [PATCH 24/28] PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus() Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` [PATCH 25/28] PCI: Rename __pci_create_root_bus() to pci_create_root_bus() Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 26/28] PCI: Export find_pci_host_bridge() Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44 ` [PATCH 27/28] PCI: Remove platform specific pci_domain_nr() Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  9:44   ` Arnd Bergmann
2015-01-16  9:44   ` Arnd Bergmann
2015-01-16  9:44     ` Arnd Bergmann
2015-01-16  9:44     ` Arnd Bergmann
2015-01-16  9:44     ` Arnd Bergmann
2015-01-19  3:19     ` Yijing Wang
2015-01-19  3:19       ` Yijing Wang
2015-01-19  3:19       ` Yijing Wang
2015-01-19  3:19       ` Yijing Wang
2015-01-19  3:19       ` Yijing Wang
2015-01-19  3:19     ` Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44 ` [PATCH 28/28] PCI: Remove pci_bus_assign_domain_nr() Yijing Wang
2015-01-16  1:44 ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16  1:44   ` Yijing Wang
2015-01-16 10:12 ` [PATCH 00/28] Refine PCI scan interfaces and make generic pci host bridge Arnd Bergmann
2015-01-16 10:12 ` Arnd Bergmann
2015-01-16 10:12   ` Arnd Bergmann
2015-01-16 10:12   ` Arnd Bergmann
2015-01-16 10:12   ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.