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

C++ debugfs_create_file函数代码示例

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

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



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

示例1: rk616_hdmi_probe

static int __devinit rk616_hdmi_probe (struct platform_device *pdev)
{
	int ret = -1;
	struct rkdisplay_platform_data *hdmi_data;
		
	RK616DBG("%s\n", __FUNCTION__);
	
	rk616_hdmi = kmalloc(sizeof(struct rk616_hdmi), GFP_KERNEL);
	if(!rk616_hdmi)
	{
    	dev_err(&pdev->dev, ">>rk30 hdmi kmalloc fail!");
    	return -ENOMEM;
	}
	memset(rk616_hdmi, 0, sizeof(struct rk616_hdmi));
	platform_set_drvdata(pdev, rk616_hdmi);
	
	rk616_hdmi->pwr_mode = NORMAL;
	
	rk616_hdmi->rk616_drv = dev_get_drvdata(pdev->dev.parent);
	if(rk616_hdmi->rk616_drv == NULL) {
		goto failed;
	}
	hdmi_data = rk616_hdmi->rk616_drv->pdata->pdata;
	if(hdmi_data == NULL) {
		goto failed;
	}
	// Register HDMI device
	if(hdmi_data) {
		rk616_hdmi_property.videosrc = hdmi_data->video_source;
		rk616_hdmi_property.display = hdmi_data->property;
	}
	
	rk616_hdmi_property.name = (char*)pdev->name;
	rk616_hdmi_property.priv = rk616_hdmi;
	rk616_hdmi->hdmi = hdmi_register(&rk616_hdmi_property, &rk616_hdmi_ops);
	if(rk616_hdmi->hdmi == NULL) {
		dev_err(&pdev->dev, "register hdmi device failed\n");
		ret = -ENOMEM;
		goto failed;
	}
		
	rk616_hdmi->hdmi->dev = &pdev->dev;
	rk616_hdmi->hdmi->xscale = 95;
	rk616_hdmi->hdmi->yscale = 95;
	rk616_hdmi->enable = 1;
	rk616_hdmi_initial(rk616_hdmi);
	
	#ifdef CONFIG_HAS_EARLYSUSPEND
	rk616_hdmi->early_suspend.suspend = rk616_hdmi_early_suspend;
	rk616_hdmi->early_suspend.resume = rk616_hdmi_early_resume;
	rk616_hdmi->early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB - 10;
	register_early_suspend(&rk616_hdmi->early_suspend);
	#endif
	
	#if defined(CONFIG_DEBUG_FS)
	if(rk616_hdmi->rk616_drv && rk616_hdmi->rk616_drv->debugfs_dir) {
		debugfs_create_file("hdmi", S_IRUSR, rk616_hdmi->rk616_drv->debugfs_dir, rk616_hdmi->rk616_drv, &rk616_hdmi_reg_fops);
	} else {
	    rk616_hdmi->debugfs_dir = debugfs_create_dir("rk616", NULL);
	    if (IS_ERR(rk616_hdmi->debugfs_dir)) {
	            dev_err(rk616_hdmi->hdmi->dev,"failed to create debugfs dir for rk616!\n");
	    } else {
	            debugfs_create_file("hdmi", S_IRUSR, rk616_hdmi->debugfs_dir, rk616_hdmi, &rk616_hdmi_reg_fops);
	    }
	}
#endif
	{
		rk616_hdmi->workqueue = create_singlethread_workqueue("rk616 irq");
		INIT_DELAYED_WORK(&(rk616_hdmi->delay_work), rk616_hdmi_irq_work_func);
		rk616_hdmi_irq_work_func(NULL);
	}
	dev_info(&pdev->dev, "rk616 hdmi probe sucess.\n");
	return 0;
	
failed:
	if(rk616_hdmi) {
		kfree(rk616_hdmi);
		rk616_hdmi = NULL;
	}
	dev_err(&pdev->dev, "rk30 hdmi probe error.\n");
	return ret;
}
开发者ID:avila-devlogic,项目名称:D33_KK_Kernel,代码行数:82,代码来源:rk616_hdmi.c


示例2: cyttsp5_setup_sysfs

