disp: msm: modify handling of debugfs initialization

Add support to allow creation of debugfs node only if
CONFIG_DEBUG_FS is enabled.

Change-Id: Iaeaf51b3654c9458cf8131a9756e6b905007c4ae
Signed-off-by: Krishna Manikandan <mkrishn@codeaurora.org>
Signed-off-by: Samantha Tran <samtran@codeaurora.org>
This commit is contained in:
Samantha Tran
2020-04-10 16:07:26 -07:00
parent a1143d12be
commit 22923230ef
3 changed files with 35 additions and 15 deletions

View File

@@ -873,16 +873,7 @@ static int msm_drm_component_init(struct device *dev)
drm_client_register(&kms->client); drm_client_register(&kms->client);
} }
priv->debug_root = debugfs_create_dir("debug", ret = sde_dbg_debugfs_register(dev);
ddev->primary->debugfs_root);
if (IS_ERR_OR_NULL(priv->debug_root)) {
pr_err("debugfs_root create_dir fail, error %ld\n",
PTR_ERR(priv->debug_root));
priv->debug_root = NULL;
goto fail;
}
ret = sde_dbg_debugfs_register(priv->debug_root);
if (ret) { if (ret) {
dev_err(dev, "failed to reg sde dbg debugfs: %d\n", ret); dev_err(dev, "failed to reg sde dbg debugfs: %d\n", ret);
goto fail; goto fail;

View File

@@ -6003,14 +6003,37 @@ static const struct file_operations sde_reg_fops = {
#endif #endif
}; };
int sde_dbg_debugfs_register(struct dentry *debugfs_root) int sde_dbg_debugfs_register(struct device *dev)
{ {
static struct sde_dbg_base *dbg = &sde_dbg_base; static struct sde_dbg_base *dbg = &sde_dbg_base;
struct sde_dbg_reg_base *blk_base; struct sde_dbg_reg_base *blk_base;
char debug_name[80] = ""; char debug_name[80] = "";
struct dentry *debugfs_root = NULL;
struct platform_device *pdev = to_platform_device(dev);
struct drm_device *ddev = platform_get_drvdata(pdev);
struct msm_drm_private *priv = NULL;
if (!debugfs_root) if (!ddev) {
pr_err("Invalid drm device node\n");
return -EINVAL; return -EINVAL;
}
priv = ddev->dev_private;
if (!priv) {
pr_err("Invalid msm drm private node\n");
return -EINVAL;
}
debugfs_root = debugfs_create_dir("debug",
ddev->primary->debugfs_root);
if (IS_ERR_OR_NULL(debugfs_root)) {
pr_err("debugfs_root create_dir fail, error %ld\n",
PTR_ERR(debugfs_root));
priv->debug_root = NULL;
return -EINVAL;
}
priv->debug_root = debugfs_root;
debugfs_create_file("dbg_ctrl", 0600, debugfs_root, NULL, debugfs_create_file("dbg_ctrl", 0600, debugfs_root, NULL,
&sde_dbg_ctrl_fops); &sde_dbg_ctrl_fops);

View File

@@ -247,10 +247,10 @@ int sde_dbg_init(struct device *dev);
/** /**
* sde_dbg_debugfs_register - register entries at the given debugfs dir * sde_dbg_debugfs_register - register entries at the given debugfs dir
* @debugfs_root: debugfs root in which to create sde debug entries * @dev: pointer to device
* Returns: 0 or -ERROR * Returns: 0 or -ERROR
*/ */
int sde_dbg_debugfs_register(struct dentry *debugfs_root); int sde_dbg_debugfs_register(struct device *dev);
/** /**
* sde_dbg_destroy - destroy the global sde debug facilities * sde_dbg_destroy - destroy the global sde debug facilities
@@ -404,6 +404,12 @@ static inline ssize_t sde_evtlog_dump_to_buffer(struct sde_dbg_evtlog *evtlog,
return 0; return 0;
} }
static inline int sde_dbg_dsi_ctrl_register(void __iomem *base,
const char *name)
{
return 0;
}
static inline void sde_dbg_init_dbg_buses(u32 hwversion) static inline void sde_dbg_init_dbg_buses(u32 hwversion)
{ {
} }
@@ -414,7 +420,7 @@ static inline int sde_dbg_init(struct device *dev,
return 0; return 0;
} }
static inline int sde_dbg_debugfs_register(struct dentry *debugfs_root) static inline int sde_dbg_debugfs_register(struct device *dev)
{ {
return 0; return 0;
} }