From 8c756a0a2de17f1535ef885ac7e556e016735eb2 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Thu, 31 Mar 2022 15:54:47 +0300 Subject: device property: Convert device_{dma_supported,get_dma_attr} to fwnode Make the device_dma_supported and device_get_dma_attr functions to use the fwnode ops, and move the implementation to ACPI and OF frameworks. Signed-off-by: Sakari Ailus Acked-by: Rob Herring Reviewed-by: Andy Shevchenko Reviewed-by: Heikki Krogerus Signed-off-by: Rafael J. Wysocki --- drivers/of/property.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'drivers/of') diff --git a/drivers/of/property.c b/drivers/of/property.c index 8e90071de6ed..676899566f7c 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -22,6 +22,7 @@ #define pr_fmt(fmt) "OF: " fmt #include +#include #include #include #include @@ -872,6 +873,20 @@ static bool of_fwnode_device_is_available(const struct fwnode_handle *fwnode) return of_device_is_available(to_of_node(fwnode)); } +static bool of_fwnode_device_dma_supported(const struct fwnode_handle *fwnode) +{ + return true; +} + +static enum dev_dma_attr +of_fwnode_device_get_dma_attr(const struct fwnode_handle *fwnode) +{ + if (of_dma_is_coherent(to_of_node(fwnode))) + return DEV_DMA_COHERENT; + else + return DEV_DMA_NON_COHERENT; +} + static bool of_fwnode_property_present(const struct fwnode_handle *fwnode, const char *propname) { @@ -1472,6 +1487,8 @@ const struct fwnode_operations of_fwnode_ops = { .put = of_fwnode_put, .device_is_available = of_fwnode_device_is_available, .device_get_match_data = of_fwnode_device_get_match_data, + .device_dma_supported = of_fwnode_device_dma_supported, + .device_get_dma_attr = of_fwnode_device_get_dma_attr, .property_present = of_fwnode_property_present, .property_read_int_array = of_fwnode_property_read_int_array, .property_read_string_array = of_fwnode_property_read_string_array, -- cgit v1.2.3