static int cyttsp5_setup_sysfs(struct device *dev)
{
	struct cyttsp5_device_access_data *dad
		= cyttsp5_get_device_access_data(dev);
	int rc;

	rc = device_create_file(dev, &dev_attr_command);
	if (rc) {
		dev_err(dev, "%s: Error, could not create command\n",
				__func__);
		goto exit;
	}

	rc = device_create_file(dev, &dev_attr_status);
	if (rc) {
		dev_err(dev, "%s: Error, could not create status\n",
				__func__);
		goto unregister_command;
	}

	rc = device_create_file(dev, &dev_attr_response);
	if (rc) {
		dev_err(dev, "%s: Error, could not create response\n",
				__func__);
		goto unregister_status;
	}

	dad->base_dentry = debugfs_create_dir(dev_name(dev), NULL);
	if (IS_ERR_OR_NULL(dad->base_dentry)) {
		dev_err(dev, "%s: Error, could not create base directory\n",
				__func__);
		goto unregister_response;
	}

	dad->mfg_test_dentry = debugfs_create_dir("mfg_test",
			dad->base_dentry);
	if (IS_ERR_OR_NULL(dad->mfg_test_dentry)) {
		dev_err(dev, "%s: Error, could not create mfg_test directory\n",
				__func__);
		goto unregister_base_dir;
	}

	if (IS_ERR_OR_NULL(debugfs_create_file("panel_scan", 0600,
			dad->mfg_test_dentry, dad,
			&panel_scan_debugfs_fops))) {
		dev_err(dev, "%s: Error, could not create panel_scan\n",
				__func__);
		goto unregister_base_dir;
	}

	if (IS_ERR_OR_NULL(debugfs_create_file("get_idac", 0600,
			dad->mfg_test_dentry, dad, &get_idac_debugfs_fops))) {
		dev_err(dev, "%s: Error, could not create get_idac\n",
				__func__);
		goto unregister_base_dir;
	}

	if (IS_ERR_OR_NULL(debugfs_create_file("auto_shorts", 0400,
			dad->mfg_test_dentry, dad,
			&auto_shorts_debugfs_fops))) {
		dev_err(dev, "%s: Error, could not create auto_shorts\n",
				__func__);
		goto unregister_base_dir;
	}

	if (IS_ERR_OR_NULL(debugfs_create_file("opens", 0400,
			dad->mfg_test_dentry, dad, &opens_debugfs_fops))) {
		dev_err(dev, "%s: Error, could not create opens\n",
				__func__);
		goto unregister_base_dir;
	}

	if (IS_ERR_OR_NULL(debugfs_create_file("calibrate", 0600,
			dad->mfg_test_dentry, dad, &calibrate_debugfs_fops))) {
		dev_err(dev, "%s: Error, could not create calibrate\n",
				__func__);
		goto unregister_base_dir;
	}

	if (IS_ERR_OR_NULL(debugfs_create_file("baseline", 0600,
			dad->mfg_test_dentry, dad, &baseline_debugfs_fops))) {
		dev_err(dev, "%s: Error, could not create baseline\n",
				__func__);
		goto unregister_base_dir;
	}

	if (IS_ERR_OR_NULL(debugfs_create_file("cm_panel", 0400,
			dad->mfg_test_dentry, dad, &cm_panel_debugfs_fops))) {
		dev_err(dev, "%s: Error, could not create cm_panel\n",
				__func__);
		goto unregister_base_dir;
	}

	if (IS_ERR_OR_NULL(debugfs_create_file("cp_panel", 0400,
			dad->mfg_test_dentry, dad, &cp_panel_debugfs_fops))) {
		dev_err(dev, "%s: Error, could not create cp_panel\n",
				__func__);
		goto unregister_base_dir;
	}

//.........这里部分代码省略.........
开发者ID:jemisa,项目名称:N939St_5.1_kenel,代码行数:101,代码来源:cyttsp5_device_access.c


示例3: mutex_module_init

static int __init mutex_module_init(void)
{
	debugfs_mutex = debugfs_create_file("mutex", 0666, NULL, &value, &fops);
	return 0;
}
开发者ID:hiboma,项目名称:kernel_module_scratch,代码行数:5,代码来源:mutex.c


示例4: pr_err

struct ion_client *ion_client_create(struct ion_device *dev,
				     unsigned int heap_mask,
				     const char *name)
{
	struct ion_client *client;
	struct task_struct *task;
	struct rb_node **p;
	struct rb_node *parent = NULL;
	struct ion_client *entry;
	pid_t pid;
	unsigned int name_len;

	if (!name) {
		pr_err("%s: Name cannot be null\n", __func__);
		return ERR_PTR(-EINVAL);
	}
	name_len = strnlen(name, 64);

	get_task_struct(current->group_leader);
	task_lock(current->group_leader);
	pid = task_pid_nr(current->group_leader);
	if (current->group_leader->flags & PF_KTHREAD) {
		put_task_struct(current->group_leader);
		task = NULL;
	} else {
		task = current->group_leader;
	}
	task_unlock(current->group_leader);

	client = kzalloc(sizeof(struct ion_client), GFP_KERNEL);
	if (!client) {
		if (task)
			put_task_struct(current->group_leader);
		return ERR_PTR(-ENOMEM);
	}

	client->dev = dev;
	client->handles = RB_ROOT;
	mutex_init(&client->lock);

	client->name = kzalloc(name_len+1, GFP_KERNEL);
	if (!client->name) {
		put_task_struct(current->group_leader);
		kfree(client);
		return ERR_PTR(-ENOMEM);
	} else {
		strlcpy(client->name, name, name_len+1);
	}

	client->heap_mask = heap_mask;
	client->task = task;
	client->pid = pid;

	mutex_lock(&dev->lock);
	p = &dev->clients.rb_node;
	while (*p) {
		parent = *p;
		entry = rb_entry(parent, struct ion_client, node);

		if (client < entry)
			p = &(*p)->rb_left;
		else if (client > entry)
			p = &(*p)->rb_right;
	}
	rb_link_node(&client->node, parent, p);
	rb_insert_color(&client->node, &dev->clients);


	client->debug_root = debugfs_create_file(name, 0664,
						 dev->debug_root, client,
						 &debug_client_fops);
	mutex_unlock(&dev->lock);

	return client;
}
开发者ID:fulmix,项目名称:fulmix.Kernel,代码行数:75,代码来源:ion.c


示例5: smb347_probe


//.........这里部分代码省略.........
	smb->pdata = pdata;

	smb->mains_current_limit = smb->pdata->mains_current_limit;

	if (pdata->en_gpio) {
		ret = gpio_request_one(
			pdata->en_gpio,
			smb->pdata->enable_control ==
			SMB347_CHG_ENABLE_PIN_ACTIVE_LOW ?
			GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
			smb->client->name);
		if (ret < 0)
			dev_warn(dev, "failed to claim EN GPIO: %d\n", ret);
		else
			smb->en_gpio = pdata->en_gpio;
	}

	ret = smb347_write(smb, CMD_B, CMD_B_POR);
	if (ret < 0)
		return ret;

	msleep(20);

	ret = smb347_read(smb, CMD_B);
	if (ret < 0) {
		dev_err(dev, "failed read after reset\n");
		return ret;
	}

	ret = smb347_hw_init(smb);
	if (ret < 0)
		return ret;

	smb->mains.name = "smb347-mains";
	smb->mains.type = POWER_SUPPLY_TYPE_MAINS;
	smb->mains.get_property = smb347_mains_get_property;
	smb->mains.set_property = smb347_mains_set_property;
	smb->mains.property_is_writeable = smb347_mains_property_is_writeable;
	smb->mains.properties = smb347_mains_properties;
	smb->mains.num_properties = ARRAY_SIZE(smb347_mains_properties);
	smb->mains.supplied_to = battery;
	smb->mains.num_supplicants = ARRAY_SIZE(battery);

	smb->usb.name = "smb347-usb";
	smb->usb.type = POWER_SUPPLY_TYPE_USB;
	smb->usb.get_property = smb347_usb_get_property;
	smb->usb.set_property = smb347_usb_set_property;
	smb->usb.property_is_writeable = smb347_usb_property_is_writeable;
	smb->usb.properties = smb347_usb_properties;
	smb->usb.num_properties = ARRAY_SIZE(smb347_usb_properties);
	smb->usb.supplied_to = battery;
	smb->usb.num_supplicants = ARRAY_SIZE(battery);

	smb->battery.name = "smb347-battery";
	smb->battery.type = POWER_SUPPLY_TYPE_BATTERY;
	smb->battery.get_property = smb347_battery_get_property;
	smb->battery.set_property = smb347_battery_set_property;
	smb->battery.property_is_writeable = smb347_battery_property_is_writeable;
	smb->battery.properties = smb347_battery_properties;
	smb->battery.num_properties = ARRAY_SIZE(smb347_battery_properties);

	if (smb->pdata->supplied_to) {
		smb->battery.supplied_to = smb->pdata->supplied_to;
		smb->battery.num_supplicants = smb->pdata->num_supplicants;
		smb->battery.external_power_changed = power_supply_changed;
	}

	ret = power_supply_register(dev, &smb->mains);
	if (ret < 0)
		return ret;

	ret = power_supply_register(dev, &smb->usb);
	if (ret < 0) {
		power_supply_unregister(&smb->mains);
		return ret;
	}

	ret = power_supply_register(dev, &smb->battery);
	if (ret < 0) {
		power_supply_unregister(&smb->usb);
		power_supply_unregister(&smb->mains);
		return ret;
	}

	/*
	 * Interrupt pin is optional. If it is connected, we setup the
	 * interrupt support here.
	 */
	if (pdata->irq_gpio >= 0) {
		ret = smb347_irq_init(smb);
		if (ret < 0) {
			dev_warn(dev, "failed to initialize IRQ: %d\n", ret);
			dev_warn(dev, "disabling IRQ support\n");
		}
	}

	smb->dentry = debugfs_create_file("smb347-regs", S_IRUSR, NULL, smb,
					  &smb347_debugfs_fops);
	return 0;
}
开发者ID:ASAZING,项目名称:Android-Kernel-Gt-s7390l,代码行数:101,代码来源:smb347-charger.c


