linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Charles Keepax <ckeepax@opensource.cirrus.com>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 04/10] regulator: max8952: Let core handle GPIO descriptor
Date: Wed, 28 Nov 2018 11:43:44 +0100	[thread overview]
Message-ID: <20181128104350.31902-5-linus.walleij@linaro.org> (raw)
In-Reply-To: <20181128104350.31902-1-linus.walleij@linaro.org>

Use the gpiod_get() rather than the devm_* version so that the
regulator core can handle the lifecycle of these descriptors.

Fixes: d7a261c2d1f2 ("regulator: max8952: Pass descriptor instead of GPIO number")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/regulator/max8952.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index 6c39fff73b8a..baa8b771a6e4 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -231,9 +231,9 @@ static int max8952_pmic_probe(struct i2c_client *client,
 	else
 		gflags = GPIOD_OUT_LOW;
 	gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE;
-	gpiod = devm_gpiod_get_optional(&client->dev,
-					"max8952,en",
-					gflags);
+	gpiod = gpiod_get_optional(&client->dev,
+				   "max8952,en",
+				   gflags);
 	if (IS_ERR(gpiod))
 		return PTR_ERR(gpiod);
 	if (gpiod)
@@ -241,6 +241,8 @@ static int max8952_pmic_probe(struct i2c_client *client,
 
 	rdev = devm_regulator_register(&client->dev, &regulator, &config);
 	if (IS_ERR(rdev)) {
+		if (gpiod)
+			gpiod_put(gpiod);
 		ret = PTR_ERR(rdev);
 		dev_err(&client->dev, "regulator init failed (%d)\n", ret);
 		return ret;
-- 
2.19.1


  parent reply	other threads:[~2018-11-28 10:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28 10:43 [PATCH 00/10] Regulator ena_gpiod fixups Linus Walleij
2018-11-28 10:43 ` [PATCH 01/10] regulator: fixed: Let core handle GPIO descriptor Linus Walleij
2018-11-28 10:43 ` [PATCH 02/10] regulator: lm363x: " Linus Walleij
2018-11-28 10:43 ` [PATCH 03/10] regulator: lp8788-ldo: " Linus Walleij
2018-11-28 10:43 ` Linus Walleij [this message]
2018-11-28 10:43 ` [PATCH 05/10] regulator: max8973: " Linus Walleij
2018-11-28 10:43 ` [PATCH 06/10] gpio: Export gpiod_get_from_of_node() Linus Walleij
2018-11-28 10:43 ` [PATCH 07/10] regulator: da9211: Let core handle GPIO descriptors Linus Walleij
2018-11-28 15:11   ` Charles Keepax
2018-11-28 10:43 ` [PATCH 08/10] regulator: max77686: Let core handle GPIO descriptor Linus Walleij
2018-11-28 15:24   ` Charles Keepax
2018-11-30  9:07     ` Linus Walleij
2018-11-28 10:43 ` [PATCH 09/10] regulator: s5m8767: Let core handle GPIO descriptors Linus Walleij
2018-11-28 15:17   ` Charles Keepax
2018-11-28 10:43 ` [PATCH 10/10] regulator: tps65090: " Linus Walleij
2018-11-28 15:18   ` Charles Keepax
2018-11-28 15:22 ` [PATCH 00/10] Regulator ena_gpiod fixups Charles Keepax
2018-11-29 15:52   ` Linus Walleij
2018-11-29 16:29     ` Mark Brown
2018-11-29 18:38 ` Bartosz Golaszewski
2018-11-29 19:01   ` Mark Brown
2018-11-30  8:35     ` Bartosz Golaszewski
2018-11-30 10:56       ` Linus Walleij

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=20181128104350.31902-5-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=bgolaszewski@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).