PCI: Put pci dev to device tree as early as possible

We want to put created pci device in the device tree as soon as possible.
- just after we find it and create pci_dev struct for it.
so for_pci_dev iteration will not miss them.

But at that time, we can not load driver for them yet. Need to be after
pci_assign_unsigned_resources() etc to make sure all pci devices get
resource allocated at first.

Move out device registering out of pci_bus_add_devices, and
new pci_bus_add_devices() will do the device_attach work to load pci drivers

Also remove unattached child bus handling in pci_bus_add_devices().
Because that is not needed, child bus via pci_add_new_bus() is already
in parent bus children list.

-v2: replace pci_bus_add_child() with ->is_added directly according to
	Rafael.
     Move pci_create_sysfs_dev_files() back in pci_bus_add_dev(), as we
       need to wait assign unassigned resources done to create resource
       files in /sys.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

4 files changed