Skip to content

Commit 2b5ae96

Browse files
andy-shevrafaeljw
authored andcommitted
ACPI: bus: Introduce acpi_match_acpi_device() helper
Match the ACPI device against a given list of ACPI IDs. Subsequent changes will make use of this. Signed-off-by: Andy Shevchenko <[email protected]> [ rjw: Changelog edit ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 90f6af8 commit 2b5ae96

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

drivers/acpi/bus.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,26 @@ static bool __acpi_match_device(struct acpi_device *device,
850850
return true;
851851
}
852852

853+
/**
854+
* acpi_match_acpi_device - Match an ACPI device against a given list of ACPI IDs
855+
* @ids: Array of struct acpi_device_id objects to match against.
856+
* @adev: The ACPI device pointer to match.
857+
*
858+
* Match the ACPI device @adev against a given list of ACPI IDs @ids.
859+
*
860+
* Return:
861+
* a pointer to the first matching ACPI ID on success or %NULL on failure.
862+
*/
863+
const struct acpi_device_id *acpi_match_acpi_device(const struct acpi_device_id *ids,
864+
const struct acpi_device *adev)
865+
{
866+
const struct acpi_device_id *id = NULL;
867+
868+
__acpi_match_device(adev, ids, NULL, &id, NULL);
869+
return id;
870+
}
871+
EXPORT_SYMBOL_GPL(acpi_match_acpi_device);
872+
853873
/**
854874
* acpi_match_device - Match a struct device against a given list of ACPI IDs
855875
* @ids: Array of struct acpi_device_id object to match against.
@@ -864,10 +884,7 @@ static bool __acpi_match_device(struct acpi_device *device,
864884
const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
865885
const struct device *dev)
866886
{
867-
const struct acpi_device_id *id = NULL;
868-
869-
__acpi_match_device(acpi_companion_match(dev), ids, NULL, &id, NULL);
870-
return id;
887+
return acpi_match_acpi_device(ids, acpi_companion_match(dev));
871888
}
872889
EXPORT_SYMBOL_GPL(acpi_match_device);
873890

include/linux/acpi.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,9 @@ extern int acpi_nvs_register(__u64 start, __u64 size);
719719
extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
720720
void *data);
721721

722+
const struct acpi_device_id *acpi_match_acpi_device(const struct acpi_device_id *ids,
723+
const struct acpi_device *adev);
724+
722725
const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
723726
const struct device *dev);
724727

@@ -935,6 +938,12 @@ static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
935938

936939
struct acpi_device_id;
937940

941+
static inline const struct acpi_device_id *acpi_match_acpi_device(
942+
const struct acpi_device_id *ids, const struct acpi_device *adev)
943+
{
944+
return NULL;
945+
}
946+
938947
static inline const struct acpi_device_id *acpi_match_device(
939948
const struct acpi_device_id *ids, const struct device *dev)
940949
{

0 commit comments

Comments
 (0)