enum dev_dma_attr device_get_dma_attr(struct device *dev) { enum dev_dma_attr attr = DEV_DMA_NOT_SUPPORTED; if (IS_ENABLED(CONFIG_OF) && dev->of_node) { if (of_dma_is_coherent(dev->of_node)) attr = DEV_DMA_COHERENT; else attr = DEV_DMA_NON_COHERENT; } else attr = acpi_get_dma_attr(ACPI_COMPANION(dev)); return attr; }
int platform_dma_configure(struct device *dev) { enum dev_dma_attr attr; int ret = 0; if (dev->of_node) { ret = of_dma_configure(dev, dev->of_node, true); } else if (has_acpi_companion(dev)) { attr = acpi_get_dma_attr(to_acpi_device_node(dev->fwnode)); ret = acpi_dma_configure(dev, attr); } return ret; }