 if (!is_shpc_capable(pdev)) return -ENODEV; 
static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent){	int rc;	struct controller *ctrl;	struct slot *t_slot;	int first_device_num;	/* first PCI device number supported by this SHPC */	int num_ctlr_slots;	/* number of slots supported by this SHPC */	ctrl = (struct controller *) kmalloc(sizeof(struct controller), GFP_KERNEL);	if (!ctrl) {		err("%s : out of memory\n", __FUNCTION__);		goto err_out_none;	}	memset(ctrl, 0, sizeof(struct controller));	dbg("DRV_thread pid = %d\n", current->pid);	rc = shpc_init(ctrl, pdev,			(php_intr_callback_t) shpchp_handle_attention_button,			(php_intr_callback_t) shpchp_handle_switch_change,			(php_intr_callback_t) shpchp_handle_presence_change,			(php_intr_callback_t) shpchp_handle_power_fault);	if (rc) {		dbg("%s: controller initialization failed\n", SHPC_MODULE_NAME);		goto err_out_free_ctrl;	}	dbg("%s: controller initialization success\n", __FUNCTION__);	ctrl->pci_dev = pdev;  /* pci_dev of the P2P bridge */	pci_set_drvdata(pdev, ctrl);	ctrl->pci_bus = kmalloc (sizeof (*ctrl->pci_bus), GFP_KERNEL);	if (!ctrl->pci_bus) {		err("out of memory\n");		rc = -ENOMEM;		goto err_out_unmap_mmio_region;	}		memcpy (ctrl->pci_bus, pdev->bus, sizeof (*ctrl->pci_bus));	ctrl->bus = pdev->bus->number;	ctrl->slot_bus = pdev->subordinate->number;	ctrl->device = PCI_SLOT(pdev->devfn);	ctrl->function = PCI_FUNC(pdev->devfn);	dbg("ctrl bus=0x%x, device=%x, function=%x, irq=%x\n", ctrl->bus, ctrl->device, ctrl->function, pdev->irq);	/*	 *	Save configuration headers for this and subordinate PCI buses	 */	rc = get_ctlr_slot_config(ctrl);	if (rc) {		err(msg_initialization_err, rc);		goto err_out_free_ctrl_bus;	}	first_device_num = ctrl->slot_device_offset;	num_ctlr_slots = ctrl->num_slots;	/* Store PCI Config Space for all devices on this bus */	rc = shpchp_save_config(ctrl, ctrl->slot_bus, num_ctlr_slots, first_device_num);	if (rc) {		err("%s: unable to save PCI configuration data, error %d\n", __FUNCTION__, rc);		goto err_out_free_ctrl_bus;	}	ctrl->add_support = 1;		/* Setup the slot information structures */	rc = init_slots(ctrl);	if (rc) {		err(msg_initialization_err, 6);		goto err_out_free_ctrl_slot;	}	/* Now hpc_functions (slot->hpc_ops->functions) are ready  */	t_slot = shpchp_find_slot(ctrl, first_device_num);	/* Check for operation bus speed */	rc = t_slot->hpc_ops->get_cur_bus_speed(t_slot, &ctrl->speed);	dbg("%s: t_slot->hp_slot %x\n", __FUNCTION__,t_slot->hp_slot);	if (rc || ctrl->speed == PCI_SPEED_UNKNOWN) {		err(SHPC_MODULE_NAME ": Can't get current bus speed. Set to 33MHz PCI.\n");		ctrl->speed = PCI_SPEED_33MHz;	}	/* Finish setting up the hot plug ctrl device */	ctrl->next_event = 0;	if (!shpchp_ctrl_list) {		shpchp_ctrl_list = ctrl;		ctrl->next = NULL;	} else {		ctrl->next = shpchp_ctrl_list;		shpchp_ctrl_list = ctrl;	}	shpchp_create_ctrl_files(ctrl);	return 0;err_out_free_ctrl_slot:	cleanup_slots(ctrl);err_out_free_ctrl_bus:	kfree(ctrl->pci_bus);err_out_unmap_mmio_region:	ctrl->hpc_ops->release_ctlr(ctrl);err_out_free_ctrl:	kfree(ctrl);err_out_none:	return -ENODEV;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/1410dc1cef1e2f5e90c1fcb97041f42e0eee35b4/shpchp_core.c/buggy/drivers/pci/hotplug/shpchp_core.c