示例6: mt8193_hdmi_debug_init

void mt8193_hdmi_debug_init(void)
{
	mt8193_hdmi_dbgfs = debugfs_create_file("8193",
						S_IFREG | S_IRUGO, NULL, (void *)0,
						&mt8193_hdmi_debug_fops);
}
开发者ID:P-D-A,项目名称:android_kernel_lge_mt6753,代码行数:6,代码来源:hdmi_drv.c


示例7: diag_debugfs_init

int diag_debugfs_init(void)
{
	struct dentry *entry = NULL;

	diag_dbgfs_dent = debugfs_create_dir("diag", 0);
	if (IS_ERR(diag_dbgfs_dent))
		return -ENOMEM;

	entry = debugfs_create_file("status", 0444, diag_dbgfs_dent, 0,
				    &diag_dbgfs_status_ops);
	if (!entry)
		goto err;

	entry = debugfs_create_file("table", 0444, diag_dbgfs_dent, 0,
				    &diag_dbgfs_table_ops);
	if (!entry)
		goto err;

	entry = debugfs_create_file("work_pending", 0444, diag_dbgfs_dent, 0,
				    &diag_dbgfs_workpending_ops);
	if (!entry)
		goto err;

	entry = debugfs_create_file("mempool", 0444, diag_dbgfs_dent, 0,
				    &diag_dbgfs_mempool_ops);
	if (!entry)
		goto err;

	entry = debugfs_create_file("usbinfo", 0444, diag_dbgfs_dent, 0,
				    &diag_dbgfs_usbinfo_ops);
	if (!entry)
		goto err;

	entry = debugfs_create_file("dci_stats", 0444, diag_dbgfs_dent, 0,
				    &diag_dbgfs_dcistats_ops);
	if (!entry)
		goto err;

	entry = debugfs_create_file("power", 0444, diag_dbgfs_dent, 0,
				    &diag_dbgfs_power_ops);
	if (!entry)
		goto err;

#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
	entry = debugfs_create_file("bridge", 0444, diag_dbgfs_dent, 0,
				    &diag_dbgfs_bridge_ops);
	if (!entry)
		goto err;

	entry = debugfs_create_file("bridge_dci", 0444, diag_dbgfs_dent, 0,
				    &diag_dbgfs_bridge_dci_ops);
	if (!entry)
		goto err;
#endif

	diag_dbgfs_table_index = 0;
	diag_dbgfs_mempool_index = 0;
	diag_dbgfs_usbinfo_index = 0;
	diag_dbgfs_finished = 0;
	diag_dbgfs_dci_data_index = 0;
	diag_dbgfs_dci_finished = 0;

	/* DCI related structures */
	dci_traffic = kzalloc(sizeof(struct diag_dci_data_info) *
				DIAG_DCI_DEBUG_CNT, GFP_KERNEL);
	if (ZERO_OR_NULL_PTR(dci_traffic))
		pr_warn("diag: could not allocate memory for dci debug info\n");

	mutex_init(&dci_stat_mutex);
	return 0;
err:
	kfree(dci_traffic);
	debugfs_remove_recursive(diag_dbgfs_dent);
	return -ENOMEM;
}
开发者ID:Skin1980,项目名称:bass-MM,代码行数:75,代码来源:diag_debugfs.c


示例8: kgsl_device_debugfs_init

