示例#1
0
static int __init tegra_uart_init(void)
{
	int ret;
	struct dentry *d;

	ret = uart_register_driver(&tegra_uart_driver);
	if (unlikely(ret)) {
		pr_err("Could not register %s driver\n",
			tegra_uart_driver.driver_name);
		return ret;
	}

	ret = platform_driver_register(&tegra_uart_platform_driver);
	if (unlikely(ret)) {
		pr_err("Could not register the UART platfrom driver\n");
		uart_unregister_driver(&tegra_uart_driver);
		return ret;
	}

	irda_test_dir = debugfs_create_dir("tegra_irda", NULL);
	if (!irda_test_dir) {
		pr_err("Error in debugfs creation\n");
		return PTR_ERR(irda_test_dir);
	}

	d = debugfs_create_u8("irda_loop", S_IWUSR | S_IRUGO, irda_test_dir,
								&irda_loop);
	if (!d) {
		pr_err("Error in debugfs entry creation\n");
		return PTR_ERR(d);
	}

	pr_info("Initialized tegra uart driver\n");
	return 0;
}
示例#2
0
static int __init demo_debugfs_init(void)
{
	struct dentry *sub_dir, *p0_dentry, *p1_dentry, *p2_dentry;
	
	demo_debugfs_root = debugfs_create_dir("debugfs-demo", NULL);
	if (!demo_debugfs_root)
		return -ENOENT;

	p0_dentry = debugfs_create_u8("p0", 0644, demo_debugfs_root, &p0);
	if (!p0_dentry)
		goto Fail;

	p1.data = (void *)str;
	p1.size = strlen(str) + 1;
	p1_dentry = debugfs_create_blob("p1", 0644, demo_debugfs_root, &p1);
	if (!p1_dentry)
		goto Fail;

	sub_dir = debugfs_create_dir("subdir", demo_debugfs_root);
	if (!sub_dir)
		goto Fail;

	p2_dentry = debugfs_create_file("p2", 0644, sub_dir, NULL, &p2_fops);
	if (!p2_dentry)
		goto Fail;
	        
	return 0;

Fail:
	debugfs_remove_recursive(demo_debugfs_root);
	demo_debugfs_root = NULL;
	return -ENOENT;
}
示例#3
0
static int perf_debugfs_setup(struct perf_ctx *perf)
{
	struct pci_dev *pdev = perf->ntb->pdev;

	if (!debugfs_initialized())
		return -ENODEV;

	if (!perf_debugfs_dir) {
		perf_debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
		if (!perf_debugfs_dir)
			return -ENODEV;
	}

	perf->debugfs_node_dir = debugfs_create_dir(pci_name(pdev),
						    perf_debugfs_dir);
	if (!perf->debugfs_node_dir)
		return -ENODEV;

	perf->debugfs_run = debugfs_create_file("run", S_IRUSR | S_IWUSR,
						perf->debugfs_node_dir, perf,
						&ntb_perf_debugfs_run);
	if (!perf->debugfs_run)
		return -ENODEV;

	perf->debugfs_threads = debugfs_create_u8("threads", S_IRUSR | S_IWUSR,
						  perf->debugfs_node_dir,
						  &perf->perf_threads);
	if (!perf->debugfs_threads)
		return -ENODEV;

	return 0;
}
示例#4
0
void omap_iommu_debugfs_add(struct omap_iommu *obj)
{
	struct dentry *d;

	if (!iommu_debug_root)
		return;

	obj->debug_dir = debugfs_create_dir(obj->name, iommu_debug_root);
	if (!obj->debug_dir)
		return;

	d = debugfs_create_u8("nr_tlb_entries", 0400, obj->debug_dir,
			      (u8 *)&obj->nr_tlb_entries);
	if (!d)
		return;

	DEBUG_ADD_FILE_RO(regs);
	DEBUG_ADD_FILE_RO(tlb);
	DEBUG_ADD_FILE_RO(pagetable);

	return;

err:
	debugfs_remove_recursive(obj->debug_dir);
}
示例#5
0
文件: pb173.c 项目: mchalupa/pb173
static int my_init(void)
{
	misc_register(&my_misc);

	dbgdir = debugfs_create_dir(MODULE_NAME, NULL);
	if (! dbgdir)
		return -ENODEV;
	
	dbgcount = debugfs_create_u8("count", 444, dbgdir, &count);
	if (! dbgcount) {
		debugfs_remove(dbgdir);
		return -ENODEV;
	}

	dbgbin = debugfs_create_file("text", 444, dbgdir, NULL, &dbgfile);
	if (! dbgbin) {
		debugfs_remove(dbgcount);
		debugfs_remove(dbgdir);
		return -ENODEV;
	}
	
	print_hex_dump_bytes("offset: ", DUMP_PREFIX_OFFSET, THIS_MODULE->module_core, THIS_MODULE->core_text_size);

	return 0;

}
示例#6
0
文件: replay.c 项目: Axure/Ext3Fsd
static void __init jbd_create_debugfs_entry(void)
{
    jbd_debugfs_dir = debugfs_create_dir("jbd", NULL);
    if (jbd_debugfs_dir)
        jbd_debug = debugfs_create_u8("jbd-debug", S_IRUGO,
                                      jbd_debugfs_dir,
                                      &journal_enable_debug);
}
示例#7
0
文件: hci_qca.c 项目: hellocccat/ath
static void qca_debugfs_init(struct hci_dev *hdev)
{
	struct hci_uart *hu = hci_get_drvdata(hdev);
	struct qca_data *qca = hu->priv;
	struct dentry *ibs_dir;
	umode_t mode;

	if (!hdev->debugfs)
		return;

	ibs_dir = debugfs_create_dir("ibs", hdev->debugfs);

	/* read only */
	mode = S_IRUGO;
	debugfs_create_u8("tx_ibs_state", mode, ibs_dir, &qca->tx_ibs_state);
	debugfs_create_u8("rx_ibs_state", mode, ibs_dir, &qca->rx_ibs_state);
	debugfs_create_u64("ibs_sent_sleeps", mode, ibs_dir,
			   &qca->ibs_sent_slps);
	debugfs_create_u64("ibs_sent_wakes", mode, ibs_dir,
			   &qca->ibs_sent_wakes);
	debugfs_create_u64("ibs_sent_wake_acks", mode, ibs_dir,
			   &qca->ibs_sent_wacks);
	debugfs_create_u64("ibs_recv_sleeps", mode, ibs_dir,
			   &qca->ibs_recv_slps);
	debugfs_create_u64("ibs_recv_wakes", mode, ibs_dir,
			   &qca->ibs_recv_wakes);
	debugfs_create_u64("ibs_recv_wake_acks", mode, ibs_dir,
			   &qca->ibs_recv_wacks);
	debugfs_create_bool("tx_vote", mode, ibs_dir, &qca->tx_vote);
	debugfs_create_u64("tx_votes_on", mode, ibs_dir, &qca->tx_votes_on);
	debugfs_create_u64("tx_votes_off", mode, ibs_dir, &qca->tx_votes_off);
	debugfs_create_bool("rx_vote", mode, ibs_dir, &qca->rx_vote);
	debugfs_create_u64("rx_votes_on", mode, ibs_dir, &qca->rx_votes_on);
	debugfs_create_u64("rx_votes_off", mode, ibs_dir, &qca->rx_votes_off);
	debugfs_create_u64("votes_on", mode, ibs_dir, &qca->votes_on);
	debugfs_create_u64("votes_off", mode, ibs_dir, &qca->votes_off);
	debugfs_create_u32("vote_on_ms", mode, ibs_dir, &qca->vote_on_ms);
	debugfs_create_u32("vote_off_ms", mode, ibs_dir, &qca->vote_off_ms);

	/* read/write */
	mode = S_IRUGO | S_IWUSR;
	debugfs_create_u32("wake_retrans", mode, ibs_dir, &qca->wake_retrans);
	debugfs_create_u32("tx_idle_delay", mode, ibs_dir,
			   &qca->tx_idle_delay);
}
/* ************************************************************************
 * Description: KERNEL_DEBUGLEVEL
 * ************************************************************************ */
