ASoC: Intel - Convert to use acpi_dev_get_first_match_name()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 12 Jan 2018 21:16:17 +0000 (23:16 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 12 Jan 2018 21:20:29 +0000 (21:20 +0000)
Instead of home grown snd_soc_acpi_find_name_from_hid() use
acpi_dev_get_first_match_name().

Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-acpi.h
sound/soc/intel/boards/bytcht_da7213.c
sound/soc/intel/boards/bytcht_es8316.c
sound/soc/intel/boards/bytcr_rt5640.c
sound/soc/intel/boards/bytcr_rt5651.c
sound/soc/intel/boards/cht_bsw_rt5645.c
sound/soc/intel/boards/cht_bsw_rt5672.c
sound/soc/soc-acpi.c

index 83320af8def28c71c86ba3246ab607de8d6cdd18..082224275f5232256819f4f4316886e0965c5a79 100644 (file)
@@ -31,16 +31,9 @@ struct snd_soc_acpi_package_context {
 #define SND_ACPI_I2C_ID_LEN (4 + ACPI_ID_LEN + 3 + 1)
 
 #if IS_ENABLED(CONFIG_ACPI)
-/* translation fron HID to I2C name, needed for DAI codec_name */
-const char *snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN]);
 bool snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
                                    struct snd_soc_acpi_package_context *ctx);
 #else
-static inline const char *
-snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN])
-{
-       return NULL;
-}
 static inline bool
 snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
                                   struct snd_soc_acpi_package_context *ctx)
index 6219c04d4731c06a63b307ecaeedbe984a113f3d..2179dedb28ad6d1e890b3ed963faf30428e566cc 100644 (file)
@@ -243,7 +243,7 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
        }
 
        /* fixup codec name based on HID */
-       i2c_name = snd_soc_acpi_find_name_from_hid(mach->id);
+       i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
        if (i2c_name) {
                snprintf(codec_name, sizeof(codec_name),
                        "%s%s", "i2c-", i2c_name);
index 079f35cd4eafaf0ccd343201c55ca252426f83bb..305e7f4fe55ab86fbe1e711f54d538ee863728e1 100644 (file)
@@ -258,7 +258,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
        }
 
        /* fixup codec name based on HID */
-       i2c_name = snd_soc_acpi_find_name_from_hid(mach->id);
+       i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
        if (i2c_name) {
                snprintf(codec_name, sizeof(codec_name),
                        "%s%s", "i2c-", i2c_name);
index 4548f75498d0ea132c443b681e23ea728727cce1..b6a1cfeec83011deba6519ac2f532adabf5b44d1 100644 (file)
@@ -762,7 +762,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
        }
 
        /* fixup codec name based on HID */
-       i2c_name = snd_soc_acpi_find_name_from_hid(mach->id);
+       i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
        if (i2c_name) {
                snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name),
                        "%s%s", "i2c-", i2c_name);
index 5a6b7dedb77319142f715c377f19e3a21d3b7b73..456526a93dd568b6b8bb89df752a2de6d7d86ea1 100644 (file)
@@ -539,7 +539,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
        }
 
        /* fixup codec name based on HID */
-       i2c_name = snd_soc_acpi_find_name_from_hid(mach->id);
+       i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
        if (i2c_name) {
                snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name),
                        "%s%s", "i2c-", i2c_name);
index cef6a8c31c8d08eb9f2c4c2c14bac06946b72fe9..976ea6bf9539cb75a988ba000d9740689bfb3da1 100644 (file)
@@ -566,7 +566,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
                }
 
        /* fixup codec name based on HID */
-       i2c_name = snd_soc_acpi_find_name_from_hid(mach->id);
+       i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
        if (i2c_name) {
                snprintf(cht_rt5645_codec_name, sizeof(cht_rt5645_codec_name),
                        "%s%s", "i2c-", i2c_name);
index 1f3d38dc4fcbff797e0385c6f2972d46f5df407d..c14a52d2f71440fd099d201e9ac2606b962e7b69 100644 (file)
@@ -396,7 +396,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 
        /* fixup codec name based on HID */
        if (mach) {
-               i2c_name = snd_soc_acpi_find_name_from_hid(mach->id);
+               i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
                if (i2c_name) {
                        snprintf(drv->codec_name, sizeof(drv->codec_name),
                                 "i2c-%s", i2c_name);
index 7f43c9bf3d09054a2893d6478c38150f71c49534..3d7e1ff7913931cd762ba44346e899db7f4ca40d 100644 (file)
 
 #include <sound/soc-acpi.h>
 
-static acpi_status snd_soc_acpi_find_name(acpi_handle handle, u32 level,
-                                     void *context, void **ret)
-{
-       struct acpi_device *adev;
-       const char *name = NULL;
-
-       if (acpi_bus_get_device(handle, &adev))
-               return AE_OK;
-
-       if (adev->status.present && adev->status.functional) {
-               name = acpi_dev_name(adev);
-               *(const char **)ret = name;
-               return AE_CTRL_TERMINATE;
-       }
-
-       return AE_OK;
-}
-
-const char *snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN])
-{
-       const char *name = NULL;
-       acpi_status status;
-
-       status = acpi_get_devices(hid, snd_soc_acpi_find_name, NULL,
-                                 (void **)&name);
-
-       if (ACPI_FAILURE(status) || name[0] == '\0')
-               return NULL;
-
-       return name;
-}
-EXPORT_SYMBOL_GPL(snd_soc_acpi_find_name_from_hid);
-
 struct snd_soc_acpi_mach *
 snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines)
 {