diff options
author | Suthikulpanit, Suravee <Suravee.Suthikulpanit@amd.com> | 2015-06-10 12:08:54 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-06-15 08:40:49 -0400 |
commit | 05ca556003b1d6b4df0b8831e4c07fad7f5bdd2c (patch) | |
tree | dd1bc07e455fb16d12b56cb5bf593c3cb48a01e0 | |
parent | b6197b93fa4bcba9313cc415934e3fe27e2db9b0 (diff) |
device property: Introduces device_dma_is_coherent()
Currently, device drivers, which support both OF and ACPI,
need to call two separate APIs, of_dma_is_coherent() and
acpi_dma_is_coherent()) to determine device coherency attribute.
This patch simplifies this process by introducing a new device
property API, device_dma_is_coherent(), which calls the appropriate
interface based on the booting architecture.
Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/base/property.c | 14 | ||||
-rw-r--r-- | include/linux/property.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/drivers/base/property.c b/drivers/base/property.c index 1d0b116cae95..e645852396ba 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/export.h> | 14 | #include <linux/export.h> |
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/of.h> | 16 | #include <linux/of.h> |
17 | #include <linux/of_address.h> | ||
17 | #include <linux/property.h> | 18 | #include <linux/property.h> |
18 | 19 | ||
19 | /** | 20 | /** |
@@ -519,3 +520,16 @@ unsigned int device_get_child_node_count(struct device *dev) | |||
519 | return count; | 520 | return count; |
520 | } | 521 | } |
521 | EXPORT_SYMBOL_GPL(device_get_child_node_count); | 522 | EXPORT_SYMBOL_GPL(device_get_child_node_count); |
523 | |||
524 | bool device_dma_is_coherent(struct device *dev) | ||
525 | { | ||
526 | bool coherent = false; | ||
527 | |||
528 | if (IS_ENABLED(CONFIG_OF) && dev->of_node) | ||
529 | coherent = of_dma_is_coherent(dev->of_node); | ||
530 | else | ||
531 | acpi_check_dma(ACPI_COMPANION(dev), &coherent); | ||
532 | |||
533 | return coherent; | ||
534 | } | ||
535 | EXPORT_SYMBOL_GPL(device_dma_is_coherent); | ||
diff --git a/include/linux/property.h b/include/linux/property.h index de8bdf417a35..76ebde9c11d4 100644 --- a/include/linux/property.h +++ b/include/linux/property.h | |||
@@ -164,4 +164,6 @@ struct property_set { | |||
164 | 164 | ||
165 | void device_add_property_set(struct device *dev, struct property_set *pset); | 165 | void device_add_property_set(struct device *dev, struct property_set *pset); |
166 | 166 | ||
167 | bool device_dma_is_coherent(struct device *dev); | ||
168 | |||
167 | #endif /* _LINUX_PROPERTY_H_ */ | 169 | #endif /* _LINUX_PROPERTY_H_ */ |