static void vibrator_create_kernel_debuglevel_entries(void)
{
	if (kernel_debuglevel_dir != NULL) {
		debugfs_create_u8("vibrator_dll", S_IRUGO | S_IWUGO,
			kernel_debuglevel_dir, (u8 *)(&VIBRATOR_DLL));
	} else {
		VIBRATOR_PRINTK(0, "vibrator kernel debuglevel dir falied\n");
	}
}
示例#9
0
void mt76x2_init_debugfs(struct mt76x2_dev *dev)
{
	struct dentry *dir;

	dir = mt76_register_debugfs(&dev->mt76);
	if (!dir)
		return;

	debugfs_create_u8("temperature", S_IRUSR, dir, &dev->cal.temp);

	debugfs_create_file("ampdu_stat", S_IRUSR, dir, dev, &fops_ampdu_stat);
	debugfs_create_devm_seqfile(dev->mt76.dev, "txpower", dir, read_txpower);
}
示例#10
0
static int __init wdog_dbg_init(void)
{
	struct dentry *wdog_dir;

	wdog_dir = debugfs_create_dir("wdog", NULL);
	if (IS_ERR_OR_NULL(wdog_dir))
		goto fail;

	if (IS_ERR_OR_NULL(debugfs_create_u8("id",
					     S_IWUSR | S_IWGRP | S_IRUGO, wdog_dir,
					     &wdog_id)))
		goto fail;

	if (IS_ERR_OR_NULL(debugfs_create_file("config",
					       S_IWUSR | S_IWGRP | S_IRUGO, wdog_dir,
					       (void *)WDOG_DBG_CONFIG,
					       &wdog_dbg_fops)))
		goto fail;

	if (IS_ERR_OR_NULL(debugfs_create_file("load",
					       S_IWUSR | S_IWGRP | S_IRUGO, wdog_dir,
					       (void *)WDOG_DBG_LOAD,
					       &wdog_dbg_fops)))
		goto fail;

	if (IS_ERR_OR_NULL(debugfs_create_file("kick",
					       S_IWUSR | S_IWGRP, wdog_dir,
					       (void *)WDOG_DBG_KICK,
					       &wdog_dbg_fops)))
		goto fail;

	if (IS_ERR_OR_NULL(debugfs_create_file("enable",
					       S_IWUSR | S_IWGRP | S_IRUGO, wdog_dir,
					       (void *)WDOG_DBG_EN,
					       &wdog_dbg_fops)))
		goto fail;

	if (IS_ERR_OR_NULL(debugfs_create_file("disable",
					       S_IWUSR | S_IWGRP | S_IRUGO, wdog_dir,
					       (void *)WDOG_DBG_DIS,
					       &wdog_dbg_fops)))
		goto fail;

	return 0;
fail:
	pr_err("ux500:wdog: Failed to initialize wdog dbg\n");
	debugfs_remove_recursive(wdog_dir);

	return -EFAULT;
}
示例#11
0
static int __init debugexample_module_init(void)
{
	/* the simplest interface */
	tmp = debugfs_create_u8("myfile", 0644, NULL, &myvalue);
	if (!tmp) {
		printk("error creating file");
		return -ENODEV;
	}

	/* custom read and write functions */
	dir = debugfs_create_dir("mydirectory", NULL);
	file = debugfs_create_file("myfile", 0644, dir, &file_value, &my_fops);

	return 0;
}
示例#12
0
/*
 * ext4_snapshot_create_debugfs_entry - register ext4 debug hooks
 * Void function doesn't return error if debug hooks are not registered.
 */
