Skip to content

Commit 89992d9

Browse files
AnsuelDaniel Lezcano
authored andcommitted
thermal/drivers/qcom/tsens: Rework debugfs file structure
The current tsens debugfs structure is composed by: - a tsens dir in debugfs with a version file - a directory for each tsens istance with sensors file to dump all the sensors value. This works on the assumption that we have the same version for each istance but this assumption seems fragile and with more than one tsens istance results in the version file not tracking each of them. A better approach is to just create a subdirectory for each tsens istance and put there version and sensors debugfs file. Using this new implementation results in less code since debugfs entry are created only on successful tsens probe. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Link: https://lore.kernel.org/r/20221022125657.22530-4-ansuelsmth@gmail.com Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
1 parent c7e077e commit 89992d9

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

drivers/thermal/qcom/tsens.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -725,21 +725,14 @@ DEFINE_SHOW_ATTRIBUTE(dbg_sensors);
725725
static void tsens_debug_init(struct platform_device *pdev)
726726
{
727727
struct tsens_priv *priv = platform_get_drvdata(pdev);
728-
struct dentry *root, *file;
729728

730-
root = debugfs_lookup("tsens", NULL);
731-
if (!root)
729+
priv->debug_root = debugfs_lookup("tsens", NULL);
730+
if (!priv->debug_root)
732731
priv->debug_root = debugfs_create_dir("tsens", NULL);
733-
else
734-
priv->debug_root = root;
735-
736-
file = debugfs_lookup("version", priv->debug_root);
737-
if (!file)
738-
debugfs_create_file("version", 0444, priv->debug_root,
739-
pdev, &dbg_version_fops);
740732

741733
/* A directory for each instance of the TSENS IP */
742734
priv->debug = debugfs_create_dir(dev_name(&pdev->dev), priv->debug_root);
735+
debugfs_create_file("version", 0444, priv->debug, pdev, &dbg_version_fops);
743736
debugfs_create_file("sensors", 0444, priv->debug, pdev, &dbg_sensors_fops);
744737
}
745738
#else

0 commit comments

Comments
 (0)