All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leonard Crestez <leonard.crestez@nxp.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <kernel@pengutronix.de>,
	Mark Brown <broonie@kernel.org>
Cc: Leonard Crestez <leonard.crestez@nxp.com>,
	Lucas Stach <l.stach@pengutronix.de>,
	Robin Gong <yibin.gong@nxp.com>,
	Anson Huang <Anson.Huang@nxp.com>,
	Irina Tirdea <irina.tirdea@nxp.com>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	Octavian Purdila <octavian.purdila@nxp.com>,
	Liam Girdwood <lgirdwood@gmail.com>, <linux-pm@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH 2/5] cpufreq: imx6q: Fix handling EPROBE_DEFER from regulator
Date: Fri, 31 Mar 2017 22:25:37 +0300	[thread overview]
Message-ID: <36c230773c14d37037dbe8cadf4f99b0d875e679.1490987945.git.leonard.crestez@nxp.com> (raw)
In-Reply-To: <cover.1490987945.git.leonard.crestez@nxp.com>

From: Irina Tirdea <irina.tirdea@nxp.com>

If there are any errors in getting the cpu0 regulators, the driver returns
-ENOENT. In case the regulators are not yet available, the devm_regulator_get
calls will return -EPROBE_DEFER, so that the driver can be probed later.
If we return -ENOENT, the driver will fail its initialization and will
not try to probe again (when the regulators become available).

Return the actual error received from regulator_get in probe. Print a
differentiated message in case we need to probe the device later and
in case we actually failed. Also add a message to inform when the
driver has been successfully registered.

Signed-off-by: Irina Tirdea <irina.tirdea@nxp.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/imx6q-cpufreq.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index 7719b02..be90ee3 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -222,6 +222,13 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
 	arm_reg = regulator_get(cpu_dev, "arm");
 	pu_reg = regulator_get_optional(cpu_dev, "pu");
 	soc_reg = regulator_get(cpu_dev, "soc");