void ext4_snapshot_create_debugfs_entry(void)
{
	int i;

	ext4_debugfs_dir = debugfs_create_dir("ext4", NULL);
	if (!ext4_debugfs_dir)
		return;
	snapshot_debug = debugfs_create_u8("snapshot-debug", S_IRUGO|S_IWUSR,
					   ext4_debugfs_dir,
					   &snapshot_enable_debug);
	snapshot_version = debugfs_create_blob("snapshot-version", S_IRUGO,
					       ext4_debugfs_dir,
					       &snapshot_version_blob);
	for (i = 0; i < SNAPSHOT_TESTS_NUM && i < SNAPSHOT_TEST_NAMES; i++)
		snapshot_test[i] = debugfs_create_u16(snapshot_test_names[i],
					      S_IRUGO|S_IWUSR,
					      ext4_debugfs_dir,
					      &snapshot_enable_test[i]);
#ifdef CONFIG_EXT4_FS_SNAPSHOT_JOURNAL_CACHE
	cow_cache = debugfs_create_u8("cow-cache", S_IRUGO,
					   ext4_debugfs_dir,
					   &cow_cache_offset);
#endif
}
示例#13
0
static
int i2400mu_debugfs_add(struct i2400mu *i2400mu)
{
	int result;
	struct device *dev = &i2400mu->usb_iface->dev;
	struct dentry *dentry = i2400mu->i2400m.wimax_dev.debugfs_dentry;
	struct dentry *fd;

	dentry = debugfs_create_dir("i2400m-usb", dentry);
	result = PTR_ERR(dentry);
	if (IS_ERR(dentry)) {
		if (result == -ENODEV)
			result = 0;	/* No debugfs support */
		goto error;
	}
	i2400mu->debugfs_dentry = dentry;
	__debugfs_register("dl_", usb, dentry);
	__debugfs_register("dl_", fw, dentry);
	__debugfs_register("dl_", notif, dentry);
	__debugfs_register("dl_", rx, dentry);
	__debugfs_register("dl_", tx, dentry);

	/* Don't touch these if you don't know what you are doing */
	fd = debugfs_create_u8("rx_size_auto_shrink", 0600, dentry,
			       &i2400mu->rx_size_auto_shrink);
	result = PTR_ERR(fd);
	if (IS_ERR(fd) && result != -ENODEV) {
		dev_err(dev, "Can't create debugfs entry "
			"rx_size_auto_shrink: %d\n", result);
		goto error;
	}

	fd = debugfs_create_size_t("rx_size", 0600, dentry,
				   &i2400mu->rx_size);
	result = PTR_ERR(fd);
	if (IS_ERR(fd) && result != -ENODEV) {
		dev_err(dev, "Can't create debugfs entry "
			"rx_size: %d\n", result);
		goto error;
	}

	return 0;

error:
	debugfs_remove_recursive(i2400mu->debugfs_dentry);
	return result;
}
示例#14
0
static int edac_create_debug_nodes(struct mem_ctl_info *mci)
{
	struct dentry *d, *parent;
	char name[80];
	int i;

	if (!edac_debugfs)
		return -ENODEV;

	d = debugfs_create_dir(mci->dev.kobj.name, edac_debugfs);
	if (!d)
		return -ENOMEM;
	parent = d;

	for (i = 0; i < mci->n_layers; i++) {
		sprintf(name, "fake_inject_%s",
			     edac_layer_name[mci->layers[i].type]);
		d = debugfs_create_u8(name, S_IRUGO | S_IWUSR, parent,
				      &mci->fake_inject_layer[i]);
		if (!d)
			goto nomem;
	}

	d = debugfs_create_bool("fake_inject_ue", S_IRUGO | S_IWUSR, parent,
				&mci->fake_inject_ue);
	if (!d)
		goto nomem;

	d = debugfs_create_u16("fake_inject_count", S_IRUGO | S_IWUSR, parent,
				&mci->fake_inject_count);
	if (!d)
		goto nomem;

	d = debugfs_create_file("fake_inject", S_IWUSR, parent,
				&mci->dev,
				&debug_fake_inject_fops);
	if (!d)
		goto nomem;

	mci->debugfs = parent;
	return 0;
nomem:
	debugfs_remove(mci->debugfs);
	return -ENOMEM;
}
示例#15
0
void mt76x02_init_debugfs(struct mt76x02_dev *dev)
{
	struct dentry *dir;

	dir = mt76_register_debugfs(&dev->mt76);
	if (!dir)
		return;

	debugfs_create_u8("temperature", 0400, dir, &dev->cal.temp);
	debugfs_create_bool("tpc", 0600, dir, &dev->enable_tpc);

	debugfs_create_file("ampdu_stat", 0400, dir, dev, &fops_ampdu_stat);
	debugfs_create_file("dfs_stats", 0400, dir, dev, &fops_dfs_stat);
	debugfs_create_devm_seqfile(dev->mt76.dev, "txpower", dir,
				    read_txpower);

	debugfs_create_devm_seqfile(dev->mt76.dev, "agc", dir, read_agc);

	debugfs_create_u32("tx_hang_reset", 0400, dir, &dev->tx_hang_reset);
}
示例#16
0
struct dentry *mt76_register_debugfs(struct mt76_dev *dev)
{
	struct dentry *dir;

