summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2021-10-06 17:04:27 +0200
committerMark Brown <broonie@kernel.org>2021-10-07 16:45:10 +0200
commit10f4a96543b744c8cc7ef8b0799af21d911dd37d (patch)
tree1eb8dfd116c599ef3c5ed1be2979e2405bea97da /sound
parentASoC: Intel: bytcht_es8316: Use temporary variable for struct device (diff)
downloadlinux-10f4a96543b744c8cc7ef8b0799af21d911dd37d.tar.xz
linux-10f4a96543b744c8cc7ef8b0799af21d911dd37d.zip
ASoC: Intel: bytcht_es8316: Switch to use gpiod_get_optional()
First of all, replace indexed API by plain one since we have index 0. Second, switch to optional variant and drop duplicated code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20211006150428.16434-3-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/intel/boards/bytcht_es8316.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
index efd71e6e42b3..421a04d96d84 100644
--- a/sound/soc/intel/boards/bytcht_es8316.c
+++ b/sound/soc/intel/boards/bytcht_es8316.c
@@ -566,16 +566,12 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
devm_acpi_dev_add_driver_gpios(codec_dev, byt_cht_es8316_gpios);
priv->speaker_en_gpio =
- gpiod_get_index(codec_dev, "speaker-enable", 0,
- /* see comment in byt_cht_es8316_resume */
- GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
-
+ gpiod_get_optional(codec_dev, "speaker-enable",
+ /* see comment in byt_cht_es8316_resume() */
+ GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
if (IS_ERR(priv->speaker_en_gpio)) {
ret = PTR_ERR(priv->speaker_en_gpio);
switch (ret) {
- case -ENOENT:
- priv->speaker_en_gpio = NULL;
- break;
default:
dev_err(dev, "get speaker GPIO failed: %d\n", ret);
fallthrough;