Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f02c5113 authored by Krishna Manikandan's avatar Krishna Manikandan
Browse files

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: default avatarKrishna Manikandan <mkrishn@codeaurora.org>
parent db6d9547
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 * Copyright (C) 2013 Red Hat
 * Author: Rob Clark <robdclark@gmail.com>
 *
@@ -804,16 +804,7 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
		priv->fbdev = msm_fbdev_init(ddev);
#endif

	priv->debug_root = debugfs_create_dir("debug",
					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);
	ret = sde_dbg_debugfs_register(dev);
	if (ret) {
		dev_err(dev, "failed to reg sde dbg debugfs: %d\n", ret);
		goto fail;
+26 −3
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2009-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2009-2020, The Linux Foundation. All rights reserved.
 */

#define pr_fmt(fmt)	"[drm:%s:%d] " fmt, __func__, __LINE__
@@ -4522,14 +4522,37 @@ static const struct file_operations sde_reg_fops = {
#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;
	struct sde_dbg_reg_base *blk_base;
	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;
	}

	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,
			&sde_dbg_ctrl_fops);
+3 −3
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 */

#ifndef SDE_DBG_H_
@@ -250,7 +250,7 @@ int sde_dbg_init(struct device *dev);
 * @debugfs_root:	debugfs root in which to create sde debug entries
 * 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
@@ -413,7 +413,7 @@ static inline int sde_dbg_init(struct device *dev,
	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;
}