	dir = debugfs_create_dir("mt76", dev->hw->wiphy->debugfsdir);
	if (!dir)
		return NULL;

	debugfs_create_u8("led_pin", 0600, dir, &dev->led_pin);
	debugfs_create_u32("regidx", 0600, dir, &dev->debugfs_reg);
	debugfs_create_file_unsafe("regval", 0600, dir, dev,
				   &fops_regval);
	debugfs_create_blob("eeprom", 0400, dir, &dev->eeprom);
	if (dev->otp.data)
		debugfs_create_blob("otp", 0400, dir, &dev->otp);
	debugfs_create_devm_seqfile(dev->dev, "queues", dir, mt76_queues_read);
	debugfs_create_devm_seqfile(dev->dev, "rate_txpower", dir,
				    mt76_read_rate_txpower);

	return dir;
}
int tegra_emc_iso_usage_debugfs_init(struct dentry *emc_debugfs_root)
{
	struct dentry *d;

	d = debugfs_create_file("emc_usage_table", S_IRUGO, emc_debugfs_root,
		NULL, &emc_usage_table_fops);
	if (!d)
		return -ENOMEM;

	d = debugfs_create_u8("emc_iso_share", S_IRUGO, emc_debugfs_root,
			      &tegra_emc_iso_share);
	if (!d)
		return -ENOMEM;

	d = debugfs_create_u32("emc_iso_allocation", S_IRUGO, emc_debugfs_root,
			      (u32 *)&emc_iso_allocation);
	if (!d)
		return -ENOMEM;

	return 0;
}
示例#18
0
文件: debugfs.c 项目: lumag/linux
/**
 * wil6210_debugfs_init_offset - create set of debugfs files
 * @wil - driver's context, used for printing
 * @dbg - directory on the debugfs, where files will be created
 * @base - base address used in address calculation
 * @tbl - table with file descriptions. Should be terminated with empty element.
 *
 * Creates files accordingly to the @tbl.
 */