void kgsl_device_debugfs_init(struct kgsl_device *device)
{
	if (kgsl_debugfs_dir && !IS_ERR(kgsl_debugfs_dir))
		device->d_debugfs = debugfs_create_dir(device->name,
						       kgsl_debugfs_dir);

	if (!device->d_debugfs || IS_ERR(device->d_debugfs))
		return;

	device->cmd_log = KGSL_LOG_LEVEL_DEFAULT;
	device->ctxt_log = KGSL_LOG_LEVEL_DEFAULT;
	device->drv_log = KGSL_LOG_LEVEL_DEFAULT;
	device->mem_log = KGSL_LOG_LEVEL_DEFAULT;
	device->pwr_log = KGSL_LOG_LEVEL_DEFAULT;
	device->ft_log = KGSL_LOG_LEVEL_DEFAULT;

	debugfs_create_file("log_level_cmd", 0644, device->d_debugfs, device,
			    &cmd_log_fops);
	debugfs_create_file("log_level_ctxt", 0644, device->d_debugfs, device,
			    &ctxt_log_fops);
	debugfs_create_file("log_level_drv", 0644, device->d_debugfs, device,
			    &drv_log_fops);
	debugfs_create_file("log_level_mem", 0644, device->d_debugfs, device,
				&mem_log_fops);
	debugfs_create_file("log_level_pwr", 0644, device->d_debugfs, device,
				&pwr_log_fops);
	debugfs_create_file("log_level_ft", 0644, device->d_debugfs, device,
				&ft_log_fops);
#ifdef CONFIG_MSM_KGSL_GPU_USAGE
	debugfs_create_file("contexpid_dump",  0644, device->d_debugfs, device,
				&ctx_dump_fops);
#endif
	

	pm_d_debugfs = debugfs_create_dir("postmortem", device->d_debugfs);

	if (IS_ERR(pm_d_debugfs))
		return;

	debugfs_create_file("dump",  0600, pm_d_debugfs, device,
			    &pm_dump_fops);
	debugfs_create_file("regs_enabled", 0644, pm_d_debugfs, device,
			    &pm_regs_enabled_fops);
	debugfs_create_file("ib_enabled", 0644, pm_d_debugfs, device,
				    &pm_ib_enabled_fops);
	device->pm_dump_enable = 0;
	debugfs_create_file("enable", 0644, pm_d_debugfs, device,
				    &pm_enabled_fops);

}
开发者ID:JonnyXDA,项目名称:DarkSense-M7,代码行数:50,代码来源:kgsl_debugfs.c


示例9: ceph_debugfs_client_init

int ceph_debugfs_client_init(struct ceph_client *client)
{
	int ret = -ENOMEM;
	char name[80];

	snprintf(name, sizeof(name), "%pU.client%lld", &client->fsid,
		 client->monc.auth->global_id);

	dout("ceph_debugfs_client_init %p %s\n", client, name);

	BUG_ON(client->debugfs_dir);
	client->debugfs_dir = debugfs_create_dir(name, ceph_debugfs_dir);
	if (!client->debugfs_dir)
		goto out;

	client->monc.debugfs_file = debugfs_create_file("monc",
						      0400,
						      client->debugfs_dir,
						      client,
						      &monc_show_fops);
	if (!client->monc.debugfs_file)
		goto out;

	client->osdc.debugfs_file = debugfs_create_file("osdc",
						      0400,
						      client->debugfs_dir,
						      client,
						      &osdc_show_fops);
	if (!client->osdc.debugfs_file)
		goto out;

	client->debugfs_monmap = debugfs_create_file("monmap",
					0400,
					client->debugfs_dir,
					client,
					&monmap_show_fops);
	if (!client->debugfs_monmap)
		goto out;

	client->debugfs_osdmap = debugfs_create_file("osdmap",
					0400,
					client->debugfs_dir,
					client,
					&osdmap_show_fops);
	if (!client->debugfs_osdmap)
		goto out;

	client->debugfs_options = debugfs_create_file("client_options",
					0400,
					client->debugfs_dir,
					client,
					&client_options_show_fops);
	if (!client->debugfs_options)
		goto out;

	return 0;

out:
	ceph_debugfs_client_cleanup(client);
	return ret;
}
开发者ID:Lyude,项目名称:linux,代码行数:61,代码来源:debugfs.c


示例10: rcu_boost_trace_create_file

/*
 * Create the rcuboost debugfs entry.  Standard error return.
 */
static int rcu_boost_trace_create_file(struct dentry *rcudir)
{
	return !debugfs_create_file("rcuboost", 0444, rcudir, NULL,
				    &rcu_node_boost_fops);
}
开发者ID:303750856,项目名称:linux-3.1,代码行数:8,代码来源:rcutree_trace.c


示例11: ufsdbg_add_debugfs

void ufsdbg_add_debugfs(struct ufs_hba *hba)
{
	if (!hba) {
		dev_err(hba->dev, "%s: NULL hba, exiting", __func__);
		goto err_no_root;
	}

	hba->debugfs_files.debugfs_root = debugfs_create_dir("ufs", NULL);
	if (IS_ERR(hba->debugfs_files.debugfs_root))
		/* Don't complain -- debugfs just isn't enabled */
		goto err_no_root;
	if (!hba->debugfs_files.debugfs_root) {
		/*
		 * Complain -- debugfs is enabled, but it failed to
		 * create the directory
		 */
		dev_err(hba->dev,
			"%s: NULL debugfs root directory, exiting", __func__);
		goto err_no_root;
	}

	hba->debugfs_files.tag_stats =
		debugfs_create_file("tag_stats", S_IRUSR,
					   hba->debugfs_files.debugfs_root, hba,
					   &ufsdbg_tag_stats_fops);
	if (!hba->debugfs_files.tag_stats) {
		dev_err(hba->dev, "%s:  NULL tag stats file, exiting",
			__func__);
		goto err;
	}

	if (ufshcd_init_tag_statistics(hba)) {
		dev_err(hba->dev, "%s: Error initializing tag stats",
			__func__);
		goto err;
	}

	hba->debugfs_files.host_regs = debugfs_create_file("host_regs", S_IRUSR,
				hba->debugfs_files.debugfs_root, hba,
				&ufsdbg_host_regs_fops);
	if (!hba->debugfs_files.host_regs) {
		dev_err(hba->dev, "%s:  NULL hcd regs file, exiting", __func__);
		goto err;
	}

	hba->debugfs_files.show_hba = debugfs_create_file("show_hba", S_IRUSR,
				hba->debugfs_files.debugfs_root, hba,
				&ufsdbg_show_hba_fops);
	if (!hba->debugfs_files.show_hba) {
		dev_err(hba->dev, "%s:  NULL hba file, exiting", __func__);
		goto err;
	}

	hba->debugfs_files.dump_dev_desc =
		debugfs_create_file("dump_device_desc", S_IRUSR,
				    hba->debugfs_files.debugfs_root, hba,
				    &ufsdbg_dump_device_desc);
	if (!hba->debugfs_files.dump_dev_desc) {
		dev_err(hba->dev,
			"%s:  NULL dump_device_desc file, exiting", __func__);
		goto err;
	}

	ufsdbg_setup_fault_injection(hba);

	return;

err:
	debugfs_remove_recursive(hba->debugfs_files.debugfs_root);
	hba->debugfs_files.debugfs_root = NULL;
err_no_root:
	dev_err(hba->dev, "%s: failed to initialize debugfs\n", __func__);
}
开发者ID:AD5GB,项目名称:wicked_kernel_lge_hammerhead,代码行数:73,代码来源:debugfs.c


