Commit 7075e9ba authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Rafael J. Wysocki

ASoC: Intel: bytcr_rt5651: 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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent a320d89e
...@@ -867,8 +867,8 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev) ...@@ -867,8 +867,8 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
struct byt_rt5651_private *priv; struct byt_rt5651_private *priv;
struct snd_soc_acpi_mach *mach; struct snd_soc_acpi_mach *mach;
const char *platform_name; const char *platform_name;
struct acpi_device *adev;
struct device *codec_dev; struct device *codec_dev;
const char *i2c_name = NULL;
const char *hp_swapped; const char *hp_swapped;
bool is_bytcr = false; bool is_bytcr = false;
int ret_val = 0; int ret_val = 0;
...@@ -894,14 +894,16 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev) ...@@ -894,14 +894,16 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
} }
/* fixup codec name based on HID */ /* fixup codec name based on HID */
i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1); adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
if (!i2c_name) { if (adev) {
snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name),
"i2c-%s", acpi_dev_name(adev));
put_device(&adev->dev);
byt_rt5651_dais[dai_index].codec_name = byt_rt5651_codec_name;
} else {
dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id); dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
return -ENODEV; return -ENODEV;
} }
snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name),
"%s%s", "i2c-", i2c_name);
byt_rt5651_dais[dai_index].codec_name = byt_rt5651_codec_name;
codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL, codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL,
byt_rt5651_codec_name); byt_rt5651_codec_name);
......
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