Skip to content

Commit fe79e39

Browse files
andy-shevrafaeljw
authored andcommitted
ACPI: bus: Refactor ACPI matching functions for better readability
With temporary variables for OF and ACPI IDs, it's easier to read the code. No functional change intended. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 1cd43ac commit fe79e39

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/acpi/bus.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -925,12 +925,13 @@ static const void *acpi_of_device_get_match_data(const struct device *dev)
925925

926926
const void *acpi_device_get_match_data(const struct device *dev)
927927
{
928+
const struct acpi_device_id *acpi_ids = dev->driver->acpi_match_table;
928929
const struct acpi_device_id *match;
929930

930-
if (!dev->driver->acpi_match_table)
931+
if (!acpi_ids)
931932
return acpi_of_device_get_match_data(dev);
932933

933-
match = acpi_match_device(dev->driver->acpi_match_table, dev);
934+
match = acpi_match_device(acpi_ids, dev);
934935
if (!match)
935936
return NULL;
936937

@@ -948,14 +949,13 @@ EXPORT_SYMBOL(acpi_match_device_ids);
948949
bool acpi_driver_match_device(struct device *dev,
949950
const struct device_driver *drv)
950951
{
951-
if (!drv->acpi_match_table)
952-
return acpi_of_match_device(ACPI_COMPANION(dev),
953-
drv->of_match_table,
954-
NULL);
955-
956-
return __acpi_match_device(acpi_companion_match(dev),
957-
drv->acpi_match_table, drv->of_match_table,
958-
NULL, NULL);
952+
const struct acpi_device_id *acpi_ids = drv->acpi_match_table;
953+
const struct of_device_id *of_ids = drv->of_match_table;
954+
955+
if (!acpi_ids)
956+
return acpi_of_match_device(ACPI_COMPANION(dev), of_ids, NULL);
957+
958+
return __acpi_match_device(acpi_companion_match(dev), acpi_ids, of_ids, NULL, NULL);
959959
}
960960
EXPORT_SYMBOL_GPL(acpi_driver_match_device);
961961

0 commit comments

Comments
 (0)