当前位置: 首页>>代码示例>>C++>>正文


C++ pci_register_driver函数代码示例

本文整理汇总了C++中pci_register_driver函数的典型用法代码示例。如果您正苦于以下问题:C++ pci_register_driver函数的具体用法?C++ pci_register_driver怎么用?C++ pci_register_driver使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pci_register_driver函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: optidma_init

static int __init optidma_init(void)
{
	return pci_register_driver(&optidma_pci_driver);
}
开发者ID:08opt,项目名称:linux,代码行数:4,代码来源:pata_optidma.c

示例2: ath_pci_init

int ath_pci_init(void)
{
	return pci_register_driver(&ath_pci_driver);
}
开发者ID:andi34,项目名称:Dhollmen_Kernel,代码行数:4,代码来源:pci.c

示例3: abyss_init

static int __init abyss_init (void)
{
	return pci_register_driver(&abyss_driver);
}
开发者ID:PennPanda,项目名称:linux-repo,代码行数:4,代码来源:abyss.c

示例4: fnic_init_module

static int __init fnic_init_module(void)
{
	size_t len;
	int err = 0;

	printk(KERN_INFO PFX "%s, ver %s\n", DRV_DESCRIPTION, DRV_VERSION);

	/* Allocate memory for trace buffer */
	err = fnic_trace_buf_init();
	if (err < 0) {
		printk(KERN_ERR PFX "Trace buffer initialization Failed "
				  "Fnic Tracing utility is disabled\n");
		fnic_trace_free();
	}

	/* Create a cache for allocation of default size sgls */
	len = sizeof(struct fnic_dflt_sgl_list);
	fnic_sgl_cache[FNIC_SGL_CACHE_DFLT] = (struct kmem_cache *)
			kmem_cache_create("fnic_sgl_dflt" ,
			len + FNIC_SG_DESC_ALIGN, 0,
			SLAB_CACHE_DMA, NULL, NULL);
	if (!fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]) {
		printk(KERN_ERR PFX "failed to create fnic dflt sgl slab\n");
		err = -ENOMEM;
		goto err_create_fnic_sgl_slab_dflt;
	}

	/* Create a cache for allocation of max size sgls*/
	len = sizeof(struct fnic_sgl_list);
	fnic_sgl_cache[FNIC_SGL_CACHE_MAX] = (struct kmem_cache *)
			kmem_cache_create("fnic_sgl_max",
			len + FNIC_SG_DESC_ALIGN, 0,
			SLAB_CACHE_DMA, NULL, NULL);
	if (!fnic_sgl_cache[FNIC_SGL_CACHE_MAX]) {
		printk(KERN_ERR PFX "failed to create fnic max sgl slab\n");
		err = -ENOMEM;
		goto err_create_fnic_sgl_slab_max;
	}

	/* Create a cache of io_req structs for use via mempool */
	fnic_io_req_cache = (struct kmem_cache *)
				kmem_cache_create("fnic_io_req",
				      sizeof(struct fnic_io_req),
				      0, SLAB_HWCACHE_ALIGN, NULL,
				      NULL);
	if (!fnic_io_req_cache) {
		printk(KERN_ERR PFX "failed to create fnic io_req slab\n");
		err = -ENOMEM;
		goto err_create_fnic_ioreq_slab;
	}

	fnic_event_queue = create_singlethread_workqueue("fnic_event_wq");
	if (!fnic_event_queue) {
		printk(KERN_ERR PFX "fnic work queue create failed\n");
		err = -ENOMEM;
		goto err_create_fnic_workq;
	}

	spin_lock_init(&fnic_list_lock);
	INIT_LIST_HEAD(&fnic_list);

	fnic_fc_transport = fc_attach_transport(&fnic_fc_functions);
	if (!fnic_fc_transport) {
		printk(KERN_ERR PFX "fc_attach_transport error\n");
		err = -ENOMEM;
		goto err_fc_transport;
	}

	/* register the driver with PCI system */
	err = pci_register_driver(&fnic_driver);
	if (err < 0) {
		printk(KERN_ERR PFX "pci register error\n");
		goto err_pci_register;
	}

        /* Setup procfs */
        err = init_fnic_procfs();
        if (err < 0) {
                printk(KERN_ERR PFX "Failed to set up procfs\n");
                goto err_init_fnic_procfs;
        }
        return err;
err_init_fnic_procfs:
        teardown_fnic_procfs();


err_pci_register:
	fc_release_transport(fnic_fc_transport);
err_fc_transport:
	destroy_workqueue(fnic_event_queue);
err_create_fnic_workq:
	kmem_cache_destroy(fnic_io_req_cache);
err_create_fnic_ioreq_slab:
	kmem_cache_destroy(fnic_sgl_cache[FNIC_SGL_CACHE_MAX]);
