aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-03-28 13:17:22 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-04-01 05:00:16 -0400
commitd00d2109c3679bf87d412b1667bcb6d42c1ac12f (patch)
treea9203942a83720004dec3b181d3f217c80826ead
parent0cf064db948aca1e760fc513594536f761dee1cd (diff)
gpio: merrifield: 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> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/gpio/gpio-merrifield.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c
index 7c659fdaa6d5..2383dc78b123 100644
--- a/drivers/gpio/gpio-merrifield.c
+++ b/drivers/gpio/gpio-merrifield.c
@@ -377,10 +377,20 @@ static void mrfld_irq_init_hw(struct mrfld_gpio *priv)
377 } 377 }
378} 378}
379 379
380static const char *mrfld_gpio_get_pinctrl_dev_name(void) 380static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv)
381{ 381{
382 const char *dev_name = acpi_dev_get_first_match_name("INTC1002", NULL, -1); 382 struct acpi_device *adev;
383 return dev_name ? dev_name : "pinctrl-merrifield"; 383 const char *name;
384
385 adev = acpi_dev_get_first_match_dev("INTC1002", NULL, -1);
386 if (adev) {
387 name = devm_kstrdup(priv->dev, acpi_dev_name(adev), GFP_KERNEL);
388 put_device(&adev->dev);
389 } else {
390 name = "pinctrl-merrifield";
391 }
392
393 return name;
384} 394}
385 395
386static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id) 396static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id)
@@ -441,7 +451,7 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id
441 return retval; 451 return retval;
442 } 452 }
443 453
444 pinctrl_dev_name = mrfld_gpio_get_pinctrl_dev_name(); 454 pinctrl_dev_name = mrfld_gpio_get_pinctrl_dev_name(priv);
445 for (i = 0; i < ARRAY_SIZE(mrfld_gpio_ranges); i++) { 455 for (i = 0; i < ARRAY_SIZE(mrfld_gpio_ranges); i++) {
446 range = &mrfld_gpio_ranges[i]; 456 range = &mrfld_gpio_ranges[i];
447 retval = gpiochip_add_pin_range(&priv->chip, 457 retval = gpiochip_add_pin_range(&priv->chip,