linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Amit Kucheria <amitk@kernel.org>,
	Thara Gopinath <thara.gopinath@linaro.org>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Zhang Rui <rui.zhang@intel.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: [PATCH v2 1/2] thermal: qcom: tsens: remove data indirection in the debugfs
Date: Sun, 26 Sep 2021 16:42:36 +0300	[thread overview]
Message-ID: <20210926134237.23863-1-dmitry.baryshkov@linaro.org> (raw)

There is no reason to pass platform device to debugfs just to get the
tsens_priv from it. Not to mention that for TSENS_V0 the platform device
(gcc) might have other device data. Pass the tsens_priv data to debugfs
callbacks directly.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/thermal/qcom/tsens.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 4c7ebd1d3f9c..6aeea74c1bb0 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -657,8 +657,7 @@ int get_temp_common(const struct tsens_sensor *s, int *temp)
 #ifdef CONFIG_DEBUG_FS
 static int dbg_sensors_show(struct seq_file *s, void *data)
 {
-	struct platform_device *pdev = s->private;
-	struct tsens_priv *priv = platform_get_drvdata(pdev);
+	struct tsens_priv *priv = s->private;
 	int i;
 
 	seq_printf(s, "max: %2d\nnum: %2d\n\n",
@@ -675,8 +674,7 @@ static int dbg_sensors_show(struct seq_file *s, void *data)
 
 static int dbg_version_show(struct seq_file *s, void *data)
 {
-	struct platform_device *pdev = s->private;
-	struct tsens_priv *priv = platform_get_drvdata(pdev);
+	struct tsens_priv *priv = s->private;
 	u32 maj_ver, min_ver, step_ver;
 	int ret;
 
@@ -701,9 +699,8 @@ static int dbg_version_show(struct seq_file *s, void *data)
 DEFINE_SHOW_ATTRIBUTE(dbg_version);
 DEFINE_SHOW_ATTRIBUTE(dbg_sensors);
 
-static void tsens_debug_init(struct platform_device *pdev)
+static void tsens_debug_init(struct platform_device *pdev, struct tsens_priv *priv)
 {
-	struct tsens_priv *priv = platform_get_drvdata(pdev);
 	struct dentry *root, *file;
 
 	root = debugfs_lookup("tsens", NULL);
@@ -715,14 +712,14 @@ static void tsens_debug_init(struct platform_device *pdev)
 	file = debugfs_lookup("version", priv->debug_root);
 	if (!file)
 		debugfs_create_file("version", 0444, priv->debug_root,
-				    pdev, &dbg_version_fops);
+				    priv, &dbg_version_fops);
 
 	/* A directory for each instance of the TSENS IP */
 	priv->debug = debugfs_create_dir(dev_name(&pdev->dev), priv->debug_root);
-	debugfs_create_file("sensors", 0444, priv->debug, pdev, &dbg_sensors_fops);
+	debugfs_create_file("sensors", 0444, priv->debug, priv, &dbg_sensors_fops);
 }
 #else
-static inline void tsens_debug_init(struct platform_device *pdev) {}
+static inline void tsens_debug_init(struct platform_device *pdev, struct tsens_priv *priv) {}
 #endif
 
 static const struct regmap_config tsens_config = {
@@ -918,7 +915,7 @@ int __init init_common(struct tsens_priv *priv)
 	if (tsens_version(priv) >= VER_0_1)
 		tsens_enable_irq(priv);
 
-	tsens_debug_init(op);
+	tsens_debug_init(op, priv);
 
 err_put_device:
 	put_device(&op->dev);
-- 
2.30.2


             reply	other threads:[~2021-09-26 13:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-26 13:42 Dmitry Baryshkov [this message]
2021-09-26 13:42 ` [PATCH v2 2/2] thermal: qcom: tsens: fix VER_0 support Dmitry Baryshkov
2021-10-01 12:48   ` Thara Gopinath
2021-10-01 10:28 ` [PATCH v2 1/2] thermal: qcom: tsens: remove data indirection in the debugfs Thara Gopinath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210926134237.23863-1-dmitry.baryshkov@linaro.org \
    --to=dmitry.baryshkov@linaro.org \
    --cc=agross@kernel.org \
    --cc=amitk@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=thara.gopinath@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).