Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Douglas Anderson <dianders@chromium.org>
To: andy.gross@linaro.org
Cc: tdas@codeaurora.org, collinsd@codeaurora.org, sboyd@kernel.org,
	ilina@codeaurora.org, broonie@kernel.org, rplsssn@codeaurora.org,
	Douglas Anderson <dianders@chromium.org>,
	linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org,
	David Brown <david.brown@linaro.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] drivers: qcom: rpmh-rsc: Check cmd_db_ready() to help children
Date: Mon, 18 Jun 2018 10:22:29 -0700	[thread overview]
Message-ID: <20180618172230.241960-1-dianders@chromium.org> (raw)

Children of RPMh will need access to cmd_db.  Rather than having each
child have code to check if cmd_db is ready let's add the check to
RPMh.

Suggested-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
This code is based upon v11 of Lina and Raju's RPMh series.

With this we'll be able to remove this boilerplate code from
clk-rpmh.c and qcom-rpmh-regulator.c.  Neither of these files has
landed upstream yet but patches are pretty far along.

 drivers/soc/qcom/rpmh-rsc.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
index 144a058407c0..ad85523bdd3b 100644
--- a/drivers/soc/qcom/rpmh-rsc.c
+++ b/drivers/soc/qcom/rpmh-rsc.c
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 
+#include <soc/qcom/cmd-db.h>
 #include <soc/qcom/tcs.h>
 #include <dt-bindings/soc/qcom,rpmh-rsc.h>
 
@@ -621,6 +622,18 @@ static int rpmh_rsc_probe(struct platform_device *pdev)
 	struct rsc_drv *drv;
 	int ret, irq;
 
+	/*
+	 * Even though RPMh doesn't directly use cmd-db, all of its children
+	 * do.  To avoid adding this check to our children we'll do it now.
+	 */
+	ret = cmd_db_ready();
+	if (ret) {
+		if (ret != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "Command DB not available (%d)\n",
+									ret);
+		return ret;
+	}
+
 	drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
 	if (!drv)
 		return -ENOMEM;
-- 
2.18.0.rc1.244.gcf134e6275-goog

             reply	other threads:[~2018-06-18 17:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18 17:22 Douglas Anderson [this message]
2018-06-18 17:42 ` [PATCH] drivers: qcom: rpmh-rsc: Check cmd_db_ready() to help children Lina Iyer
2018-06-22 17:02 ` Bjorn Andersson

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=20180618172230.241960-1-dianders@chromium.org \
    --to=dianders@chromium.org \
    --cc=andy.gross@linaro.org \
    --cc=broonie@kernel.org \
    --cc=collinsd@codeaurora.org \
    --cc=david.brown@linaro.org \
    --cc=ilina@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-soc@vger.kernel.org \
    --cc=rplsssn@codeaurora.org \
    --cc=sboyd@kernel.org \
    --cc=tdas@codeaurora.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