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


C++ device_add函数代码示例

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


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

示例1: machine_at_wd76c10_init

void
machine_at_wd76c10_init(const machine_t *model)
{
        machine_at_common_ide_init(model);

	device_add(&keyboard_ps2_quadtel_device);
	wd76c10_fdc = device_add(&fdc_at_device);
	wd76c10_uart[0] = device_add_inst(&i8250_device, 1);
	wd76c10_uart[1] = device_add_inst(&i8250_device, 2);

        wd76c10_init();

	device_add(&paradise_wd90c11_megapc_device);
}
开发者ID:OBattler,项目名称:PCem-Unofficial,代码行数:14,代码来源:m_at_wd76c10.c

示例2: tandy1ksl2_init

void tandy1ksl2_init()
{
//        TANDY = 1;
        common_init();
        mem_add_bios();
        keyboard_tandy_init();
        mouse_serial_init();
        device_add(&pssj_device);
        xtide_init();
	nmi_init();
        device_add(&tandy_rom_device);
        device_add(&tandy_eeprom_device);
        device_add(&gameport_device);
}
开发者ID:MoochMcGee,项目名称:PCem-mooch,代码行数:14,代码来源:model.c

示例3: tandy1k_init

void tandy1k_init()
{
        TANDY = 1;
        common_init();
        keyboard_tandy_init();
        mouse_serial_init();
        if (romset == ROM_TANDY)
                device_add(&sn76489_device);
        else
                device_add(&ncr8496_device);
        xtide_init();
	nmi_init();
	if (romset != ROM_TANDY)
                device_add(&tandy_eeprom_device);
}
开发者ID:aliaspider,项目名称:PCem-mooch,代码行数:15,代码来源:model.c

示例4: malloc

struct ssd *ssdmodel_ssd_loadparams(struct lp_block *b, int *num)
{
  /* temp vars for parameters */
  int n;
  struct ssd *result;

  if(!disksim->ssdinfo) ssd_initialize_diskinfo();

  result = malloc(sizeof(struct ssd));
  if(!result) return 0;
  bzero(result, sizeof(struct ssd));

  n = ssd_add(result);

  result->hdr = ssd_hdr_initializer;
  if(b->name)
    result->hdr.device_name = _strdup(b->name);

  lp_loadparams(result, b, &ssdmodel_ssd_mod);

  device_add((struct device_header *)result, n);
  if (num != NULL)
	  *num = n;
  return result;
}
开发者ID:vishnu89,项目名称:gijoe,代码行数:25,代码来源:ssd.c

示例5: edac_mc_sysfs_init

/*
 * Init/exit code for the module. Basically, creates/removes /sys/class/rc
 */
int __init edac_mc_sysfs_init(void)
{
	int err;

	mci_pdev = kzalloc(sizeof(*mci_pdev), GFP_KERNEL);
	if (!mci_pdev) {
		err = -ENOMEM;
		goto out;
	}

	mci_pdev->bus = edac_get_sysfs_subsys();
	mci_pdev->type = &mc_attr_type;
	device_initialize(mci_pdev);
	dev_set_name(mci_pdev, "mc");

	err = device_add(mci_pdev);
	if (err < 0)
		goto out_dev_free;

	edac_dbg(0, "device %s created\n", dev_name(mci_pdev));

	return 0;

 out_dev_free:
	kfree(mci_pdev);
 out:
	return err;
}
开发者ID:020gzh,项目名称:linux,代码行数:31,代码来源:edac_mc_sysfs.c

示例6: mmc_add_card

/*
 * Register a new MMC card with the driver model.
 */
int mmc_add_card(struct mmc_card *card)
{
    int ret;
    const char *type;

    dev_set_name(&card->dev, "%s:%04x", mmc_hostname(card->host), card->rca);

    switch (card->type) {
    case MMC_TYPE_MMC:
        type = "MMC";
        break;
    case MMC_TYPE_SD:
        type = "SD";
        if (mmc_card_blockaddr(card)) {
            if (mmc_card_ext_capacity(card))
                type = "SDXC";
            else
                type = "SDHC";
        }
        break;
    case MMC_TYPE_SDIO:
        type = "SDIO";
        break;
    case MMC_TYPE_SD_COMBO:
        type = "SD-combo";
        if (mmc_card_blockaddr(card))
            type = "SDHC-combo";
        break;
    default:
        type = "?";
        break;
    }

    if (mmc_host_is_spi(card->host)) {
        printk(KERN_INFO "%s: new %s%s%s card on SPI\n",
               mmc_hostname(card->host),
               mmc_card_highspeed(card) ? "high speed " : "",
               mmc_card_ddr_mode(card) ? "DDR " : "",
               type);
    } else {
        printk(KERN_INFO "%s: new %s%s%s card at address %04x\n",
               mmc_hostname(card->host),
               mmc_sd_card_uhs(card) ? "ultra high speed " :
               (mmc_card_highspeed(card) ? "high speed " : ""),
               mmc_card_ddr_mode(card) ? "DDR " : "",
               type, card->rca);
    }

#ifdef CONFIG_DEBUG_FS
    mmc_add_card_debugfs(card);
#endif

    ret = device_add(&card->dev);
    if (ret)
        return ret;

    mmc_card_set_present(card);

    return 0;
}
开发者ID:printusrzero,项目名称:hwp6s-kernel,代码行数:63,代码来源:bus.c

