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; }
/** * fwnode_get_reference_node - Find the firmware node referenced * @fwnode: Firmware node to get the property from. * @propname: Name of the property * @index: Index of the reference * * Returns referenced fwnode handler pointer, or an NULL if not found */ struct fwnode_handle *fwnode_get_reference_node(struct fwnode_handle *fwnode, const char *propname, int index) { if (is_of_node(fwnode)) { struct device_node *np; np = of_parse_phandle(to_of_node(fwnode), propname, index); if(!np) return NULL; return &np->fwnode; } else if (is_acpi_node(fwnode)) { struct acpi_device *adev; adev = acpi_dev_get_reference_device(to_acpi_device_node(fwnode), propname, index); if(!adev) return NULL; return acpi_fwnode_handle(adev); } return NULL; }