• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pci_register_driver函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: gemtek_pci_init_module

static int __init gemtek_pci_init_module( void )
{
    return pci_register_driver( &gemtek_pci_driver );
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-i_fw-40-21-10-2,代码行数:4,代码来源:radio-gemtek-pci.c


示例17: xhci_register_pci

int __init xhci_register_pci(void)
{
	return pci_register_driver(&xhci_pci_driver);
}
开发者ID:AnadoluPanteri,项目名称:kernel-plus-harmattan,代码行数:4,代码来源:xhci-pci.c


示例18: cy82c693_init

static int __init cy82c693_init(void)
{
	return pci_register_driver(&cy82c693_pci_driver);
}
开发者ID:mikeberkelaar,项目名称:grhardened,代码行数:4,代码来源:pata_cypress.c


示例19: marvell_init

static int __init marvell_init(void)
{
	return pci_register_driver(&marvell_pci_driver);
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:4,代码来源:pata_marvell.c


示例20: philips_fmd1216_pll_init


//.........这里部分代码省略.........
		goto fail_core;
	dev->pci = pci_dev;
	dev->core = core;

	err = cx8802_init_common(dev);
	if (0 != err)
		goto fail_free;

#ifdef HAVE_VP3054_I2C
	err = vp3054_i2c_probe(dev);
	if (0 != err)
		goto fail_free;
#endif

	/* dvb stuff */
	printk("%s/2: cx2388x based dvb card\n", core->name);
	videobuf_queue_init(&dev->dvb.dvbq, &dvb_qops,
			    dev->pci, &dev->slock,
			    V4L2_BUF_TYPE_VIDEO_CAPTURE,
			    V4L2_FIELD_TOP,
			    sizeof(struct cx88_buffer),
			    dev);
	err = dvb_register(dev);
	if (0 != err)
		goto fail_fini;

	/* Maintain a reference to cx88-video can query the 8802 device. */
	core->dvbdev = dev;
	return 0;

 fail_fini:
	cx8802_fini_common(dev);
 fail_free:
	kfree(dev);
 fail_core:
	cx88_core_put(core,pci_dev);
	return err;
}

static void __devexit dvb_remove(struct pci_dev *pci_dev)
{
	struct cx8802_dev *dev = pci_get_drvdata(pci_dev);

	/* Destroy any 8802 reference. */
	dev->core->dvbdev = NULL;

	/* dvb */
	videobuf_dvb_unregister(&dev->dvb);

#ifdef HAVE_VP3054_I2C
	vp3054_i2c_remove(dev);
#endif

	/* common */
	cx8802_fini_common(dev);
	cx88_core_put(dev->core,dev->pci);
	kfree(dev);
}

static struct pci_device_id cx8802_pci_tbl[] = {
	{
		.vendor       = 0x14f1,
		.device       = 0x8802,
		.subvendor    = PCI_ANY_ID,
		.subdevice    = PCI_ANY_ID,
	},{
		/* --- end of list --- */
	}
};
MODULE_DEVICE_TABLE(pci, cx8802_pci_tbl);

static struct pci_driver dvb_pci_driver = {
	.name     = "cx88-dvb",
	.id_table = cx8802_pci_tbl,
	.probe    = dvb_probe,
	.remove   = __devexit_p(dvb_remove),
	.suspend  = cx8802_suspend_common,
	.resume   = cx8802_resume_common,
};

static int dvb_init(void)
{
	printk(KERN_INFO "cx2388x dvb driver version %d.%d.%d loaded\n",
	       (CX88_VERSION_CODE >> 16) & 0xff,
	       (CX88_VERSION_CODE >>  8) & 0xff,
	       CX88_VERSION_CODE & 0xff);
#ifdef SNAPSHOT
	printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n",
	       SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100);
#endif
	return pci_register_driver(&dvb_pci_driver);
}

static void dvb_fini(void)
{
	pci_unregister_driver(&dvb_pci_driver);
}

module_init(dvb_init);
module_exit(dvb_fini);
开发者ID:FatSunHYS,项目名称:OSCourseDesign,代码行数:101,代码来源:cx88-dvb.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pci_release_msi函数代码示例发布时间:2022-05-30
下一篇:
C++ pci_read_config_word函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap