linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/panfrost: Fix regulator_get_optional() misuse
@ 2019-09-04 12:30 Mark Brown
  2019-09-05  8:21 ` Rob Herring
  2019-09-06 15:23 ` Steven Price
  0 siblings, 2 replies; 14+ messages in thread
From: Mark Brown @ 2019-09-04 12:30 UTC (permalink / raw)
  To: Rob Herring, Tomeu Vizoso, David Airlie, Daniel Vetter
  Cc: dri-devel, linux-kernel, Mark Brown

The panfrost driver requests a supply using regulator_get_optional()
but both the name of the supply and the usage pattern suggest that it is
being used for the main power for the device and is not at all optional
for the device for function, there is no meaningful handling for absent
supplies.  Such regulators should use the vanilla regulator_get()
interface, it will ensure that even if a supply is not described in the
system integration one will be provided in software.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/gpu/drm/panfrost/panfrost_device.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c
index 46b0b02e4289..238fb6d54df4 100644
--- a/drivers/gpu/drm/panfrost/panfrost_device.c
+++ b/drivers/gpu/drm/panfrost/panfrost_device.c
@@ -89,12 +89,9 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev)
 {
 	int ret;
 
-	pfdev->regulator = devm_regulator_get_optional(pfdev->dev, "mali");
+	pfdev->regulator = devm_regulator_get(pfdev->dev, "mali");
 	if (IS_ERR(pfdev->regulator)) {
 		ret = PTR_ERR(pfdev->regulator);
-		pfdev->regulator = NULL;
-		if (ret == -ENODEV)
-			return 0;
 		dev_err(pfdev->dev, "failed to get regulator: %d\n", ret);
 		return ret;
 	}
@@ -110,8 +107,7 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev)
 
 static void panfrost_regulator_fini(struct panfrost_device *pfdev)
 {
-	if (pfdev->regulator)
-		regulator_disable(pfdev->regulator);
+	regulator_disable(pfdev->regulator);
 }
 
 int panfrost_device_init(struct panfrost_device *pfdev)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-09-19 16:55 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-04 12:30 [PATCH] drm/panfrost: Fix regulator_get_optional() misuse Mark Brown
2019-09-05  8:21 ` Rob Herring
2019-09-05  9:37   ` Steven Price
2019-09-05 12:40     ` Mark Brown
2019-09-05 13:02       ` Steven Price
2019-09-05 13:49         ` Neil Armstrong
2019-09-05 16:34         ` Mark Brown
2019-09-06 10:00           ` Steven Price
2019-09-06 10:55             ` Mark Brown
2019-09-06 14:45               ` Steven Price
2019-09-06 15:23 ` Steven Price
2019-09-09 15:41   ` Rob Herring
2019-09-09 16:22     ` Steven Price
2019-09-19 16:55       ` Rob Herring

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).