示例7: sio_detect_init

static void *
sio_detect_init(const device_t *info)
{
    sio_detect_t *dev = (sio_detect_t *) malloc(sizeof(sio_detect_t));
    memset(dev, 0, sizeof(sio_detect_t));

    device_add(&fdc_at_smc_device);

    io_sethandler(0x0024, 0x0004,
		  sio_detect_read, NULL, NULL, sio_detect_write, NULL, NULL, dev);
    io_sethandler(0x002e, 0x0002,
		  sio_detect_read, NULL, NULL, sio_detect_write, NULL, NULL, dev);
    io_sethandler(0x0044, 0x0004,
		  sio_detect_read, NULL, NULL, sio_detect_write, NULL, NULL, dev);
    io_sethandler(0x004e, 0x0002,
		  sio_detect_read, NULL, NULL, sio_detect_write, NULL, NULL, dev);
    io_sethandler(0x0108, 0x0002,
		  sio_detect_read, NULL, NULL, sio_detect_write, NULL, NULL, dev);
    io_sethandler(0x0250, 0x0002,
		  sio_detect_read, NULL, NULL, sio_detect_write, NULL, NULL, dev);
    io_sethandler(0x0370, 0x0002,
		  sio_detect_read, NULL, NULL, sio_detect_write, NULL, NULL, dev);
    io_sethandler(0x03f0, 0x0002,
		  sio_detect_read, NULL, NULL, sio_detect_write, NULL, NULL, dev);

    return dev;
}
开发者ID:OBattler,项目名称:PCem-Unofficial,代码行数:27,代码来源:sio_detect.c

示例8: midi_device_init

void
midi_device_init()
{
    if (devices[midi_device_current].device)
	device_add(devices[midi_device_current].device);
    midi_device_last = midi_device_current;
}
开发者ID:OBattler,项目名称:PCem-Unofficial,代码行数:7,代码来源:midi.c

示例9: iio_trigger_register

int iio_trigger_register(struct iio_trigger *trig_info)
{
	int ret;

	trig_info->id = ida_simple_get(&iio_trigger_ida, 0, 0, GFP_KERNEL);
	if (trig_info->id < 0)
		return trig_info->id;

	/* Set the name used for the sysfs directory etc */
	dev_set_name(&trig_info->dev, "trigger%ld",
		     (unsigned long) trig_info->id);

	ret = device_add(&trig_info->dev);
	if (ret)
		goto error_unregister_id;

	/* Add to list of available triggers held by the IIO core */
	mutex_lock(&iio_trigger_list_lock);
	list_add_tail(&trig_info->list, &iio_trigger_list);
	mutex_unlock(&iio_trigger_list_lock);

	return 0;

error_unregister_id:
	ida_simple_remove(&iio_trigger_ida, trig_info->id);
	return ret;
}
开发者ID:168519,项目名称:linux,代码行数:27,代码来源:industrialio-trigger.c

示例10: spmi_add_device

/**
 * spmi_add_device: Add a new device without register board info.
 * @spmi_dev: spmi_device to be added (registered).
 *
 * Called when device doesn't have an explicit client-driver to be probed, or
 * the client-driver is a module installed dynamically.
 */
int spmi_add_device(struct spmi_device *spmidev)
{
	int rc;
	struct device *dev = get_valid_device(spmidev);

	if (!dev) {
		pr_err("invalid SPMI device\n");
		return -EINVAL;
	}

//#ifdef CONFIG_ZTEMT_HW_VERSION
	if(strncmp(spmidev->name,"qpnp-ztemt_hw_version",strlen("qpnp-ztemt_hw_version"))==0)
	{
	   dev_set_name(dev, "%s", spmidev->name);
    }else{	
	   /* Set the device name */
	   dev_set_name(dev, "%s-%p", spmidev->name, spmidev);
	}
//#else
//	/* Set the device name */
//	dev_set_name(dev, "%s-%p", spmidev->name, spmidev);
//#endif

	/* Device may be bound to an active driver when this returns */
	rc = device_add(dev);

	if (rc < 0)
		dev_err(dev, "Can't add %s, status %d\n", dev_name(dev), rc);
	else
		dev_dbg(dev, "device %s registered\n", dev_name(dev));

	return rc;
}
开发者ID:kenmjlee,项目名称:X9180_kernel,代码行数:40,代码来源:spmi.c

示例11: edac_create_dimm_object