err_create_fnic_sgl_slab_max:
	kmem_cache_destroy(fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]);
err_create_fnic_sgl_slab_dflt:
	fnic_trace_free();
	return err;
}
开发者ID:pombredanne,项目名称:https-git.sfconservancy.org-vmkdrivers,代码行数:100,代码来源:fnic_main.c

示例5: acqiris_init

static int __init acqiris_init(void)
{
    int result;

    printk(ACQRS_INFO "Initializing module " MOD_NAME " (Acqiris PCI I/O Driver) version " MOD_VERSION "\n");
    printk(ACQRS_INFO "    compiled for linux kernel version %d.%d.%d\n", (LINUX_VERSION_CODE>>16)&0xff, (LINUX_VERSION_CODE>>8)&0xff, LINUX_VERSION_CODE&0xff);
    printk(ACQRS_INFO "- debug level = %#04x (%d) (modprobe " MOD_NAME " dbgl=N)\n", dbgl, dbgl);
    printk(ACQRS_INFO "    N: 0x1 DMA; 0x2 interrupt function; 0x4 module r/w ioctrl; 0x8 end of acquisition \n");
    printk(ACQRS_INFO "    N: 0x10 initialization; 0x20 memory allocations; 0x40 all operations \n");
    printk(ACQRS_INFO "- maximum devices = %d (modprobe " MOD_NAME " maxdev=N) (absolute max is 255)\n", maxdev);

    /* Creating the acqiris driver structure */
    result = acqiris_driver_init(&aq_drv);
    if (result < 0)
        return result;

    /* Attempt to register major region */
    if (MAJOR(aq_drv.dev) > 0)
        result = register_chrdev_region(aq_drv.dev, CDEV_MINOR_COUNT, MOD_NAME);
    else
        result = alloc_chrdev_region(&aq_drv.dev, CDEV_MINOR_FIRST, CDEV_MINOR_COUNT, MOD_NAME);

    if (result < 0)
    {
        printk(ACQRS_ERR "Cannot register chrdev region for major %d (%d).\n", MAJOR(aq_drv.dev), result);
        goto fail_region;
    }

    printk(ACQRS_INFO "- major number = %d (modprobe " MOD_NAME " major=N)\n", MAJOR(aq_drv.dev));

    /* Attempt to add character device */
    result = cdev_add(&aq_drv.cdev, aq_drv.dev, CDEV_MINOR_COUNT);
    if (result < 0)
    {
        printk(ACQRS_ERR "Unable to add character device.\n");
        kobject_put(&aq_drv.cdev.kobj);
        goto fail_cdev;
    }

    /* Attempt to register PCI driver */
    result = pci_register_driver(&aq_pci_driver);
    if (result < 0)
    {
        printk(ACQRS_ERR "Cannot register PCI driver (%d).\n", result);
        goto fail_pci;
    }

#ifdef AQ_USE_CLASSES
    acqiris_classP = class_create(THIS_MODULE, MOD_NAME);

    if (acqiris_classP == NULL)
    {
        printk(ACQRS_ERR "Unable to create class '%s'\n", MOD_NAME);
        result = -ENODEV;
        goto fail_all;
     }

    device_create(acqiris_classP, acqiris_deviceP, aq_drv.dev, MOD_NAME);

#endif

    nbrdev = aq_drv.nbr_devices;

    /* All is OK */
    return 0;

    goto fail_all; /* to prevent warning */
fail_all:
    pci_unregister_driver(&aq_pci_driver);
fail_pci:
    cdev_del(&aq_drv.cdev);
fail_cdev:
    unregister_chrdev_region(aq_drv.dev, CDEV_MINOR_COUNT);
fail_region:
    acqiris_driver_cleanup(&aq_drv);

    return result;
}
开发者ID:qtplatz,项目名称:qtplatz,代码行数:78,代码来源:acqiris-init.c

示例6: c2_init_module

static int __init c2_init_module(void)
{
	return pci_register_driver(&c2_pci_driver);
}
开发者ID:mecke,项目名称:linux-2.6,代码行数:4,代码来源:c2.c

示例7: hilscher_init_module

static int __init hilscher_init_module(void)
{
	return pci_register_driver(&hilscher_pci_driver);
}
开发者ID:PennPanda,项目名称:linux-repo,代码行数:4,代码来源:uio_cif.c

示例8: ps_hdmi_hpd_register_driver

/* PCI Driver registration function */
int ps_hdmi_hpd_register_driver(void)
{
	pr_debug("%s: Registering PCI driver for HDMI HPD\n", __func__);
	return pci_register_driver(&ps_hdmi_hpd_driver);
}
开发者ID:ddalex,项目名称:XT890-Kernel-Gamma,代码行数:6,代码来源:ps_hdmi.c

示例9: emu_init