示例12: ksb_init

static int __init ksb_init(void)
{
	struct ks_bridge *ksb;
	int num_instances = 0;
	int ret = 0;
	int i;

	dbg_dir = debugfs_create_dir("ks_bridge", NULL);
	if (IS_ERR(dbg_dir))
		pr_err("unable to create debug dir");

	for (i = 0; i < NO_BRIDGE_INSTANCES; i++) {
		ksb = kzalloc(sizeof(struct ks_bridge), GFP_KERNEL);
		if (!ksb) {
			pr_err("unable to allocat mem for ks_bridge");
			ret =  -ENOMEM;
			goto dev_free;
		}
		__ksb[i] = ksb;

		ksb->name = kasprintf(GFP_KERNEL, "ks_bridge:%i", i + 1);
		if (!ksb->name) {
			pr_info("unable to allocate name");
			kfree(ksb);
			ret = -ENOMEM;
			goto dev_free;
		}

		spin_lock_init(&ksb->lock);
		INIT_LIST_HEAD(&ksb->to_mdm_list);
		INIT_LIST_HEAD(&ksb->to_ks_list);
		init_waitqueue_head(&ksb->ks_wait_q);
		ksb->wq = create_singlethread_workqueue(ksb->name);
		if (!ksb->wq) {
			pr_err("unable to allocate workqueue");
			kfree(ksb->name);
			kfree(ksb);
			ret = -ENOMEM;
			goto dev_free;
		}

		INIT_WORK(&ksb->to_mdm_work, ksb_tomdm_work);
		INIT_WORK(&ksb->start_rx_work, ksb_start_rx_work);
		init_usb_anchor(&ksb->submitted);

		ksb->dbg_idx = 0;
		ksb->dbg_lock = __RW_LOCK_UNLOCKED(lck);

		if (!IS_ERR(dbg_dir))
			debugfs_create_file(ksb->name, S_IRUGO, dbg_dir,
					ksb, &dbg_fops);

		num_instances++;
	}

	ret = usb_register(&ksb_usb_driver);
	if (ret) {
		pr_err("unable to register ks bridge driver");
		goto dev_free;
	}

	pr_info("init done");

	return 0;

dev_free:
	if (!IS_ERR(dbg_dir))
		debugfs_remove_recursive(dbg_dir);

	for (i = 0; i < num_instances; i++) {
		ksb = __ksb[i];

		destroy_workqueue(ksb->wq);
		kfree(ksb->name);
		kfree(ksb);
	}

	return ret;

}
开发者ID:hiepgia,项目名称:android_kernel_lge_geeb,代码行数:80,代码来源:ks_bridge.c


示例13: wil6210_debugfs_init

/*----------------*/
int wil6210_debugfs_init(struct wil6210_priv *wil)
{
	struct dentry *dbg = wil->debug = debugfs_create_dir(WIL_NAME,
			wil_to_wiphy(wil)->debugfsdir);

	if (IS_ERR_OR_NULL(dbg))
		return -ENODEV;

	debugfs_create_file("mbox", S_IRUGO, dbg, wil, &fops_mbox);
	debugfs_create_file("vrings", S_IRUGO, dbg, wil, &fops_vring);
	debugfs_create_file("txdesc", S_IRUGO, dbg, wil, &fops_txdesc);
	debugfs_create_u32("txdesc_index", S_IRUGO | S_IWUSR, dbg,
			   &dbg_txdesc_index);
	debugfs_create_file("bf", S_IRUGO, dbg, wil, &fops_bf);
	debugfs_create_file("ssid", S_IRUGO | S_IWUSR, dbg, wil, &fops_ssid);
	debugfs_create_u32("secure_pcp", S_IRUGO | S_IWUSR, dbg,
			   &wil->secure_pcp);

	wil6210_debugfs_create_ISR(wil, "USER_ICR", dbg,
				   HOSTADDR(RGF_USER_USER_ICR));
	wil6210_debugfs_create_ISR(wil, "DMA_EP_TX_ICR", dbg,
				   HOSTADDR(RGF_DMA_EP_TX_ICR));
	wil6210_debugfs_create_ISR(wil, "DMA_EP_RX_ICR", dbg,
				   HOSTADDR(RGF_DMA_EP_RX_ICR));
	wil6210_debugfs_create_ISR(wil, "DMA_EP_MISC_ICR", dbg,
				   HOSTADDR(RGF_DMA_EP_MISC_ICR));
	wil6210_debugfs_create_pseudo_ISR(wil, dbg);
	wil6210_debugfs_create_ITR_CNT(wil, dbg);

	debugfs_create_u32("mem_addr", S_IRUGO | S_IWUSR, dbg, &mem_addr);
	debugfs_create_file("mem_val", S_IRUGO, dbg, wil, &fops_memread);

	debugfs_create_file("reset", S_IWUSR, dbg, wil, &fops_reset);
	debugfs_create_file("temp", S_IRUGO, dbg, wil, &fops_temp);

	wil->rgf_blob.data = (void * __force)wil->csr + 0;
	wil->rgf_blob.size = 0xa000;
	wil_debugfs_create_ioblob("blob_rgf", S_IRUGO, dbg, &wil->rgf_blob);

	wil->fw_code_blob.data = (void * __force)wil->csr + 0x40000;
	wil->fw_code_blob.size = 0x40000;
	wil_debugfs_create_ioblob("blob_fw_code", S_IRUGO, dbg,
				  &wil->fw_code_blob);

	wil->fw_data_blob.data = (void * __force)wil->csr + 0x80000;
	wil->fw_data_blob.size = 0x8000;
	wil_debugfs_create_ioblob("blob_fw_data", S_IRUGO, dbg,
				  &wil->fw_data_blob);

	wil->fw_peri_blob.data = (void * __force)wil->csr + 0x88000;
	wil->fw_peri_blob.size = 0x18000;
	wil_debugfs_create_ioblob("blob_fw_peri", S_IRUGO, dbg,
				  &wil->fw_peri_blob);

	wil->uc_code_blob.data = (void * __force)wil->csr + 0xa0000;
	wil->uc_code_blob.size = 0x10000;
	wil_debugfs_create_ioblob("blob_uc_code", S_IRUGO, dbg,
				  &wil->uc_code_blob);

	wil->uc_data_blob.data = (void * __force)wil->csr + 0xb0000;
	wil->uc_data_blob.size = 0x4000;
	wil_debugfs_create_ioblob("blob_uc_data", S_IRUGO, dbg,
				  &wil->uc_data_blob);

	return 0;
}
开发者ID:AICP,项目名称:kernel_moto_shamu,代码行数:67,代码来源:debugfs.c


