static void * indra_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) { struct indra_priv *ip; ip = kzalloc(sizeof(struct indra_priv), GFP_ATOMIC); if (!ip) return NULL; ip->cw_min = 15; if (hw->max_rate_tries > 0) ip->max_retry = hw->max_rate_tries; else /* safe default, does not necessarily have to match hw properties */ ip->max_retry = 7; if (hw->max_rates >= 4) ip->has_mrr = true; ip->hw = hw; #ifdef CPTCFG_MAC80211_DEBUGFS ip->st_deadline = (u32) 2000; ip->dbg_st_deadline = debugfs_create_u32("deadline", S_IRUGO | S_IWUGO, debugfsdir, &ip->st_deadline); ip->ref_payload_size = (u32) 100; ip->dbg_ref_payload_size = debugfs_create_u32("ref_payload_size", S_IRUGO | S_IWUGO, debugfsdir, &ip->ref_payload_size); #endif indra_init_cck_rates(ip); return ip; }
static int __init simon_debugfs_init(void) { int i; struct tegra_simon_grader *grader; struct dentry *dir; dir = debugfs_create_dir("tegra_simon", NULL); if (!dir) return -ENOMEM; if (!debugfs_create_u32("grading_sec", S_IWUSR | S_IRUGO, dir, &grading_sec)) goto err_out; if (!debugfs_create_u32("timeout_sec", S_IWUSR | S_IRUGO, dir, &timeout_sec)) goto err_out; for (i = 0; i < TEGRA_SIMON_DOMAIN_NUM; i++) { grader = &simon_graders[i]; if (!grader->domain_name) continue; if (simon_debugfs_init_domain(dir, grader)) goto err_out; } return 0; err_out: debugfs_remove_recursive(dir); return -ENOMEM; }
void fpga_mgr_debugfs_add(struct fpga_manager *mgr) { struct fpga_mgr_debugfs *debugfs; struct fpga_image_info *info; if (!fpga_mgr_debugfs_root) return; debugfs = kzalloc(sizeof(*debugfs), GFP_KERNEL); if (!debugfs) return; debugfs->debugfs_dir = debugfs_create_dir(dev_name(&mgr->dev), fpga_mgr_debugfs_root); debugfs_create_file("firmware_name", 0600, debugfs->debugfs_dir, mgr, &fpga_mgr_firmware_fops); debugfs_create_file("image", 0200, debugfs->debugfs_dir, mgr, &fpga_mgr_image_fops); info = &debugfs->info; debugfs_create_u32("flags", 0600, debugfs->debugfs_dir, &info->flags); debugfs_create_u32("enable_to", 0600, debugfs->debugfs_dir, &info->enable_timeout_us); debugfs_create_u32("disable_to", 0600, debugfs->debugfs_dir, &info->disable_timeout_us); debugfs_create_u32("config_to", 0600, debugfs->debugfs_dir, &info->config_complete_timeout_us); mgr->debugfs = debugfs; }
static int pfn_inject_init(void) { struct dentry *dentry; hwpoison_dir = debugfs_create_dir("hwpoison", NULL); if (hwpoison_dir == NULL) return -ENOMEM; /* * Note that the below poison/unpoison interfaces do not involve * hardware status change, hence do not require hardware support. * They are mainly for testing hwpoison in software level. */ dentry = debugfs_create_file("corrupt-pfn", 0600, hwpoison_dir, NULL, &hwpoison_fops); if (!dentry) goto fail; dentry = debugfs_create_file("unpoison-pfn", 0600, hwpoison_dir, NULL, &unpoison_fops); if (!dentry) goto fail; dentry = debugfs_create_u32("corrupt-filter-enable", 0600, hwpoison_dir, &hwpoison_filter_enable); if (!dentry) goto fail; dentry = debugfs_create_u32("corrupt-filter-dev-major", 0600, hwpoison_dir, &hwpoison_filter_dev_major); if (!dentry) goto fail; dentry = debugfs_create_u32("corrupt-filter-dev-minor", 0600, hwpoison_dir, &hwpoison_filter_dev_minor); if (!dentry) goto fail; dentry = debugfs_create_u64("corrupt-filter-flags-mask", 0600, hwpoison_dir, &hwpoison_filter_flags_mask); if (!dentry) goto fail; dentry = debugfs_create_u64("corrupt-filter-flags-value", 0600, hwpoison_dir, &hwpoison_filter_flags_value); if (!dentry) goto fail; #ifdef CONFIG_MEMCG_SWAP dentry = debugfs_create_u64("corrupt-filter-memcg", 0600, hwpoison_dir, &hwpoison_filter_memcg); if (!dentry) goto fail; #endif return 0; fail: pfn_inject_exit(); return -ENOMEM; }
static void host1x_debugfs_init(struct host1x *host1x) { struct dentry *de = debugfs_create_dir("tegra-host1x", NULL); if (!de) return; /* Store the created entry */ host1x->debugfs = de; debugfs_create_file("status", S_IRUGO, de, host1x, &host1x_debug_fops); debugfs_create_file("status_all", S_IRUGO, de, host1x, &host1x_debug_all_fops); debugfs_create_u32("trace_cmdbuf", S_IRUGO|S_IWUSR, de, &host1x_debug_trace_cmdbuf); host1x_hw_debug_init(host1x, de); debugfs_create_u32("force_timeout_pid", S_IRUGO|S_IWUSR, de, &host1x_debug_force_timeout_pid); debugfs_create_u32("force_timeout_val", S_IRUGO|S_IWUSR, de, &host1x_debug_force_timeout_val); debugfs_create_u32("force_timeout_channel", S_IRUGO|S_IWUSR, de, &host1x_debug_force_timeout_channel); }
void adreno_debugfs_init(struct kgsl_device *device) { struct adreno_device *adreno_dev = ADRENO_DEVICE(device); if (!device->d_debugfs || IS_ERR(device->d_debugfs)) return; debugfs_create_file("cff_dump", 0644, device->d_debugfs, device, &kgsl_cff_dump_enable_fops); debugfs_create_u32("wait_timeout", 0644, device->d_debugfs, &adreno_dev->wait_timeout); debugfs_create_u32("ib_check", 0644, device->d_debugfs, &adreno_dev->ib_check_level); /* By Default enable fast hang detection */ adreno_dev->fast_hang_detect = 1; debugfs_create_u32("fast_hang_detect", 0644, device->d_debugfs, &adreno_dev->fast_hang_detect); /* Create post mortem control files */ 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); }
static void init_debug(void) { struct dentry *dd, *df; if (!sysedp_debugfs_dir) return; dd = debugfs_create_dir("batmon", sysedp_debugfs_dir); WARN_ON(IS_ERR_OR_NULL(dd)); df = debugfs_create_file("rbat", S_IRUGO, dd, NULL, &rbat_fops); WARN_ON(IS_ERR_OR_NULL(df)); df = debugfs_create_file("ibat", S_IRUGO, dd, NULL, &ibat_fops); WARN_ON(IS_ERR_OR_NULL(df)); df = debugfs_create_file("ocv", S_IRUGO, dd, NULL, &ocv_fops); WARN_ON(IS_ERR_OR_NULL(df)); df = debugfs_create_u32("r_const", S_IRUGO, dd, &pdata->r_const); WARN_ON(IS_ERR_OR_NULL(df)); df = debugfs_create_u32("vsys_min", S_IRUGO, dd, &pdata->vsys_min); WARN_ON(IS_ERR_OR_NULL(df)); }
void abe_init_debugfs(struct omap_abe *abe) { abe->debugfs.d_root = debugfs_create_dir("omap-abe", NULL); if (!abe->debugfs.d_root) { dev_err(abe->dev, "Failed to create debugfs directory\n"); return; } abe->debugfs.d_fmt1 = debugfs_create_bool("format1", 0644, abe->debugfs.d_root, &abe->debugfs.format1); if (!abe->debugfs.d_fmt1) dev_err(abe->dev, "Failed to create format1 debugfs file\n"); abe->debugfs.d_fmt2 = debugfs_create_bool("format2", 0644, abe->debugfs.d_root, &abe->debugfs.format2); if (!abe->debugfs.d_fmt2) dev_err(abe->dev, "Failed to create format2 debugfs file\n"); abe->debugfs.d_fmt3 = debugfs_create_bool("format3", 0644, abe->debugfs.d_root, &abe->debugfs.format3); if (!abe->debugfs.d_fmt3) dev_err(abe->dev, "Failed to create format3 debugfs file\n"); abe->debugfs.d_elem_bytes = debugfs_create_u32("element_bytes", 0604, abe->debugfs.d_root, &abe->debugfs.elem_bytes); if (!abe->debugfs.d_elem_bytes) dev_err(abe->dev, "Failed to create element size debugfs file\n"); abe->debugfs.d_size = debugfs_create_u32("msecs", 0644, abe->debugfs.d_root, &abe->debugfs.buffer_msecs); if (!abe->debugfs.d_size) dev_err(abe->dev, "Failed to create buffer size debugfs file\n"); abe->debugfs.d_circ = debugfs_create_bool("circular", 0644, abe->debugfs.d_root, &abe->debugfs.circular); if (!abe->debugfs.d_size) dev_err(abe->dev, "Failed to create circular mode debugfs file\n"); abe->debugfs.d_data = debugfs_create_file("debug", 0644, abe->debugfs.d_root, abe, &omap_abe_fops); if (!abe->debugfs.d_data) dev_err(abe->dev, "Failed to create data debugfs file\n"); abe->debugfs.d_opp = debugfs_create_u32("opp_level", 0604, abe->debugfs.d_root, &abe->opp.level); if (!abe->debugfs.d_opp) dev_err(abe->dev, "Failed to create OPP level debugfs file\n"); init_waitqueue_head(&abe->debugfs.wait); }
int __init balong_compose_debug_init(void) { debugfs_create_u32("mit1_compose", 0664, NULL, &g_command_file_wr_enable); debugfs_create_u32("mit1_ade_off", 0664, NULL, &g_ade_power_off_enable); debugfs_create_u32("mit1_ade_isr_off", 0664, NULL, &g_ade_isr_disable); debugfs_create_u32("mit1_offline_disable", 0664, NULL, &g_ade_offline_disable); debugfs_create_u32("mit1_dis_ade_ioctl", 0664, NULL, &g_debug_dis_ade_ioctl); return 0; }
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("stations", S_IRUGO, dbg, wil, &fops_sta); debugfs_create_file("desc", S_IRUGO, dbg, wil, &fops_txdesc); debugfs_create_u32("desc_index", S_IRUGO | S_IWUSR, dbg, &dbg_txdesc_index); debugfs_create_u32("vring_index", S_IRUGO | S_IWUSR, dbg, &dbg_vring_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); wil_debugfs_create_ulong("status", S_IRUGO | S_IWUSR, dbg, &wil->status); debugfs_create_u32("fw_version", S_IRUGO, dbg, &wil->fw_version); debugfs_create_x32("hw_version", S_IRUGO, dbg, &wil->hw_version); 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); wil_debugfs_create_iomem_x32("RGF_USER_USAGE_1", S_IRUGO, dbg, wil->csr + HOSTADDR(RGF_USER_USAGE_1)); 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("rxon", S_IWUSR, dbg, wil, &fops_rxon); debugfs_create_file("tx_mgmt", S_IWUSR, dbg, wil, &fops_txmgmt); debugfs_create_file("wmi_send", S_IWUSR, dbg, wil, &fops_wmi); debugfs_create_file("temp", S_IRUGO, dbg, wil, &fops_temp); debugfs_create_file("freq", S_IRUGO, dbg, wil, &fops_freq); debugfs_create_file("link", S_IRUGO, dbg, wil, &fops_link); debugfs_create_file("info", S_IRUGO, dbg, wil, &fops_info); wil6210_debugfs_init_blobs(wil, dbg); return 0; }
static void debugfs_init(void) { dentry_debug_root = debugfs_create_dir("power", NULL); if (IS_ERR(dentry_debug_root) || !dentry_debug_root) { printk("!!!powermanager Failed to create debugfs directory\n"); dentry_debug_root = NULL; return; } debugfs_create_u32("print_sleep_mode", 0644, dentry_debug_root, &is_print_sleep_mode); debugfs_create_u32("print_linux_clock", 0644, dentry_debug_root, &is_print_linux_clock); debugfs_create_u32("print_modem_clock", 0644, dentry_debug_root, &is_print_modem_clock); debugfs_create_u32("print_irq", 0644, dentry_debug_root, &is_print_irq); debugfs_create_u32("print_wakeup", 0644, dentry_debug_root, &is_print_wakeup); debugfs_create_u32("print_irq_runtime", 0644, dentry_debug_root, &is_print_irq_runtime); debugfs_create_u32("print_time", 0644, dentry_debug_root, &is_print_time); debugfs_create_u32("print_thread_enable", 0644, dentry_debug_root, &print_thread_enable); debugfs_create_u32("print_thread_interval", 0644, dentry_debug_root, &print_thread_interval); }
int mdss_panel_debugfs_setup(struct mdss_panel_info *panel_info, struct dentry *parent, char *dsi_str) { struct mdss_panel_debugfs_info *debugfs_info; debugfs_info = kzalloc(sizeof(*debugfs_info), GFP_KERNEL); if (!debugfs_info) { pr_err("No memory to create panel debugfs info"); return -ENOMEM; } debugfs_info->root = debugfs_create_dir(dsi_str, parent); if (IS_ERR_OR_NULL(debugfs_info->root)) { pr_err("Debugfs create dir failed with error: %ld\n", PTR_ERR(debugfs_info->root)); kfree(debugfs_info); return -ENODEV; } debugfs_create_u32("override_flag", 0644, parent, (u32 *)&debugfs_info->override_flag); debugfs_create_u32("xres", 0644, debugfs_info->root, (u32 *)&debugfs_info->xres); debugfs_create_u32("yres", 0644, debugfs_info->root, (u32 *)&debugfs_info->yres); debugfs_create_u32("h_back_porch", 0644, debugfs_info->root, (u32 *)&debugfs_info->lcdc.h_back_porch); debugfs_create_u32("h_front_porch", 0644, debugfs_info->root, (u32 *)&debugfs_info->lcdc.h_front_porch); debugfs_create_u32("h_pulse_width", 0644, debugfs_info->root, (u32 *)&debugfs_info->lcdc.h_pulse_width); debugfs_create_u32("v_back_porch", 0644, debugfs_info->root, (u32 *)&debugfs_info->lcdc.v_back_porch); debugfs_create_u32("v_front_porch", 0644, debugfs_info->root, (u32 *)&debugfs_info->lcdc.v_front_porch); debugfs_create_u32("v_pulse_width", 0644, debugfs_info->root, (u32 *)&debugfs_info->lcdc.v_pulse_width); debugfs_create_u32("frame_rate", 0644, parent, (u32 *)&debugfs_info->frame_rate); mdss_panel_debugfs_fbc_setup(debugfs_info, panel_info, debugfs_info->root); debugfs_info->xres = panel_info->xres; debugfs_info->yres = panel_info->yres; debugfs_info->lcdc = panel_info->lcdc; debugfs_info->frame_rate = panel_info->mipi.frame_rate; debugfs_info->override_flag = 0; panel_info->debugfs_info = debugfs_info; return 0; }
struct dentry *msm_vidc_debugfs_init_core(struct msm_vidc_core *core, struct dentry *parent) { struct dentry *dir = NULL; char debugfs_name[MAX_DEBUGFS_NAME]; if (!core) { dprintk(VIDC_ERR, "Invalid params, core: %p\n", core); goto failed_create_dir; } snprintf(debugfs_name, MAX_DEBUGFS_NAME, "core%d", core->id); dir = debugfs_create_dir(debugfs_name, parent); if (!dir) { dprintk(VIDC_ERR, "Failed to create debugfs for msm_vidc\n"); goto failed_create_dir; } if (!debugfs_create_file("info", S_IRUGO, dir, core, &core_info_fops)) { dprintk(VIDC_ERR, "debugfs_create_file: fail\n"); goto failed_create_dir; } if (!debugfs_create_u32("debug_level", S_IRUGO | S_IWUSR, parent, &msm_vidc_debug)) { dprintk(VIDC_ERR, "debugfs_create_file: fail\n"); goto failed_create_dir; } if (!debugfs_create_u32("fw_level", S_IRUGO | S_IWUSR, parent, &msm_fw_debug)) { dprintk(VIDC_ERR, "debugfs_create_file: fail\n"); goto failed_create_dir; } if (!debugfs_create_file("trigger_ssr", S_IWUSR, dir, core, &ssr_fops)) { dprintk(VIDC_ERR, "debugfs_create_file: fail\n"); goto failed_create_dir; } if (!debugfs_create_u32("fw_debug_mode", S_IRUGO | S_IWUSR, parent, &msm_fw_debug_mode)) { dprintk(VIDC_ERR, "debugfs_create_file: fail\n"); goto failed_create_dir; } if (!debugfs_create_u32("fw_low_power_mode", S_IRUGO | S_IWUSR, parent, &msm_fw_low_power_mode)) { dprintk(VIDC_ERR, "debugfs_create_file: fail\n"); goto failed_create_dir; } if (!debugfs_create_u32("vp8_low_tier", S_IRUGO | S_IWUSR, parent, &msm_vp8_low_tier)) { dprintk(VIDC_ERR, "debugfs_create_file: fail\n"); goto failed_create_dir; } failed_create_dir: return dir; }
/* Create debugfs counters for the device */ static inline void debugfs_init(struct cfv_info *cfv) { cfv->debugfs = debugfs_create_dir(netdev_name(cfv->ndev), NULL); if (IS_ERR(cfv->debugfs)) return; debugfs_create_u32("rx-napi-complete", S_IRUSR, cfv->debugfs, &cfv->stats.rx_napi_complete); debugfs_create_u32("rx-napi-resched", S_IRUSR, cfv->debugfs, &cfv->stats.rx_napi_resched); debugfs_create_u32("rx-nomem", S_IRUSR, cfv->debugfs, &cfv->stats.rx_nomem); debugfs_create_u32("rx-kicks", S_IRUSR, cfv->debugfs, &cfv->stats.rx_kicks); debugfs_create_u32("tx-full-ring", S_IRUSR, cfv->debugfs, &cfv->stats.tx_full_ring); debugfs_create_u32("tx-no-mem", S_IRUSR, cfv->debugfs, &cfv->stats.tx_no_mem); debugfs_create_u32("tx-kicks", S_IRUSR, cfv->debugfs, &cfv->stats.tx_kicks); debugfs_create_u32("tx-flow-on", S_IRUSR, cfv->debugfs, &cfv->stats.tx_flow_on); }
int tegra_emc_timers_init(struct dentry *parent) { #ifdef CONFIG_DEBUG_FS struct dentry *dram_therm_debugfs; struct dentry *training_debugfs; /* * If caller doesn't want us to make a debugfs dir it can pass NULL. * This should never be a top level debugfs dir. For subsequent debugfs * errors return 0 - don't fail the entire EMC driver init if debugfs * has problems. We do a best effort here. */ if (!parent) return 0; emc_timers_debugfs = debugfs_create_dir("emc_timers", parent); if (!emc_timers_debugfs) return 0; dram_therm_debugfs = debugfs_create_dir("dram_therm", emc_timers_debugfs); if (!dram_therm_debugfs) return 0; debugfs_create_u32("debug", S_IRUGO | S_IWUSR, emc_timers_debugfs, &emc_timers_dbg); /* DRAM thermals. */ debugfs_create_u32("timer_period", S_IRUGO | S_IWUSR, dram_therm_debugfs, &timer_period_mr4); debugfs_create_u32("test_mode", S_IRUGO | S_IWUSR, dram_therm_debugfs, &test_mode); debugfs_create_u32("dram_temp_override", S_IRUGO | S_IWUSR, dram_therm_debugfs, &dram_temp_override); debugfs_create_file("force_poll", S_IRUGO | S_IWUSR, dram_therm_debugfs, NULL, &mr4_force_poll_fops); if (tegra_emc_get_dram_type() == DRAM_TYPE_LPDDR4) { /* Training. */ training_debugfs = debugfs_create_dir("training", emc_timers_debugfs); if (!training_debugfs) return 0; debugfs_create_u32("timer_period", S_IRUGO | S_IWUSR, training_debugfs, &timer_period_training); } #endif return 0; }
int __init rhea_pm_debug_init(void) { int ret; INIT_DELAYED_WORK(&uartb_wq, uartb_wq_handler); #ifdef CONFIG_UART_FORCE_RETENTION_TST if (pwr_mgr_register_event_handler(UBRX_EVENT, uartb_pwr_mgr_event_cb, NULL)) return -ENOMEM; #endif /* create root clock dir /clock */ dent_rhea_pm_root_dir = debugfs_create_dir("rhea_pm", 0); if(!dent_rhea_pm_root_dir) return -ENOMEM; if (!debugfs_create_u32("log_mask", S_IRUGO | S_IWUSR, dent_rhea_pm_root_dir, (int *)&log_mask)) return -ENOMEM; if (!debugfs_create_file("en_self_refresh", S_IRUGO | S_IWUSR, dent_rhea_pm_root_dir, NULL, &pm_en_self_refresh_fops)) return -ENOMEM; if (!debugfs_create_u32("force_retention", S_IRUGO | S_IWUSR, dent_rhea_pm_root_dir, (int*)&force_retention)) return -ENOMEM; /* A9 QOS interface is used to disable dormant C-states * at runtime. To disable dormant set PM_QOS_CPU_DMA_LATENCY * to the latency of the highest non-dormant state. */ ret = pi_mgr_qos_add_request(&arm_qos, "pm", PI_MGR_PI_ID_ARM_CORE, PI_MGR_QOS_DEFAULT_VALUE); if (ret < 0) return ret; /* If dormant is not enabled out of boot, prevent cpuidle * from entering into dormant C-states. */ if (dormant_enable == 0) pi_mgr_qos_request_update(&arm_qos, NON_DORMANT_MAX_EXIT_LATENCY); /* Interface to enable disable dormant mode at runtime */ if (!debugfs_create_file("dormant_enable", S_IRUGO | S_IWUSR, dent_rhea_pm_root_dir, NULL, &dormant_enable_fops)) return -ENOMEM; return 0; }
static int cdc_dbg_init(struct cdc *cdc_info) { int i; char buf[20]; cdc_info->cdc_dir = debugfs_create_dir("cdc", 0); if (!cdc_info->cdc_dir) return -EINVAL; for (i = 0; i < cdc_info->nr_cpus; i++) { sprintf(buf, "cpu%d_status", i); if (!debugfs_create_file(buf, S_IRUSR, cdc_info->cdc_dir, (void *)i, &cdc_dbg_get_status_ops)) goto err; } if (!debugfs_create_u32("dbg_mask", S_IRUSR | S_IWUSR, cdc_info->cdc_dir, (u32 *)dbg_mask)) goto err; if (!debugfs_create_file("dbg_bus", S_IRUSR | S_IWUSR , cdc_info->cdc_dir, NULL, &cdc_dbg_bus_ops)) goto err; return 0; err: debugfs_remove_recursive(cdc_info->cdc_dir); return -EINVAL; }
/** * 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); 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)); } }
/* ccmni debug sys file create */ int ccmni_debug_file_init(int md_id) { int result = -1; char fname[16]; struct dentry *dentry1, *dentry2, *dentry3; CCMNI_INF_MSG(md_id, "ccmni_debug_file_init\n"); dentry1 = debugfs_create_dir("ccmni", NULL); if (!dentry1) { CCMNI_ERR_MSG(md_id, "create /proc/ccmni fail\n"); return -ENOENT; } snprintf(fname, 16, "md%d", (md_id+1)); dentry2 = debugfs_create_dir(fname, dentry1); if (!dentry2) { CCMNI_ERR_MSG(md_id, "create /proc/ccmni/md%d fail\n", (md_id+1)); return -ENOENT; } dentry3 = debugfs_create_u32("debug_level", 0600, dentry2, &ccmni_debug_level); result = PTR_ERR(dentry3); if (IS_ERR(dentry3) && result != -ENODEV) { CCMNI_ERR_MSG(md_id, "create /proc/ccmni/md%d/debug_level fail: %d\n", md_id, result); return -ENOENT; } return 0; }
static int ufs_test_debugfs_init(void) { struct dentry *utils_root, *tests_root; int ret = 0; utils_root = test_iosched_get_debugfs_utils_root(); tests_root = test_iosched_get_debugfs_tests_root(); utd->test_list = kmalloc(sizeof(struct dentry *) * NUM_TESTS, GFP_KERNEL); if (!utd->test_list) { pr_err("%s: failed to allocate tests dentrys", __func__); return -ENODEV; } if (!utils_root || !tests_root) { pr_err("%s: Failed to create debugfs root.", __func__); ret = -EINVAL; goto exit_err; } utd->random_test_seed_dentry = debugfs_create_u32("random_test_seed", S_IRUGO | S_IWUGO, utils_root, &utd->random_test_seed); if (!utd->random_test_seed_dentry) { pr_err("%s: Could not create debugfs random_test_seed.", __func__); ret = -ENOMEM; goto exit_err; } ret = add_test(utd, write_read_test, WRITE_READ_TEST); if (ret) goto exit_err; ret = add_test(utd, long_sequential_read, LONG_SEQUENTIAL_READ); if (ret) goto exit_err; ret = add_test(utd, long_sequential_write, LONG_SEQUENTIAL_WRITE); if (ret) goto exit_err; ret = add_test(utd, long_sequential_mixed, LONG_SEQUENTIAL_MIXED); if (ret) goto exit_err; add_test(utd, multi_query, MULTI_QUERY); if (ret) goto exit_err; add_test(utd, parallel_read_and_write, PARALLEL_READ_AND_WRITE); if (ret) goto exit_err; add_test(utd, lun_depth, LUN_DEPTH); if (ret) goto exit_err; goto exit; exit_err: ufs_test_debugfs_cleanup(); exit: return ret; }
static int setup_debugfs(void) { int i; usecase_dir = debugfs_create_dir("usecase", NULL); if (IS_ERR_OR_NULL(usecase_dir)) return -EINVAL; for (i = 0; i < ARRAY_SIZE(debug_entry); i++) { if (IS_ERR_OR_NULL(debugfs_create_file(debug_entry[i].name, S_IWUSR | S_IWGRP | S_IRUGO, usecase_dir, NULL, debug_entry[i].fops))) goto fail; } if (IS_ERR_OR_NULL(debugfs_create_u32("exit_irq_per_s", S_IWUSR | S_IWGRP | S_IRUGO, usecase_dir, &exit_irq_per_s))) goto fail; return 0; fail: debugfs_remove_recursive(usecase_dir); return -EINVAL; }
static int test_create_debugfs(void) { struct dentry *root = g_ts_data.dbg_root; struct dentry *dir; struct dentry *dent; int i; int error = -EINVAL; if(!root){ TS_LOG_ERR("g_ts_data dont have dbg_root\n"); goto out; } dir = debugfs_create_dir("test_dir", root); if (!dir) { TS_LOG_ERR("failed to create test_dir directory\n"); goto out; } for(i = 0; i<ARRAY_SIZE(g_test_items); i++){ dent = debugfs_create_u32(g_test_items[i].item_name, S_IRUGO | S_IWUSR, dir, &g_test_items[i].item_switch); if (!dent) { TS_LOG_ERR("failed to create %s file\n", g_test_items[i].item_name); debugfs_remove_recursive(dir); break; } } if(i==ARRAY_SIZE(g_test_items)) error = NO_ERR; out: return error; }
int __init g2d_debug_init(void) { struct dentry *g2d_debugfs_dir = NULL; g2d_debugfs_dir = debugfs_create_dir("g2d", NULL); if (ERR_PTR(-ENODEV) == g2d_debugfs_dir) { printk("debugfs_create_dir create dir fail! \n "); return -EINVAL; } debugfs_create_u32("powerdown", 0664, g2d_debugfs_dir, &(g2dPoweroffstatus)); debugfs_create_u32("startfreq", 0444, g2d_debugfs_dir, &(g2d_start_freq)); debugfs_create_u32("lockstate", 0444, g2d_debugfs_dir, &(g2d_lock_state)); debugfs_create_u32("currentfreq", 0444, g2d_debugfs_dir, &(g_g2d_current_freq)); return 0; }
static int __init debugfs_unaligned(void) { struct dentry *d; if (!mips_debugfs_dir) return -ENODEV; d = debugfs_create_u32("unaligned_instructions", S_IRUGO, mips_debugfs_dir, &unaligned_instructions); if (!d) return -ENOMEM; d = debugfs_create_u32("unaligned_action", S_IRUGO | S_IWUSR, mips_debugfs_dir, &unaligned_action); if (!d) return -ENOMEM; return 0; }
void adreno_debugfs_init(struct kgsl_device *device) { struct adreno_device *adreno_dev = ADRENO_DEVICE(device); if (!device->d_debugfs || IS_ERR(device->d_debugfs)) return; debugfs_create_file("ib_dump", 0600, device->d_debugfs, device, &kgsl_ib_dump_fops); debugfs_create_file("istore", 0400, device->d_debugfs, device, &kgsl_istore_fops); debugfs_create_file("sx_debug", 0400, device->d_debugfs, device, &kgsl_sx_debug_fops); debugfs_create_file("cp_debug", 0400, device->d_debugfs, device, &kgsl_cp_debug_fops); debugfs_create_file("mh_debug", 0400, device->d_debugfs, device, &kgsl_mh_debug_fops); debugfs_create_file("cff_dump", 0644, device->d_debugfs, device, &kgsl_cff_dump_enable_fops); debugfs_create_u32("wait_timeout", 0644, device->d_debugfs, &adreno_dev->wait_timeout); /* Create post mortem control files */ 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); }
static int ufs_test_debugfs_init(void) { struct dentry *utils_root, *tests_root; utils_root = test_iosched_get_debugfs_utils_root(); tests_root = test_iosched_get_debugfs_tests_root(); if (!utils_root || !tests_root) { test_pr_err("%s: Failed to create debugfs root.", __func__); return -EINVAL; } utd->debug.random_test_seed = debugfs_create_u32("random_test_seed", S_IRUGO | S_IWUGO, utils_root, &utd->random_test_seed); if (!utd->debug.random_test_seed) { test_pr_err("%s: Could not create debugfs random_test_seed.", __func__); return -ENOMEM; } utd->debug.write_read_test = debugfs_create_file("write_read_test", S_IRUGO | S_IWUGO, tests_root, NULL, &write_read_test_ops); if (!utd->debug.write_read_test) { debugfs_remove(utd->debug.random_test_seed); test_pr_err("%s: Could not create debugfs write_read_test.", __func__); return -ENOMEM; } return 0; }
void mmc_add_host_debugfs(struct mmc_host *host) { struct dentry *root; root = debugfs_create_dir(mmc_hostname(host), NULL); if (IS_ERR(root)) /* Don't complain -- debugfs just isn't enabled */ return; if (!root) /* Complain -- debugfs is enabled, but it failed to * create the directory. */ goto err_root; host->debugfs_root = root; if (!debugfs_create_file("ios", S_IRUSR, root, host, &mmc_ios_fops)) goto err_node; if (!debugfs_create_file("clock", S_IRUSR | S_IWUSR, root, host, &mmc_clock_fops)) goto err_node; #ifdef CONFIG_MMC_CLKGATE if (!debugfs_create_u32("clk_delay", (S_IRUSR | S_IWUSR), root, &host->clk_delay)) goto err_node; #endif return; err_node: debugfs_remove_recursive(root); host->debugfs_root = NULL; err_root: dev_err(&host->class_dev, "failed to initialize debugfs\n"); }
int init_module(void) { dir = debugfs_create_dir("eudyptula", NULL); if (IS_ERR(dir)) { pr_debug("task08: failed to create /sys/kernel/debug/eudyptula\n"); return -ENODEV; } if (!debugfs_create_file("id", 0666, dir, NULL, &eudyptula_fops)) { pr_debug("task08: failed to create id file\n"); return -ENODEV; } if (!debugfs_create_u32("jiffies", 0444, dir, (u32 *)&jiffies)) { pr_debug("task08: failed to create jiffies file\n"); return -ENODEV; } if (!debugfs_create_file("foo", 0644, dir, NULL, &foo_fops)) { pr_debug("task08: failed to create foo file\n"); return -ENODEV; } return 0; }
void adreno_debugfs_init(struct kgsl_device *device) { struct adreno_device *adreno_dev = ADRENO_DEVICE(device); if (!device->d_debugfs || IS_ERR(device->d_debugfs)) return; debugfs_create_file("cff_dump", 0644, device->d_debugfs, device, &kgsl_cff_dump_enable_fops); debugfs_create_u32("wait_timeout", 0644, device->d_debugfs, &adreno_dev->wait_timeout); debugfs_create_u32("ib_check", 0644, device->d_debugfs, &adreno_dev->ib_check_level); debugfs_create_file("active_cnt", 0444, device->d_debugfs, device, &_active_count_fops); }
void vidc_debugfs_file_create(struct dentry *root, const char *name, u32 *var) { struct dentry *vidc_debugfs_file = debugfs_create_u32(name, S_IRUGO | S_IWUSR, root, var); if (!vidc_debugfs_file) ERR("%s(): Error creating/opening file %s\n", __func__, name); }