63cce7974b378fb556cd313383fd373cf3ddb0e9
[openwrt/staging/neocturne.git] /
1 From 89992d95ed1046338c7866ef7bbe6de543a2af91 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Sat, 22 Oct 2022 14:56:57 +0200
4 Subject: [PATCH 3/3] thermal/drivers/qcom/tsens: Rework debugfs file structure
5
6 The current tsens debugfs structure is composed by:
7 - a tsens dir in debugfs with a version file
8 - a directory for each tsens istance with sensors file to dump all the
9 sensors value.
10
11 This works on the assumption that we have the same version for each
12 istance but this assumption seems fragile and with more than one tsens
13 istance results in the version file not tracking each of them.
14
15 A better approach is to just create a subdirectory for each tsens
16 istance and put there version and sensors debugfs file.
17
18 Using this new implementation results in less code since debugfs entry
19 are created only on successful tsens probe.
20
21 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
22 Link: https://lore.kernel.org/r/20221022125657.22530-4-ansuelsmth@gmail.com
23 Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
24 ---
25 drivers/thermal/qcom/tsens.c | 13 +++----------
26 1 file changed, 3 insertions(+), 10 deletions(-)
27
28 --- a/drivers/thermal/qcom/tsens.c
29 +++ b/drivers/thermal/qcom/tsens.c
30 @@ -704,21 +704,14 @@ DEFINE_SHOW_ATTRIBUTE(dbg_sensors);
31 static void tsens_debug_init(struct platform_device *pdev)
32 {
33 struct tsens_priv *priv = platform_get_drvdata(pdev);
34 - struct dentry *root, *file;
35
36 - root = debugfs_lookup("tsens", NULL);
37 - if (!root)
38 + priv->debug_root = debugfs_lookup("tsens", NULL);
39 + if (!priv->debug_root)
40 priv->debug_root = debugfs_create_dir("tsens", NULL);
41 - else
42 - priv->debug_root = root;
43 -
44 - file = debugfs_lookup("version", priv->debug_root);
45 - if (!file)
46 - debugfs_create_file("version", 0444, priv->debug_root,
47 - pdev, &dbg_version_fops);
48
49 /* A directory for each instance of the TSENS IP */
50 priv->debug = debugfs_create_dir(dev_name(&pdev->dev), priv->debug_root);
51 + debugfs_create_file("version", 0444, priv->debug, pdev, &dbg_version_fops);
52 debugfs_create_file("sensors", 0444, priv->debug, pdev, &dbg_sensors_fops);
53 }
54 #else