u8 class_code, header_type, BCR; u8 index = 0; 
int pciehp_disable_slot(struct slot *p_slot){	u8 class_code, header_type, BCR;	u8 index = 0;	u8 getstatus = 0;	u32 rc = 0;	int ret = 0;	unsigned int devfn;	struct pci_bus *pci_bus = p_slot->ctrl->pci_dev->subordinate;	struct pci_func *func;	if (!p_slot->ctrl)		return 1;	/* Check to see if (latch closed, card present, power on) */	down(&p_slot->ctrl->crit_sect);	if (!HP_SUPR_RM(p_slot->ctrl->ctrlcap)) {			ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);		if (ret || !getstatus) {			info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number);			up(&p_slot->ctrl->crit_sect);			return 1;		}	}	if (MRL_SENS(p_slot->ctrl->ctrlcap)) {			ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);		if (ret || getstatus) {			info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number);			up(&p_slot->ctrl->crit_sect);			return 1;		}	}	if (POWER_CTRL(p_slot->ctrl->ctrlcap)) {			ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);		if (ret || !getstatus) {			info("%s: already disabled slot(%x)\n", __FUNCTION__, p_slot->number);			up(&p_slot->ctrl->crit_sect);			return 1;		}	}	up(&p_slot->ctrl->crit_sect);	func = pciehp_slot_find(p_slot->bus, p_slot->device, index++);	/* Make sure there are no video controllers here	 * for all func of p_slot	 */	while (func && !rc) {		pci_bus->number = func->bus;		devfn = PCI_DEVFN(func->device, func->function);		/* Check the Class Code */		rc = pci_bus_read_config_byte (pci_bus, devfn, 0x0B, &class_code);		if (rc)			return rc;		if (class_code == PCI_BASE_CLASS_DISPLAY) {			/* Display/Video adapter (not supported) */			rc = REMOVE_NOT_SUPPORTED;		} else {			/* See if it's a bridge */			rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type);			if (rc)				return rc;			/* If it's a bridge, check the VGA Enable bit */			if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {				rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_BRIDGE_CONTROL, &BCR);				if (rc)					return rc;				/* If the VGA Enable bit is set, remove isn't supported */				if (BCR & PCI_BRIDGE_CTL_VGA) {					rc = REMOVE_NOT_SUPPORTED;				}			}		}		func = pciehp_slot_find(p_slot->bus, p_slot->device, index++);	}	func = pciehp_slot_find(p_slot->bus, p_slot->device, 0);	if ((func != NULL) && !rc) {		rc = remove_board(func, p_slot->ctrl);	} else if (!rc)		rc = 1;	if (p_slot)		update_slot_info(p_slot);	return rc;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/ca22a5e4d70620b7f3d809e424daa5214b0aa00d/pciehp_ctrl.c/buggy/drivers/pci/hotplug/pciehp_ctrl.c