linux/drivers/hid/intel-ish-hid/ipc/pci-ish.c
/**
 * ish_probe() - PCI driver probe callback
 * @pdev:	pci device
 * @ent:	pci device id
 *
 * Initialize PCI function, setup interrupt and call for ISH initialization
 *
 * Return: 0 for success or error code for failure
 */
PCI driver probe callback
@pdev:       pci device
@ent:        pci device id

Initialize PCI function, setup interrupt and call for ISH initialization

0 for success or error code for failure
PCI driver probe callback @pdev : pci device @ent : pci device id Initialize PCI function setup interrupt and call for ISH initialization 0 for success or error code for failure
static int ish_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
	struct ishtp_device *dev;
	struct ish_hw *hw;
	int	ret;
	if (pci_dev_present(ish_invalid_pci_ids))
		return -ENODEV;
	ret = pci_enable_device(pdev);
	if (ret) {
		dev_err(&pdev->dev, "ISH: Failed to enable PCI device\n");
		return ret;
	}
	pci_set_master(pdev);
	ret = pci_request_regions(pdev, KBUILD_MODNAME);
	if (ret) {
		dev_err(&pdev->dev, "ISH: Failed to get PCI regions\n");
		goto disable_device;
	}
	dev = ish_dev_init(pdev);
	if (!dev) {
		ret = -ENOMEM;
		goto release_regions;
	}
	hw = to_ish_hw(dev);
	dev->print_log = ish_event_tracer;
	hw->mem_addr = pci_iomap(pdev, 0, 0);
	if (!hw->mem_addr) {
		dev_err(&pdev->dev, "ISH: mapping I/O range failure\n");
		ret = -ENOMEM;
		goto free_device;
	}
	dev->pdev = pdev;
	pdev->dev_flags |= PCI_DEV_FLAGS_NO_D3;
	ret = request_irq(pdev->irq, ish_irq_handler, IRQF_SHARED,
			  KBUILD_MODNAME, dev);
	if (ret) {
		dev_err(&pdev->dev, "ISH: request IRQ failure (%d)\n",
			pdev->irq);
		goto free_device;
	}
	dev_set_drvdata(dev->devc, dev);
	init_waitqueue_head(&dev->suspend_wait);
	init_waitqueue_head(&dev->resume_wait);
	ret = ish_init(dev);
	if (ret)
		goto free_irq;
	return 0;
free_irq:
	free_irq(pdev->irq, dev);
free_device:
	pci_iounmap(pdev, hw->mem_addr);
release_regions:
	pci_release_regions(pdev);
disable_device:
	pci_clear_master(pdev);
	pci_disable_device(pdev);
	dev_err(&pdev->dev, "ISH: PCI driver initialization failed.\n");
	return ret;
}
static int ish_probe ( struct pci_dev * pdev , const struct pci_device_id * ent ) { struct ishtp_device * dev ; struct ish_hw * hw ; int ret ; if ( pci_dev_present ( ish_invalid_pci_ids ) ) return - ENODEV ; ret = pci_enable_device ( pdev ) ; if ( ret ) { dev_err ( & pdev -> dev , " \n " ) ; return ret ; } pci_set_master ( pdev ) ; ret = pci_request_regions ( pdev , KBUILD_MODNAME ) ; if ( ret ) { dev_err ( & pdev -> dev , " \n " ) ; goto disable_device ; } dev = ish_dev_init ( pdev ) ; if ( ! dev ) { ret = - ENOMEM ; goto release_regions ; } hw = to_ish_hw ( dev ) ; dev -> print_log = ish_event_tracer ; hw -> mem_addr = pci_iomap ( pdev , 0 , 0 ) ; if ( ! hw -> mem_addr ) { dev_err ( & pdev -> dev , " \n " ) ; ret = - ENOMEM ; goto free_device ; } dev -> pdev = pdev ; pdev -> dev_flags |= PCI_DEV_FLAGS_NO_D3 ; ret = request_irq ( pdev -> irq , ish_irq_handler , IRQF_SHARED , KBUILD_MODNAME , dev ) ; if ( ret ) { dev_err ( & pdev -> dev , " \n " , pdev -> irq ) ; goto free_device ; } dev_set_drvdata ( dev -> devc , dev ) ; init_waitqueue_head ( & dev -> suspend_wait ) ; init_waitqueue_head ( & dev -> resume_wait ) ; ret = ish_init ( dev ) ; if ( ret ) goto free_irq ; return 0 ; free_irq : free_irq ( pdev -> irq , dev ) ; free_device : pci_iounmap ( pdev , hw -> mem_addr ) ; release_regions : pci_release_regions ( pdev ) ; disable_device : pci_clear_master ( pdev ) ; pci_disable_device ( pdev ) ; dev_err ( & pdev -> dev , " \n " ) ; return ret ; }
ish_probe() - PCI driver probe callback
 @pdev:       pci device
 @ent:        pci device id
ish_probe () - PCI driver probe callback @pdev : pci device @ent : pci device id
/* Check for invalid platforms for ISH support */ /* enable pci dev */ /* set PCI host mastering */ /* pci request regions for ISH driver */ /* allocates and initializes the ISH dev structure */ /* mapping IO device memory */ /* request and enable interrupt */