All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: rt5645: Use devm_gpiod_get_optional for hp-detect
@ 2015-06-12  9:19 Axel Lin
  2015-06-12 10:54 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2015-06-12  9:19 UTC (permalink / raw)
  To: Mark Brown; +Cc: Oder Chiou, Bard Liao, alsa-devel, Liam Girdwood

Since hp-detect is optional, use devm_gpiod_get_optional instead.
In additional, it should return error if devm_gpiod_get_optional fails.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 sound/soc/codecs/rt5645.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 7d04b1a..04d9ff8 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3255,11 +3255,12 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
 		}
 	}
 
-	rt5645->gpiod_hp_det = devm_gpiod_get(&i2c->dev, "hp-detect", GPIOD_IN);
+	rt5645->gpiod_hp_det = devm_gpiod_get_optional(&i2c->dev, "hp-detect",
+						       GPIOD_IN);
 
 	if (IS_ERR(rt5645->gpiod_hp_det)) {
-		rt5645->gpiod_hp_det = NULL;
 		dev_err(&i2c->dev, "failed to initialize gpiod\n");
+		return PTR_ERR(rt5645->gpiod_hp_det);
 	}
 
 	rt5645->regmap = devm_regmap_init_i2c(i2c, &rt5645_regmap);
-- 
2.1.0

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

* Re: [PATCH] ASoC: rt5645: Use devm_gpiod_get_optional for hp-detect
  2015-06-12  9:19 [PATCH] ASoC: rt5645: Use devm_gpiod_get_optional for hp-detect Axel Lin
@ 2015-06-12 10:54 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-06-12 10:54 UTC (permalink / raw)
  To: Axel Lin; +Cc: Oder Chiou, Bard Liao, alsa-devel, Liam Girdwood


[-- Attachment #1.1: Type: text/plain, Size: 218 bytes --]

On Fri, Jun 12, 2015 at 05:19:15PM +0800, Axel Lin wrote:
> Since hp-detect is optional, use devm_gpiod_get_optional instead.
> In additional, it should return error if devm_gpiod_get_optional fails.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2015-06-12 10:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-12  9:19 [PATCH] ASoC: rt5645: Use devm_gpiod_get_optional for hp-detect Axel Lin
2015-06-12 10:54 ` Mark Brown

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.