示例14: tegra_spdif_debug_add

static void tegra_spdif_debug_add(struct tegra_spdif *spdif)
{
	spdif->debug = debugfs_create_file(DRV_NAME, S_IRUGO,
						snd_soc_debugfs_root, spdif,
						&tegra_spdif_debug_fops);
}
开发者ID:404992361,项目名称:mi1_kernel,代码行数:6,代码来源:tegra_spdif.c


示例15: smb347_probe

static int smb347_probe(struct i2c_client *client,
			const struct i2c_device_id *id)
{
	static char *battery[] = { "smb347-battery" };
	const struct smb347_charger_platform_data *pdata;
	struct device *dev = &client->dev;
	struct smb347_charger *smb;
	int ret;

	pdata = dev->platform_data;
	if (!pdata)
		return -EINVAL;

	if (!pdata->use_mains && !pdata->use_usb)
		return -EINVAL;

	smb = devm_kzalloc(dev, sizeof(*smb), GFP_KERNEL);
	if (!smb)
		return -ENOMEM;

	i2c_set_clientdata(client, smb);

	mutex_init(&smb->lock);
	smb->client = client;
	smb->pdata = pdata;

	ret = smb347_hw_init(smb);
	if (ret < 0)
		return ret;

	smb->mains.name = "smb347-mains";
	smb->mains.type = POWER_SUPPLY_TYPE_MAINS;
	smb->mains.get_property = smb347_mains_get_property;
	smb->mains.properties = smb347_mains_properties;
	smb->mains.num_properties = ARRAY_SIZE(smb347_mains_properties);
	smb->mains.supplied_to = battery;
	smb->mains.num_supplicants = ARRAY_SIZE(battery);

	smb->usb.name = "smb347-usb";
	smb->usb.type = POWER_SUPPLY_TYPE_USB;
	smb->usb.get_property = smb347_usb_get_property;
	smb->usb.properties = smb347_usb_properties;
	smb->usb.num_properties = ARRAY_SIZE(smb347_usb_properties);
	smb->usb.supplied_to = battery;
	smb->usb.num_supplicants = ARRAY_SIZE(battery);

	smb->battery.name = "smb347-battery";
	smb->battery.type = POWER_SUPPLY_TYPE_BATTERY;
	smb->battery.get_property = smb347_battery_get_property;
	smb->battery.properties = smb347_battery_properties;
	smb->battery.num_properties = ARRAY_SIZE(smb347_battery_properties);

	ret = power_supply_register(dev, &smb->mains);
	if (ret < 0)
		return ret;

	ret = power_supply_register(dev, &smb->usb);
	if (ret < 0) {
		power_supply_unregister(&smb->mains);
		return ret;
	}

	ret = power_supply_register(dev, &smb->battery);
	if (ret < 0) {
		power_supply_unregister(&smb->usb);
		power_supply_unregister(&smb->mains);
		return ret;
	}

	/*
	 * Interrupt pin is optional. If it is connected, we setup the
	 * interrupt support here.
	 */
	if (pdata->irq_gpio >= 0) {
		ret = smb347_irq_init(smb);
		if (ret < 0) {
			dev_warn(dev, "failed to initialize IRQ: %d\n", ret);
			dev_warn(dev, "disabling IRQ support\n");
		}
	}

	smb->dentry = debugfs_create_file("smb347-regs", S_IRUSR, NULL, smb,
					  &smb347_debugfs_fops);
	return 0;
}
开发者ID:404992361,项目名称:mi1_kernel,代码行数:85,代码来源:smb347-charger.c


示例16: android_irrc_probe