static int __init emu_init(void)
{
	return pci_register_driver(&emu_driver);
}
开发者ID:12rafael,项目名称:jellytimekernel,代码行数:4,代码来源:emu10k1-gp.c

示例10: jmicron_init

static int __init jmicron_init(void)
{
	return pci_register_driver(&jmicron_pci_driver);
}
开发者ID:ivucica,项目名称:linux,代码行数:4,代码来源:pata_jmicron.c

示例11: sil680_init_one


//.........这里部分代码省略.........

    if (!try_mmio)
        goto use_ioports;

    /* Try to acquire MMIO resources and fallback to PIO if
     * that fails
     */
    rc = pcim_enable_device(pdev);
    if (rc)
        return rc;
    rc = pcim_iomap_regions(pdev, 1 << SIL680_MMIO_BAR, DRV_NAME);
    if (rc)
        goto use_ioports;

    /* Allocate host and set it up */
    host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2);
    if (!host)
        return -ENOMEM;
    host->iomap = pcim_iomap_table(pdev);

    /* Setup DMA masks */
    rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
    if (rc)
        return rc;
    rc = pci_set_consistent_dma_mask(pdev, ATA_DMA_MASK);
    if (rc)
        return rc;
    pci_set_master(pdev);

    /* Get MMIO base and initialize port addresses */
    mmio_base = host->iomap[SIL680_MMIO_BAR];
    host->ports[0]->ioaddr.bmdma_addr = mmio_base + 0x00;
    host->ports[0]->ioaddr.cmd_addr = mmio_base + 0x80;
    host->ports[0]->ioaddr.ctl_addr = mmio_base + 0x8a;
    host->ports[0]->ioaddr.altstatus_addr = mmio_base + 0x8a;
    ata_sff_std_ports(&host->ports[0]->ioaddr);
    host->ports[1]->ioaddr.bmdma_addr = mmio_base + 0x08;
    host->ports[1]->ioaddr.cmd_addr = mmio_base + 0xc0;
    host->ports[1]->ioaddr.ctl_addr = mmio_base + 0xca;
    host->ports[1]->ioaddr.altstatus_addr = mmio_base + 0xca;
    ata_sff_std_ports(&host->ports[1]->ioaddr);

    /* Register & activate */
    return ata_host_activate(host, pdev->irq, ata_sff_interrupt,
                             IRQF_SHARED, &sil680_sht);

use_ioports:
    return ata_pci_sff_init_one(pdev, ppi, &sil680_sht, NULL);
}

#ifdef CONFIG_PM
static int sil680_reinit_one(struct pci_dev *pdev)
{
    struct ata_host *host = dev_get_drvdata(&pdev->dev);
    int try_mmio, rc;

    rc = ata_pci_device_do_resume(pdev);
    if (rc)
        return rc;
    sil680_init_chip(pdev, &try_mmio);
    ata_host_resume(host);
    return 0;
}
#endif

static const struct pci_device_id sil680[] = {
    { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_680), },

    { },
};

static struct pci_driver sil680_pci_driver = {
    .name         = DRV_NAME,
    .id_table    = sil680,
    .probe         = sil680_init_one,
    .remove        = ata_pci_remove_one,
#ifdef CONFIG_PM
    .suspend    = ata_pci_device_suspend,
    .resume        = sil680_reinit_one,
#endif
};

static int __init sil680_init(void)
{
    return pci_register_driver(&sil680_pci_driver);
}

static void __exit sil680_exit(void)
{
    pci_unregister_driver(&sil680_pci_driver);
}

MODULE_AUTHOR("Alan Cox");
MODULE_DESCRIPTION("low-level driver for SI680 PATA");
MODULE_LICENSE("GPL");
MODULE_DEVICE_TABLE(pci, sil680);
MODULE_VERSION(DRV_VERSION);

module_init(sil680_init);
module_exit(sil680_exit);
开发者ID:274914765,项目名称:C,代码行数:101,代码来源:pata_sil680.c

示例12: poulsbo_init

static int __init poulsbo_init(void)
{
	return pci_register_driver(&poulsbo_driver);
}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:4,代码来源:poulsbo.c

示例13: scb2_flash_init

static int __init
scb2_flash_init(void)
{
	return pci_register_driver(&scb2_flash_driver);
}
开发者ID:maliyu,项目名称:SOM2416,代码行数:5,代码来源:scb2_flash.c

示例14: rt2400pci_init

static int __init rt2400pci_init(void)
{
	return pci_register_driver(&rt2400pci_driver);
}
开发者ID:ARMP,项目名称:samsung_kernel_cooper,代码行数:4,代码来源:rt2400pci.c

示例15: denali_init

static int __devinit denali_init(void)
{
	printk(KERN_INFO "Spectra MTD driver\n");
	return pci_register_driver(&denali_pci_driver);
}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:5,代码来源:denali.c


注:本文中的pci_register_driver函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。