Skip to content

Commit

Permalink
ACPI / bus: Respect PRP0001 when retrieving device match data
Browse files Browse the repository at this point in the history
In the PRP0001 case, the compatible string may have additional data
affiliated with the device.  When we call device_get_match_data() on
such device, we will get nothing since currently
acpi_device_get_match_data() doesn't respect PRP0001.

To fix the above, try acpi_of_match_device() if there is no ACPI
table in the driver.

Anyway, note that the device is expected to get its own proper
ACPI ID.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Andy Shevchenko authored and Rafael J. Wysocki committed Feb 27, 2019
1 parent 5908e6b commit 886ca88
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions drivers/acpi/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,10 +799,24 @@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
}
EXPORT_SYMBOL_GPL(acpi_match_device);

static const void *acpi_of_device_get_match_data(const struct device *dev)
{
struct acpi_device *adev = ACPI_COMPANION(dev);
const struct of_device_id *match = NULL;

if (!acpi_of_match_device(adev, dev->driver->of_match_table, &match))
return NULL;

return match->data;
}

const void *acpi_device_get_match_data(const struct device *dev)
{
const struct acpi_device_id *match;

if (!dev->driver->acpi_match_table)
return acpi_of_device_get_match_data(dev);

match = acpi_match_device(dev->driver->acpi_match_table, dev);
if (!match)
return NULL;
Expand Down

0 comments on commit 886ca88

Please sign in to comment.