ASoC: Intel: bytcht_es8316: Switch to use gpiod_get_optional()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 7 Oct 2021 16:45:22 +0000 (19:45 +0300)
committerMark Brown <broonie@kernel.org>
Fri, 8 Oct 2021 12:51:13 +0000 (13:51 +0100)
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>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Message-Id: <20211007164523.27094-4-andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/boards/bytcht_es8316.c

index 171f3d8c5996ca33a53c16e872aa36b86bc20395..d8dcf63825a650017b493b9ac7cd4c514a59145b 100644 (file)
@@ -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;