static void wil6210_debugfs_init_offset(struct wil6210_priv *wil,
					struct dentry *dbg, void *base,
					const struct dbg_off * const tbl)
{
	int i;

	for (i = 0; tbl[i].name; i++) {
		struct dentry *f;

		switch (tbl[i].type) {
		case doff_u32:
			f = debugfs_create_u32(tbl[i].name, tbl[i].mode, dbg,
					       base + tbl[i].off);
			break;
		case doff_x32:
			f = debugfs_create_x32(tbl[i].name, tbl[i].mode, dbg,
					       base + tbl[i].off);
			break;
		case doff_ulong:
			f = wil_debugfs_create_ulong(tbl[i].name, tbl[i].mode,
						     dbg, base + tbl[i].off);
			break;
		case doff_io32:
			f = wil_debugfs_create_iomem_x32(tbl[i].name,
							 tbl[i].mode, dbg,
							 base + tbl[i].off,
							 wil);
			break;
		case doff_u8:
			f = debugfs_create_u8(tbl[i].name, tbl[i].mode, dbg,
					      base + tbl[i].off);
			break;
		default:
			f = ERR_PTR(-EINVAL);
		}
		if (IS_ERR_OR_NULL(f))
			wil_err(wil, "Create file \"%s\": err %ld\n",
				tbl[i].name, PTR_ERR(f));
	}
}
示例#19
0
struct dentry *esp_dump_var(const char *name, struct dentry *parent, void *value, esp_type type) {
        struct dentry *rc = NULL;
        umode_t mode = 0644;

        if(!esp_debugfs_root)
                return NULL;

        if(!parent)
                parent = esp_debugfs_root;

        switch(type) {
        case ESP_U8:
                rc = debugfs_create_u8(name, mode, parent, (u8*)value);
                break;
        case ESP_U16:
                rc = debugfs_create_u16(name, mode, parent, (u16*)value);
                break;
        case ESP_U32:
                rc = debugfs_create_u32(name, mode, parent, (u32*)value);
                break;
        case ESP_U64:
                rc = debugfs_create_u64(name, mode, parent, (u64*)value);
                break;
        case ESP_BOOL:
                rc = debugfs_create_bool(name, mode, parent, (u32*)value);
                break;
        default: //32
                rc = debugfs_create_u32(name, mode, parent, (u32*)value);
        }

        if (!rc)
                goto Fail;
        else
                return rc;
Fail:
        debugfs_remove_recursive(esp_debugfs_root);
        esp_debugfs_root = NULL;
        esp_dbg(ESP_DBG_ERROR, "%s failed, debugfs root removed; var name: %s\n", __FUNCTION__, name);
        return NULL;
}
示例#20
0
static int iommu_debug_register(struct device *dev, void *data)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct omap_iommu *obj = platform_get_drvdata(pdev);
	struct omap_iommu_arch_data *arch_data;
	struct dentry *d, *parent;

	if (!obj || !obj->dev)
		return -EINVAL;

	arch_data = kzalloc(sizeof(*arch_data), GFP_KERNEL);
	if (!arch_data)
		return -ENOMEM;

	arch_data->iommu_dev = obj;

	dev->archdata.iommu = arch_data;

	d = debugfs_create_dir(obj->name, iommu_debug_root);
	if (!d)
		goto nomem;
	parent = d;

	d = debugfs_create_u8("nr_tlb_entries", 400, parent,
			      (u8 *)&obj->nr_tlb_entries);
	if (!d)
		goto nomem;

	DEBUG_ADD_FILE_RO(ver);
	DEBUG_ADD_FILE_RO(regs);
	DEBUG_ADD_FILE_RO(tlb);
	DEBUG_ADD_FILE(pagetable);

	return 0;

