extcon: axp288: 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: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Andy Shevchenko 2019-03-28 19:17:21 +02:00 коммит произвёл Rafael J. Wysocki
Родитель 817b4d64da
Коммит 0cf064db94
1 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -333,7 +333,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
struct axp288_extcon_info *info; struct axp288_extcon_info *info;
struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
const char *name; struct acpi_device *adev;
int ret, i, pirq; int ret, i, pirq;
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
@ -357,9 +357,10 @@ static int axp288_extcon_probe(struct platform_device *pdev)
if (ret) if (ret)
return ret; return ret;
name = acpi_dev_get_first_match_name("INT3496", NULL, -1); adev = acpi_dev_get_first_match_dev("INT3496", NULL, -1);
if (name) { if (adev) {
info->id_extcon = extcon_get_extcon_dev(name); info->id_extcon = extcon_get_extcon_dev(acpi_dev_name(adev));
put_device(&adev->dev);
if (!info->id_extcon) if (!info->id_extcon)
return -EPROBE_DEFER; return -EPROBE_DEFER;