pciehp_resource_sort_and_combine(&(ctrl->mem_head)); pciehp_resource_sort_and_combine(&(ctrl->p_mem_head)); pciehp_resource_sort_and_combine(&(ctrl->io_head)); pciehp_resource_sort_and_combine(&(ctrl->bus_head)); 
p_slot->hpc_ops->green_led_on(p_slot);  /* Wait for the command to complete */ wait_for_ctrl_irq (ctrl);  /* Done with exclusive hardware access */ up(&ctrl->crit_sect); } return 0; 
static u32 board_added(struct pci_func * func, struct controller * ctrl){	u8 hp_slot;	int index;	u32 temp_register = 0xFFFFFFFF;	u32 rc = 0;	struct pci_func *new_func = NULL;	struct slot *p_slot;	struct resource_lists res_lists;	p_slot = pciehp_find_slot(ctrl, func->device);	hp_slot = func->device - ctrl->slot_device_offset;	dbg("%s: func->device, slot_offset, hp_slot = %d, %d ,%d\n", __FUNCTION__, func->device, ctrl->slot_device_offset, hp_slot);	/* Wait for exclusive access to hardware */	down(&ctrl->crit_sect);	if (POWER_CTRL(ctrl->ctrlcap)) {		/* Power on slot */		rc = p_slot->hpc_ops->power_on_slot(p_slot);		if (rc) {			up(&ctrl->crit_sect);			return -1;		}		/* Wait for the command to complete */		wait_for_ctrl_irq (ctrl);	}		if (PWR_LED(ctrl->ctrlcap)) {		p_slot->hpc_ops->green_led_blink(p_slot);					/* Wait for the command to complete */		wait_for_ctrl_irq (ctrl);	}	/* Done with exclusive hardware access */	up(&ctrl->crit_sect);	/* Wait for ~1 second */	dbg("%s: before long_delay\n", __FUNCTION__);	wait_for_ctrl_irq (ctrl);	dbg("%s: afterlong_delay\n", __FUNCTION__);	/*  Check link training status */	rc = p_slot->hpc_ops->check_lnk_status(ctrl);  	if (rc) {		err("%s: Failed to check link status\n", __FUNCTION__);		set_slot_off(ctrl, p_slot);		return rc;	}	dbg("%s: func status = %x\n", __FUNCTION__, func->status);	/* Check for a power fault */	if (func->status == 0xFF) {		/* power fault occurred, but it was benign */		temp_register = 0xFFFFFFFF;		dbg("%s: temp register set to %x by power fault\n", __FUNCTION__, temp_register);		rc = POWER_FAILURE;		func->status = 0;	} else {		/* Get vendor/device ID u32 */		rc = pci_bus_read_config_dword (ctrl->pci_dev->subordinate, PCI_DEVFN(func->device, func->function), 			PCI_VENDOR_ID, &temp_register);		dbg("%s: pci_bus_read_config_dword returns %d\n", __FUNCTION__, rc);		dbg("%s: temp_register is %x\n", __FUNCTION__, temp_register);		if (rc != 0) {			/* Something's wrong here */			temp_register = 0xFFFFFFFF;			dbg("%s: temp register set to %x by error\n", __FUNCTION__, temp_register);		}		/* Preset return code.  It will be changed later if things go okay. */		rc = NO_ADAPTER_PRESENT;	}	/* All F's is an empty slot or an invalid board */	if (temp_register != 0xFFFFFFFF) {	  /* Check for a board in the slot */		res_lists.io_head = ctrl->io_head;		res_lists.mem_head = ctrl->mem_head;		res_lists.p_mem_head = ctrl->p_mem_head;		res_lists.bus_head = ctrl->bus_head;		res_lists.irqs = NULL;		rc = configure_new_device(ctrl, func, 0, &res_lists, 0, 0);		dbg("%s: back from configure_new_device\n", __FUNCTION__);		ctrl->io_head = res_lists.io_head;		ctrl->mem_head = res_lists.mem_head;		ctrl->p_mem_head = res_lists.p_mem_head;		ctrl->bus_head = res_lists.bus_head;		pciehp_resource_sort_and_combine(&(ctrl->mem_head));		pciehp_resource_sort_and_combine(&(ctrl->p_mem_head));		pciehp_resource_sort_and_combine(&(ctrl->io_head));		pciehp_resource_sort_and_combine(&(ctrl->bus_head));		if (rc) {			set_slot_off(ctrl, p_slot);			return rc;		}		pciehp_save_slot_config(ctrl, func);		func->status = 0;		func->switch_save = 0x10;		func->is_a_board = 0x01;		/* next, we will instantiate the linux pci_dev structures 		 * (with appropriate driver notification, if already present) 		 */		index = 0;		do {			new_func = pciehp_slot_find(ctrl->slot_bus, func->device, index++);			if (new_func && !new_func->pci_dev) {				dbg("%s:call pci_hp_configure_dev, func %x\n", 					__FUNCTION__, index);				pciehp_configure_device(ctrl, new_func);			}		} while (new_func); 		/*  		 * Some PCI Express root ports require fixup after hot-plug operation. 		 */ 		if (pcie_mch_quirk) 			pci_fixup_device(pci_fixup_final, ctrl->pci_dev);   		if (PWR_LED(ctrl->ctrlcap)) {  			/* Wait for exclusive access to hardware */  			down(&ctrl->crit_sect);     			p_slot->hpc_ops->green_led_on(p_slot);    			/* Wait for the command to complete */  			wait_for_ctrl_irq (ctrl);  	  			/* Done with exclusive hardware access */  			up(&ctrl->crit_sect);  		}	} else {		set_slot_off(ctrl, p_slot);		return -1;	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/71b720c0f96145f5868c87591c286b290bc1a6af/pciehp_ctrl.c/buggy/drivers/pci/hotplug/pciehp_ctrl.c