diff options
| -rw-r--r-- | drivers/acpi/bus.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 147f6c7ea59c..6ecbbabf1233 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
| @@ -799,10 +799,24 @@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, | |||
| 799 | } | 799 | } |
| 800 | EXPORT_SYMBOL_GPL(acpi_match_device); | 800 | EXPORT_SYMBOL_GPL(acpi_match_device); |
| 801 | 801 | ||
| 802 | static const void *acpi_of_device_get_match_data(const struct device *dev) | ||
| 803 | { | ||
| 804 | struct acpi_device *adev = ACPI_COMPANION(dev); | ||
| 805 | const struct of_device_id *match = NULL; | ||
| 806 | |||
| 807 | if (!acpi_of_match_device(adev, dev->driver->of_match_table, &match)) | ||
| 808 | return NULL; | ||
| 809 | |||
| 810 | return match->data; | ||
| 811 | } | ||
| 812 | |||
| 802 | const void *acpi_device_get_match_data(const struct device *dev) | 813 | const void *acpi_device_get_match_data(const struct device *dev) |
| 803 | { | 814 | { |
| 804 | const struct acpi_device_id *match; | 815 | const struct acpi_device_id *match; |
| 805 | 816 | ||
| 817 | if (!dev->driver->acpi_match_table) | ||
| 818 | return acpi_of_device_get_match_data(dev); | ||
| 819 | |||
| 806 | match = acpi_match_device(dev->driver->acpi_match_table, dev); | 820 | match = acpi_match_device(dev->driver->acpi_match_table, dev); |
| 807 | if (!match) | 821 | if (!match) |
| 808 | return NULL; | 822 | return NULL; |