static int android_irrc_probe(struct platform_device *pdev)
{
	int rc;
	struct timed_irrc_data *irrc;

	INFO_MSG("probe\n");

	irrc = kzalloc(sizeof(struct timed_irrc_data), GFP_KERNEL);
	if (irrc == NULL) {
		ERR_MSG("Can not allocate memory.\n");
		goto err_1;
	}

#ifdef CONFIG_OF
	if (pdev->dev.of_node) {
		android_irrc_parse_dt(&pdev->dev, irrc);
	}
#endif

	irrc->pctrl = devm_pinctrl_get(&pdev->dev);

	if (IS_ERR(irrc->pctrl)) {
		ERR_MSG("pinctrl get failed \n");
	}

	irrc->active_state = pinctrl_lookup_state(irrc->pctrl, "active");
	irrc->suspended_state = pinctrl_lookup_state(irrc->pctrl, "suspend");

	if (IS_ERR(irrc->active_state)) {
		ERR_MSG("irrc_active state_get failed \n");
	}
	if (IS_ERR(irrc->suspended_state)) {
		ERR_MSG("irrc_suspended state_get failed \n");

	}

	rc = gpio_request(irrc->pwm_gpio, "irrc_pwm");

	if (rc) {
		ERR_MSG("IRRC GPIO set failed.\n");
		goto err_2;
	}

	virt_bases_v = ioremap(irrc->gp_cmd_rcgr, MMSS_CC_PWM_SIZE);

	rc = misc_register(&irrc_misc);
	if (rc) {
		ERR_MSG("misc_register failed.\n");
		goto err_3;
	}

	irrc->workqueue = create_workqueue("irrc_ts_workqueue");
	if (!irrc->workqueue) {
		ERR_MSG("Unable to create workqueue\n");
		goto err_4;
	}

	INIT_DELAYED_WORK(&irrc->gpio_off_work, android_irrc_disable_pwm);

	irrc->dev.name = "irrc";
	pdev->dev.init_name = irrc->dev.name;
	INFO_MSG("dev->init_name : %s, dev->kobj : %s\n", pdev->dev.init_name, pdev->dev.kobj.name);

	irrc->gp_clk = clk_get(&pdev->dev, irrc->clk_name);
	clk_set_rate(irrc->gp_clk, (unsigned long)irrc->clk_rate);

    // for VREG_L17_2V85 on irrc sensor.
	irrc->vreg = regulator_get(&pdev->dev, "vreg_irrc");
	if (IS_ERR(irrc->vreg)) {
		ERR_MSG("regulator_get failed (%ld)\n", PTR_ERR(irrc->vreg));
		irrc->vreg = NULL;
		goto err_4;
	}

	// for lvs1 on irrc sensor.
/*	irrc->vreg2 = regulator_get(&pdev->dev, "vreg2_irrc");
	if (IS_ERR(irrc->vreg2)) {
		ERR_MSG("regulator_get failed (%ld)\n", PTR_ERR(irrc->vreg2));
		irrc->vreg2 = NULL;
		goto err_4;
	}
*/

	irrc_data_ptr = irrc;
	irrc_dev_ptr = pdev;

	platform_set_drvdata(pdev, irrc);

#ifdef CONFIG_DEBUG_FS
	debugfs_wcd9xxx_dent = debugfs_create_dir("sw_irrc", 0);
	if (!IS_ERR(debugfs_wcd9xxx_dent)) {
		debugfs_poke = debugfs_create_file("poke", S_IFREG | S_IRUGO, debugfs_wcd9xxx_dent, (void *) "poke", &codec_debug_ops);
	}
#endif
	return 0;

err_4:
	misc_deregister(&irrc_misc);
err_3:
	iounmap(virt_bases_v);
//.........这里部分代码省略.........
开发者ID:GameTheory-,项目名称:android_kernel_g4stylusn2,代码行数:101,代码来源:android_irrc.c


示例17: ncp6335d_regulator_probe

static int ncp6335d_regulator_probe(struct i2c_client *client,
                                    const struct i2c_device_id *id)
{
    int rc;
    unsigned int val = 0;
    struct ncp6335d_info *dd;
    const struct ncp6335d_platform_data *pdata;
    struct regulator_config config = { };

    if (client->dev.of_node)
        pdata = ncp6335d_get_of_platform_data(client);
    else
        pdata = client->dev.platform_data;

    if (!pdata) {
        dev_err(&client->dev, "Platform data not specified\n");
        return -EINVAL;
    }

    dd = devm_kzalloc(&client->dev, sizeof(*dd), GFP_KERNEL);
    if (!dd) {
        dev_err(&client->dev, "Unable to allocate memory\n");
        return -ENOMEM;
    }

    if (client->dev.of_node) {
        rc = ncp6335d_parse_dt(client, dd);
        if (rc)
            return rc;
    } else {
        dd->step_size	= NCP6335D_STEP_VOLTAGE_UV;
        dd->min_voltage	= NCP6335D_MIN_VOLTAGE_UV;
        dd->min_slew_ns	= NCP6335D_MIN_SLEW_NS;
        dd->max_slew_ns	= NCP6335D_MAX_SLEW_NS;
    }

    dd->regmap = devm_regmap_init_i2c(client, &ncp6335d_regmap_config);
    if (IS_ERR(dd->regmap)) {
        dev_err(&client->dev, "Error allocating regmap\n");
        return PTR_ERR(dd->regmap);
    }

    rc = ncp6335x_read(dd, REG_NCP6335D_PID, &val);
    if (rc) {
        dev_err(&client->dev, "Unable to identify NCP6335D, rc(%d)\n",
                rc);
        return rc;
    }
    dev_info(&client->dev, "Detected Regulator NCP6335D PID = %d\n", val);

    dd->init_data = pdata->init_data;
    dd->dev = &client->dev;
    i2c_set_clientdata(client, dd);

    rc = ncp6335d_init(client, dd, pdata);
    if (rc) {
        dev_err(&client->dev, "Unable to intialize the regulator\n");
        return -EINVAL;
    }

    config.dev = &client->dev;
    config.init_data = dd->init_data;
    config.regmap = dd->regmap;
    config.driver_data = dd;
    config.of_node = client->dev.of_node;

    dd->regulator = regulator_register(&rdesc, &config);

    if (IS_ERR(dd->regulator)) {
        dev_err(&client->dev, "Unable to register regulator rc(%ld)",
                PTR_ERR(dd->regulator));

        return PTR_ERR(dd->regulator);
    }

    dd->debug_root = debugfs_create_dir("ncp6335x", NULL);
    if (!dd->debug_root)
        dev_err(&client->dev, "Couldn't create debug dir\n");

    if (dd->debug_root) {
        struct dentry *ent;

        ent = debugfs_create_x32("address", S_IFREG | S_IWUSR | S_IRUGO,
                                 dd->debug_root,
                                 &(dd->peek_poke_address));
        if (!ent)
            dev_err(&client->dev, "Couldn't create address debug file rc = %d\n",
                    rc);

        ent = debugfs_create_file("data", S_IFREG | S_IWUSR | S_IRUGO,
                                  dd->debug_root, dd,
                                  &poke_poke_debug_ops);
        if (!ent)
            dev_err(&client->dev, "Couldn't create data debug file rc = %d\n",
                    rc);
    }

    return 0;
}
开发者ID:dtsd,项目名称:zte_blade_s6_lollipop_kernel,代码行数:99,代码来源:onsemi-ncp6335d.c


示例18: debug_create

static void debug_create(const char *name, mode_t mode,
			 struct dentry *dent,
			 int (*fill)(char *buf, int max))
{
	debugfs_create_file(name, mode, dent, fill, &debug_ops);
}
开发者ID:CrysisLTU,项目名称:Project-X5pro-Kernel-u8800pro,代码行数:6,代码来源:smd_debug.c


示例19: audio_open

static int audio_open(struct inode *inode, struct file *file)
{
	struct q6audio_aio *audio = NULL;
	int rc = 0;
	struct msm_audio_aac_config *aac_config = NULL;

#ifdef CONFIG_DEBUG_FS
	/* 4 bytes represents decoder number, 1 byte for terminate string */
	char name[sizeof "msm_multi_aac_" + 5];
#endif
	audio = kzalloc(sizeof(struct q6audio_aio), GFP_KERNEL);

	if (audio == NULL) {
		pr_err("Could not allocate memory for aac decode driver\n");
		return -ENOMEM;
	}

	audio->codec_cfg = kzalloc(sizeof(struct msm_audio_aac_config),
					GFP_KERNEL);
	if (audio->codec_cfg == NULL) {
		pr_err("%s: Could not allocate memory for aac config\n",
							 __func__);
		kfree(audio);
		return -ENOMEM;
	}

	aac_config = audio->codec_cfg;

	audio->pcm_cfg.buffer_size = PCM_BUFSZ_MIN_AACM;
	aac_config->dual_mono_mode = AUDIO_AAC_DUAL_MONO_INVALID;

	audio->ac = q6asm_audio_client_alloc((app_cb) q6_audio_cb,
					     (void *)audio);

	if (!audio->ac) {
		pr_err("Could not allocate memory for audio client\n");
		kfree(audio->codec_cfg);
		kfree(audio);
		return -ENOMEM;
	}

	/* open in T/NT mode */
	if ((file->f_mode & FMODE_WRITE) && (file->f_mode & FMODE_READ)) {
		rc = q6asm_open_read_write(audio->ac, FORMAT_LINEAR_PCM,
					   FORMAT_MPEG4_MULTI_AAC);
		if (rc < 0) {
			pr_err("NT mode Open failed rc=%d\n", rc);
			rc = -ENODEV;
			goto fail;
		}
		audio->feedback = NON_TUNNEL_MODE;
		/* open AAC decoder, expected frames is always 1
		audio->buf_cfg.frames_per_buf = 0x01;*/
		audio->buf_cfg.meta_info_enable = 0x01;
	} else if ((file->f_mode & FMODE_WRITE) &&
			!(file->f_mode & FMODE_READ)) {
		rc = q6asm_open_write(audio->ac, FORMAT_MPEG4_MULTI_AAC);
		if (rc < 0) {
			pr_err("T mode Open failed rc=%d\n", rc);
			rc = -ENODEV;
			goto fail;
		}
		audio->feedback = TUNNEL_MODE;
		audio->buf_cfg.meta_info_enable = 0x00;
	} else {
		pr_err("Not supported mode\n");
		rc = -EACCES;
		goto fail;
	}
	rc = audio_aio_open(audio, file);
	if (IS_ERR_OR_NULL(audio)) {
		pr_err("%s: audio_aio_open failed\n", __func__);
		rc = -EACCES;
		goto fail;
	}

#ifdef CONFIG_DEBUG_FS
	snprintf(name, sizeof name, "msm_multi_aac_%04x", audio->ac->session);
	audio->dentry = debugfs_create_file(name, S_IFREG | S_IRUGO,
					    NULL, (void *)audio,
					    &audio_aac_debug_fops);

	if (IS_ERR(audio->dentry))
		pr_debug("debugfs_create_file failed\n");
#endif
	pr_info("%s:AAC 5.1 Decoder OPEN success mode[%d]session[%d]\n",
		__func__, audio->feedback, audio->ac->session);
	return rc;
fail:
	q6asm_audio_client_free(audio->ac);
	kfree(audio->codec_cfg);
	kfree(audio);
	return rc;
}
开发者ID:BlownFuze,项目名称:Koding,代码行数:94,代码来源:audio_multi_aac.c


示例20: ath9k_init_debug

int ath9k_init_debug(struct ath_hw *ah)
{
	struct ath_common *common = ath9k_hw_common(ah);
	struct ath_softc *sc = (struct ath_softc *) common->priv;

	sc->debug.debugfs_phy = debugfs_create_dir("ath9k",
						   sc->hw->wiphy->debugfsdir);
	if (!sc->debug.debugfs_phy)
		return -ENOMEM;

#ifdef CPTCFG_ATH_DEBUG
	debugfs_create_file("debug", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
			    sc, &fops_debug);
#endif

	ath9k_dfs_init_debug(sc);
	ath9k_tx99_init_debug(sc);
	ath9k_cmn_spectral_init_debug(&sc 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ debugfs_create_u32函数代码示例发布时间:2022-05-30
下一篇:
C++ debugfs_create_dir函数代码示例发布时间: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