From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@kernel.org>
Cc: Johannes Stezenbach <js@sig21.net>,
Sven Brandau <info@brandau.biz>,
Liam Girdwood <lgirdwood@gmail.com>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: [PATCH v2 2/2] ASoC: sta350: Use devm_gpiod_get_optional at appropriate place
Date: Sat, 09 May 2015 23:09:32 +0800 [thread overview]
Message-ID: <1431184172.5393.2.camel@ingics.com> (raw)
In-Reply-To: <1431184113.5393.1.camel@ingics.com>
devm_gpiod_get_optional is equivalent to devm_gpiod_get(), except that
when no GPIO was assigned to the requested function it will return NULL.
This is convenient for drivers that need to handle optional GPIOs.
I just checked the code in commit 34d7c3905adb9a9
("ASoC: improve usage of gpiod API") and found that it should use
devm_gpiod_get_optional rather than devm_gpiod_get here.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
v2: Fixup subject line
sound/soc/codecs/sta350.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/sta350.c b/sound/soc/codecs/sta350.c
index 50d8bbf..0cea8f9 100644
--- a/sound/soc/codecs/sta350.c
+++ b/sound/soc/codecs/sta350.c
@@ -1217,8 +1217,8 @@ static int sta350_i2c_probe(struct i2c_client *i2c,
if (IS_ERR(sta350->gpiod_nreset))
return PTR_ERR(sta350->gpiod_nreset);
- sta350->gpiod_power_down = devm_gpiod_get(dev, "power-down",
- GPIOD_OUT_LOW);
+ sta350->gpiod_power_down = devm_gpiod_get_optional(dev, "power-down",
+ GPIOD_OUT_LOW);
if (IS_ERR(sta350->gpiod_power_down))
return PTR_ERR(sta350->gpiod_power_down);
--
2.1.0
next prev parent reply other threads:[~2015-05-09 15:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-09 15:08 [PATCH v2 1/2] ASoC: sta32x: Use devm_gpiod_get_optional at appropriate place Axel Lin
2015-05-09 15:09 ` Axel Lin [this message]
2015-05-12 17:52 ` [PATCH v2 2/2] ASoC: sta350: " Mark Brown
2015-05-12 17:52 ` [PATCH v2 1/2] ASoC: sta32x: " Mark Brown
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=1431184172.5393.2.camel@ingics.com \
--to=axel.lin@ingics.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=info@brandau.biz \
--cc=js@sig21.net \
--cc=lgirdwood@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox