-static int setup_pci_slot(struct slot *slot)
-{
- struct device_node *dn = slot->dn;
- struct pci_bus *bus;
-
- BUG_ON(!dn);
- bus = pcibios_find_pci_bus(dn);
- if (!bus) {
- err("%s: no pci_bus for dn %s\n", __FUNCTION__, dn->full_name);
- goto exit_rc;
- }
-
- slot->bus = bus;
- slot->pci_devs = &bus->devices;
- set_slot_name(slot);
-
- /* find slot's pci_dev if it's not empty */
- if (slot->hotplug_slot->info->adapter_status == EMPTY) {
- slot->state = EMPTY; /* slot is empty */
- } else {
- /* slot is occupied */
- if (!dn->child) {
- /* non-empty slot has to have child */
- err("%s: slot[%s]'s device_node doesn't have child for adapter\n",
- __FUNCTION__, slot->name);
- goto exit_rc;
- }
-
- if (slot->hotplug_slot->info->adapter_status == NOT_CONFIGURED) {
- dbg("%s CONFIGURING pci adapter in slot[%s]\n",
- __FUNCTION__, slot->name);
- pcibios_add_pci_devices(slot->bus);
-
- } else if (slot->hotplug_slot->info->adapter_status != CONFIGURED) {
- err("%s: slot[%s]'s adapter_status is NOT_VALID.\n",
- __FUNCTION__, slot->name);
- goto exit_rc;
- }
- print_slot_pci_funcs(slot->bus);
- if (!list_empty(slot->pci_devs)) {
- slot->state = CONFIGURED;
- } else {
- /* DLPAR add as opposed to
- * boot time */
- slot->state = NOT_CONFIGURED;
- }
- }
- return 0;
-exit_rc:
- return -EINVAL;
-}
-