regulator: scmi: Allow for zero voltage domains

Message ID 20230126180511.766373-1-cristian.marussi@arm.com
State New
Headers
Series regulator: scmi: Allow for zero voltage domains |

Commit Message

Cristian Marussi Jan. 26, 2023, 6:05 p.m. UTC
  SCMI Voltage protocol allows the platform to report no voltage domains
on discovery, while warning the user about such an odd configuration.
As a consequence this condition should not be treated as error by the SCMI
regulator driver either.

Allow SCMI regulator driver to probe successfully even when no voltage
domains are discovered.

Cc: Mark Brown <broonie@kernel.org>
Cc: Jim Quinlan <james.quinlan@broadcom.com>
Cc: Florian Fainelli <florian.fainelli@broadcom.com>
Fixes: 0fbeae70ee7c ("regulator: add SCMI driver")
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
 drivers/regulator/scmi-regulator.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
  

Comments

Mark Brown Jan. 26, 2023, 6:38 p.m. UTC | #1
On Thu, Jan 26, 2023 at 06:05:11PM +0000, Cristian Marussi wrote:
> SCMI Voltage protocol allows the platform to report no voltage domains
> on discovery, while warning the user about such an odd configuration.

This patch removes all diagnostics in this case?
  
Cristian Marussi Jan. 26, 2023, 10:03 p.m. UTC | #2
On Thu, Jan 26, 2023 at 06:38:20PM +0000, Mark Brown wrote:
> On Thu, Jan 26, 2023 at 06:05:11PM +0000, Cristian Marussi wrote:
> > SCMI Voltage protocol allows the platform to report no voltage domains
> > on discovery, while warning the user about such an odd configuration.
> 
> This patch removes all diagnostics in this case?

You'll still see a warning from the SCMI core Voltage Protocol saying:

	"No Voltage domains found."

but nothing from the regulator driver itself which will successfully probe,
albeit not creating any regulators...if this is what you mean.

Thanks for having a look,
Cristian
  
Mark Brown Jan. 27, 2023, 12:53 a.m. UTC | #3
On Thu, 26 Jan 2023 18:05:11 +0000, Cristian Marussi wrote:
> SCMI Voltage protocol allows the platform to report no voltage domains
> on discovery, while warning the user about such an odd configuration.
> As a consequence this condition should not be treated as error by the SCMI
> regulator driver either.
> 
> Allow SCMI regulator driver to probe successfully even when no voltage
> domains are discovered.
> 
> [...]

Applied to

   broonie/regulator.git for-next

Thanks!

[1/1] regulator: scmi: Allow for zero voltage domains
      commit: 668f777d02f61faa834f1e24f3b99576dbe5ff6b

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
  

Patch

diff --git a/drivers/regulator/scmi-regulator.c b/drivers/regulator/scmi-regulator.c
index b9918f4fd241..29ab217297d6 100644
--- a/drivers/regulator/scmi-regulator.c
+++ b/drivers/regulator/scmi-regulator.c
@@ -311,16 +311,12 @@  static int scmi_regulator_probe(struct scmi_device *sdev)
 		return PTR_ERR(voltage_ops);
 
 	num_doms = voltage_ops->num_domains_get(ph);
-	if (num_doms <= 0) {
-		if (!num_doms) {
-			dev_err(&sdev->dev,
-				"number of voltage domains invalid\n");
-			num_doms = -EINVAL;
-		} else {
-			dev_err(&sdev->dev,
-				"failed to get voltage domains - err:%d\n",
-				num_doms);
-		}
+	if (!num_doms)
+		return 0;
+
+	if (num_doms < 0) {
+		dev_err(&sdev->dev, "failed to get voltage domains - err:%d\n",
+			num_doms);
 
 		return num_doms;
 	}