+	if (PTR_ERR(arm_reg) == -EPROBE_DEFER ||
+			PTR_ERR(soc_reg) == -EPROBE_DEFER ||
+			PTR_ERR(pu_reg) == -EPROBE_DEFER) {
+		ret = -EPROBE_DEFER;
+		dev_dbg(cpu_dev, "regulators not ready, defer\n");
+		goto put_reg;
+	}
 	if (IS_ERR(arm_reg) || IS_ERR(soc_reg)) {
 		dev_err(cpu_dev, "failed to get regulators\n");
 		ret = -ENOENT;
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: Leonard Crestez <leonard.crestez@nxp.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <kernel@pengutronix.de>,
	Mark Brown <broonie@kernel.org>
Cc: Leonard Crestez <leonard.crestez@nxp.com>,
	Anson Huang <Anson.Huang@nxp.com>,
	Irina Tirdea <irina.tirdea@nxp.com>,
	linux-pm@vger.kernel.org, Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org,
	Octavian Purdila <octavian.purdila@nxp.com>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	Robin Gong <yibin.gong@nxp.com>,
	linux-arm-kernel@lists.infradead.org,
	Lucas Stach <l.stach@pengutronix.de>
Subject: [PATCH 2/5] cpufreq: imx6q: Fix handling EPROBE_DEFER from regulator
Date: Fri, 31 Mar 2017 22:25:37 +0300	[thread overview]
Message-ID: <36c230773c14d37037dbe8cadf4f99b0d875e679.1490987945.git.leonard.crestez@nxp.com> (raw)
In-Reply-To: <cover.1490987945.git.leonard.crestez@nxp.com>

From: Irina Tirdea <irina.tirdea@nxp.com>

If there are any errors in getting the cpu0 regulators, the driver returns
-ENOENT. In case the regulators are not yet available, the devm_regulator_get
calls will return -EPROBE_DEFER, so that the driver can be probed later.
If we return -ENOENT, the driver will fail its initialization and will
not try to probe again (when the regulators become available).

Return the actual error received from regulator_get in probe. Print a
differentiated message in case we need to probe the device later and
in case we actually failed. Also add a message to inform when the
driver has been successfully registered.

Signed-off-by: Irina Tirdea <irina.tirdea@nxp.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/imx6q-cpufreq.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index 7719b02..be90ee3 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -222,6 +222,13 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
 	arm_reg = regulator_get(cpu_dev, "arm");
 	pu_reg = regulator_get_optional(cpu_dev, "pu");
 	soc_reg = regulator_get(cpu_dev, "soc");
+	if (PTR_ERR(arm_reg) == -EPROBE_DEFER ||
+			PTR_ERR(soc_reg) == -EPROBE_DEFER ||
+			PTR_ERR(pu_reg) == -EPROBE_DEFER) {
+		ret = -EPROBE_DEFER;
+		dev_dbg(cpu_dev, "regulators not ready, defer\n");
+		goto put_reg;
+	}
 	if (IS_ERR(arm_reg) || IS_ERR(soc_reg)) {
 		dev_err(cpu_dev, "failed to get regulators\n");
 		ret = -ENOENT;
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: leonard.crestez@nxp.com (Leonard Crestez)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] cpufreq: imx6q: Fix handling EPROBE_DEFER from regulator
Date: Fri, 31 Mar 2017 22:25:37 +0300	[thread overview]
Message-ID: <36c230773c14d37037dbe8cadf4f99b0d875e679.1490987945.git.leonard.crestez@nxp.com> (raw)
In-Reply-To: <cover.1490987945.git.leonard.crestez@nxp.com>

From: Irina Tirdea <irina.tirdea@nxp.com>

If there are any errors in getting the cpu0 regulators, the driver returns
-ENOENT. In case the regulators are not yet available, the devm_regulator_get
calls will return -EPROBE_DEFER, so that the driver can be probed later.
If we return -ENOENT, the driver will fail its initialization and will
not try to probe again (when the regulators become available).

Return the actual error received from regulator_get in probe. Print a
differentiated message in case we need to probe the device later and
in case we actually failed. Also add a message to inform when the
driver has been successfully registered.

Signed-off-by: Irina Tirdea <irina.tirdea@nxp.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/imx6q-cpufreq.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index 7719b02..be90ee3 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -222,6 +222,13 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
 	arm_reg = regulator_get(cpu_dev, "arm");
 	pu_reg = regulator_get_optional(cpu_dev, "pu");
 	soc_reg = regulator_get(cpu_dev, "soc");
+	if (PTR_ERR(arm_reg) == -EPROBE_DEFER ||
+			PTR_ERR(soc_reg) == -EPROBE_DEFER ||
+			PTR_ERR(pu_reg) == -EPROBE_DEFER) {
+		ret = -EPROBE_DEFER;
+		dev_dbg(cpu_dev, "regulators not ready, defer\n");
+		goto put_reg;
+	}
 	if (IS_ERR(arm_reg) || IS_ERR(soc_reg)) {
 		dev_err(cpu_dev, "failed to get regulators\n");
 		ret = -ENOENT;
-- 
2.7.4

  parent reply	other threads:[~2017-03-31 19:27 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 19:25 [PATCH 0/5] ARM: imx: Set LDO regulator supply Leonard Crestez
2017-03-31 19:25 ` Leonard Crestez
2017-03-31 19:25 ` Leonard Crestez
2017-03-31 19:25 ` [PATCH 1/5] ARM: imx: gpc: Do not print error message for EPROBE_DEFER Leonard Crestez
2017-03-31 19:25   ` Leonard Crestez
2017-03-31 19:25   ` Leonard Crestez
2017-04-04  9:46   ` Lucas Stach
2017-04-04  9:46     ` Lucas Stach
2017-04-04 10:28     ` Leonard Crestez
2017-04-04 10:28       ` Leonard Crestez
2017-04-04 10:28       ` Leonard Crestez
2017-04-04 10:30       ` Lucas Stach
2017-04-04 10:30         ` Lucas Stach
2017-04-04 10:30         ` Lucas Stach
2017-03-31 19:25 ` Leonard Crestez [this message]
2017-03-31 19:25   ` [PATCH 2/5] cpufreq: imx6q: Fix handling EPROBE_DEFER from regulator Leonard Crestez
2017-03-31 19:25   ` Leonard Crestez
2017-04-04  9:48   ` Lucas Stach
2017-04-04  9:48     ` Lucas Stach
2017-03-31 19:25 ` [PATCH 3/5] cpufreq: imx6q: Set max suspend_freq to avoid changes during suspend Leonard Crestez
2017-03-31 19:25   ` Leonard Crestez
2017-03-31 19:25   ` Leonard Crestez
2017-04-04  9:51   ` Lucas Stach
2017-04-04  9:51     ` Lucas Stach
2017-04-04 17:04     ` Leonard Crestez
2017-04-04 17:04       ` Leonard Crestez
2017-04-04 17:04       ` Leonard Crestez
2017-03-31 19:25 ` [PATCH 4/5] ARM: dts: imx6qdl-sabresd: Set LDO regulator supply Leonard Crestez
2017-03-31 19:25   ` Leonard Crestez
2017-03-31 19:25   ` Leonard Crestez
2017-04-04  9:52   ` Lucas Stach
2017-04-04  9:52     ` Lucas Stach
2017-04-04  9:52     ` Lucas Stach
2017-03-31 19:25 ` [PATCH 5/5] ARM: dts: imx6qp-sabresd: Set reg_arm " Leonard Crestez
2017-03-31 19:25   ` Leonard Crestez
2017-03-31 19:25   ` Leonard Crestez
2017-04-04  9:53   ` Lucas Stach
2017-04-04  9:53     ` Lucas Stach
2017-04-04  9:53     ` Lucas Stach

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=36c230773c14d37037dbe8cadf4f99b0d875e679.1490987945.git.leonard.crestez@nxp.com \
    --to=leonard.crestez@nxp.com \
    --cc=Anson.Huang@nxp.com \
    --cc=broonie@kernel.org \
    --cc=fabio.estevam@nxp.com \
    --cc=irina.tirdea@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=octavian.purdila@nxp.com \
    --cc=rjw@rjwysocki.net \
    --cc=shawnguo@kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=yibin.gong@nxp.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.