/* Create a DIMM object under specifed memory controller device */
static int edac_create_dimm_object(struct mem_ctl_info *mci,
				   struct dimm_info *dimm,
				   int index)
{
	int err;
	dimm->mci = mci;

	dimm->dev.type = &dimm_attr_type;
	dimm->dev.bus = mci->bus;
	device_initialize(&dimm->dev);

	dimm->dev.parent = &mci->dev;
	if (mci->csbased)
		dev_set_name(&dimm->dev, "rank%d", index);
	else
		dev_set_name(&dimm->dev, "dimm%d", index);
	dev_set_drvdata(&dimm->dev, dimm);
	pm_runtime_forbid(&mci->dev);

	err =  device_add(&dimm->dev);

	edac_dbg(0, "creating rank/dimm device %s\n", dev_name(&dimm->dev));

	return err;
}
开发者ID:emilsvennesson,项目名称:linux_media,代码行数:26,代码来源:edac_mc_sysfs.c

示例12: edac_mc_sysfs_init

/*
 * Init/exit code for the module. Basically, creates/removes /sys/class/rc
 */
int __init edac_mc_sysfs_init(void)
{
	struct bus_type *edac_subsys;
	int err;

	/* get the /sys/devices/system/edac subsys reference */
	edac_subsys = edac_get_sysfs_subsys();
	if (edac_subsys == NULL) {
		edac_dbg(1, "no edac_subsys\n");
		return -EINVAL;
	}

	mci_pdev = kzalloc(sizeof(*mci_pdev), GFP_KERNEL);

	mci_pdev->bus = edac_subsys;
	mci_pdev->type = &mc_attr_type;
	device_initialize(mci_pdev);
	dev_set_name(mci_pdev, "mc");

	err = device_add(mci_pdev);
	if (err < 0)
		return err;

	edac_dbg(0, "device %s created\n", dev_name(mci_pdev));

	return 0;
}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:30,代码来源:edac_mc_sysfs.c

示例13: register_disk

void register_disk(struct gendisk *disk)
{
	struct device *ddev = disk_to_dev(disk);
	struct block_device *bdev;
	struct disk_part_iter piter;
	struct hd_struct *part;
	int err;
#ifdef MY_ABC_HERE
	int error;
#endif

	ddev->parent = disk->driverfs_dev;

	dev_set_name(ddev, disk->disk_name);

	/* delay uevents, until we scanned partition table */
	dev_set_uevent_suppress(ddev, 1);

	if (device_add(ddev))
		return;
#ifdef MY_ABC_HERE
	if (ddev->parent) {
		char *class_name;
		class_name = make_class_name(ddev->class->name,
						&ddev->kobj);
		if (class_name) {
			error = sysfs_create_link(&ddev->parent->kobj,
						&ddev->kobj, class_name);
		}
		kfree(class_name);
	}
开发者ID:Vincentxiaojie,项目名称:xpenology,代码行数:31,代码来源:genhd.c

示例14: rmi_register_function

int rmi_register_function(struct rmi_function *fn)
{
	struct rmi_device *rmi_dev = fn->rmi_dev;
	int error;

	device_initialize(&fn->dev);

	dev_set_name(&fn->dev, "%s.fn%02x",
		     dev_name(&rmi_dev->dev), fn->fd.function_number);

	fn->dev.parent = &rmi_dev->dev;
	fn->dev.type = &rmi_function_type;
	fn->dev.bus = &rmi_bus_type;

	error = device_add(&fn->dev);
	if (error) {
		dev_err(&rmi_dev->dev,
			"Failed device_register function device %s\n",
			dev_name(&fn->dev));
		goto err_put_device;
	}

	rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev, "Registered F%02X.\n",
			fn->fd.function_number);

	return 0;

err_put_device:
	put_device(&fn->dev);
	return error;
}
开发者ID:513855417,项目名称:linux,代码行数:31,代码来源:rmi_bus.c

示例15: device_add

zx_status_t PlatformBus::Create(zx_device_t* parent, const char* name, zx::vmo zbi) {
    // This creates the "sys" device.
    sys_device_proto.version = DEVICE_OPS_VERSION;

    device_add_args_t args = {};
    args.version = DEVICE_ADD_ARGS_VERSION;
    args.name = "sys";
    args.ops = &sys_device_proto;
    args.flags = DEVICE_ADD_NON_BINDABLE;

    // Add child of sys for the board driver to bind to.
    auto status = device_add(parent, &args, &parent);
    if (status != ZX_OK) {
        return status;
    }

    fbl::AllocChecker ac;
    fbl::unique_ptr<platform_bus::PlatformBus> bus(new (&ac) platform_bus::PlatformBus(parent));
    if (!ac.check()) {
        return ZX_ERR_NO_MEMORY;
    }

    status = bus->Init(std::move(zbi));
    if (status != ZX_OK) {
        return status;
    }

    // devmgr is now in charge of the device.
    __UNUSED auto* dummy = bus.release();
    return ZX_OK;
}
开发者ID:saltstar,项目名称:smartnix,代码行数:31,代码来源:platform-bus.cpp


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