diff options
author | Heikki Krogerus <heikki.krogerus@linux.intel.com> | 2022-08-16 12:16:26 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2022-09-10 18:22:24 +0200 |
commit | 6bb057bfd9d509755349cd2a6ca5e5e6e6071304 (patch) | |
tree | ad234ac1a7152df9fce10c4f00ec3f62ab2a187a /drivers/acpi/resource.c | |
parent | ACPI: resource: Filter out the non memory resources in is_memory() (diff) | |
download | linux-6bb057bfd9d509755349cd2a6ca5e5e6e6071304.tar.xz linux-6bb057bfd9d509755349cd2a6ca5e5e6e6071304.zip |
ACPI: resource: Add helper function acpi_dev_get_memory_resources()
Wrapper function that finds all memory type resources by
using acpi_dev_get_resources(). It removes the need for the
drivers to check the resource data type separately.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/resource.c')
-rw-r--r-- | drivers/acpi/resource.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index e644e90d1884..8032d50ca944 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c @@ -722,6 +722,23 @@ int acpi_dev_get_dma_resources(struct acpi_device *adev, struct list_head *list) EXPORT_SYMBOL_GPL(acpi_dev_get_dma_resources); /** + * acpi_dev_get_memory_resources - Get current memory resources of a device. + * @adev: ACPI device node to get the resources for. + * @list: Head of the resultant list of resources (must be empty). + * + * This is a helper function that locates all memory type resources of @adev + * with acpi_dev_get_resources(). + * + * The number of resources in the output list is returned on success, an error + * code reflecting the error condition is returned otherwise. + */ +int acpi_dev_get_memory_resources(struct acpi_device *adev, struct list_head *list) +{ + return acpi_dev_get_resources(adev, list, is_memory, NULL); +} +EXPORT_SYMBOL_GPL(acpi_dev_get_memory_resources); + +/** * acpi_dev_filter_resource_type - Filter ACPI resource according to resource * types * @ares: Input ACPI resource object. |