Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: Intel: cht_bsw_rt5672: Convert to use acpi_dev_get_first_match_dev()

acpi_dev_get_first_match_name() is deprecated and going to be removed
because it leaks a reference.

Convert the driver to use acpi_dev_get_first_match_dev() instead.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Andy Shevchenko and committed by
Rafael J. Wysocki
b664e6fe fe4c283a

+5 -4
+5 -4
sound/soc/intel/boards/cht_bsw_rt5672.c
··· 401 401 struct cht_mc_private *drv; 402 402 struct snd_soc_acpi_mach *mach = pdev->dev.platform_data; 403 403 const char *platform_name; 404 - const char *i2c_name; 404 + struct acpi_device *adev; 405 405 int i; 406 406 407 407 drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); ··· 411 411 strcpy(drv->codec_name, RT5672_I2C_DEFAULT); 412 412 413 413 /* fixup codec name based on HID */ 414 - i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1); 415 - if (i2c_name) { 414 + adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1); 415 + if (adev) { 416 416 snprintf(drv->codec_name, sizeof(drv->codec_name), 417 - "i2c-%s", i2c_name); 417 + "i2c-%s", acpi_dev_name(adev)); 418 + put_device(&adev->dev); 418 419 for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) { 419 420 if (!strcmp(cht_dailink[i].codec_name, 420 421 RT5672_I2C_DEFAULT)) {