nomem:
	kfree(arch_data);
	return -ENOMEM;
}
示例#21
0
static int __init xen_mc_debugfs(void)
{
	struct dentry *d_xen = xen_init_debugfs();

	if (d_xen == NULL)
		return -ENOMEM;

	d_mc_debug = debugfs_create_dir("multicalls", d_xen);

	debugfs_create_u8("zero_stats", 0644, d_mc_debug, &zero_stats);

	debugfs_create_u32("batches", 0444, d_mc_debug, &mc_stats.issued);
	debugfs_create_u32("hypercalls", 0444, d_mc_debug, &mc_stats.hypercalls);
	debugfs_create_u32("arg_total", 0444, d_mc_debug, &mc_stats.arg_total);

	xen_debugfs_create_u32_array("batch_histo", 0444, d_mc_debug,
				     mc_stats.histo, MC_BATCH);
	xen_debugfs_create_u32_array("hypercall_histo", 0444, d_mc_debug,
				     mc_stats.histo_hypercalls, NHYPERCALLS);
	xen_debugfs_create_u32_array("flush_reasons", 0444, d_mc_debug,
				     mc_stats.flush, FL_N_REASONS);

	return 0;
}
示例#22
0
int i2400m_debugfs_add(struct i2400m *i2400m)
{
	int result;
	struct device *dev = i2400m_dev(i2400m);
	struct dentry *dentry = i2400m->wimax_dev.debugfs_dentry;
	struct dentry *fd;

	dentry = debugfs_create_dir("i2400m", dentry);
	result = PTR_ERR(dentry);
	if (IS_ERR(dentry)) {
		if (result == -ENODEV)
			result = 0;	/* No debugfs support */
		goto error;
	}
	i2400m->debugfs_dentry = dentry;
	__debugfs_register("dl_", control, dentry);
	__debugfs_register("dl_", driver, dentry);
	__debugfs_register("dl_", debugfs, dentry);
	__debugfs_register("dl_", fw, dentry);
	__debugfs_register("dl_", netdev, dentry);
	__debugfs_register("dl_", rfkill, dentry);
	__debugfs_register("dl_", rx, dentry);
	__debugfs_register("dl_", tx, dentry);

	fd = debugfs_create_size_t("tx_in", 0400, dentry,
				   &i2400m->tx_in);
	result = PTR_ERR(fd);
	if (IS_ERR(fd) && result != -ENODEV) {
		dev_err(dev, "Can't create debugfs entry "
			"tx_in: %d\n", result);
		goto error;
	}

	fd = debugfs_create_size_t("tx_out", 0400, dentry,
				   &i2400m->tx_out);
	result = PTR_ERR(fd);
	if (IS_ERR(fd) && result != -ENODEV) {
		dev_err(dev, "Can't create debugfs entry "
			"tx_out: %d\n", result);
		goto error;
	}

	fd = debugfs_create_u32("state", 0600, dentry,
				&i2400m->state);
	result = PTR_ERR(fd);
	if (IS_ERR(fd) && result != -ENODEV) {
		dev_err(dev, "Can't create debugfs entry "
			"state: %d\n", result);
		goto error;
	}

	/*
	 * Trace received messages from user space
	 *
	 * In order to tap the bidirectional message stream in the
	 * 'msg' pipe, user space can read from the 'msg' pipe;
	 * however, due to limitations in libnl, we can't know what
	 * the different applications are sending down to the kernel.
	 *
	 * So we have this hack where the driver will echo any message
	 * received on the msg pipe from user space [through a call to
	 * wimax_dev->op_msg_from_user() into
	 * i2400m_op_msg_from_user()] into the 'trace' pipe that this
	 * driver creates.
	 *
	 * So then, reading from both the 'trace' and 'msg' pipes in
	 * user space will provide a full dump of the traffic.
	 *
	 * Write 1 to activate, 0 to clear.
	 *
	 * It is not really very atomic, but it is also not too
	 * critical.
	 */
	fd = debugfs_create_u8("trace_msg_from_user", 0600, dentry,
			       &i2400m->trace_msg_from_user);
	result = PTR_ERR(fd);
	if (IS_ERR(fd) && result != -ENODEV) {
		dev_err(dev, "Can't create debugfs entry "
			"trace_msg_from_user: %d\n", result);
		goto error;
	}

	fd = debugfs_create_netdev_queue_stopped("netdev_queue_stopped",
						 dentry, i2400m);
	result = PTR_ERR(fd);
	if (IS_ERR(fd) && result != -ENODEV) {
		dev_err(dev, "Can't create debugfs entry "
			"netdev_queue_stopped: %d\n", result);
		goto error;
	}

	fd = debugfs_create_file("rx_stats", 0600, dentry, i2400m,
				 &i2400m_rx_stats_fops);
	result = PTR_ERR(fd);
	if (IS_ERR(fd) && result != -ENODEV) {
		dev_err(dev, "Can't create debugfs entry "
			"rx_stats: %d\n", result);
		goto error;
	}

	fd = debugfs_create_file("tx_stats", 0600, dentry, i2400m,
				 &i2400m_tx_stats_fops);
	result = PTR_ERR(fd);
	if (IS_ERR(fd) && result != -ENODEV) {
		dev_err(dev, "Can't create debugfs entry "
			"tx_stats: %d\n", result);
		goto error;
	}

	fd = debugfs_create_i2400m_suspend("suspend", dentry, i2400m);
	result = PTR_ERR(fd);
	if (IS_ERR(fd) && result != -ENODEV) {
		dev_err(dev, "Can't create debugfs entry suspend: %d\n",
			result);
		goto error;
	}

	fd = debugfs_create_i2400m_reset("reset", dentry, i2400m);
	result = PTR_ERR(fd);
	if (IS_ERR(fd) && result != -ENODEV) {
		dev_err(dev, "Can't create debugfs entry reset: %d\n", result);
		goto error;
	}

	result = 0;
error:
	return result;
}
示例#23
0
static int thinkpad_wmi_debugfs_init(struct thinkpad_wmi *thinkpad)
{
	struct dentry *dent;
	int i;

	thinkpad->debug.instances_count = thinkpad->settings_count;

	thinkpad->debug.root = debugfs_create_dir(THINKPAD_WMI_FILE, NULL);
	if (!thinkpad->debug.root) {
		pr_err("failed to create debugfs directory");
		goto error_debugfs;
	}

	dent = debugfs_create_file("argument", S_IRUGO | S_IWUSR,
				   thinkpad->debug.root, thinkpad,
				   &thinkpad_wmi_debugfs_argument_fops);
	if (!dent)
		goto error_debugfs;

	dent = debugfs_create_u8("instance", S_IRUGO | S_IWUSR,
				 thinkpad->debug.root,
				 &thinkpad->debug.instance);
	if (!dent)
		goto error_debugfs;

	dent = debugfs_create_u8("instances_count", S_IRUGO,
				 thinkpad->debug.root,
				 &thinkpad->debug.instances_count);
	if (!dent)
		goto error_debugfs;

	for (i = 0; i < ARRAY_SIZE(thinkpad_wmi_debug_files); i++) {
		struct thinkpad_wmi_debugfs_node *node;

		node = &thinkpad_wmi_debug_files[i];

		/* Filter non-present interfaces */
		if (!strcmp(node->name, "set_bios_settings") &&
		    !thinkpad->can_set_bios_settings)
			continue;
		if (!strcmp(node->name, "dicard_bios_settings") &&
		    !thinkpad->can_discard_bios_settings)
			continue ;
		if (!strcmp(node->name, "load_default_settings") &&
		    !thinkpad->can_load_default_settings)
			continue ;
		if (!strcmp(node->name, "get_bios_selections") &&
		    !thinkpad->can_get_bios_selections)
			continue ;
		if (!strcmp(node->name, "set_bios_password") &&
		    !thinkpad->can_set_bios_password)
			continue ;
		if (!strcmp(node->name, "bios_password_settings") &&
		    !thinkpad->can_get_password_settings)
			continue ;

		node->thinkpad = thinkpad;
		dent = debugfs_create_file(node->name, S_IFREG | S_IRUGO,
					   thinkpad->debug.root, node,
					   &thinkpad_wmi_debugfs_io_ops);
		if (!dent) {
			pr_err("failed to create debug file: %s\n", node->name);
			goto error_debugfs;
		}
	}


	return 0;

error_debugfs:
	thinkpad_wmi_debugfs_exit(thinkpad);
	return -ENOMEM;
}
示例#24
0
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->spec_priv, sc->debug.debugfs_phy);

	debugfs_create_devm_seqfile(sc->dev, "dma", sc->debug.debugfs_phy,
				    read_file_dma);
	debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
				    read_file_interrupt);
	debugfs_create_devm_seqfile(sc->dev, "xmit", sc->debug.debugfs_phy,
				    read_file_xmit);
	debugfs_create_devm_seqfile(sc->dev, "queues", sc->debug.debugfs_phy,
				    read_file_queues);
	debugfs_create_u32("qlen_bk", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
			   &sc->tx.txq_max_pending[IEEE80211_AC_BK]);
	debugfs_create_u32("qlen_be", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
			   &sc->tx.txq_max_pending[IEEE80211_AC_BE]);
	debugfs_create_u32("qlen_vi", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
			   &sc->tx.txq_max_pending[IEEE80211_AC_VI]);
	debugfs_create_u32("qlen_vo", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
			   &sc->tx.txq_max_pending[IEEE80211_AC_VO]);
	debugfs_create_devm_seqfile(sc->dev, "misc", sc->debug.debugfs_phy,
				    read_file_misc);
	debugfs_create_devm_seqfile(sc->dev, "reset", sc->debug.debugfs_phy,
				    read_file_reset);

	ath9k_cmn_debug_recv(sc->debug.debugfs_phy, &sc->debug.stats.rxstats);
	ath9k_cmn_debug_phy_err(sc->debug.debugfs_phy, &sc->debug.stats.rxstats);

	debugfs_create_u8("rx_chainmask", S_IRUSR, sc->debug.debugfs_phy,
			  &ah->rxchainmask);
	debugfs_create_u8("tx_chainmask", S_IRUSR, sc->debug.debugfs_phy,
			  &ah->txchainmask);
	debugfs_create_file("ani", S_IRUSR | S_IWUSR,
			    sc->debug.debugfs_phy, sc, &fops_ani);
	debugfs_create_bool("paprd", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
			    &sc->sc_ah->config.enable_paprd);
	debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
			    sc, &fops_regidx);
	debugfs_create_file("regval", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
			    sc, &fops_regval);
	debugfs_create_bool("ignore_extcca", S_IRUSR | S_IWUSR,
			    sc->debug.debugfs_phy,
			    &ah->config.cwm_ignore_extcca);
	debugfs_create_file("regdump", S_IRUSR, sc->debug.debugfs_phy, sc,
			    &fops_regdump);
	debugfs_create_devm_seqfile(sc->dev, "dump_nfcal",
				    sc->debug.debugfs_phy,
				    read_file_dump_nfcal);

	ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah);
	ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah);

	debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR,
			   sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask);
	debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR,
			   sc->debug.debugfs_phy, &sc->sc_ah->gpio_val);
	debugfs_create_file("antenna_diversity", S_IRUSR,
			    sc->debug.debugfs_phy, sc, &fops_antenna_diversity);
#ifdef CPTCFG_ATH9K_BTCOEX_SUPPORT
	debugfs_create_file("bt_ant_diversity", S_IRUSR | S_IWUSR,
			    sc->debug.debugfs_phy, sc, &fops_bt_ant_diversity);
	debugfs_create_file("btcoex", S_IRUSR, sc->debug.debugfs_phy, sc,
			    &fops_btcoex);
#endif

#ifdef CPTCFG_ATH9K_WOW
	debugfs_create_file("wow", S_IRUSR | S_IWUSR,
			    sc->debug.debugfs_phy, sc, &fops_wow);
#endif

#ifdef CPTCFG_ATH9K_DYNACK
	debugfs_create_file("ack_to", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
			    sc, &fops_ackto);
#endif
	debugfs_create_file("tpc", S_IRUSR | S_IWUSR,
			    sc->debug.debugfs_phy, sc, &fops_tpc);

	return 0;
}