Commit 4e03b1b7 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Mark Brown

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Message-Id: <20211007164523.27094-4-andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent e8ccf82b
...@@ -566,16 +566,12 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) ...@@ -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); devm_acpi_dev_add_driver_gpios(codec_dev, byt_cht_es8316_gpios);
priv->speaker_en_gpio = priv->speaker_en_gpio =
gpiod_get_index(codec_dev, "speaker-enable", 0, gpiod_get_optional(codec_dev, "speaker-enable",
/* see comment in byt_cht_es8316_resume */ /* see comment in byt_cht_es8316_resume() */
GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE); GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
if (IS_ERR(priv->speaker_en_gpio)) { if (IS_ERR(priv->speaker_en_gpio)) {
ret = PTR_ERR(priv->speaker_en_gpio); ret = PTR_ERR(priv->speaker_en_gpio);
switch (ret) { switch (ret) {
case -ENOENT:
priv->speaker_en_gpio = NULL;
break;
default: default:
dev_err(dev, "get speaker GPIO failed: %d\n", ret); dev_err(dev, "get speaker GPIO failed: %d\n", ret);
fallthrough; fallthrough;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment