Skip to contentSkip to conversation

drivers: qcom: rpmh-rsc: Check cmd_db_ready() to help children

PATCH Superseded Douglas Anderson 3 participants 3 messages Jun 18, 2018 – Jun 22, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: qcom: rpmh-rsc: Check cmd_db_ready() to help children

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.

---
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(+)
drivers/soc/qcom/rpmh-rsc.c +13 -0
index 144a058407c0..ad85523bdd3b 100644
@@ -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;
Signature · 1 line
2.18.0.rc1.244.gcf134e6275-goog
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Douglas Anderson

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.

Quoted 23 lines

---
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(+)
drivers/soc/qcom/rpmh-rsc.c +1 -0
index 144a058407c0..ad85523bdd3b 100644
@@ -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>
 

drivers/soc/qcom/rpmh-rsc.c static int rpmh_rsc_probe(struct platform_device *pdev) · line 627

Quoted 6 lines
drivers/soc/qcom/rpmh-rsc.c +3 -0
@@ -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.

nit: Double space before To

Quoted 15 lines
drivers/soc/qcom/rpmh-rsc.c +9 -1
+	 */
+	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

Reviewed-by on v1 1/1
#2 lore raw
In reply to Douglas Anderson
Quoted 6 lines · Douglas Anderson

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.

Regards,
Bjorn

Quoted 48 lines

---
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(+)
drivers/soc/qcom/rpmh-rsc.c +13 -0
index 144a058407c0..ad85523bdd3b 100644
@@ -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;
Signature · 6 lines
2.18.0.rc1.244.gcf134e6275-goog

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html