diff options
-rw-r--r-- | drivers/acpi/scan.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 3e5a2768c3b4..99f97ac64aa4 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -949,9 +949,17 @@ int acpi_match_device_ids(struct acpi_device *device, | |||
949 | } | 949 | } |
950 | EXPORT_SYMBOL(acpi_match_device_ids); | 950 | EXPORT_SYMBOL(acpi_match_device_ids); |
951 | 951 | ||
952 | /* Performs match against special "PRP0001" shoehorn ACPI ID */ | 952 | /** |
953 | static bool acpi_of_driver_match_device(struct device *dev, | 953 | * acpi_of_match_device - Match device using the "compatible" property. |
954 | const struct device_driver *drv) | 954 | * @dev: Device to match. |
955 | * @of_match_table: List of device IDs to match against. | ||
956 | * | ||
957 | * If @dev has an ACPI companion which has the special PRP0001 device ID in its | ||
958 | * list of identifiers and a _DSD object with the "compatible" property, use | ||
959 | * that property to match against the given list of identifiers. | ||
960 | */ | ||
961 | static bool acpi_of_match_device(struct device *dev, | ||
962 | const struct of_device_id *of_match_table) | ||
955 | { | 963 | { |
956 | const union acpi_object *of_compatible, *obj; | 964 | const union acpi_object *of_compatible, *obj; |
957 | struct acpi_device *adev; | 965 | struct acpi_device *adev; |
@@ -962,7 +970,7 @@ static bool acpi_of_driver_match_device(struct device *dev, | |||
962 | return false; | 970 | return false; |
963 | 971 | ||
964 | of_compatible = adev->data.of_compatible; | 972 | of_compatible = adev->data.of_compatible; |
965 | if (!drv->of_match_table || !of_compatible) | 973 | if (!of_match_table || !of_compatible) |
966 | return false; | 974 | return false; |
967 | 975 | ||
968 | if (of_compatible->type == ACPI_TYPE_PACKAGE) { | 976 | if (of_compatible->type == ACPI_TYPE_PACKAGE) { |
@@ -976,7 +984,7 @@ static bool acpi_of_driver_match_device(struct device *dev, | |||
976 | for (i = 0; i < nval; i++, obj++) { | 984 | for (i = 0; i < nval; i++, obj++) { |
977 | const struct of_device_id *id; | 985 | const struct of_device_id *id; |
978 | 986 | ||
979 | for (id = drv->of_match_table; id->compatible[0]; id++) | 987 | for (id = of_match_table; id->compatible[0]; id++) |
980 | if (!strcasecmp(obj->string.pointer, id->compatible)) | 988 | if (!strcasecmp(obj->string.pointer, id->compatible)) |
981 | return true; | 989 | return true; |
982 | } | 990 | } |
@@ -988,7 +996,7 @@ bool acpi_driver_match_device(struct device *dev, | |||
988 | const struct device_driver *drv) | 996 | const struct device_driver *drv) |
989 | { | 997 | { |
990 | if (!drv->acpi_match_table) | 998 | if (!drv->acpi_match_table) |
991 | return acpi_of_driver_match_device(dev, drv); | 999 | return acpi_of_match_device(dev, drv->of_match_table); |
992 | 1000 | ||
993 | return !!acpi_match_device(drv->acpi_match_table, dev); | 1001 | return !!acpi_match_device(drv->acpi_match_table, dev); |
994 | } | 1002 | } |