Source
* devm_acpi_dma_controller_register - resource managed acpi_dma_controller_register()
/*
* ACPI helpers for DMA request / controller
*
* Based on of-dma.c
*
* Copyright (C) 2013, Intel Corporation
* Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
* Mika Westerberg <mika.westerberg@linux.intel.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
static LIST_HEAD(acpi_dma_list);
static DEFINE_MUTEX(acpi_dma_lock);
/**
* acpi_dma_parse_resource_group - match device and parse resource group
* @grp: CSRT resource group
* @adev: ACPI device to match with
* @adma: struct acpi_dma of the given DMA controller
*
* In order to match a device from DSDT table to the corresponding CSRT device
* we use MMIO address and IRQ.
*
* Return:
* 1 on success, 0 when no information is available, or appropriate errno value
* on error.
*/
static int acpi_dma_parse_resource_group(const struct acpi_csrt_group *grp,
struct acpi_device *adev, struct acpi_dma *adma)
{
const struct acpi_csrt_shared_info *si;
struct list_head resource_list;
struct resource_entry *rentry;
resource_size_t mem = 0, irq = 0;
int ret;
if (grp->shared_info_length != sizeof(struct acpi_csrt_shared_info))
return -ENODEV;
INIT_LIST_HEAD(&resource_list);
ret = acpi_dev_get_resources(adev, &resource_list, NULL, NULL);
if (ret <= 0)
return 0;
list_for_each_entry(rentry, &resource_list, node) {
if (resource_type(rentry->res) == IORESOURCE_MEM)
mem = rentry->res->start;
else if (resource_type(rentry->res) == IORESOURCE_IRQ)