Skip to content
This repository has been archived by the owner on Nov 14, 2021. It is now read-only.

Commit

Permalink
treewide: Don't warn on debugfs failures when DEBUG_FS is disabled
Browse files Browse the repository at this point in the history
It stands to reason that if I disable DEBUG_FS, then dependant
functions will fail. There is no need to redundantly alert to this
in dmesg, unless these calls are failing when DEBUG_FS is actually
enabled. Guard applicable emissions accordingly, where possible,
otherwise demote to debug.

Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
  • Loading branch information
0ctobot committed Mar 6, 2021
1 parent 70e7100 commit ce14a32
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion drivers/char/adsprpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5211,7 +5211,7 @@ static int __init fastrpc_device_init(void)

debugfs_root = debugfs_create_dir("adsprpc", NULL);
if (IS_ERR_OR_NULL(debugfs_root)) {
pr_warn("Error: %s: %s: failed to create debugfs root dir\n",
pr_debug("Error: %s: %s: failed to create debugfs root dir\n",
current->comm, __func__);
debugfs_remove_recursive(debugfs_root);
debugfs_root = NULL;
Expand Down
4 changes: 4 additions & 0 deletions drivers/media/platform/msm/cvp/msm_cvp_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ struct dentry *msm_cvp_debugfs_init_core(struct msm_cvp_core *core,
dir = debugfs_create_dir(debugfs_name, parent);
if (IS_ERR_OR_NULL(dir)) {
dir = NULL;
#ifdef CONFIG_DEBUG_FS
dprintk(CVP_ERR, "Failed to create debugfs for msm_cvp\n");
#endif
goto failed_create_dir;
}
if (!debugfs_create_file("info", 0444, dir, core, &core_info_fops)) {
Expand Down Expand Up @@ -426,7 +428,9 @@ struct dentry *msm_cvp_debugfs_init_inst(struct msm_cvp_inst *inst,
dir = debugfs_create_dir(debugfs_name, parent);
if (IS_ERR_OR_NULL(dir)) {
dir = NULL;
#ifdef CONFIG_DEBUG_FS
dprintk(CVP_ERR, "Failed to create debugfs for msm_cvp\n");
#endif
goto failed_create_dir;
}

Expand Down
2 changes: 2 additions & 0 deletions drivers/media/platform/msm/cvp/msm_v4l2_cvp.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,11 @@ static int __init msm_cvp_init(void)
INIT_LIST_HEAD(&cvp_driver->cores);
mutex_init(&cvp_driver->lock);
cvp_driver->debugfs_root = msm_cvp_debugfs_init_drv();
#ifdef CONFIG_DEBUG_FS
if (!cvp_driver->debugfs_root)
dprintk(CVP_ERR,
"Failed to create debugfs for msm_cvp\n");
#endif

rc = platform_driver_register(&msm_cvp_driver);
if (rc) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/platform/msm/npu/npu_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ int npu_debugfs_init(struct npu_device *npu_dev)

debugfs->root = debugfs_create_dir("npu", NULL);
if (IS_ERR_OR_NULL(debugfs->root)) {
NPU_ERR("debugfs_create_dir for npu failed, error %ld\n",
NPU_DBG("debugfs_create_dir for npu failed, error %ld\n",
PTR_ERR(debugfs->root));
return -ENODEV;
}
Expand Down
6 changes: 6 additions & 0 deletions drivers/media/usb/uvc/uvc_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ void uvc_debugfs_init_stream(struct uvc_streaming *stream)

dent = debugfs_create_dir(dir_name, uvc_debugfs_root_dir);
if (IS_ERR_OR_NULL(dent)) {
#ifdef CONFIG_DEBUG_FS
uvc_printk(KERN_INFO, "Unable to create debugfs %s "
"directory.\n", dir_name);
#endif
return;
}

Expand All @@ -98,7 +100,9 @@ void uvc_debugfs_init_stream(struct uvc_streaming *stream)
dent = debugfs_create_file("stats", 0444, stream->debugfs_dir,
stream, &uvc_debugfs_stats_fops);
if (IS_ERR_OR_NULL(dent)) {
#ifdef CONFIG_DEBUG_FS
uvc_printk(KERN_INFO, "Unable to create debugfs stats file.\n");
#endif
uvc_debugfs_cleanup_stream(stream);
return;
}
Expand All @@ -119,7 +123,9 @@ void uvc_debugfs_init(void)

dir = debugfs_create_dir("uvcvideo", usb_debug_root);
if (IS_ERR_OR_NULL(dir)) {
#ifdef CONFIG_DEBUG_FS
uvc_printk(KERN_INFO, "Unable to create debugfs directory\n");
#endif
return;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/net/wireless/cnss_prealloc/cnss_prealloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,12 @@ static int __init wcnss_pre_alloc_init(void)

debug_base = debugfs_create_dir(PRE_ALLOC_DEBUGFS_DIR, NULL);
if (IS_ERR_OR_NULL(debug_base)) {
pr_err("%s: Failed to create debugfs dir\n", __func__);
pr_debug("%s: Failed to create debugfs dir\n", __func__);
} else if (IS_ERR_OR_NULL(debugfs_create_file
(PRE_ALLOC_DEBUGFS_FILE_OBJ,
0644, debug_base, NULL,
&prealloc_memory_stats_fops))) {
pr_err("%s: Failed to create debugfs file\n", __func__);
pr_debug("%s: Failed to create debugfs file\n", __func__);
debugfs_remove_recursive(debug_base);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/cnss_utils/cnss_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ static int cnss_utils_debugfs_create(struct cnss_utils_priv *priv)

if (IS_ERR(root_dentry)) {
ret = PTR_ERR(root_dentry);
pr_err("Unable to create debugfs %d\n", ret);
pr_debug("Unable to create debugfs %d\n", ret);
goto out;
}
priv->root_dentry = root_dentry;
Expand Down
2 changes: 1 addition & 1 deletion drivers/power/supply/qcom/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -1960,7 +1960,7 @@ static void qcom_batt_create_debugfs(struct pl_data *chip)

chip->dfs_root = debugfs_create_dir("battery", NULL);
if (IS_ERR_OR_NULL(chip->dfs_root)) {
pr_err("Couldn't create battery debugfs rc=%ld\n",
pr_debug("Couldn't create battery debugfs rc=%ld\n",
(long)chip->dfs_root);
return;
}
Expand Down
10 changes: 5 additions & 5 deletions drivers/power/supply/qcom/fg-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1645,30 +1645,30 @@ int fg_debugfs_create(struct fg_dev *fg)
fg->dfs_root = debugfs_create_dir("fg", NULL);
if (IS_ERR_OR_NULL(fg->dfs_root)) {
if (PTR_ERR(fg->dfs_root) == -ENODEV)
pr_err("debugfs is not enabled in the kernel\n");
pr_debug("debugfs is not enabled in the kernel\n");
else
pr_err("error creating fg dfs root rc=%ld\n",
pr_debug("error creating fg dfs root rc=%ld\n",
(long)fg->dfs_root);
return -ENODEV;
}

file = debugfs_create_u32("debug_mask", 0600, fg->dfs_root,
fg->debug_mask);
if (IS_ERR_OR_NULL(file)) {
pr_err("failed to create debug_mask\n");
pr_debug("failed to create debug_mask\n");
goto err_remove_fs;
}

rc = fg_sram_debugfs_create(fg);
if (rc < 0) {
pr_err("failed to create sram dfs rc=%d\n", rc);
pr_debug("failed to create sram dfs rc=%d\n", rc);
goto err_remove_fs;
}

if (fg->alg_flags) {
if (!debugfs_create_file("alg_flags", 0400, fg->dfs_root, fg,
&fg_alg_flags_fops)) {
pr_err("failed to create alg_flags file\n");
pr_debug("failed to create alg_flags file\n");
goto err_remove_fs;
}
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/soc/qcom/msm_bus/msm_bus_arb_rpmh.c
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ static uint32_t register_client_adhoc(struct msm_bus_scale_pdata *pdata)
}
client->src_devs[i] = dev;

MSM_BUS_ERR("%s:find path.src %d dest %d",
MSM_BUS_DBG("%s:find path.src %d dest %d",
__func__, src, dest);

lnode[i] = getpath(dev, dest, client->pdata->name);
Expand All @@ -1308,7 +1308,7 @@ static uint32_t register_client_adhoc(struct msm_bus_scale_pdata *pdata)
handle = gen_handle(client);
msm_bus_dbg_client_data(client->pdata, MSM_BUS_DBG_REGISTER,
handle);
MSM_BUS_ERR("%s:Client handle %d %s", __func__, handle,
MSM_BUS_DBG("%s:Client handle %d %s", __func__, handle,
client->pdata->name);
rt_mutex_unlock(&msm_bus_adhoc_lock);
return handle;
Expand Down

0 comments on commit ce14a32

Please sign in to comment.